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.

Constructors

__init__(frame[, metadata, _metadata])

Initialize a Zmat instance.

read_zmat(inputfile[, implicit_index])

Read a zmat file.

copy()

Export and IO

to_latex([buf, upper_triangle])

Render a DataFrame to a tabular environment table.

to_string([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 a zmat file.

write(*args, **kwargs)

Deprecated, use to_zmat().

Methods

add_data([new_cols])

Add a column with the requested data.

assign(idx, col, val)

Return a copy where the value is assigned.

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()

Return the total mass in g/mol.

has_same_sumformula(other)

Determine if other has the same sum formula.

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.

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

Sort object by labels (wrapper for pandas.DataFrame.sort_index).

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

Sort by the values along either axis (wrapper for pandas.DataFrame.sort_values()).

subs(*args, **kwargs)

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

change_numbering([new_index])

Change numbering to a new index.

Attributes

columns

Return the columns (wrapper for pandas.DataFrame.columns).

dtypes

Return the dtypes (wrapper for pandas.DataFrame.dtypes).

iloc

Integer position based indexing for obtaining elements.

index

Return the index (wrapper for pandas.DataFrame.index).

loc

Label based indexing for obtaining elements.

safe_iloc

Integer position based indexing for obtaining elements

safe_loc

Label based indexing for obtaining elements and assigning values safely.

shape

Return the shape (wrapper for pandas.DataFrame.shape).

unsafe_iloc

Integer position based indexing for obtaining elements

unsafe_loc

Label based indexing for obtaining elements

Parameters: