schrodinger.application.matsci.zmutils module¶
Contains classes for working with Z-Matrices
Copyright Schrodinger, LLC. All rights reserved.
-
schrodinger.application.matsci.zmutils.
rotation_matrix
(axis, angle)[source]¶ Get rotation matrix based on the Euler-Rodrigues formula.
- Parameters
axis (list) – Axis, defined by 3 floats, will be normalized
angle (float) – Angle (deg) to rotate around the axis
- Return type
numpy.array
- Returns
Rotation matrix (3 x 3)
-
class
schrodinger.application.matsci.zmutils.
ZAtom
(index, element, values, constraints, neighbor_indexes, neighbor_elements)[source]¶ Bases:
object
A single atom in a Z-matrix
-
COORD_LETTERS
= ['r', 'a', 'd']¶
-
__init__
(index, element, values, constraints, neighbor_indexes, neighbor_elements)[source]¶ Initialize ZAtom object
- Parameters
index (int) – Atom index with the structure
element (str) – Atom element
values (list) – Atom values (bond distance, angle, torsion)
constraints (set) – Atom constraints
neighbor_indexes (list) – Atom neighboring indices
neighbor_elements (list) – Atom neighboring elements
-
classmethod
fromJagin
(jagin, index)[source]¶ Create a ZAtom object from jaguar input.
- Parameters
jagin (
schrodinger.application.jaguar.input.JaguarInput
) – The JaguarInput object the Z-matrix is forindex (int) – The atom index (1-based) that this ZAtom is for
- Return type
- Returns
New ZAtom object
-
constrainCoord
(coord)[source]¶ Constrain the given coord so it can’t be optimized
- Parameters
coord (int) – 0 (bond), 1 (angle) or 2 (dihedral)
-
freeCoord
(coord)[source]¶ Allow the given coord to be optimized
- Parameters
coord (int) – 0 (bond), 1 (angle) or 2 (dihedral)
-
bumpIndexes
(bump)[source]¶ Modify all the indexes (both for self and any referenced atoms) by a constant number. Used when this z-matrix is being added to another, and now atom 1 is actually atom 20…
- Parameters
bump (int) – The amount to modify each index
-
getSymbolicLine
()[source]¶ Get the line that defines the atoms for the bond, angle and dihedral and also the coordinate names. i.e. C11 H1 r11 C2 a11 C7 d11
- Return type
str
- Returns
The string defining the z-matrix coordinates for this atom. Includes the trailing return character
-
getVariableLines
()[source]¶ Get a series of lines that defines each coordinate. i.e.: r11 = 1.452
a11 = 102.4 d11 = 180.
- rtype
str
- return
The string defining the z-matrix coordinate values for this atom. Includes the trailing return character at the end of the block.
-
getAtomName
(element, index)[source]¶ Get the name of an atom with the given element and index
- Parameters
element (str) – The atomic symbol of the atom
index (int) – The index of the atom
- Return type
str
- Returns
The name of the atom, such as “C12”
-
getCoordName
(coord)[source]¶ Get the name of a coordinate for this atom, such as r11 or d7
- Parameters
coord (int) – 0 (bond), 1 (angle) or 2 (dihedral)
- Return type
str
- Returns
The name of the coordinate, such as “r12”
-
addCoord
(index, element, value)[source]¶ Add an internal coordinate for this atom referenced to a target atom. Note that coordinates must be added in the order bond, angle, dihedral.
- Parameters
index (int) – The atom index of the target atom (such as the atom the bond extends to)
element (str) – The element of the target atom
value (float) – The value of this coordinate
-
changeCoord
(coord, value, index=None, element=None)[source]¶ Change the definition of an existing internal coordinate. If index and element are passed in the target atom for the coordinate will be changed.
- Parameters
coord (int) – 0 (bond), 1 (angle) or 2 (dihedral)
value (float) – The value of this coordinate
index (int) – The atom index of the target atom (such as the atom the bond extends to), 1-based. Both index and element must be supplied for them to be used.
element (str) – The element of the target atom. Both index and element must be supplied for them to be used.
-
-
class
schrodinger.application.matsci.zmutils.
ZMatrix
(struct=None)[source]¶ Bases:
object
Contains the z-matrix for a structure
-
__init__
(struct=None)[source]¶ Create a ZMatrix instance
- Parameters
struct (
schrodinger.structure.Structure
or None) – The structure this zmatrix is for
-
getStructure
()[source]¶ Create and return structure based on the zmatrix.
- Return type
- Returns
Newly created structure
-
fromStructure
(struct)[source]¶ Given the input structure, generate a ZMatrix with the same atom neighbors lists as self.
- Parameters
struct (structure.Structure) – The structure this zmatrix is for
- Return type
- Returns
Newly created ZMatrix
-
difference
(other_zmat)[source]¶ Compute difference Z-matrix between other zmatrix and self zmatrix (in this order).
-
interpolate
(other_zmat, disps, indices=None)[source]¶ Interpolate between two Z-matrices. Initial Z-matrix is self, other zmatrix is final point.
-
bumpIndexes
(bump)[source]¶ Bump all atom indexes for this z-matrix
- Parameters
bump (int) – The amount to modify each index
-
freeAtom
(index)[source]¶ Free all the internal coordinates for a single atom
- Parameters
index (int) – The atom index (1-based) of the atom to free
-
freeAtomBond
(index)[source]¶ Free all the bond internal coordinate for a single atom
- Parameters
index (int) – The atom index (1-based) of the atom to free
-
freeAtomAngle
(index)[source]¶ Free all the angle internal coordinate for a single atom
- Parameters
index (int) – The atom index (1-based) of the atom to free
-
freeAtomDihedral
(index)[source]¶ Free all the angle internal coordinate for a single atom
- Parameters
index (int) – The atom index (1-based) of the atom to free
-
findNonlinearAngle
(struct, atom_a, atom_b, do_not_use, index_less_than, linear)[source]¶ Find an angle between atom_a, atom_b and some other atom that is smaller than linear
- Parameters
struct (
schrodinger.structure.Structure
) – The struct to useatom_a (int) – The 1-indexed index of atom A for the A-B-C angle
atom_b (int) – The 1-indexed index of atom B for the A-B-C angle
do_not_use (set) – An set of atom indexes that should not be used for the C atom for the A-B-C angle
index_less_than (int) – Only look for indexes less than this number
linear (float) – The threshold where any angle greater than this is considered linear
- Return type
- Returns
The index of an atom that forms an angle with atom_a and atom_b that is less than linear degrees, and the angle it forms. None, None is returned if none of the indexes in choose_from gave a non-linear angle.
-
merge
(child_zmat, struct, glue_index)[source]¶ Combine the atom lists from this (parent) z-matrix and another (child) z-matrix. This involves not just combining the lists, but also defining the following new internal coordinates:
child_atom_1: bond, angle, dihedral child_atom_2: angle, dihedral child_atom_3: dihedral
All new internal coordinates will reference an atom from the parent structure. These six new internal coordinates fully specify the parent-child orientation.
- Parameters
child_zmat (
ZMatrix
) – The child z-matrix to merge with this onestruct (
schrodinger.structure.Structure
) – The structure that results from merging these two z-matrices. This is needed to compute the new bonds, angles and dihedrals.glue_index (int) – The index of the atom in the parent structure that should be bonded to the first atom of the child structure. This index should be 1-based (i.e. structure.atom indexed, not list indexed)
-
-
schrodinger.application.matsci.zmutils.
add_zmatrix_lines
(lines, zmat)[source]¶ Add the lines defining a z-matrix to the character string using the format required by Jaguar input files.
- Parameters
lines (str) – The string to add the z-matrix to
zmat (
schrodinger.application.matsci.zmutils.ZMatrix
) – The ZMatrix that defines the lines to be added
- Return type
str
- Returns
The original lines with the z-matrix lines appended. The initial ‘&zmat’ and the closing ‘&’ are appended by this function
-
schrodinger.application.matsci.zmutils.
replace_coords_with_zmat
(path, zmat)[source]¶ Replace the coordinate section in a jaguar input file with the z-matrix. Replaces the current:
&zmat … &
section with
&zmat … & &zvar … &
- Parameters
path (str) – The path to the input file
@zmat: ZMatrix :param: The ZMatrix object to use to replace the coordinates