chemcoord.Zmat

class chemcoord.Zmat(frame, metadata=None, _metadata=None)[source]

The main class for dealing with internal Coordinates.

Rotational direction:

Chemcoord uses the IUPAC definition. Note that this does not include the automatic choosing of the canonical equivalence class representation. An angle of -30° could be represented by 270°. Use iupacify() to choose also the IUPAC conform angle representation.

Mathematical Operations:

The general rule is that mathematical operations using the binary operators + - * / and the unary operators + - abs are only applied to the ['bond', 'angle', 'dihedral'] columns.

Addition/Subtraction/Multiplication/Division: The most common case is to add another Zmat instance. In this case it is tested, if the used references are the same. Afterwards the addition in the ['bond', 'angle', 'dihedral'] columns is performed. If you add a scalar to a Zmat it is added elementwise onto the ['bond', 'angle', 'dihedral'] columns. If you add a 3-dimensional vector, list, tuple… the first element of this vector is added elementwise to the 'bond' column of the Zmat instance and so on. The third possibility is to add a matrix with shape=(len(Zmat), 3) which is again added elementwise. The same rules are true for subtraction, division and multiplication.

Indexing:

The indexing behaves like Indexing and Selecting data in Pandas. You can slice with loc(), iloc(), and Zmat[...]. The only question is about the return type. If the information in the columns is enough to draw a molecule, an instance of the own class (e.g. Zmat) is returned. If the information in the columns is enough to draw a molecule, an instance of the own class (e.g. Zmat) is returned. If the information in the columns is not enough to draw a molecule, there are two cases to consider:

  • A Series instance is returned for one dimensional slices.

  • A DataFrame instance is returned in all other cases.

This means that:

molecule.loc[:, ['atom', 'b', 'bond', 'a', 'angle', 'd', 'dihedral']] returns a Zmat.

molecule.loc[:, ['atom', 'bond']] returns a pandas.DataFrame.

molecule.loc[:, 'atom'] returns a pandas.Series.

Comparison:

Comparison for equality with == is supported. It behaves exactly like the equality comparison of DataFrames in pandas. Amongst other things this means that the index has to be the same and the comparison of floating point numbers is exact and not numerical.

__init__(frame, metadata=None, _metadata=None)

How to initialize a Zmat instance.

Parameters:
  • init (pd.DataFrame) – A Dataframe with at least the columns ['atom', 'b', 'bond', 'a', 'angle', 'd', 'dihedral']. Where 'atom' is a string for the elementsymbol.

  • order_of_definition (list like) – Specify in which order the Zmatrix is defined. If None it just uses self.index.

Returns:

A new zmat instance.

Return type:

Zmat

Methods

__init__(frame[, metadata, _metadata])

How to initialize a Zmat instance.

add_data([new_cols])

Adds a column with the requested data.

change_numbering([new_index])

Change numbering to a new index.

copy()

get_cartesian()

Return the molecule in cartesian coordinates.

get_electron_number([charge])

Return the number of electrons.

get_grad_cartesian([as_function, chain, ...])

Return the gradient for the transformation to a Cartesian.

get_total_mass()

Returns the total mass in g/mol.

has_same_sumformula(other)

Determines if other has the same sumformula

insert(loc, column, value[, ...])

Insert column into molecule at specified location.

iupacify()

Give the IUPAC conform representation.

minimize_dihedrals()

Give a representation of the dihedral with minimized absolute value.

read_zmat(inputfile[, implicit_index])

Reads a zmat file.

sort_index([axis, level, ascending, ...])

Sort object by labels (along an axis)

sort_values(by[, axis, ascending, kind, ...])

Sort by the values along either axis

subs(*args, **kwargs)

Substitute a symbolic expression in ['bond', 'angle', 'dihedral']

to_latex([buf, upper_triangle])

Render a DataFrame to a tabular environment table.

to_string([buf, format_abs_ref_as, ...])

Render a DataFrame to a console-friendly tabular output.

to_xyz(*args, **kwargs)

Deprecated, use get_cartesian()

to_zmat([buf, upper_triangle, ...])

Write zmat-file

write(*args, **kwargs)

Deprecated, use to_zmat()

Attributes

columns

Returns the columns.

dtypes

Returns the dtypes.

dummy_manipulation_allowed

empty

iloc

Integer position based indexing for obtaining elements.

index

Returns the index.

loc

Label based indexing for obtaining elements.

pure_internal_mov

safe_iloc

Integer position based indexing for obtaining elements and assigning values safely.

safe_loc

Label based indexing for obtaining elements and assigning values safely.

shape

Returns the shape.

test_operators

unsafe_iloc

Integer position based indexing for obtaining elements and assigning values unsafely.

unsafe_loc

Label based indexing for obtaining elements and assigning values unsafely.