schrodinger.application.matsci.zmutils module

Contains classes for working with Z-Matrices

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.zmutils.ZAtom(jagin, index)

Bases: object

A single atom in a Z-matrix

COORD_LETTERS = ['r', 'a', 'd']
__init__(jagin, index)

Create a ZAtom object

Parameters:
constrainCoord(coord)

Constrain the given coord so it can’t be optimized

Parameters:coord (int) – 0 (bond), 1 (angle) or 2 (dihedral)
freeCoord(coord)

Allow the given coord to be optimized

Parameters:coord (int) – 0 (bond), 1 (angle) or 2 (dihedral)
constrainAll()

Constrain all the coords so they can’t be optimized

freeAll()

Allow all the coords to be optimized

bumpIndexes(bump)

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

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

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)

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)

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)

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__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.zmutils', '__doc__': '\n A single atom in a Z-matrix\n ', 'COORD_LETTERS': ['r', 'a', 'd'], '__init__': <function ZAtom.__init__>, 'constrainCoord': <function ZAtom.constrainCoord>, 'freeCoord': <function ZAtom.freeCoord>, 'constrainAll': <function ZAtom.constrainAll>, 'freeAll': <function ZAtom.freeAll>, 'bumpIndexes': <function ZAtom.bumpIndexes>, 'getSymbolicLine': <function ZAtom.getSymbolicLine>, 'getVariableLines': <function ZAtom.getVariableLines>, 'getAtomName': <function ZAtom.getAtomName>, 'getCoordName': <function ZAtom.getCoordName>, 'addCoord': <function ZAtom.addCoord>, 'changeCoord': <function ZAtom.changeCoord>, '__dict__': <attribute '__dict__' of 'ZAtom' objects>, '__weakref__': <attribute '__weakref__' of 'ZAtom' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.matsci.zmutils'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.application.matsci.zmutils.ZMatrix(struct)

Bases: object

Contains the z-matrix for a structure

__init__(struct)

Create a ZMatrix instance

Parameters:struct (schrodinger.structure.Structure) – The structure this zmatrix is for
bumpIndexes(bump)

Bump all atom indexes for this z-matrix

Parameters:bump (int) – The amount to modify each index
constrainAll()

Constrain all internal coordinates

freeAtom(index)

Free all the internal coordinates for a single atom

Parameters:index (int) – The atom index (1-based) of the atom to free
freeAtomBond(index)

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)

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)

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)

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 use
  • atom_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:

int, float or None, None

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)

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 one
  • struct (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)
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.zmutils', '__doc__': '\n Contains the z-matrix for a structure\n ', '__init__': <function ZMatrix.__init__>, 'bumpIndexes': <function ZMatrix.bumpIndexes>, 'constrainAll': <function ZMatrix.constrainAll>, 'freeAtom': <function ZMatrix.freeAtom>, 'freeAtomBond': <function ZMatrix.freeAtomBond>, 'freeAtomAngle': <function ZMatrix.freeAtomAngle>, 'freeAtomDihedral': <function ZMatrix.freeAtomDihedral>, 'findNonlinearAngle': <function ZMatrix.findNonlinearAngle>, 'merge': <function ZMatrix.merge>, '__dict__': <attribute '__dict__' of 'ZMatrix' objects>, '__weakref__': <attribute '__weakref__' of 'ZMatrix' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.matsci.zmutils'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

schrodinger.application.matsci.zmutils.add_zmatrix_lines(lines, zmat)

Add the lines defining a z-matrix to the character string using the format required by Jaguar input files.

Parameters:
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)

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