schrodinger.application.matsci.amorphous module

Builder classes for making amorphous cells

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.amorphous.AttachmentAtoms(coupler, coupler_marker, grower, grow_marker)

Bases: tuple

__contains__

Return key in self.

__init__

Initialize self. See help(type(self)) for accurate signature.

__len__

Return len(self).

count(value) → integer -- return number of occurrences of value
coupler

Alias for field number 0

coupler_marker

Alias for field number 1

grow_marker

Alias for field number 3

grower

Alias for field number 2

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

class schrodinger.application.matsci.amorphous.ConnectionInfo(missed_atom_ids, connecting_atom_ids)

Bases: tuple

__contains__

Return key in self.

__init__

Initialize self. See help(type(self)) for accurate signature.

__len__

Return len(self).

connecting_atom_ids

Alias for field number 1

count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

missed_atom_ids

Alias for field number 0

schrodinger.application.matsci.amorphous.has_head_tail_roles_marked(struct)

Check if a monomer is marked with the polymer head and tail role properties

Parameters:struct (schrodinger.structure.Structure) – The structure to check
Return type:bool
Returns:True if head and tail role atoms are marked, False if not
schrodinger.application.matsci.amorphous.mark_monomer_head_tail_ce_th(struct)

Find monomers marked with the Canvas method of marking head and tail - a Ce atom marks the head and tha Th atom marks the tail. Mark the Ce atom with the HEAD role and the Th atom with the TAIL role.

Parameters:struct (schrodinger.structure.Structure) – The structure to mark
Return type:bool
Returns:True if head and tail role atoms were marked, False if not
schrodinger.application.matsci.amorphous.mark_monomer_head_tail_dummy(struct)

Find monomers marked with the dummy atom method of marking head and tail - dummy atoms mark both the head and tail. In this case there is nothing to distinguish the two position, so mark the first dummy atom with the HEAD role and the second dummy atom with the TAIL role.

Parameters:struct (schrodinger.structure.Structure) – The structure to mark
Return type:bool
Returns:True if head and tail role atoms were marked, False if not
schrodinger.application.matsci.amorphous.mark_monomer_head_tail_rx(struct)

Find monomers marked with the polymer builder method of marking head and tail - the Rx atom property is used to identify atoms. The atom designated as R1 is marked as the HEAD role and the atom designated as R2 with the TAIL role.

Parameters:struct (schrodinger.structure.Structure) – The structure to mark
Return type:bool
Returns:True if head and tail role atoms were marked, False if not
schrodinger.application.matsci.amorphous.mark_monomer_head_and_tail(struct)

Find monomers marked with a variety of marking head and tail atoms and mark them with the polymer role property. Note that the atoms so marked will be the atoms to remove when building a polymer - the disposable H, dummy or other atom attached to the heavy atom that remains in the monomer when the polymer is built.

Parameters:struct (schrodinger.structure.Structure) – The structure to mark
Return type:bool
Returns:True if head and tail role atoms were marked, False if not
schrodinger.application.matsci.amorphous.find_head_tail(struct, atom_ids=None, graph=None, source=None)

Find the head and tail atoms of the longest path. If multiple longest paths are found, rank those longest paths by the head atom ids and then tail atom ids. Choose the longest path with the smallest head/tail atom ids.

Parameters:
  • struct (the structure containing the target molecule.) – structure.Structure
  • atom_ids (atom ids of the target molecule. If None, all the atoms in the struct are used.) – list of int or None
  • graph (An undirected graph of the structure with edges in place of each bond. Edges are identical regardless of the bond order of the bond.) – networkx.Graph
  • source (int) – node (head atom index), Starting node for path. If not specified, compute shortest path lengths using all nodes as source nodes.
Return type:

int, int

Returns:

atom ids for head and tail atoms

schrodinger.application.matsci.amorphous.mark_orig_atom_idx(struct)

Mark the original atom indexes as atom property.

Parameters:struct ('schrodinger.structure.Structure') – each atom in this structure will be marked with atom index as original atom index property.
schrodinger.application.matsci.amorphous.get_orig_atom_idx(struct)

Return the original atom indexes.

Parameters:struct ('schrodinger.structure.Structure' or any 'schrodinger.structure._AtomCollection') – the structure to get original atom indexes.
Return type:list of int
Returns:the original atom indexes of this atom collection.
schrodinger.application.matsci.amorphous.get_missed_atom_id_groups(struct, atom_ids)

Return the missed atom indexed grouped by bond connectivity.

Parameters:
  • struct ('schrodinger.structure.Structure') – the structure to get missed atom indexes groups
  • atom_ids (list of int) – each int is an atom index of a missing atom in the polymerfragment.
Return type:

list of list

Returns:

such sublist contains atom indexes that are bonded.

schrodinger.application.matsci.amorphous.get_density(struct)

Calculate the density of the struct.

Parameters:struct (schrodinger.structure.Structure) – A structure with chorus_properties
Return type:float
Returns:The density of the struct in unit g/cm^3
schrodinger.application.matsci.amorphous.get_maximum_vdw_radius(struct)

Find the maximum VDW radius of any atom in the structure

Parameters:struct (schrodinger.structure.Structure) – The structure to check
Return type:float
Returns:The maximum VDW radius of any atom
schrodinger.application.matsci.amorphous.get_color(index)

Get the next color in our color rotation

Parameters:index (int) – The index in the color rotation to get. If index is greater than the number of colors, we just start over
Return type:str
Returns:A color as understood by the schrodinger.structure._StructureAtom.color property
schrodinger.application.matsci.amorphous.random_rotation(struct, centroid=None, max_rotation=6.283185307179586)

Randomly rotate struct in 3 dimensions

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to rotate
  • centroid (3-element numpy array) – the rotation center [x, y, z]
  • max_rotation (float) – The maximum rotation to perform
schrodinger.application.matsci.amorphous.prepare_building_block(struct, index, recolor=True, preserve_res=False)

Do some prepwork on a component before adding them to the disordered cell

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to modify
  • index (int) – The index of this structure in the list of components
  • recolor (bool) – Whether to color the molecule a single color
  • preserve_res (bool) – Whether to preserve the current residue information
class schrodinger.application.matsci.amorphous.Box(vertices)

Bases: object

Class that defines the region a new structure may be placed in

X = 0
Y = 1
Z = 2
AXES = [0, 1, 2]
__init__(vertices)

Create a box object

Parameters:vertices (list) – A six item list that defines the min and max value of X, Y and Z. The six values in order are: Xmin, Xmax, Ymin, Ymax, Zmin, Zmax
getMinMax(axis)

Get the min and max values for axis

Parameters:axis (int) – One of the class constants X, Y or Z
Return type:(float, float)
Returns:The min and max value for the requested axis
getLargestSpan()

Get the largest span of the box in the X, Y or Z direction

Return type:float
Returns:The largest span (delta between the min and max value)
getCentroid()

Get the centroid of the box

Return type:numpy.array
Returns:The centoid of the box - a numpy array of 3 items (x, y, z)
getPointInBox()

Get a point in a random position in the box

Return type:list
Returns:[x, y, z] coordinates of a random point in the box
isPointInBox(point)

Is the given point inside the box

Parameters:point (iterable) – An iterable of length 3 floats that gives the x, y and z values of the point in question
Return type:bool
Returns:Whether the point falls within the box
getTranslationToBox(point)

Return a vector that translates the mirror image of a point inside the box

Parameters:point (iterable) – An iterable of length 3 floats that gives the x, y and z values of the point in question
Return type:list
Returns:A list of 3 floats that gives the x, y and z coordinates of the mirror image of point that lies within the box
isValidPoint(point)

Check if point is a valid point - the default implementation just returns True. Subclasses may use this to weed out points that violate custom box conditions

class schrodinger.application.matsci.amorphous.BoxWithInnerHull(hull, *args, **kwargs)

Bases: schrodinger.application.matsci.amorphous.Box

A cubic Box object that contains an inner non-cubic region that limits the valid volume for the components to be placed in.

__init__(hull, *args, **kwargs)

Create a BoxWithInnerHull object

Parameters:hull (scipy.spatial.Delaunay) – The convex hull defining the region of space the components are allowed to be placed in

See parent class for additional documentation

isPointInBox(point, *args)

Overrides the parent method to check to see if the given point is also inside the hull

Parameters:point (iterable) – An iterable of length 3 floats that gives the x, y and z values of the point in question
Return type:bool
Returns:Whether the point falls within the box
isPointInHull(point)

Check to see if the point is inside the hull

Parameters:point (iterable) – An iterable of length 3 floats that gives the x, y and z values of the point in question
Return type:bool
Returns:Whether the point falls within the hull
getPointInBox(max_attempts=1000)

Overrides the parent class to get a point that is inside the hull rather than just in the box

Parameters:max_attempts (int) – Maximum number of attempts to try to find a point that is both inside the box and the hull
Return type:list
Returns:List of three floats that give the xyz coordinates of a point in the hull
Raises:ScaffoldError – If a point can’t be found inside the hull
isValidPoint(point)

Overrides the parent method to check to make sure the point is inside the hull

Parameters:point (iterable) – An iterable of length 3 floats that gives the x, y and z values of the point in question
Return type:bool
Returns:Whether the point is inside the hull
AXES = [0, 1, 2]
X = 0
Y = 1
Z = 2
getCentroid()

Get the centroid of the box

Return type:numpy.array
Returns:The centoid of the box - a numpy array of 3 items (x, y, z)
getLargestSpan()

Get the largest span of the box in the X, Y or Z direction

Return type:float
Returns:The largest span (delta between the min and max value)
getMinMax(axis)

Get the min and max values for axis

Parameters:axis (int) – One of the class constants X, Y or Z
Return type:(float, float)
Returns:The min and max value for the requested axis
getTranslationToBox(point)

Return a vector that translates the mirror image of a point inside the box

Parameters:point (iterable) – An iterable of length 3 floats that gives the x, y and z values of the point in question
Return type:list
Returns:A list of 3 floats that gives the x, y and z coordinates of the mirror image of point that lies within the box
exception schrodinger.application.matsci.amorphous.ScaffoldError

Bases: ValueError

Class for errors involving the scaffold input

__init__

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.application.matsci.amorphous.Scaffold(struct=None)

Bases: object

A Scaffold is a structure that occupies space in a cluster of molecules but is not considered part of the system itself. Scaffolds could be: 1) A nanoparticle that has an amorphous system surrounding it or a protein surrounded by a box of water molecules, 2) A container such as a zeolyte or nanotube that holds an amorphous system within it, 3) a surface upon which a disordered system is laid down.

__init__(struct=None)

Create a Scaffold object

Parameters:struct (schrodinger.structure.Structure or None) – The scaffold structure, or None if there is no scaffold for the cell.
approximateVolume(vdw_scale=1.0, seed=None, sphere_radius=None, sphere_origin=None, buffer_len=2, return_ratio=False)

Computes the approximate volume of the scaffold molecule using a Monte Carlo sampling algorithm. The alogorithm:

  1. define a box or sphere that fully encloses the structure
  2. randomly pick a point inside the shape
  3. check if the point lies inside the VDW radius of an atom
  4. iterate over steps 2 & 3 a bunch
  5. The volume is shape_volume * fraction of points inside VDW radii
Parameters:
  • vdw_scale (float) – The VdW scale factor to apply to VdW radii when checking to see if a point is “inside” an atom
  • seed (int or None) – the seed for random, if None then random is not re-seeded
  • sphere_radius (float) – specifies to sample points in a sphere of this radius in Angstrom rather than the default which uses the smallest enclosing box
  • sphere_origin (numpy.array) – the origin in Angstrom of the sphere used if sampling points in a sphere
  • buffer_len (float) – a shape buffer lengths in Angstrom
  • return_ratio (bool) – whether to return the hit ratio as a percent
Return type:

float or float, float

Returns:

The approximate volume of a molecule in Angstrom^3 followed by the hit ratio if return_ratio is used

Note:

This is expensive, so is only done at class initialization. After that, call getExcludedVolume to obtain the cached volume.

getNewCell()

Return a new structure that contains the scaffold molecule. If there is scaffold structure, the returned structure is empty

Return type:schrodinger.structure.Structure
Returns:A structure object that is either empty or contains the scaffold structure, depending on whether a scaffold structure exists or not.
getExcludedVolume()

Get the amount of volume the scaffold occupies

Return type:bool
Returns:The volume computed by approximateVolume when this object was created.
defineBox(volume)

The default implementation is to define a cube with all sides equal that is centered on the scaffold centroid.

Parameters:volume (float) – The volume of the desired cube
Return type:Box
Returns:The Box object for this scaffold
addPBCProperties(struct, volume)

Add periodic boundary condition properties to the structure. This method overwrites any existing periodic boundary condition properties, including Desmond chorus and PDB space group properties.

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to add the properties to
  • volume (float) – The volume of the cubic periodic boundary condition
addDesmondPBC(struct, ax, ay=0.0, az=0.0, bx=0.0, by=None, bz=0.0, cx=0.0, cy=0.0, cz=None)

Add properties to the structure that define the periodic boundary condition in the way Desmond wants it defined.

Parameters:struct (schrodinger.structure.Structure) – The structure to add the properties to

@ax: float :param ax: The value of the ax box property

@ay: float :param ay: The value of the ay box property. Defaults to 0.

@az: float :param az: The value of the az box property. Defaults to 0.

@bx: float :param bx: The value of the bx box property. Defaults to 0.

@by: float :param by: The value of the by box property. If not given, this value is

set the same as ax.

@bz: float :param bz: The value of the bz box property. Defaults to 0.

@cx: float :param cx: The value of the cx box property. Defaults to 0.

@cy: float :param cy: The value of the cy box property. Defaults to 0.

@cz: float :param cz: The value of the cz box property. If not given, this value is

set the same as ax.
addSpaceGroupPBC(struct, aval, bval, cval, alpha=90.0, beta=90.0, gamma=90.0, space_group='P 1')

Add properties to the structure that define the periodic boundary condition in the way Crystal wants it defined.

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to add the properties to
  • side (float) – The length of one side of the cubic periodic boundary condition
getPBCMinMaxes()

Get the length of one side of the periodic boundary condition

Parameters:cell (schrodinger.structure.Structure) – The current cell with structures that have already been placed
Return type:list
Returns:A six item list that defines the min and max value of X, Y and Z. The six values in order are: Xmin, Ymin, Zmin, Xmax, Ymax, Zmax. If not PBC box has been created, a list of all 0.0 is returned
getPointInBox()

Get a point in a random position in the box

Return type:list
Returns:[x, y, z] coordinates of a random point in the box
class schrodinger.application.matsci.amorphous.BuilderWithClashDetection(basename='cell', backend=None, logger=None, color=None, vdw_scale=1.0)

Bases: object

The base class for the amorphous builder classes

__init__(basename='cell', backend=None, logger=None, color=None, vdw_scale=1.0)

Create a Builder object

Parameters:
  • basename (str) – The base name for structure files created by this builder
  • backend (schrodinger.job.jobcontrol._Backend) – The job control backend we are running under, or None if not running under a backend
  • logger (logging.Logger) – The logger for this builder
  • color (str or None) – Set to module constant COLOR_BY_MOLECULE to color the structures in the cell by molecule
  • vdw_scale (float) – Scale factor for VdW radii during clash detection
log(msg, level=20)

Log a message

Parameters:
  • msg (str) – The message to log
  • level (logging constant) – A log level constant from the logging module such as INFO, WARNING, ERROR…
buildingBlocksHaveRings()

Override in subclasses to check if any of the building blocks have rings. If none do, it will be a waste of time to look for them in the larger structure.

Return type:bool
Returns:If any of the building blocks have rings
findRings(struct)

Find all the rings in the provided structure. Since ring-finding is expensive, its best to pre-calculate them once. Since the coordinates of the ring don’t matter, we can use these rings over and over as long as the atom numbering doesn’t change.

Parameters:struct (schrodinger.structure.Structure) – The structure to find the rings for
Return type:list
Returns:List of schrodinger.structure._Ring objects in the given structure.
findRingSpears(ring_struct, spear_struct=None, rings=None, ring_based=True, pbc=None)

Find all cases where a bond spears a ring

Parameters:
  • ring_struct (schrodinger.structure.Structure) – The structure containing the rings
  • spear_struct (schrodinger.structure.Structure) – The structure containing the atoms that might spear the rings. If not provided, ring_struct will be used.
  • rings (list) – Each item of the list is a schrodinger.structure._Ring object. This is the list returned by the findRings() method. If not provided, they will be calculated on the fly - which takes considerable time. If findRingSpears will be run more than once on the same structure (even if the geometry changes), the rings should be precalculated via findRings and passed in via this parameter.
  • ring_based (bool) – Whether the returned dictionary should contain keys that are atom indexes of the speared ring (True), or of the bond spearing the ring (False)
  • pbc (None, infrastructure.PBC, or list) –

    If periodic boundary conditions should be used, provide either an infrastructure.PBC object or the parameters to construct one. Allowed constructors:

    * a, b, c : box lengths
    * a, b, c, alpha, beta, gamma box : box lengths and angles
    * ax, ay, az, bx, by, bz, cx, cy, cz : box vectors
    
Return type:

dict

Returns:

If ring_based=True, keys are an atom index of one of the atoms in the speared ring, and values are the atom index of one of the atoms in the spearing bond. If ring_based=False, the keys/values are flipped.

removeIgnoredClashes(all_clashes, ignored_clashes)

Get only those clashes that are not ignored.

Parameters:
  • all_clashes (dict) – All found clashes
  • ignored_clashes (dict) – Clashes that should be ignored
Return type:

dict

Returns:

Those clashes in all_clashes that are not in ignored_clashes. Keys are atom indexes, values are all the atom indexes that clash with that atom

getInfraStructure(struct)

Get an infrastructure Structure object and an associated bitset struct.atom_total long

Parameters:struct (schrodinger.structure.Structure) – The python module Structure object
Return type:tuple
Returns:First item of the tuple is a schrodinger.infra.structure.Structure object. Second item is a bitset that is struct.atom_total long
getClashes(struct1, cutoff, struct2=None, pbc=None, check_14=False)

Find clashes - either intrastructure if struct2 is None, or interstructure if struct2 is not None.

Parameters:
  • struct (schrodinger.structure.Structure) – The structure for intrastructure clashes or the first structure for interstructure clashes
  • cutoff (float) – The cutoff for finding clashes. This value is multipied times the sum of the VDW radii of the two atoms. If the distance is less than this scaled VDW radii sum, a clash exists
  • struct2 (schrodinger.structure.Structure) – The second structure for interstructure clashes
  • pbc (None, infrastructure.PBC, or list) –

    If periodic boundary conditions should be used, provide either an infrastructure.PBC object or the parameters to construct one. Allowed constructors:

    * a, b, c : box lengths
    * a, b, c, alpha, beta, gamma box : box lengths and angles
    * ax, ay, az, bx, by, bz, cx, cy, cz : box vectors
    
  • check_14 (bool) – If False, the atom pairs separated by 3 covalent bonds are excluded for clash check.
Return type:

dict

Returns:

keys are atom indexes in struct1 (or struct2 if defined), and values are all the atom indexes in struct1 that clash with that atom

checkForIntraStructureClashes(struct, scale=None, pbc=None, rings=None)

Check for any intrastructure clashes

Parameters:
  • struct (schrodinger.structure.Structure) – The structure for intrastructure clashes
  • scale (float) – The cutoff for finding clashes. This value is multipied times the sum of the VDW radii of the two atoms. If the distance is less than this scaled VDW radii sum, a clash exists
  • pbc (None, infrastructure.PBC, or list) –

    If periodic boundary conditions should be used, provide either an infrastructure.PBC object or the parameters to construct one. Allowed constructors:

    * a, b, c : box lengths
    * a, b, c, alpha, beta, gamma box : box lengths and angles
    * ax, ay, az, bx, by, bz, cx, cy, cz : box vectors
    
  • rings (list) – The precalculated rings returned by findRings() on the structure. If not supplied, they will be calculated on the fly.
Return type:

dict

Returns:

keys are atom indexes, and values are all the atom indexes that clash with that atom. A clash may come from two atoms too close together, or a ring that is speared by a bond.

static countClashes(clashes)

Count the total number of clashes

Parameters:clashes (dict) – keys are atom indexes, values are all the atom indexes that clash with that atom
colorByMolecule(struct)

Color each molecule in struct a different color

Parameters:struct (schrodinger.structure.Structure) – The structure to color
schrodinger.application.matsci.amorphous.nearest_rotatable_bonds(struct, rings, backbone_atom_id, side_atom_ids, pre_atom_prop='b_matsci_polymer_branch_atom', atom_prop='b_matsci_polymer_head_atom')

Search the side groups of one atom and find the ‘first neighbor’ rotatable bonds.

Parameters:
  • struct (schrodinger.structure.Structure) – structure to search bonds
  • rings (list) – List of ring atom index lists
  • backbone_atom_id (int) – the atom id of one backbone atom
  • side_atom_ids (list) – list of atom ids of the side groups for the backbone_atom
  • pre_atom_prop (str) – the property to be set True for the atom in the rotatable bonds that is closer to the backbone_atom_id
  • atom_prop (str) – the property to be set True for the atom in the rotatable bonds that is deeper in side group
Return type:

list of tuple

Returns:

each tuple is two atom indexes, indicating ‘first neighbor’ rotable bonds in side groups for one atoms

class schrodinger.application.matsci.amorphous.BuilderGrowInCellMixin

Bases: object

A mixin for classes that uses in-cell polymer grow method.

setRingsForOneMol(new_init_frag, ringnum)

Create _Ring objects for each fragment in one molecule.

Parameters:
  • new_init_frag (PolymerFragment) – the first fragment containing initiator
  • ringnum (int) – the total number of rings of all molecules in cell
placeOneIniInCell(frag, new_chain=True)

Place a new or dead chain fragment containing initiator into the cell. If new_chain=True, randomly pick a position in cell; make sure the position is away from pre-existing initiators; check contact of the newly added fragments against all pre-existing atoms. If contact exists, randomly pick anothor position. If new_chain=False, find a random position in the largest void in cell; check contact; if contact exists, loop over all the gridded positions in the largest void.

Parameters:
  • frag (PolymerFragment) – the first fragment containing initiator
  • new_chain (bool) – if True, the fragment is from a new chain; else, the fragment is from a dead chain.
Return type:

bool

Returns:

True, if the initiator fragment is successfully placed in cell

growFragmentCell(density, avdw_scale)

Make a single attempt at building the cell by growing polymer fragments.

Parameters:
  • density (float) – The density of the cell
  • avdw_scale (float) – The VDW scale factor for clash cutoffs
Return type:

schrodinger.structure.Structure or None

Returns:

The built cell, or None if an error occurred

setDistanceCell()

Set DistanceCell for the clash check of current fragment.

writeDihedralDis(file_name='tmp_dis.txt')

Write the dihedral angle distribution of the structures in cell.

relocateFailedMol(pre_frag, frags_in_one_mol, tried_per_mol, undo_crystal_links=False)

Place one failed molecule back into the cell.

Parameters:
  • pre_frag ({PolymerFragment}) – the ini fragment of one polymer
  • frags_in_one_mol (list of {PolymerFragment}) – polymer fragment of this polymer within one polymer
  • tried_per_mol (int) – failed trial number
  • undo_crystal_links (bool) – whether to unlink the chain from the crystals
Return type:

bool

Returns:

True, if successfully placed the ini fragment back

hasClashes()

Check whether current fragment has clashes and speared rings with pre-existing structure.

Return type:bool
Returns:True, if has clashes
removeFinishedPolymer(frags_by_mol)

Remove frags_by_mols that have no polymer fragments and update finished polymer number.

Parameters:frags_by_mol (list of list) – each sublist contains polymer fragments within one polymer
bitSetOn(frag)

Set on the pre-existing atom bitset according to atom ids in the fragment; record rings and spear_rings according to rings in the fragment.

Parameters:frag (PolymerFragment) – the polymer fragment providing the atom ids
bitSetOff(bitset, frag)

Set the bitset off according to the atom ids in the fragment; remove rings and spear_rings according to rings in the fragment.

Parameters:
  • bitset (Bitset) – the bitset to set
  • frag (PolymerFragment) – the polymer fragment providing the atom ids
getPosition(new_chain)

Find random positions in the cell according to the following rules. If new_chain=True, randomly pick a position in cell that is away from pre-existing initiators. If new_chain=False, randomly loop over all the gridded positions in the largest void in cell.

Parameters:new_chain (bool) – if True, the fragment is from a new chain; else, the fragment is from a dead chain.
Return type:list
Returns:[x, y, z], a random position in cell
getRandGridXYZ()

Get xyz iterator of random grid points in the largest void.

Return type:list
Returns:[x, y, z], a random position in cell
getRandXYZ(max_num=2000, max_failed_num=2000)

Return a random point in the space and no other initiators and scaffold within a pre-defined raduis.

Parameters:
  • max_num (int) – max number of xyz position returned
  • max_failed_num (int) – max number of attemps when finding points self.r_per_ini_frag away from scaffold and other initiator atoms.
Return type:

iterator of list

Returns:

iterator of [x, y, z], a random position in cell

deleteOtherBranches(pre_frag, frags_in_one_mol)

Remove the fragments from the next_frags pool and set off the bitset of moved fragments.

Parameters:
  • pre_frag (PolymerFragment) – the branching parent polymer fragment
  • frags_in_one_mol (list of PolymerFragment) – the pool of PolymerFragment to be grown
copyAllStructsIntoCell()

Copy monomer structures into the cell, but the bitsets are off.

Parameters:
preparePbcAndParams(avdw_scale)

Prepare pbc and contact parameters.

Parameters:avdw_scale (float) – The VDW scale factor for clash cutoffs
setPolymerFragments(vdw_scale)

Set polymer fragments for tangled chain method.

Parameters:avdw_scale (float) – The VDW scale factor for clash cutoffs
getPolymerFragments(vdw_scale, get_rigid=False)

Break polymers (if needed), prepare them, and return the corresponding PolymerFragments objects.

Parameters:
  • avdw_scale (float) – The VDW scale factor for clash cutoffs
  • get_rigid (bool) – If True, pick those marked as rigid bodies. If False, skip those marked as rigid bodies.
Return type:

list of ‘PolymerFragments’

Returns:

Each item contains fragment information for one molecule.

__init__

Initialize self. See help(type(self)) for accurate signature.

class schrodinger.application.matsci.amorphous.AmorphousCellBuilder(scaffold=None, system=True, population=1, density=0.5, amorphous_vdw_scale=1.0, obey='density', tries_per_dc=5, tries_per_mol=5, title='', allow_increased_density=True, forcefield='OPLS_2005', grow=False, dihe_temperature=None, recolor=False, preserve_res=True, split_components=False, **kwargs)

Bases: schrodinger.application.matsci.amorphous.BuilderWithClashDetection, schrodinger.application.matsci.amorphous.BuilderGrowInCellMixin

Builder for an amorphous cell

__init__(scaffold=None, system=True, population=1, density=0.5, amorphous_vdw_scale=1.0, obey='density', tries_per_dc=5, tries_per_mol=5, title='', allow_increased_density=True, forcefield='OPLS_2005', grow=False, dihe_temperature=None, recolor=False, preserve_res=True, split_components=False, **kwargs)

Create an AmorphousCellBuilder object

Parameters:
  • Scaffold (Scaffold) – The Scaffold object for the cell to use that defines the molecule the cell should be built around (or inside or on top of)
  • system (bool) – Whether a Desmond system should be built with the final amorphous cell
  • population (int) – The number of molecules to include in the amorphous cell
  • density (float) – The initial target density for building the cell. Does not include the scaffold volume or mass
  • amorphous_vdw_scale (float) – The initial VdW scale factor to use when looking for clashes in the amorphous cell
  • obey (str) – A module constant indicating which initial target to keep constant when trying to build an amorphous cell - either OBEY_DENSITY to keep the density constant, OBEY_CLASH to keep the VdW scale factor constant, or OBEY_BOTH to keep both constant. The latter will prevent the builder from relaxing one of these constraints to find a cell without clashes.
  • tries_per_dc (int) – The number of tries to make a cell at a given density and VdW clash scale factor before relaxing the parameter that is not specified by obey
  • tries_per_mol (int) – The number of times to try placing a molecule in the cell without clases before scrapping the cell and starting over
  • title (str) – The title to give the final cell structure
  • allow_increased_density (bool) – If True and obey=OBEY_CLASH, allow attempts to build cells at increasing density as long as a cell was built successfully
  • forcefield (str) – The name of the force field to use. The default is ‘OPLS_2005’.
  • grow (bool) – whether grow polymers via self-avoiding random walk
  • dihe_temperature (float, or None) – the temperature to calculate dihedral angle distribution
  • recolor (bool) – Whether to recolor the components so that each molecule of the same component is the same color
  • preserve_res (bool) – Whether to preserve the current residue information
  • split_components (bool) – Whether to split system in components in the system build

See the parent class for additional keyword documentation

setDensityIncreaseAllowed(is_allowed)

Set whether increased cell densities can be attempted after a successful cell is built using OBEY_CLASH

Parameters:is_allowed (bool) – Whether increased density attempts can be tried
build(generate_only=False, center=True)

Build the cell and do all the post-processing

Parameters:
  • generate_only (bool) – Only generate the cell, do not write it to a file, write final density, or attempt to create a Desmond system with it
  • center (bool) – Center the structure in the PBC unit cell, assuming the cell has its origin at 0, 0, 0
Return type:

schrodinger.structure.Structure or None

Returns:

The created structure or None if no structure was found

postTreatBuiltCell(cell)

The default implementation of this does nothing, but subclasses can use this method to modify the raw cell immediately after the last structure is added to it but before any other processing (such as centering, coloring, writing out or building a Desmond system)

Parameters:cell (schrodinger.structure.Structure) – The built cell
Return type:schrodinger.structure.Structure
Returns:The modified cell
buildCell(density, avdw_scale)

Make a single attempt at building the cell.

Parameters:
  • density (float) – The density of the cell
  • avdw_scale (float) – The VDW scale factor for clash cutoffs
Return type:

schrodinger.structure.Structure or None

Returns:

The built cell, or None if an error occurred

buildCellDriver()

Driver function for cell building. Tries multiple cells until one succeeds. Adjust initial parameters to try to create more dense or tighter class cells as needed.

Return type:schrodinger.structure.Structure or None
Returns:The built cell, or None if an error occurred
prepareTangledChainBlocks(vdw_scale, vdw_min)

Break structures into polymer fragments and handle vdw scale adjustment.

Parameters:
  • vdw_scale (float) – the vdw scale to check clashes.
  • vdw_min (float or None) – If float, this is the minimum allowable vdw scale after adjustment. If None, don’t allow vdw adjustment.
Return type:

float or None

Returns:

If float, this is the vdw scale.

getBuildingBlocks(number)

Get the structures to place into the amorphous cell. Must be overridden in the subclass to produce structures

Parameters:number (int) – The number of structures to return
Return type:list
Returns:list of schrodinger.structure.Structure objects to place into the cell
rotateRigidBodyCell(density, avdw_scale)

Make a single attempt at building the cell by random placing and rotating rigid structures.

Parameters:
  • density (float) – The density of the cell
  • avdw_scale (float) – The VDW scale factor for clash cutoffs
Return type:

schrodinger.structure.Structure or None

Returns:

The built cell, or None if an error occurred

placeStructureInCell(cell, struct, avdw_scale)

Place a structure in the cell. Make multiple rotations and translations to try to find a spot that the structure fits in with no clashes

Parameters:
Return type:

bool

Returns:

Whether the structure was placed in the cell successfully

duplicateRings(original_rings, new_struct)

Take a list of _Ring objects referenced to one structure and convert to a list of _Ring objects referenced to a new structure. This is much faster than finding rings in the new structure. It is implied that the new and old structure have identical bonding.

Parameters:
  • original_rings (iterable of _Ring objects) – The _Ring objects to duplicate
  • new_structschrodinger.structure.Structure
  • new_struct – The new structure the ring objects should reference
Return type:

list

Returns:

List of schrodinger.structure._Ring objects that reference atoms in new_structure

locateAndRotate(struct)

Randomly rotate a copy of struct and translate it to a position in the cell

Parameters:struct (schrodinger.structure.Structure) – The structure to attempt to place into the cell
Return type:schrodinger.structure.Structure
Returns:A copy of struct that has been randomly rotated and translated
adjustACellDensity(density, down=True)

Adjust the cell density up or down - the amount it is adjusted depends on its current value and the direction it is being adjusted

Parameters:
  • density (float) – The current cell density
  • down (bool) – Whether to adjust the density down (or up if False)
Return type:

float

Returns:

The adjusted density

adjustACellClashVDWScale(avdw_scale, down=True)

Adjust the cell clash scaling up or down - the amount it is adjusted depends on its current value and the direction it is being adjusted

Parameters:
  • avdw_scale (float) – The current clash vdw scale factor
  • down (bool) – Whether to adjust the scale factor down (or up if False)
Return type:

float

Returns:

The adjusted scale factor

checkForClashes(cell, candidate, avdw_scale, raw_clashes, cell_rings, candidate_rings)

Check for clashes between the candidate structure and structures already within the cell, and also intrastructure clashes within the candiate that are the result of the periodic boundary condition. If intrastructure clashes are found, interstructure clashes are not checked for.

Parameters:
  • cell (schrodinger.structure.Structure) – The current cell with structures that have already been placed
  • candidate (schrodinger.structure.Structure) – The structure to attempt to place into the cell
  • avdw_scale (float) – The VDW scale factor for clash cutoffs
  • raw_clashes (dict) – Those clashes that exist in the candidate without accounting for the PBC
  • cell_rings (list) – Each item of the list is a schrodinger.structure._Ring object returned by the findRings() method.
  • candidate_rings (list) – Each item of the list is a schrodinger.structure._Ring object returned by the findRings() method.
Return type:

dict

Returns:

Any clashes found. Keys are atom indexes values are all the atom indexes that clash with that atom

checkForInterStructureClashes(cell, candidate, avdw_scale, pbc, cell_rings, candidate_rings)

Check for clashes of the structure with other structures in the cell, including the periodic boundary condition. Also check for ring spears. The first check that finds clashes will return those clashes and no more checks will be made.

Parameters:
  • cell (schrodinger.structure.Structure) – The current cell with structures that have already been placed
  • candidate (schrodinger.structure.Structure) – The structure to attempt to place into the cell
  • avdw_scale (float) – The VDW scale factor for clash cutoffs
  • pbc (None, infrastructure.PBC, or list) –

    If periodic boundary conditions should be used, provide either an infrastructure.PBC object or the parameters to construct one. Allowed constructors:

    * a, b, c : box lengths
    * a, b, c, alpha, beta, gamma box : box lengths and angles
    * ax, ay, az, bx, by, bz, cx, cy, cz : box vectors
    
  • cell_rings (list) – Each item of the list is a schrodinger.structure._Ring object returned by the findRings() method.
  • candidate_rings (list) – Each item of the list is a schrodinger.structure._Ring object returned by the findRings() method.
Return type:

dict

Returns:

Any clashes found. Keys are atom indexes values are all the atom indexes that clash with that atom

getPBCSide(cell)

Get the length of one side of the periodic boundary condition

Parameters:cell (schrodinger.structure.Structure) – The current cell with structures that have already been placed
Return type:float
Returns:The length of one side of the periodic boundary condition. 0 is returned if no PBC has been set on the cell
getNewCellStructure(volume)

Get a new, empty structure with the periodic boundary condition set

Parameters:volume (float) – The desired volume of the periodic boundary condition
Return type:schrodinger.structure.Structure
Returns:The structure to add the properties to
getDesiredVolume(structures, density, num_per_chain=None)

Get the volume of a cube that will have the given density when the given structures are placed entirely inside it

Parameters:
  • structures (list) – The list of structures to be placed into the box
  • density (float) – The desired density (g/cm3)
  • num_per_chain (list of int) – The number of each structure. If provided, this list must be of the same length as the above structure list
Return type:

float

Returns:

The desired box side

bitSetOff(bitset, frag)

Set the bitset off according to the atom ids in the fragment; remove rings and spear_rings according to rings in the fragment.

Parameters:
  • bitset (Bitset) – the bitset to set
  • frag (PolymerFragment) – the polymer fragment providing the atom ids
bitSetOn(frag)

Set on the pre-existing atom bitset according to atom ids in the fragment; record rings and spear_rings according to rings in the fragment.

Parameters:frag (PolymerFragment) – the polymer fragment providing the atom ids
buildingBlocksHaveRings()

Override in subclasses to check if any of the building blocks have rings. If none do, it will be a waste of time to look for them in the larger structure.

Return type:bool
Returns:If any of the building blocks have rings
checkForIntraStructureClashes(struct, scale=None, pbc=None, rings=None)

Check for any intrastructure clashes

Parameters:
  • struct (schrodinger.structure.Structure) – The structure for intrastructure clashes
  • scale (float) – The cutoff for finding clashes. This value is multipied times the sum of the VDW radii of the two atoms. If the distance is less than this scaled VDW radii sum, a clash exists
  • pbc (None, infrastructure.PBC, or list) –

    If periodic boundary conditions should be used, provide either an infrastructure.PBC object or the parameters to construct one. Allowed constructors:

    * a, b, c : box lengths
    * a, b, c, alpha, beta, gamma box : box lengths and angles
    * ax, ay, az, bx, by, bz, cx, cy, cz : box vectors
    
  • rings (list) – The precalculated rings returned by findRings() on the structure. If not supplied, they will be calculated on the fly.
Return type:

dict

Returns:

keys are atom indexes, and values are all the atom indexes that clash with that atom. A clash may come from two atoms too close together, or a ring that is speared by a bond.

colorByMolecule(struct)

Color each molecule in struct a different color

Parameters:struct (schrodinger.structure.Structure) – The structure to color
copyAllStructsIntoCell()

Copy monomer structures into the cell, but the bitsets are off.

Parameters:
static countClashes(clashes)

Count the total number of clashes

Parameters:clashes (dict) – keys are atom indexes, values are all the atom indexes that clash with that atom
deleteOtherBranches(pre_frag, frags_in_one_mol)

Remove the fragments from the next_frags pool and set off the bitset of moved fragments.

Parameters:
  • pre_frag (PolymerFragment) – the branching parent polymer fragment
  • frags_in_one_mol (list of PolymerFragment) – the pool of PolymerFragment to be grown
findRingSpears(ring_struct, spear_struct=None, rings=None, ring_based=True, pbc=None)

Find all cases where a bond spears a ring

Parameters:
  • ring_struct (schrodinger.structure.Structure) – The structure containing the rings
  • spear_struct (schrodinger.structure.Structure) – The structure containing the atoms that might spear the rings. If not provided, ring_struct will be used.
  • rings (list) – Each item of the list is a schrodinger.structure._Ring object. This is the list returned by the findRings() method. If not provided, they will be calculated on the fly - which takes considerable time. If findRingSpears will be run more than once on the same structure (even if the geometry changes), the rings should be precalculated via findRings and passed in via this parameter.
  • ring_based (bool) – Whether the returned dictionary should contain keys that are atom indexes of the speared ring (True), or of the bond spearing the ring (False)
  • pbc (None, infrastructure.PBC, or list) –

    If periodic boundary conditions should be used, provide either an infrastructure.PBC object or the parameters to construct one. Allowed constructors:

    * a, b, c : box lengths
    * a, b, c, alpha, beta, gamma box : box lengths and angles
    * ax, ay, az, bx, by, bz, cx, cy, cz : box vectors
    
Return type:

dict

Returns:

If ring_based=True, keys are an atom index of one of the atoms in the speared ring, and values are the atom index of one of the atoms in the spearing bond. If ring_based=False, the keys/values are flipped.

findRings(struct)

Find all the rings in the provided structure. Since ring-finding is expensive, its best to pre-calculate them once. Since the coordinates of the ring don’t matter, we can use these rings over and over as long as the atom numbering doesn’t change.

Parameters:struct (schrodinger.structure.Structure) – The structure to find the rings for
Return type:list
Returns:List of schrodinger.structure._Ring objects in the given structure.
getClashes(struct1, cutoff, struct2=None, pbc=None, check_14=False)

Find clashes - either intrastructure if struct2 is None, or interstructure if struct2 is not None.

Parameters:
  • struct (schrodinger.structure.Structure) – The structure for intrastructure clashes or the first structure for interstructure clashes
  • cutoff (float) – The cutoff for finding clashes. This value is multipied times the sum of the VDW radii of the two atoms. If the distance is less than this scaled VDW radii sum, a clash exists
  • struct2 (schrodinger.structure.Structure) – The second structure for interstructure clashes
  • pbc (None, infrastructure.PBC, or list) –

    If periodic boundary conditions should be used, provide either an infrastructure.PBC object or the parameters to construct one. Allowed constructors:

    * a, b, c : box lengths
    * a, b, c, alpha, beta, gamma box : box lengths and angles
    * ax, ay, az, bx, by, bz, cx, cy, cz : box vectors
    
  • check_14 (bool) – If False, the atom pairs separated by 3 covalent bonds are excluded for clash check.
Return type:

dict

Returns:

keys are atom indexes in struct1 (or struct2 if defined), and values are all the atom indexes in struct1 that clash with that atom

getInfraStructure(struct)

Get an infrastructure Structure object and an associated bitset struct.atom_total long

Parameters:struct (schrodinger.structure.Structure) – The python module Structure object
Return type:tuple
Returns:First item of the tuple is a schrodinger.infra.structure.Structure object. Second item is a bitset that is struct.atom_total long
getPolymerFragments(vdw_scale, get_rigid=False)

Break polymers (if needed), prepare them, and return the corresponding PolymerFragments objects.

Parameters:
  • avdw_scale (float) – The VDW scale factor for clash cutoffs
  • get_rigid (bool) – If True, pick those marked as rigid bodies. If False, skip those marked as rigid bodies.
Return type:

list of ‘PolymerFragments’

Returns:

Each item contains fragment information for one molecule.

getPosition(new_chain)

Find random positions in the cell according to the following rules. If new_chain=True, randomly pick a position in cell that is away from pre-existing initiators. If new_chain=False, randomly loop over all the gridded positions in the largest void in cell.

Parameters:new_chain (bool) – if True, the fragment is from a new chain; else, the fragment is from a dead chain.
Return type:list
Returns:[x, y, z], a random position in cell
getRandGridXYZ()

Get xyz iterator of random grid points in the largest void.

Return type:list
Returns:[x, y, z], a random position in cell
getRandXYZ(max_num=2000, max_failed_num=2000)

Return a random point in the space and no other initiators and scaffold within a pre-defined raduis.

Parameters:
  • max_num (int) – max number of xyz position returned
  • max_failed_num (int) – max number of attemps when finding points self.r_per_ini_frag away from scaffold and other initiator atoms.
Return type:

iterator of list

Returns:

iterator of [x, y, z], a random position in cell

growFragmentCell(density, avdw_scale)

Make a single attempt at building the cell by growing polymer fragments.

Parameters:
  • density (float) – The density of the cell
  • avdw_scale (float) – The VDW scale factor for clash cutoffs
Return type:

schrodinger.structure.Structure or None

Returns:

The built cell, or None if an error occurred

hasClashes()

Check whether current fragment has clashes and speared rings with pre-existing structure.

Return type:bool
Returns:True, if has clashes
log(msg, level=20)

Log a message

Parameters:
  • msg (str) – The message to log
  • level (logging constant) – A log level constant from the logging module such as INFO, WARNING, ERROR…
placeOneIniInCell(frag, new_chain=True)

Place a new or dead chain fragment containing initiator into the cell. If new_chain=True, randomly pick a position in cell; make sure the position is away from pre-existing initiators; check contact of the newly added fragments against all pre-existing atoms. If contact exists, randomly pick anothor position. If new_chain=False, find a random position in the largest void in cell; check contact; if contact exists, loop over all the gridded positions in the largest void.

Parameters:
  • frag (PolymerFragment) – the first fragment containing initiator
  • new_chain (bool) – if True, the fragment is from a new chain; else, the fragment is from a dead chain.
Return type:

bool

Returns:

True, if the initiator fragment is successfully placed in cell

preparePbcAndParams(avdw_scale)

Prepare pbc and contact parameters.

Parameters:avdw_scale (float) – The VDW scale factor for clash cutoffs
relocateFailedMol(pre_frag, frags_in_one_mol, tried_per_mol, undo_crystal_links=False)

Place one failed molecule back into the cell.

Parameters:
  • pre_frag ({PolymerFragment}) – the ini fragment of one polymer
  • frags_in_one_mol (list of {PolymerFragment}) – polymer fragment of this polymer within one polymer
  • tried_per_mol (int) – failed trial number
  • undo_crystal_links (bool) – whether to unlink the chain from the crystals
Return type:

bool

Returns:

True, if successfully placed the ini fragment back

removeFinishedPolymer(frags_by_mol)

Remove frags_by_mols that have no polymer fragments and update finished polymer number.

Parameters:frags_by_mol (list of list) – each sublist contains polymer fragments within one polymer
removeIgnoredClashes(all_clashes, ignored_clashes)

Get only those clashes that are not ignored.

Parameters:
  • all_clashes (dict) – All found clashes
  • ignored_clashes (dict) – Clashes that should be ignored
Return type:

dict

Returns:

Those clashes in all_clashes that are not in ignored_clashes. Keys are atom indexes, values are all the atom indexes that clash with that atom

setDistanceCell()

Set DistanceCell for the clash check of current fragment.

setPolymerFragments(vdw_scale)

Set polymer fragments for tangled chain method.

Parameters:avdw_scale (float) – The VDW scale factor for clash cutoffs
setRingsForOneMol(new_init_frag, ringnum)

Create _Ring objects for each fragment in one molecule.

Parameters:
  • new_init_frag (PolymerFragment) – the first fragment containing initiator
  • ringnum (int) – the total number of rings of all molecules in cell
writeDihedralDis(file_name='tmp_dis.txt')

Write the dihedral angle distribution of the structures in cell.

class schrodinger.application.matsci.amorphous.EnergySurface(orig_dihe_values)

Bases: object

Calculate energy surface, and dihedral angle probability distrubtion.

__init__(orig_dihe_values)

Save original dihedral values and initialize energy.

Parameters:orig_dihe_values (list of float) – The original dihedral values
setUniformDistribution()

Set uniform distribution.

setBoltzmannDistribution(struct, dihedral, forcefield_num, force_constant, beta)

Calculate torsion energy surface. If any energies on the surface are invalid, set uniform distribution. If all are valid, set Boltzmann distribution

Parameters:
  • struct ({schrodinger.Structure.structure}) – the local structure for dihedral angle energy surface
  • dihedral (list of int) – the 4 ints are the atom ids of target dihedral angle
  • forcefield_num (int) – the mmffld integer for the given forcefield
  • force_constant (float) – the energy constant for torsion restraints
  • beta (float) – 1/kT to get Boltzmann factor (E / kT)
exception schrodinger.application.matsci.amorphous.RotationError

Bases: Exception

__init__

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.application.matsci.amorphous.PolymerFragments(struct, num_struct, dihedral_min=0.0, dihedral_max=360.0, dihedral_num=73, dihedral_exclude=False, only_backbone=False, vdw_scale=1.0, forcefield='OPLS_2005', temperature=None, pop_local_clash=True, logger=None)

Bases: schrodinger.application.matsci.amorphous.BuilderWithClashDetection

Save the struct and break it into fragments.

__init__(struct, num_struct, dihedral_min=0.0, dihedral_max=360.0, dihedral_num=73, dihedral_exclude=False, only_backbone=False, vdw_scale=1.0, forcefield='OPLS_2005', temperature=None, pop_local_clash=True, logger=None)

Prepare infomation for in-cell grow of one single polymer chain.

Parameters:
  • struct (schrodinger.structure.Structure) – the structure to be breaked into fragments
  • num_struct (int) – copy the struct by num_struct times when placing them into the cell
  • dihedral_min (float) – lower limit of dihedral angle
  • dihedral_max (float) – upper limit of dihedral angle
  • dihedral_num (int) – the number of dihedral values
  • dihedral_exclude (bool) – (0, dihedral_min) and (dihedral_max, 360) are used as dihedral angle range, if True.
  • only_backbone (bool) – only the rotatable bonds in backbone is considered
  • vdw_scale (float) – VDW scale factor to use
  • forcefield (str) – The name of the force field to use. The default is ‘OPLS_2005’.
  • temperature (float, or None) – the temperature to calculate dihedral angle distribution using boltzmann factor. If None, a uniform distribution is used.
  • pop_local_clash (bool) – whether remove dihedral angle values that lead to local clashes
  • logger (logging.Logger) – logger for output info
setDiheInit()

Set descrete dihedral values.

breakIntoFragments(is_rigid=False, restore_template=True)

Break polymer into fragments.

Parameters:
  • is_rigid (bool) – set the molecule as one fragment.
  • restore_template (bool) – restore the template polymer to the original one.
checkAndmarkPolymerProp()

Check the struct and mark with necessary polymer properties.

Return type:bool
Returns:True, if the structure is successfully marked with polymer properties.
setLocalStructs()

Set the local structures.

setAsOneFragment()

Set the whole molecule as one fragment.

setAllfragments()

Set all fragments.

saveLocalStructs()

Save local structs and update dihedrals according to the atom ids in newly saved local structs.

popLocalClashes()

Try dihedral value one by one for the target torsion in local structs, and eliminate those leading to inevitable local clashes by incomplete conformer search of local structs.

torsionEnergySurf(force_constant=10.0, temperature=300.0)

Sample torsion energy surface for local structs, and initialize the dihedral angle distribution using Boltzmann distribution.

Parameters:
  • force_constant (float) – the energy constant for torsion restraints
  • temperature (float, or None) – the temperature to calculate dihedral angle distribution
extractWithMap(struct, indices, copy_props=False)

Return a new structure object which contains the atoms of the current structure that appear in the specified list and a dict which maps atom ids in current structure to those in newly fextracted substructure.

Parameters:
  • struct (structure.Structure) – the structure to extract substructs from
  • indices (list of int) – the ids of atoms to be extracted
  • copy_props (bool) – whether to copy the structure level property
Return type:

structure.Structure, dict

Returns:

substructure, dict mapping to atom ids in substructure

getCapperTerminator(is_coarse_grain)

Get a terminator moiety to cap the atom in a broken bond.

Parameters:is_coarse_grain (bool) – whether the structure is coarse grain
Return type:Terminator
Returns:terminator moiety of one single H or C atom with Br marker.
findNeighborFrags(separated_bond_num=2)

Search for and save neighboring fragments for each fragment. For any fragments, the bond between dihe 2nd and 3rd atoms is rotatable. If any other fragments has any atoms that are within separated_bond_num bonds away from the dihe 2nd and 3rd atoms of one certain fragment, they are considered neighbor fragments of that fragment.

Parameters:separated_bond_num (int) – criteria for defining neighbor fragments
setLocalStructAtomIds()

Set the local struct atom ids and end atom ids defined by neighbor fragments.

isCgPolymer()

Coarse grain particles of one type are considerred as one type of polymer residue. If one cg structure has INI, TRM, and others as residues, consider it built from polymer builder, assuming all bonds between particles are rotatable.

Return type:bool
Returns:True, if the cg structure is originally from polymer builder and prepared properly.
renumberResGetM2PMap()

Loop over all the residues and create mapping from atom id in residue to that in polymer.

updateAllAtomIndexMaps()

Get infomation from previous polymer build for polymer grow in cell.

setInitiatorResidue()

Save the residue containing the polymer initiator.

setResidueConnectivity(moiety, residue_num)

Create mapping from connected resnum pair to connected atom pair.

Parameters:
setBackboneAndSideGroup(moiety, residue_num)

Update backbone and side group maps.

Parameters:
setPathtoBranchingAtom(moiety_bb_to_marked_end, residue_num)

Update maps for the path between backbone atom to atom branching point.

Parameters:
  • moiety_bb_to_marked_end (dict) – Keys are backbone atom indexes, values are dictionaries with keys being the branching atom and values being the path between backbone atom and branching atom
  • residue_num (int) – residue num
setRotatableBond(moiety_rotatable_bonds, residue_num)

Update maps for the path between backbone atom to atom branching point.

Parameters:
  • moiety_rotatable_bonds (list of tuple) – (atom 1, atom 2) between which bond is rotatable
  • residue_num (int) – residue num
createFragForInitiator()

Create the the first polymer fragment from the initiator and append the following children of it.

getInitiatorSubBackbone(sub_backbone, dihe_3rd)

Return a list of atom ids: the last two atoms are bonded and the last bonds with the dihe 3rd atom.

Parameters:
  • sub_backbone (list) – the last two atoms are bound and the last one binds with the dihe 3rd atom.
  • dihe_3rd (int) – the 3rd atom in a dihedral
finishPolymerFrags()

Generate all polymer fragments from the first generation fragment containing INT and the following generation fragments.

appendMissedFrags()

When polymer fragments don’t find all the atoms in the original structure, this methods first groups them by bond connections and appends each group to a found fragment.

getConnectionInfos(missed_atom_id_groups, all_missed_atom_ids)

Return the connecting atoms, which belong to the atoms in the found fragment and connect to the missed atoms.

Parameters:
  • missed_atom_id_groups (list of list) – each sublist has missed atoms connected by covalent bonds.
  • all_missed_atom_ids (list of int) – a flat list of all missed atom indexes
Return type:

list of set

Returns:

each set has the connecting atoms, which belong to the found atoms in the fragment and are connected to the missed atoms.

assignRingAtomIds()

Assign ring atom indexes to each fragment.

structToOriginByFrag()

Move the structure so the centroid of the fragment is at the origin.

getFragCentroid(struct, frag)

Calculate the centroid of polymer fragment.

Parameters:
  • frag (Polymerfragment) – polymer structure to get atom positions from
  • frag – The polymer fragment to get atom ids from
Return type:

list

Returns:

the centroid of polymer fragment

getDelNextResnumByResnum(cur_resnum)

Given resnum, find all the connected residues and atoms. Delete the connectivity from current residue to next residue and the connectivity from next residue to current residue.

Parameters:
  • cur_resnum (int) – the residue number which the atom id belongs to
  • del_connection (bool) – del the connection from current atom and residue to the connected atom and residue
Return type:

iterator to generate int, [int, int]

Returns:

the connected residue number, [atom id, connected atom id]

delConnectivity(cur_resnum, next_resnum, atom_id, next_atom_id)

Delete the connectivity from current residue to next residue and the connectivity from next residue to current residue.

Parameters:
  • cur_resnum (int) – the residue number which the current atom id belongs to
  • next_resnum (int) – the residue number which the connected atom id belongs to
  • atom_id (int) – the atom id from which other connections are searched
  • next_atom_id (int) – one connected atom id
createEndSubFragment(cur_frag, dihe_3rd_resnum, sub_backbone, dihe_4th_resnum, dihe_4th_atom_id, append_to_frag=None, last_created_frag=False)

Create one child PolymerFragment or append atoms to append_to_frag.

Parameters:
  • cur_frag (PolymerFragment) – current polymer fragment
  • dihe_3rd_resnum (int) – the resnum of the 3rd atom in dihedral
  • sub_backbone (list of int) – the backbone whose last atom (dihedral 3rd) will be connected to new fragment
  • dihe_4th_resnum (int) – a guess of the resnum of the 4th atom in res
  • dihe_4th_atom_id (int or None) – the 4th atom of dihedral, if int; None, if the 4th atom is in the adjacent res
  • append_to_frag (PolymerFragment or None) – if None, the found ‘branching’ is new polymer fragment, and new PolymerFragment is created with dihedral_4th_atom. if not None, the found ‘branching’ is part of the old polymer fragment and no new PolymerFragment is created. Add dihedral_4th_atom to old polymer fragment.
  • last_created_frag (bool) – if True, will not return fragment
Return type:

PolymerFragment or None

Returns:

the newly created PolymerFragment, or None if atoms are appended to append_to_frag fragment

addBranchingAtoms(cur_frag)

Append extra dihedral 4th atoms for branching. Add to the parent of cur_frag instead of cur_frag, if the current fragment and new branch share the 1st, 2nd, and 3rd atoms in a dihedral angle.

Parameters:cur_frag (PolymerFragment) – branching points will be added to the this fragment
resBackbone(resnum, atom_id)

Given residue number and starting atom id, return the short backbone path (from the starting atom id to the end) and set head/tail using dictionary.

Parameters:
  • resnum (int) – the residue number
  • atom_id (int) – backbone path starts from this atom id
Return type:

list of int

Returns:

the atom ids of backbone from atom_id to the other end

continueResBackbone(atom_id)

Return rest of the backbone path continuing from the atom_id.

Parameters:atom_id (int) – atom id of the starting point
Return type:list
Returns:the atom ids of backbone from atom_id to the other end
bondedAtomIdInSameRes(atom_id)

Find the atom id of a neighbor atom within the same residue.

Parameters:atom_id (int) – atom id
Return type:int or None
Returns:the atom id of a neighbor atom in the same residue
getDelNextResnumByAtomID(atom_id)

Given atom id, find all the connected residues and atoms. Delete the connectivity from current residue to next residue and the connectivity from next residue to current residue.

Parameters:
  • atom_id (int) – the atom id from which all connections are returned
  • del_connection (bool) – del the connection from current atom and residue to the connected atom and residue
Return type:

iterator to generate int, [int, int]

Returns:

the connected residue number, [atom id, connected atom id]

isAllAtomPolymer()

Each polymer built by polymer has one INI, TRM, and at least one MOMONOMER; each atom in polymer has MONOMER_ORIG_ATOM_IDX_PROP property; residues from the same moiety should have same number of atoms.

Return type:bool
Returns:True, if the structure is built using polymer builder.
breakIntoMols()

Make a copy of the template polymer and break the structure into molecules serving as INI, TRM, and Monomer.

Return type:{schrodinger.Structure.structure}, int, int
Returns:the structure copy broken into molecules serving as INI, TRM, and Monomer; atom id of one atom in INI; atom id of one atom in TRM
setAndMarkResidues()

Mark each residue with different residue number, and assign residue name and MONOMER_ORIG_ATOM_IDX_PROP to atoms.

Return type:bool
Returns:True, if struct_copy has three molecules, serving as INI, TRM, and Monomer
reassignResidueProperties(residue_name, atom_indexes, residue_number)

Reasssign atom properties so that atoms of atom_indexes are treated as one residue with proper MONOMER_ORIG_ATOM_IDX_PROP.

Parameters:
  • residue_name (str) – the residue name for atoms in this residue
  • atom_indexes (list of int) – the atom ids for atoms in one residue
  • residue_number (int) – the residue number for atom_indexes
extractMoieties()

Extract residue structures in a polymer and save one for each residue type.

updateOrigAtomIdx()

Update the MONOMER_ORIG_ATOM_IDX_PROP property in each polymer atom with the atom index of atoms in moiety_structs.

addStructProperties()

Copy and add additional properties to moiety_structs to pass the validations in Moieties. However, these properties are not used, since polymer is already built.

Parameters:polymer (schrodinger.structure.Structure) – structure of a polymer
buildingBlocksHaveRings()

Override in subclasses to check if any of the building blocks have rings. If none do, it will be a waste of time to look for them in the larger structure.

Return type:bool
Returns:If any of the building blocks have rings
checkForIntraStructureClashes(struct, scale=None, pbc=None, rings=None)

Check for any intrastructure clashes

Parameters:
  • struct (schrodinger.structure.Structure) – The structure for intrastructure clashes
  • scale (float) – The cutoff for finding clashes. This value is multipied times the sum of the VDW radii of the two atoms. If the distance is less than this scaled VDW radii sum, a clash exists
  • pbc (None, infrastructure.PBC, or list) –

    If periodic boundary conditions should be used, provide either an infrastructure.PBC object or the parameters to construct one. Allowed constructors:

    * a, b, c : box lengths
    * a, b, c, alpha, beta, gamma box : box lengths and angles
    * ax, ay, az, bx, by, bz, cx, cy, cz : box vectors
    
  • rings (list) – The precalculated rings returned by findRings() on the structure. If not supplied, they will be calculated on the fly.
Return type:

dict

Returns:

keys are atom indexes, and values are all the atom indexes that clash with that atom. A clash may come from two atoms too close together, or a ring that is speared by a bond.

colorByMolecule(struct)

Color each molecule in struct a different color

Parameters:struct (schrodinger.structure.Structure) – The structure to color
static countClashes(clashes)

Count the total number of clashes

Parameters:clashes (dict) – keys are atom indexes, values are all the atom indexes that clash with that atom
findRingSpears(ring_struct, spear_struct=None, rings=None, ring_based=True, pbc=None)

Find all cases where a bond spears a ring

Parameters:
  • ring_struct (schrodinger.structure.Structure) – The structure containing the rings
  • spear_struct (schrodinger.structure.Structure) – The structure containing the atoms that might spear the rings. If not provided, ring_struct will be used.
  • rings (list) – Each item of the list is a schrodinger.structure._Ring object. This is the list returned by the findRings() method. If not provided, they will be calculated on the fly - which takes considerable time. If findRingSpears will be run more than once on the same structure (even if the geometry changes), the rings should be precalculated via findRings and passed in via this parameter.
  • ring_based (bool) – Whether the returned dictionary should contain keys that are atom indexes of the speared ring (True), or of the bond spearing the ring (False)
  • pbc (None, infrastructure.PBC, or list) –

    If periodic boundary conditions should be used, provide either an infrastructure.PBC object or the parameters to construct one. Allowed constructors:

    * a, b, c : box lengths
    * a, b, c, alpha, beta, gamma box : box lengths and angles
    * ax, ay, az, bx, by, bz, cx, cy, cz : box vectors
    
Return type:

dict

Returns:

If ring_based=True, keys are an atom index of one of the atoms in the speared ring, and values are the atom index of one of the atoms in the spearing bond. If ring_based=False, the keys/values are flipped.

findRings(struct)

Find all the rings in the provided structure. Since ring-finding is expensive, its best to pre-calculate them once. Since the coordinates of the ring don’t matter, we can use these rings over and over as long as the atom numbering doesn’t change.

Parameters:struct (schrodinger.structure.Structure) – The structure to find the rings for
Return type:list
Returns:List of schrodinger.structure._Ring objects in the given structure.
getClashes(struct1, cutoff, struct2=None, pbc=None, check_14=False)

Find clashes - either intrastructure if struct2 is None, or interstructure if struct2 is not None.

Parameters:
  • struct (schrodinger.structure.Structure) – The structure for intrastructure clashes or the first structure for interstructure clashes
  • cutoff (float) – The cutoff for finding clashes. This value is multipied times the sum of the VDW radii of the two atoms. If the distance is less than this scaled VDW radii sum, a clash exists
  • struct2 (schrodinger.structure.Structure) – The second structure for interstructure clashes
  • pbc (None, infrastructure.PBC, or list) –

    If periodic boundary conditions should be used, provide either an infrastructure.PBC object or the parameters to construct one. Allowed constructors:

    * a, b, c : box lengths
    * a, b, c, alpha, beta, gamma box : box lengths and angles
    * ax, ay, az, bx, by, bz, cx, cy, cz : box vectors
    
  • check_14 (bool) – If False, the atom pairs separated by 3 covalent bonds are excluded for clash check.
Return type:

dict

Returns:

keys are atom indexes in struct1 (or struct2 if defined), and values are all the atom indexes in struct1 that clash with that atom

getInfraStructure(struct)

Get an infrastructure Structure object and an associated bitset struct.atom_total long

Parameters:struct (schrodinger.structure.Structure) – The python module Structure object
Return type:tuple
Returns:First item of the tuple is a schrodinger.infra.structure.Structure object. Second item is a bitset that is struct.atom_total long
log(msg, level=20)

Log a message

Parameters:
  • msg (str) – The message to log
  • level (logging constant) – A log level constant from the logging module such as INFO, WARNING, ERROR…
removeIgnoredClashes(all_clashes, ignored_clashes)

Get only those clashes that are not ignored.

Parameters:
  • all_clashes (dict) – All found clashes
  • ignored_clashes (dict) – Clashes that should be ignored
Return type:

dict

Returns:

Those clashes in all_clashes that are not in ignored_clashes. Keys are atom indexes, values are all the atom indexes that clash with that atom

class schrodinger.application.matsci.amorphous.PolymerFragment(resnum, generation, pre_frag=None, is_branching=False, pre_backbone=None, template_frag=None, molnum=None, template_polymer=None)

Bases: object

__init__(resnum, generation, pre_frag=None, is_branching=False, pre_backbone=None, template_frag=None, molnum=None, template_polymer=None)

PolymerFragment class stores the connectivity, dihedral angle, and anthoer other information for tangled chain method.

Parameters:
  • resnum (int) – the resnum of the 3rd atom in dihedral angle
  • generation (int) – the generation of the fragment
  • pre_frag (PolymerFragment) – The parent fragment
  • is_branching (bool) – True, if current fragment has more than children
  • pre_backbone (list of int) – the last atom in pre_backbone is the 3rd dihedral atom
  • template_frag (PolymerFragment or None) – the polymer fragment to be copied
  • molnum (int) – molecule number
  • template_polymer (schrodinger.structure.Structure) – the structure of one polymer chain
preDeepCopy(original_frag, molnum)

Deep copy the fragment attributes except those linking different fragments.

Parameters:
  • original_frag (PolymerFragment) – Polymerfragment object to be copied
  • molnum (int) – molecule number
deepCopy(molnum)

Deep copy the fragment class from the INI fragment.

Parameters:molnum (int) – molecule number
Return type:PolymerFragment
Returns:new INI fragment directing to all copied fragments
setDihedrals(dihe_init)

Set the dihedral angle pool and rand for each fragment. dihedral angle pool and rand are lists of possible dihedral angles. When the polymer chain grows, move to next polymer fragment and set the dihedral angle using a value randomly picked from rand; When the polymer growing site dies, move to previous polymer fragment, pop up the used dihedral angle from the pool, and randomly pick a new one from the left dihedral values in pool.

Parameters:dihe_init (list of floats) – list of possible dihedral angles
markSidegroupFrag()

Mark the side group polymer fragment, if the 3rd atom in the dihedral angle is in side group (not backbone atom).

resetFragDihedralPool()

Reset the dihedral angle pool of all following fragment according to rand in each fragment.

fragments(include_self=True)

Yield the first fragment of next_frags and append the children of that fragment to next_frags for recursion.

Parameters:include_self (bool) – If True, loop over itself and all child fragments. If False, only loop over its child polymer fragments.
Return type:iterator to generate PolymerFragment
Returns:one child polymer fragment
adjustAtomIds(pre_atomnum)

Adjust atom ids in PolymerFragment when multipe chains are added into the cell.

Parameters:pre_atomnum (int) – number of atoms before adding current molecule
markBranchingFrag()

Mark the branching fragments.

getDiheValues()

Get the possbile dihedral values of current fragment.

Return type:list
Returns:all polymer dihedral vaules
schrodinger.application.matsci.amorphous.assign_markers(residue_struct)

Find and add marker atoms to the extracted structures.

Parameters:residue_struct (schrodinger.structure.Structure) – The structure to add the markers to
exception schrodinger.application.matsci.amorphous.VolumeMemoryError

Bases: Exception

__init__

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.application.matsci.amorphous.LowMemoryVolGraph

Bases: object

This class mimics a networkx graph for the XYZVolumeGraph class. It has only minimal networkx functionality. It is necessary because networkx graphs are giant memory hogs and can’t be used for even moderately-sized sparse grid graphs. This class takes a tiny fraction - a few percent or so - of the memory for an equivalent networkx graph.

__init__()

Create a LowMemoryVolGraph instance

__len__()

The length of the graph is just the number of nodes

Return type:int
Returns:The number of nodes in the graph
checkMemoryLimit()

Check that the amount of memory used is not approaching the total memory available

Raises:VolumeMemoryError – If the amount of memory used is too large compared to the total system memory
addNode(node)

Add a new node to the graph.

Parameters:node (tuple (or hashable, sortable object)) – The node to add
addEdge(node1, node2)

Add a new edge (a connection between two nodes) to the graph

Parameters:
  • node1 (tuple (or hashable, sortable object)) – One of the nodes to create the edge between. Node order does not matter.
  • node2 (tuple (or hashable, sortable object)) – The other node to create the edge between. Node order does not matter.
Raises:

KeyError – If one of the nodes is not found in the graph

removeNode(node)

Remove a node from the graph. Also removes all edges attached to this node

Parameters:node (tuple (or hashable, sortable object)) – The node to remove
Raises:KeyError – If one of the nodes is not found in the graph
removeEdge(node1, node2)

Remove an edge (a connection between two nodes) from the graph. The nodes are not removed.

Parameters:
  • node1 (tuple (or hashable, sortable object)) – One of the nodes for the existing edge. Node order does not matter.
  • node2 (tuple (or hashable, sortable object)) – The other node to for the existing edge. Node order does not matter.
Raises:

KeyError – If one of the nodes is not found in the graph

nodes()

A generator over all the nodes in the graph

Return type:node type
Returns:Iterates over each node in the graph
edges()

A generator over all edges in the graph

Return type:(node, node)
Returns:Iterates over each pair of connected nodes. Nodes are returned in sort order.
blobs()

A generator for all the blobs (groups of connected nodes) in the graph

Return type:set
Returns:Iterates over blobs. Blobs are returned in order of largest to smallest
degree(node)

Return the number of edges for the node

Parameters:node (tuple (or hashable, sortable object)) – The node to check
Return type:int
Returns:The number of edges for a node
Raises:KeyError – If the node is not found in the graph
class schrodinger.application.matsci.amorphous.XYZVolumeGraph(struct, spacing=2.0, scaffold=None)

Bases: object

Create a networkx graph to search the voids in structure.

__init__(struct, spacing=2.0, scaffold=None)

Create networkx graph based on the structure PBC or coordinates.

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to compute the graph over
  • spacing (float) – The approximate spacing (Angstroms) between graph nodes. The actual grid spacing will be adjusted in each direction to ensure uniform grid point distribution, and the actual spacing used in each direction can be found in the self.xyz_spacings list
  • scaffold (Scaffold or None) – a structure that occupies space as a cluster of molecules.
defineBoxFromScaffold(scaffold)

Define the grid box as the scaffold box size

Parameters:scaffold (Scaffold) – a structure that occupies space as a cluster of molecules.
defineBoxFromPBC()

Define the box from the PBC. This method works for triclinic cells by virtue of creating a hull that can be used to eliminate grid points outside the arbitrary-shaped PBC region.

defineBoxFromNonPBCStruct()

Define a box that encompasses the structure, including the VDW radii of the extreme atoms

getNodeXYZ(node)

Convert networkx node (tuple of X, Y, Z index) to XYZ coordinates

Parameters:node (tuple) – the node to convert
Return type:tuple
Returns:A tuple of x, y z coordinates in Angstroms
static getDistanceCellDistance(struct, probe)

Get the distance that will be used as the cutoff for atoms close to a point

Parameters:
Return type:

float

Returns:

The distance cutoff that will be used

locateVoids(atom_ids=None, vdw_scale=1.0, probe=0.0, logger=None)

Remove all nodes that overlap a bitset-on atom (all atoms by default) in current structure. And connect all grid points that are part of the same void.

Parameters:
  • atom_ids (set or None) – if not None, only check clashes for atoms in this set
  • vdw_scale (float) – VDW scale factor to use
  • probe (float) – A radius to add to each atom’s vdw radius in order to determine whether the atom encompasses a point or not. This is the thought equivalent of rolling a ball around the vdw surface of the atoms and tracing out the center of the ball.
  • logger (Logger) – If given, progress will be logged using this object
Raises:

VolumeMemoryError – If memory usage grows too large

bondRemainingNodes()

Connect each node with its neighbor nodes that remain in the graph. Nodes that differ by 1 in 1 coordinate are considered neighbors. Any PBC is also accounted for so that neighboring nodes on the opposite side of the cell are also bonded.

Raises:VolumeMemoryError – If memory usage grows too large
static gridNeighbors(node, num_xyz, pbc)

A generator over all potential node values for the neighbors of the given node. The nodes may or may not exist in the graph. Neighbors are considered to have one of x, y or z values that differs by exactly 1 and both other values are the same. The PBC is used to connect neighbors on opposite edges of the cell.

Parameters:
  • node (tuple) – the node to get the neighbors for
  • num_xyz (list) – The number of grid points in the x, y and z directions
  • pbc (schrodinger.infra.structure.PBC or None) – The PBC if one exists
Return type:

tuple

Returns:

Iterates over potential (x, y, z) neighbors of the given node.

static getNeighborCoordVal(node, delta, coord, numpts, pbc)

Get the (x, y, z) tuple for a neighbor of node that differs by delta in coord. (x, y, z) is modified based on the PBC if necessary

Parameters:
  • node (tuple) – the node to convert
  • delta (int) – How much the coord value differs from the given node. Typically 1 or -1 to give a neighboring node.
  • coord (int) – 0, 1 or 2 for the x, y or z direction
  • numpts (int) – The number of grid points in the coord direction
  • pbc (schrodinger.infra.structure.PBC or None) – The PBC if one exists
Return type:

tuple or None

Returns:

The (x, y, z) tuple formed by modifying coord of node by delta, or None if there is no pbc and the modified coord would be outside 0:numpts-1

voids()

A generator that returns groups of connected nodes that define voids in the structure.

Return type:tuple
Returns:Each returned value is a set of nodes that are all connected and define a void blob. The sets are returned in order of size, largest to smallest
getLargestVoid()

Get the largest void.

Return type:tuple
Returns:The set of nodes that form the largest void in the structure
getSurfaceNodes(blob)

Get a list of nodes in blob that have fewer than 6 connections

Parameters:blob (set) – The set of nodes to search for surface nodes in
Return type:list
Returns:Each item of the list is a node that has fewer than 6 connections
getBuriedNode(blob)

A generator that returns nodes that is buried inside the blob of connected nodes. Buried nodes have lots of connections to other nodes.

Parameters:blob (a set of tuples) – Each item of the set is a node
Return type:tuple
Returns:The buried node
getBuriedXYZ(blob)

Like getBuriedNode but return the xyz coordinates.

Parameters:blob (a set of tuples) – Each item of the set is a node
Return type:tuple
Returns:A tuple of x, y z coordinates in Angstroms
schrodinger.application.matsci.amorphous.find_attached_atom_index(struct, mark_index, prop=None, propval=True)

Find the index of the atom attached to the atom with the given index, optionally setting a property/value on that atom

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to search for the atom
  • mark_index (int) – The index of the atom that we want to find an atom attached to.
  • prop (str) – An atom property name
  • propval – The value to set prop to on the found attached atom. The type of this object depends on the type of property being set
Return type:

int

Returns:

The index of an atom attached to the mark_index atom. If more than one atom is attached to mark_index atom, the first one is returned.

schrodinger.application.matsci.amorphous.get_other_item(two_list, item)

In a two item list, return the item that isn’t the one passed in

Parameters:
  • two_list (list) – A list two items long
  • item – One of the items from two_list
Returns:

The item in two_list that is not the one passed in

schrodinger.application.matsci.amorphous.propagate_chain_data_from_atom(struct, chain_atom)

Set the chain data for all atoms in struct to the same data as found on atom

Parameters:
schrodinger.application.matsci.amorphous.get_random_nonzero_to_one()

Get a random float: 0 > x >= 1

Return type:float
Returns:A floating point number in the range (0, 1]
class schrodinger.application.matsci.amorphous.TorsionAngler(options, minimum_steps=5, max_stepsize=15.0)

Bases: object

Class to handle cycling a structure though a series of torsion values

__init__(options, minimum_steps=5, max_stepsize=15.0)

Create a TorsionAngler object

Parameters:
  • options (argparse.Namespace) – Object with dihedral_min and dihedral_max properties that describe the minimum and maximum allowed dihedral angles
  • minimum_steps – The minimum steps to take. The actual number of steps may be larger if the allowed range of torsions is greather than max_stepsize*minimum_steps.
  • max_stepsize (float) – The largest number of degrees to move the torsion per step.
setData(struct, torsion_atoms)

Set the structure to operate on and the 4 atoms involved in the torsion

Parameters:
  • struct (schrodinger.structure.Structure) – The struct containing the torsion to rotate
  • torsion_atoms (list) – A four int list, each int is the atom index of an atom in the torsion, in the order A-B-C-D, where B-C is the bond that rotates when the torsion changes.
getTorsionValueInRange()

Get a value for the torsion that falls within the specified range. The user may have supplied 150-210, but the measured value might be -170 instead of 190. Convert the measured value to fall within the range.

Return type:float
Returns:The torsion value converted to fall within the range specified for the min/max of the torsion values.
rotomers()

A generator for structures that step the torsion through the desired values.

Return type:schrodinger.structure.Structure
Returns:Each yield gives the structure with the specified torsion marched through the specified values.
incrementTorsionValue()

Sets the torsion property to the next value to try for a dihedral as we rotate it through its allowed range.

exception schrodinger.application.matsci.amorphous.MoietyError

Bases: Exception

Raised if there is an error in creating a Moiety subclass object

__init__

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.application.matsci.amorphous.BaseMoiety(struct, markers=None, name=None)

Bases: object

Base class for all polymer units - initiator, terminator, cascader, monomers

bond_length_cache = {}
__init__(struct, markers=None, name=None)

Create a BaseMoiety object

Parameters:
  • struct (schrodinger.structure.Structure) – The structure of this Moiety
  • markers (list) – A list of the indexes of the Rx atoms. If not supplied, information will be read from the structure properties
findAttachedAtomIndex(mark_index, prop=None, propval=True)

Find the index of the atom attached to the atom with the given index, optionally setting a property/value on that atom

Parameters:
  • mark_index (int) – The index of the atom that we want to find an atom attached to.
  • prop (str) – An atom property name
  • propval – The value to set prop to on the found attached atom. The type of this object depends on the type of property being set
Return type:

int

Returns:

The index of an atom attached to the mark_index atom. If more than one atom is attached to mark_index atom, the first one is returned.

moveHeadToOrigin()

Move the structure so that the head atom is at the origin

alignToVector(struct, current_vector, vector)

Rotate the structure so that the current_vector is aligned to a new vector

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to rotate. The coordinates of this structure will be modified by this method
  • current_vector (list) – The current vector that will be aligned to the new vector
  • vector (list) – The new vector that current_vector should be aligned to
Returns:

There is no return value, the structure is modified directly

getStructureForCoupling(orientation, location=None, vector=None, remove_marker=True, residue_number=None)

Get the appropriate structure to couple to the existing unit

Parameters:
  • orientation (str) – Should be the HEADFIRST or TAILFIRST constant, indicates which end of the moiety will bind
  • location (list) – XYZ coordinates that the coupling atom (head or tail depending on orientation) should be moved to (moving the rest of this moiety with it)
  • vector (list) – The vector that the coupler-coupling marker vector should be aligned to
  • remove_marker (bool) – Whether the marker atom should be removed.
  • residue_number (int or None) – If not None, the resnum property of every atom in the returned structure will be set to this value and the residue name will be assigned.
Return type:

(schrodinger.structure.Structure, AttachementAtoms)

Returns:

A copy of the structure of this moiety rotated and translated as requested so that it can bind in the specified orientation. An AttachedAtoms tuple that gives the coupler, grower and marker indexes for this structure.

getBondLength(atom1, atom2, cg_bond_factor=0.8)

Get the desired bond length between the grower atom of the existing unit and the coupling atom of this moiety

Parameters:
  • atom1 (_StructureAtom) – One of the atoms to form a bond in between.
  • atom2 (_StructureAtom) – The other atoms to form a bond in between.
  • cg_bond_factor (float) – The pre-factor to calcuate the bond length based on the particle radius.
Return type:

float

Returns:

The desired bond distance

determineCouplerLocation(xyz, vector, bond_length)

Figure out the XYZ coordinates where the coupler atom should go

Parameters:
  • xyz (list) – The XYZ coordinates of the grower atom
  • vector (list) – The desired bond vector for coupling (goes from grower->coupler)
  • bond_length (float) – the bond length between grower and coupler
Return type:

list

Returns:

The XYZ coordinates where the coupler atom should be placed

addToChain(chain, grower, grow_marker, orientation, remove_marker=True, set_residue_data=False, propagate_chain_data=False, chain_namer=None)

Bind this moiety to an existing chain

The grower, grow_marker, coupler and coupler_marker are defined so that the binding occurs like this:

chain-grower coupler_marker
grow_marker coupler-this_moiety

goes to:

chain-grower
coupler-this_moiety
Parameters:
  • chain (schrodinger.structure.Structure) – The existing chain to add this moiety to
  • grower (int) – The index of the atom in the existing chain that this moiety should bond with
  • grow_marker (int) – The index of the Rx atom that marks the attachment point - the grower->grow_marker bond vector indicates the desired grower->coupler bond vector.
  • orientation (str) – Whether this moiety should add head first or tail first. Should be a module HEADFIRST or TAILFIRST constant.
  • remove_marker (bool) – Whether the chains grower_marker atom should be removed. Set to False if adding multiple moieties and you don’t want existing atom numbers to change during the process.
  • set_residue_data (bool) – Whether to set the residue number property for all atoms added by this method to 1 greater than the residue number of the grow atom on the passed in chain. If False, no residue numbers will be set. A residue name is also assigned if this value is True.
  • propagate_chain_data (bool) – Whether to set the chain data for all atoms added by this method to the same chain information as the grow atom on the passed in chain. If False or the grower atom contains no chain information, this will not be done. This parameter is used if the added moiety should have the same chain information as the existing moiety. See also the chain_namer parameter.
  • chain_namer (function) – A function that should be called with the structure that will be added to chain. The purpose of this function should be to add chain name data to the added structure. Supply this function if the moiety to be added is a full chain. If the moiety to be added is just another monomer, terminator, etc during the building of a single chain, do not supply this function. This parameter is used if the added moiety should have different chain information from the existing moiety, and it is up to the chain_namer function to set that data. See also the propagate_chain_data paramter.
Return type:

(int, int, int)

Returns:

The atom indexes of the coupler atom, the new grower atom and the new grow marker.

findBackbone2BranchingPoint(exclude_markers)

Find the branching point and the shortest path to the nearest atom in backbone_path_indexes. The braching point may have multiple branches connected to, but only one single pair of [backbone atom][branching atom] = [path with ends] is recorded.

Parameters:exclude_markers (list of int) – the atom ids of markers to be excluded
classmethod write(filename, struct, markers, name, classname=None)

Write the structure out to a file, tagging it with properties in such a way that the driver will recognize when reading the structure in

Parameters:
  • filename (str) – The path to the file
  • struct (schrodinger.structure.Structure) – The structure to write
  • markers (list) – A list of the indexes of the Rx atoms.
  • name (str) – The name to use for the title of the structure
  • classname (str) – The chemical class of this moiety. If not supplied, the actual python class name will be used since those are typically the same as the chemical class.
checkRequiredProperties(struct, propexps)

Check to see if the structure has the desired properties set on it

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to check
  • propexps (list of tuple) – (property string, explanation of what the property is) for each structure property to check
readFromStructure(struct, propexps=None)

Read the data for this moiety from the structure object and check to make sure all the required properties are set

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to check
  • propexps (list of tuple) – (property string, explanation of what the property is) for each structure property to check
findSideGroup()

Find and mark the side group atoms. The side group is any heavy atom not part of the backbone and any hydrogen attached to one of those heavy atoms. Note that IUPAC specifically states that a “sidechain” is an oligomer or polymer, while a “side group” is a non-oligomer/polymer. So monomers have side groups, not sidechains.

finalizeSideGroup()

Find atoms in backbone (marked as BACKBONE_ATOM_PROP) but not in the shortest path (backbone_path_indexes) and then treat these atoms along with their side groups as the side groups of certain atom in shortest path (backbone_path_indexes)

markBackboneAtom(index)

Mark the atom as a backbone atom and make sure that if the atom is in a ring that all atoms in the ring are marked as backbone

Parameters:index (int) – The index of the atom to mark
setAsFragment()

Set backbone path and side atoms for Initiator and Terminator. Only the atom connected to R1 group is treated as backbone path; all the rest real atoms are treated as side groups.

findRotatableBonds()

Find rotatable bond along the backbone path.

class schrodinger.application.matsci.amorphous.Terminator(struct, markers=None, name=None)

Bases: schrodinger.application.matsci.amorphous.BaseMoiety

A unit that terminates a chain

Note that the concept of an “Terminator” can be a bit fungible. It can either be the actual terminator moiety that ends a polymer chain, or it may be an already built chain that will be tacked on to some initiation point.

__init__(struct, markers=None, name=None)

Create a Terminator object

Terminators drawn by the user as:
R1-stuff
And stored as:
marker-head-stuff

where marker is the R1 atom, head is the atom it is bound to, and stuff is everything else.

Parameters:
  • struct (schrodinger.structure.Structure) – The structure of this Moiety
  • markers (list) – A list of the indexes of the Rx atoms
  • name (str) – The name of this moiety - gets added to each atom as an atom property
findHead()

Find and store the index of the head atom

getNextStructure(*args)

Get a copy of this structure to add to a chain

getCouplerAtom(*args)

Get the coupler (head) atom

getCouplerAndGrower(*args)

Get the coupler and grower atoms and markers. The latter is None because Terminators have no grow points

Return type:AttachmentAtoms
Returns:The atoms indexes of the coupler, grower and marker atoms
getPDBName()

Get a PDB residue-like name for this moiety

addToChain(chain, grower, grow_marker, orientation, remove_marker=True, set_residue_data=False, propagate_chain_data=False, chain_namer=None)

Bind this moiety to an existing chain

The grower, grow_marker, coupler and coupler_marker are defined so that the binding occurs like this:

chain-grower coupler_marker
grow_marker coupler-this_moiety

goes to:

chain-grower
coupler-this_moiety
Parameters:
  • chain (schrodinger.structure.Structure) – The existing chain to add this moiety to
  • grower (int) – The index of the atom in the existing chain that this moiety should bond with
  • grow_marker (int) – The index of the Rx atom that marks the attachment point - the grower->grow_marker bond vector indicates the desired grower->coupler bond vector.
  • orientation (str) – Whether this moiety should add head first or tail first. Should be a module HEADFIRST or TAILFIRST constant.
  • remove_marker (bool) – Whether the chains grower_marker atom should be removed. Set to False if adding multiple moieties and you don’t want existing atom numbers to change during the process.
  • set_residue_data (bool) – Whether to set the residue number property for all atoms added by this method to 1 greater than the residue number of the grow atom on the passed in chain. If False, no residue numbers will be set. A residue name is also assigned if this value is True.
  • propagate_chain_data (bool) – Whether to set the chain data for all atoms added by this method to the same chain information as the grow atom on the passed in chain. If False or the grower atom contains no chain information, this will not be done. This parameter is used if the added moiety should have the same chain information as the existing moiety. See also the chain_namer parameter.
  • chain_namer (function) – A function that should be called with the structure that will be added to chain. The purpose of this function should be to add chain name data to the added structure. Supply this function if the moiety to be added is a full chain. If the moiety to be added is just another monomer, terminator, etc during the building of a single chain, do not supply this function. This parameter is used if the added moiety should have different chain information from the existing moiety, and it is up to the chain_namer function to set that data. See also the propagate_chain_data paramter.
Return type:

(int, int, int)

Returns:

The atom indexes of the coupler atom, the new grower atom and the new grow marker.

alignToVector(struct, current_vector, vector)

Rotate the structure so that the current_vector is aligned to a new vector

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to rotate. The coordinates of this structure will be modified by this method
  • current_vector (list) – The current vector that will be aligned to the new vector
  • vector (list) – The new vector that current_vector should be aligned to
Returns:

There is no return value, the structure is modified directly

bond_length_cache = {}
checkRequiredProperties(struct, propexps)

Check to see if the structure has the desired properties set on it

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to check
  • propexps (list of tuple) – (property string, explanation of what the property is) for each structure property to check
determineCouplerLocation(xyz, vector, bond_length)

Figure out the XYZ coordinates where the coupler atom should go

Parameters:
  • xyz (list) – The XYZ coordinates of the grower atom
  • vector (list) – The desired bond vector for coupling (goes from grower->coupler)
  • bond_length (float) – the bond length between grower and coupler
Return type:

list

Returns:

The XYZ coordinates where the coupler atom should be placed

finalizeSideGroup()

Find atoms in backbone (marked as BACKBONE_ATOM_PROP) but not in the shortest path (backbone_path_indexes) and then treat these atoms along with their side groups as the side groups of certain atom in shortest path (backbone_path_indexes)

findAttachedAtomIndex(mark_index, prop=None, propval=True)

Find the index of the atom attached to the atom with the given index, optionally setting a property/value on that atom

Parameters:
  • mark_index (int) – The index of the atom that we want to find an atom attached to.
  • prop (str) – An atom property name
  • propval – The value to set prop to on the found attached atom. The type of this object depends on the type of property being set
Return type:

int

Returns:

The index of an atom attached to the mark_index atom. If more than one atom is attached to mark_index atom, the first one is returned.

findBackbone2BranchingPoint(exclude_markers)

Find the branching point and the shortest path to the nearest atom in backbone_path_indexes. The braching point may have multiple branches connected to, but only one single pair of [backbone atom][branching atom] = [path with ends] is recorded.

Parameters:exclude_markers (list of int) – the atom ids of markers to be excluded
findRotatableBonds()

Find rotatable bond along the backbone path.

findSideGroup()

Find and mark the side group atoms. The side group is any heavy atom not part of the backbone and any hydrogen attached to one of those heavy atoms. Note that IUPAC specifically states that a “sidechain” is an oligomer or polymer, while a “side group” is a non-oligomer/polymer. So monomers have side groups, not sidechains.

getBondLength(atom1, atom2, cg_bond_factor=0.8)

Get the desired bond length between the grower atom of the existing unit and the coupling atom of this moiety

Parameters:
  • atom1 (_StructureAtom) – One of the atoms to form a bond in between.
  • atom2 (_StructureAtom) – The other atoms to form a bond in between.
  • cg_bond_factor (float) – The pre-factor to calcuate the bond length based on the particle radius.
Return type:

float

Returns:

The desired bond distance

getStructureForCoupling(orientation, location=None, vector=None, remove_marker=True, residue_number=None)

Get the appropriate structure to couple to the existing unit

Parameters:
  • orientation (str) – Should be the HEADFIRST or TAILFIRST constant, indicates which end of the moiety will bind
  • location (list) – XYZ coordinates that the coupling atom (head or tail depending on orientation) should be moved to (moving the rest of this moiety with it)
  • vector (list) – The vector that the coupler-coupling marker vector should be aligned to
  • remove_marker (bool) – Whether the marker atom should be removed.
  • residue_number (int or None) – If not None, the resnum property of every atom in the returned structure will be set to this value and the residue name will be assigned.
Return type:

(schrodinger.structure.Structure, AttachementAtoms)

Returns:

A copy of the structure of this moiety rotated and translated as requested so that it can bind in the specified orientation. An AttachedAtoms tuple that gives the coupler, grower and marker indexes for this structure.

markBackboneAtom(index)

Mark the atom as a backbone atom and make sure that if the atom is in a ring that all atoms in the ring are marked as backbone

Parameters:index (int) – The index of the atom to mark
moveHeadToOrigin()

Move the structure so that the head atom is at the origin

readFromStructure(struct, propexps=None)

Read the data for this moiety from the structure object and check to make sure all the required properties are set

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to check
  • propexps (list of tuple) – (property string, explanation of what the property is) for each structure property to check
setAsFragment()

Set backbone path and side atoms for Initiator and Terminator. Only the atom connected to R1 group is treated as backbone path; all the rest real atoms are treated as side groups.

classmethod write(filename, struct, markers, name, classname=None)

Write the structure out to a file, tagging it with properties in such a way that the driver will recognize when reading the structure in

Parameters:
  • filename (str) – The path to the file
  • struct (schrodinger.structure.Structure) – The structure to write
  • markers (list) – A list of the indexes of the Rx atoms.
  • name (str) – The name to use for the title of the structure
  • classname (str) – The chemical class of this moiety. If not supplied, the actual python class name will be used since those are typically the same as the chemical class.
class schrodinger.application.matsci.amorphous.Cascader(*args, **kwargs)

Bases: schrodinger.application.matsci.amorphous.Terminator

A group that ends a chain but starts multiple new chains

Cascaders are drawn as:
R2 |

R1-stuff-R2

and stored as:
cascader

marker-head-stuff-cascader

where cascader is an atom property added to the R2 marker atoms

__init__(*args, **kwargs)

Create a Terminator object

Terminators drawn by the user as:
R1-stuff
And stored as:
marker-head-stuff

where marker is the R1 atom, head is the atom it is bound to, and stuff is everything else.

Parameters:
  • struct (schrodinger.structure.Structure) – The structure of this Moiety
  • markers (list) – A list of the indexes of the Rx atoms
  • name (str) – The name of this moiety - gets added to each atom as an atom property
findBackbone()

Find the set of atoms that creates the shortest distance (number of bonds) between the head and each cascade points. These are considered backbone atoms.

Backbone atoms are marked with a backbone atom property.

findHead()

Find the head atom, but also mark cascader atoms that will start new points

readFromStructure(struct)

Overrides the parent method to add and read Cascader-specific properties.

See the parent class method for documentation

classmethod write(generations, filename, struct, *args)

Over-ride the parent class method to add generations as a property to the structure.

Parameters:generations (int) – The number of cascade generations allowed

See the parent class method for documentation

getPDBName()

Get a PDB residue-like Name for this moiety

setAsFragment()

Prepare Cascader information for in-cell grow.

addToChain(chain, grower, grow_marker, orientation, remove_marker=True, set_residue_data=False, propagate_chain_data=False, chain_namer=None)

Bind this moiety to an existing chain

The grower, grow_marker, coupler and coupler_marker are defined so that the binding occurs like this:

chain-grower coupler_marker
grow_marker coupler-this_moiety

goes to:

chain-grower
coupler-this_moiety
Parameters:
  • chain (schrodinger.structure.Structure) – The existing chain to add this moiety to
  • grower (int) – The index of the atom in the existing chain that this moiety should bond with
  • grow_marker (int) – The index of the Rx atom that marks the attachment point - the grower->grow_marker bond vector indicates the desired grower->coupler bond vector.
  • orientation (str) – Whether this moiety should add head first or tail first. Should be a module HEADFIRST or TAILFIRST constant.
  • remove_marker (bool) – Whether the chains grower_marker atom should be removed. Set to False if adding multiple moieties and you don’t want existing atom numbers to change during the process.
  • set_residue_data (bool) – Whether to set the residue number property for all atoms added by this method to 1 greater than the residue number of the grow atom on the passed in chain. If False, no residue numbers will be set. A residue name is also assigned if this value is True.
  • propagate_chain_data (bool) – Whether to set the chain data for all atoms added by this method to the same chain information as the grow atom on the passed in chain. If False or the grower atom contains no chain information, this will not be done. This parameter is used if the added moiety should have the same chain information as the existing moiety. See also the chain_namer parameter.
  • chain_namer (function) – A function that should be called with the structure that will be added to chain. The purpose of this function should be to add chain name data to the added structure. Supply this function if the moiety to be added is a full chain. If the moiety to be added is just another monomer, terminator, etc during the building of a single chain, do not supply this function. This parameter is used if the added moiety should have different chain information from the existing moiety, and it is up to the chain_namer function to set that data. See also the propagate_chain_data paramter.
Return type:

(int, int, int)

Returns:

The atom indexes of the coupler atom, the new grower atom and the new grow marker.

alignToVector(struct, current_vector, vector)

Rotate the structure so that the current_vector is aligned to a new vector

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to rotate. The coordinates of this structure will be modified by this method
  • current_vector (list) – The current vector that will be aligned to the new vector
  • vector (list) – The new vector that current_vector should be aligned to
Returns:

There is no return value, the structure is modified directly

bond_length_cache = {}
checkRequiredProperties(struct, propexps)

Check to see if the structure has the desired properties set on it

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to check
  • propexps (list of tuple) – (property string, explanation of what the property is) for each structure property to check
determineCouplerLocation(xyz, vector, bond_length)

Figure out the XYZ coordinates where the coupler atom should go

Parameters:
  • xyz (list) – The XYZ coordinates of the grower atom
  • vector (list) – The desired bond vector for coupling (goes from grower->coupler)
  • bond_length (float) – the bond length between grower and coupler
Return type:

list

Returns:

The XYZ coordinates where the coupler atom should be placed

finalizeSideGroup()

Find atoms in backbone (marked as BACKBONE_ATOM_PROP) but not in the shortest path (backbone_path_indexes) and then treat these atoms along with their side groups as the side groups of certain atom in shortest path (backbone_path_indexes)

findAttachedAtomIndex(mark_index, prop=None, propval=True)

Find the index of the atom attached to the atom with the given index, optionally setting a property/value on that atom

Parameters:
  • mark_index (int) – The index of the atom that we want to find an atom attached to.
  • prop (str) – An atom property name
  • propval – The value to set prop to on the found attached atom. The type of this object depends on the type of property being set
Return type:

int

Returns:

The index of an atom attached to the mark_index atom. If more than one atom is attached to mark_index atom, the first one is returned.

findBackbone2BranchingPoint(exclude_markers)

Find the branching point and the shortest path to the nearest atom in backbone_path_indexes. The braching point may have multiple branches connected to, but only one single pair of [backbone atom][branching atom] = [path with ends] is recorded.

Parameters:exclude_markers (list of int) – the atom ids of markers to be excluded
findRotatableBonds()

Find rotatable bond along the backbone path.

findSideGroup()

Find and mark the side group atoms. The side group is any heavy atom not part of the backbone and any hydrogen attached to one of those heavy atoms. Note that IUPAC specifically states that a “sidechain” is an oligomer or polymer, while a “side group” is a non-oligomer/polymer. So monomers have side groups, not sidechains.

getBondLength(atom1, atom2, cg_bond_factor=0.8)

Get the desired bond length between the grower atom of the existing unit and the coupling atom of this moiety

Parameters:
  • atom1 (_StructureAtom) – One of the atoms to form a bond in between.
  • atom2 (_StructureAtom) – The other atoms to form a bond in between.
  • cg_bond_factor (float) – The pre-factor to calcuate the bond length based on the particle radius.
Return type:

float

Returns:

The desired bond distance

getCouplerAndGrower(*args)

Get the coupler and grower atoms and markers. The latter is None because Terminators have no grow points

Return type:AttachmentAtoms
Returns:The atoms indexes of the coupler, grower and marker atoms
getCouplerAtom(*args)

Get the coupler (head) atom

getNextStructure(*args)

Get a copy of this structure to add to a chain

getStructureForCoupling(orientation, location=None, vector=None, remove_marker=True, residue_number=None)

Get the appropriate structure to couple to the existing unit

Parameters:
  • orientation (str) – Should be the HEADFIRST or TAILFIRST constant, indicates which end of the moiety will bind
  • location (list) – XYZ coordinates that the coupling atom (head or tail depending on orientation) should be moved to (moving the rest of this moiety with it)
  • vector (list) – The vector that the coupler-coupling marker vector should be aligned to
  • remove_marker (bool) – Whether the marker atom should be removed.
  • residue_number (int or None) – If not None, the resnum property of every atom in the returned structure will be set to this value and the residue name will be assigned.
Return type:

(schrodinger.structure.Structure, AttachementAtoms)

Returns:

A copy of the structure of this moiety rotated and translated as requested so that it can bind in the specified orientation. An AttachedAtoms tuple that gives the coupler, grower and marker indexes for this structure.

markBackboneAtom(index)

Mark the atom as a backbone atom and make sure that if the atom is in a ring that all atoms in the ring are marked as backbone

Parameters:index (int) – The index of the atom to mark
moveHeadToOrigin()

Move the structure so that the head atom is at the origin

class schrodinger.application.matsci.amorphous.Initiator(*args, **kwargs)

Bases: schrodinger.application.matsci.amorphous.BaseMoiety

A group that starts the whole polymer off - can have multiple grow points, which means that multiple chains will radiate from this group (a dendrimer).

Note that the concept of an “Initiator” can be a bit fungible. It can either be the actual intiator moiety that starts the whole polymer, or it may be a partially built polymer that still needs additional chains added to it.

__init__(*args, **kwargs)

Overrides the parent init method to allow the parial_polymer keyword parameter.

Parameters:partial_polymer (bool) – If True, this Initiator is actually a partially built polymer that is going to just act like an initiator.
completePolymer(chain_terminator, chain_namer, clash_fixer)

Tack on an existing chain to each grow point

Parameters:
  • chain_terminator (Terminator) – A Terminator object that stores the existing chain to add
  • chain_namer (function) – A function that should be called on each chain that will be added to the existing polymer. The purpose of this function should be to add chain name data to the added structure.
  • clash_fixer (function) – A function to call on the polymer when any new chain is added in order to fix any clashes caused by the new chain
fillBranchPoints(chain_terminator, chain_branch_points, chain_namer, clash_fixer)

Tack on an existing chain to each of our branch points - each point has a percent chance of getting a chain added to it as long as its generation is less than the generation limit

Parameters:
  • chain_terminator (Terminator) – A Terminator object that stores the existing chain to add
  • chain_branch_points (list) – A list of atom indexes in the chain_terminator structure that are branch points
  • chain_namer (function) – A function that should be called on each chain that will be added to the existing polymer. The purpose of this function should be to add chain name data to the added structure.
  • clash_fixer (function) – A function to call on the polymer when any new chain is added in order to fix any clashes caused by the new chain
Return type:

(schrodinger.structure.Structure, int)

Returns:

The new polymer structure with additional branching, plus the number of new branches that were added

getPDBName()

Get a PDB residue-like Name for this moiety

addToChain(chain, grower, grow_marker, orientation, remove_marker=True, set_residue_data=False, propagate_chain_data=False, chain_namer=None)

Bind this moiety to an existing chain

The grower, grow_marker, coupler and coupler_marker are defined so that the binding occurs like this:

chain-grower coupler_marker
grow_marker coupler-this_moiety

goes to:

chain-grower
coupler-this_moiety
Parameters:
  • chain (schrodinger.structure.Structure) – The existing chain to add this moiety to
  • grower (int) – The index of the atom in the existing chain that this moiety should bond with
  • grow_marker (int) – The index of the Rx atom that marks the attachment point - the grower->grow_marker bond vector indicates the desired grower->coupler bond vector.
  • orientation (str) – Whether this moiety should add head first or tail first. Should be a module HEADFIRST or TAILFIRST constant.
  • remove_marker (bool) – Whether the chains grower_marker atom should be removed. Set to False if adding multiple moieties and you don’t want existing atom numbers to change during the process.
  • set_residue_data (bool) – Whether to set the residue number property for all atoms added by this method to 1 greater than the residue number of the grow atom on the passed in chain. If False, no residue numbers will be set. A residue name is also assigned if this value is True.
  • propagate_chain_data (bool) – Whether to set the chain data for all atoms added by this method to the same chain information as the grow atom on the passed in chain. If False or the grower atom contains no chain information, this will not be done. This parameter is used if the added moiety should have the same chain information as the existing moiety. See also the chain_namer parameter.
  • chain_namer (function) – A function that should be called with the structure that will be added to chain. The purpose of this function should be to add chain name data to the added structure. Supply this function if the moiety to be added is a full chain. If the moiety to be added is just another monomer, terminator, etc during the building of a single chain, do not supply this function. This parameter is used if the added moiety should have different chain information from the existing moiety, and it is up to the chain_namer function to set that data. See also the propagate_chain_data paramter.
Return type:

(int, int, int)

Returns:

The atom indexes of the coupler atom, the new grower atom and the new grow marker.

alignToVector(struct, current_vector, vector)

Rotate the structure so that the current_vector is aligned to a new vector

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to rotate. The coordinates of this structure will be modified by this method
  • current_vector (list) – The current vector that will be aligned to the new vector
  • vector (list) – The new vector that current_vector should be aligned to
Returns:

There is no return value, the structure is modified directly

bond_length_cache = {}
checkRequiredProperties(struct, propexps)

Check to see if the structure has the desired properties set on it

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to check
  • propexps (list of tuple) – (property string, explanation of what the property is) for each structure property to check
determineCouplerLocation(xyz, vector, bond_length)

Figure out the XYZ coordinates where the coupler atom should go

Parameters:
  • xyz (list) – The XYZ coordinates of the grower atom
  • vector (list) – The desired bond vector for coupling (goes from grower->coupler)
  • bond_length (float) – the bond length between grower and coupler
Return type:

list

Returns:

The XYZ coordinates where the coupler atom should be placed

finalizeSideGroup()

Find atoms in backbone (marked as BACKBONE_ATOM_PROP) but not in the shortest path (backbone_path_indexes) and then treat these atoms along with their side groups as the side groups of certain atom in shortest path (backbone_path_indexes)

findAttachedAtomIndex(mark_index, prop=None, propval=True)

Find the index of the atom attached to the atom with the given index, optionally setting a property/value on that atom

Parameters:
  • mark_index (int) – The index of the atom that we want to find an atom attached to.
  • prop (str) – An atom property name
  • propval – The value to set prop to on the found attached atom. The type of this object depends on the type of property being set
Return type:

int

Returns:

The index of an atom attached to the mark_index atom. If more than one atom is attached to mark_index atom, the first one is returned.

findBackbone2BranchingPoint(exclude_markers)

Find the branching point and the shortest path to the nearest atom in backbone_path_indexes. The braching point may have multiple branches connected to, but only one single pair of [backbone atom][branching atom] = [path with ends] is recorded.

Parameters:exclude_markers (list of int) – the atom ids of markers to be excluded
findRotatableBonds()

Find rotatable bond along the backbone path.

findSideGroup()

Find and mark the side group atoms. The side group is any heavy atom not part of the backbone and any hydrogen attached to one of those heavy atoms. Note that IUPAC specifically states that a “sidechain” is an oligomer or polymer, while a “side group” is a non-oligomer/polymer. So monomers have side groups, not sidechains.

getBondLength(atom1, atom2, cg_bond_factor=0.8)

Get the desired bond length between the grower atom of the existing unit and the coupling atom of this moiety

Parameters:
  • atom1 (_StructureAtom) – One of the atoms to form a bond in between.
  • atom2 (_StructureAtom) – The other atoms to form a bond in between.
  • cg_bond_factor (float) – The pre-factor to calcuate the bond length based on the particle radius.
Return type:

float

Returns:

The desired bond distance

getStructureForCoupling(orientation, location=None, vector=None, remove_marker=True, residue_number=None)

Get the appropriate structure to couple to the existing unit

Parameters:
  • orientation (str) – Should be the HEADFIRST or TAILFIRST constant, indicates which end of the moiety will bind
  • location (list) – XYZ coordinates that the coupling atom (head or tail depending on orientation) should be moved to (moving the rest of this moiety with it)
  • vector (list) – The vector that the coupler-coupling marker vector should be aligned to
  • remove_marker (bool) – Whether the marker atom should be removed.
  • residue_number (int or None) – If not None, the resnum property of every atom in the returned structure will be set to this value and the residue name will be assigned.
Return type:

(schrodinger.structure.Structure, AttachementAtoms)

Returns:

A copy of the structure of this moiety rotated and translated as requested so that it can bind in the specified orientation. An AttachedAtoms tuple that gives the coupler, grower and marker indexes for this structure.

markBackboneAtom(index)

Mark the atom as a backbone atom and make sure that if the atom is in a ring that all atoms in the ring are marked as backbone

Parameters:index (int) – The index of the atom to mark
moveHeadToOrigin()

Move the structure so that the head atom is at the origin

readFromStructure(struct, propexps=None)

Read the data for this moiety from the structure object and check to make sure all the required properties are set

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to check
  • propexps (list of tuple) – (property string, explanation of what the property is) for each structure property to check
setAsFragment()

Set backbone path and side atoms for Initiator and Terminator. Only the atom connected to R1 group is treated as backbone path; all the rest real atoms are treated as side groups.

classmethod write(filename, struct, markers, name, classname=None)

Write the structure out to a file, tagging it with properties in such a way that the driver will recognize when reading the structure in

Parameters:
  • filename (str) – The path to the file
  • struct (schrodinger.structure.Structure) – The structure to write
  • markers (list) – A list of the indexes of the Rx atoms.
  • name (str) – The name to use for the title of the structure
  • classname (str) – The chemical class of this moiety. If not supplied, the actual python class name will be used since those are typically the same as the chemical class.
class schrodinger.application.matsci.amorphous.Monomer(struct)

Bases: schrodinger.application.matsci.amorphous.BaseMoiety

The repeating unit that makes up the polymer chain

__init__(struct)

Create a Monomer object

Monomers drawn by the user as:
R1-stuff-R2
And stored as:
marker1-head-stuff-tail-marker2

where marker1 is the R1 atom, head is the atom it is bound to, marker2 is the R2 atom and tail is the atom it is bound to, and stuff is everything else.

setAllTransBackbone()

Set all the backbone dihedrals to 180

hasChirality()

Check if this monomer has a chiral backbone

Return type:bool
Returns:Whether the backbone has a chiral atom
findHeadTailBranch()

Find and mark the head, tail and any branching atoms

findBackbone()

Find the set of atoms that creates the shortest distance (number of bonds) between the head and tail atoms. This is the monomer backbone.

Backbone atoms are marked with a backbone atom property

findRingSideGroup(struct, terminator_indexes, root_index)

Return a list of atoms bound to root_index (and recursively all atoms bound to those atoms, ad infinitum). terminator_indexes is a set of atoms that terminate the group - when a terminator atom is encountered, the group stops growing in that direction. Unlike Structure.getMovingAtoms or buildcomplex.find_atoms_to_remove, this method gracefully handles cases where terminator atoms and group atoms share the same ring. Imagine naphthalene:

3 7

/ /

4 2 8 | | | 5 1 9

/ /
6 10

If root_index=6 and terminator_indexes={1}, all other atoms will become part of the same group as 6 - because there is a path all the way around the outer ring that bypasses 1 going clockwise from 6.

If root_index=6 and terminator_indexes={1,2}, then only atoms 6, 5, 4, 3 will be members of the group, because both atoms 1 and 2 terminate the group.

root_index is always part of the group

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to use
  • terminator_indexes (set of int) – The indexes of the atoms that terminate the group.
  • root_index (int) – The index of the first atom in the group. All neighbors of this atom that are not terminator atoms will be added to the list.
Return type:

list

Returns:

A list of all atoms recursively bound to the root atom, including root_index itself but not including any atom in terminator_indexes

alignOnXAxis()

Align the monomer so the head is at the origin and the backbone is aligned to the +X axis

flipTailFirst()

Flip the structure so the tail is on the origin and the backbone is aligned to the +X axis

setupTacticity()

Store both R and S structures for the monomer so we don’t have to keep inverting the chirality when needed. This takes a miniscule amount of effort, since it is only done once per monomer type

getNextStructure(orientation)

Get the next monomer structure with the given orientation. “Next” in this case takes into account the chirality of the previous structure - for syntactic polymers, the monomers alternate chirality.

Parameters:orientation (str) – HEADFIRST or TAILFIRST constants
Return type:schrodinger.structure.Structure
Returns:The next structure to use for this monomer
getCouplerAndGrower(orientation)

Get the coupler, coupler_marker, grower and grow_marker atoms for this monomer

Parameters:orientation (str) – HEADFIRST or TAILFIRST constants
Return type:AttachmentAtoms
Returns:The atoms indexes of the coupler, grower and marker atoms. Which one is the head and which is the tail depends on orientation.
getCouplerAtom(orientation)

Get the coupler atom.

Parameters:orientation (str) – HEADFIRST or TAILFIRST constants
Return type:_StructureAtom
Returns:The coupler atom Whether this is the head and or the tail depends on orientation.
isBrancher()

Is this monomer a braching monomer?

Return type:bool
Returns:Whether this monomer is a branching monomer
static addPropsToStructure(struct, letter, markers, name, tacticity, branching_percent, branching_max_gen, all_trans)

Add properties to the structure that the driver will need as input

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to add the properties to
  • letter (str) – The one-character code for this monomer
  • markers (list of int) – Atom indexes of the marker atoms
  • name (str) – The title to use
  • tacticity (str) – One of the TACTICITY module constants specifying the tacticity for this monomer
  • branching_percent (float) – The % chance to branch for this monomer
  • branching_max_gen (int) – The maximum branching generations for this monomer
  • all_trans (bool) – Whether the intra-monomer backbone dihedrals should be all set to 180.
classmethod write(filename, struct, *args)

Write out the structure

Parameters:

See the addPropsToStructure method for additional argument documentation

readFromStructure(struct)

Overrides the parent method to add and read Monomer-specific properties.

See the parent class method for documentation

getPDBName()

Get a PDB residue-like Name for this moiety

setAsFragment()

Prepare monomer information for in-cell grow.

breakTemplatePolymer()

Copy the original moieties to tmp_moieties and break the monomers into small new monomers according to rotatable bonds in side group.

Return type:list of {Monomer}
Returns:the small monomer moieties that replace the old large one
findBondsToBreak()

Search the side groups of all backbone atoms and find the ‘first neighbor’ rotatable bonds.

Return type:list of tuple
Returns:‘first neighbor’ rotable bonds in side groups for all backbone atoms
stripSideStructs(struct_copy, pdbres)

Strip the sub structures in side groups and form new monomers from these sub structures.

Parameters:
  • struct_copy (schrodinger.structure.Structure) – the structure copy with ‘first neighbor’ rotatable bonds deleted.
  • pdbres (str) – the name of the residue to strip side structs from
getNewResidueName(is_finished_moiety)

Generate the residue name for new sub structure.

Parameters:is_finished_moiety (bool) – whether the new sub structure contains the backbone of the parent monomer
Return type:str
Returns:residue name for new sub structure
getFirstTmpResname()

The resname of the first temporary moiety in self.tmp_moieties list.

Parameters:resname (str) – residue name of a moiety
updateTemplatePolymerResidue(struct, pdbres, resname)

Update the residue number and name for the atoms in template polymer for the newly added residue.

Parameters:
  • struct (schrodinger.structure.Structure) – the new sub struct to form new monomer
  • pdbres (str) – name of the parent residue
  • resname (str) – residue name of the new sub struct
addToChain(chain, grower, grow_marker, orientation, remove_marker=True, set_residue_data=False, propagate_chain_data=False, chain_namer=None)

Bind this moiety to an existing chain

The grower, grow_marker, coupler and coupler_marker are defined so that the binding occurs like this:

chain-grower coupler_marker
grow_marker coupler-this_moiety

goes to:

chain-grower
coupler-this_moiety
Parameters:
  • chain (schrodinger.structure.Structure) – The existing chain to add this moiety to
  • grower (int) – The index of the atom in the existing chain that this moiety should bond with
  • grow_marker (int) – The index of the Rx atom that marks the attachment point - the grower->grow_marker bond vector indicates the desired grower->coupler bond vector.
  • orientation (str) – Whether this moiety should add head first or tail first. Should be a module HEADFIRST or TAILFIRST constant.
  • remove_marker (bool) – Whether the chains grower_marker atom should be removed. Set to False if adding multiple moieties and you don’t want existing atom numbers to change during the process.
  • set_residue_data (bool) – Whether to set the residue number property for all atoms added by this method to 1 greater than the residue number of the grow atom on the passed in chain. If False, no residue numbers will be set. A residue name is also assigned if this value is True.
  • propagate_chain_data (bool) – Whether to set the chain data for all atoms added by this method to the same chain information as the grow atom on the passed in chain. If False or the grower atom contains no chain information, this will not be done. This parameter is used if the added moiety should have the same chain information as the existing moiety. See also the chain_namer parameter.
  • chain_namer (function) – A function that should be called with the structure that will be added to chain. The purpose of this function should be to add chain name data to the added structure. Supply this function if the moiety to be added is a full chain. If the moiety to be added is just another monomer, terminator, etc during the building of a single chain, do not supply this function. This parameter is used if the added moiety should have different chain information from the existing moiety, and it is up to the chain_namer function to set that data. See also the propagate_chain_data paramter.
Return type:

(int, int, int)

Returns:

The atom indexes of the coupler atom, the new grower atom and the new grow marker.

alignToVector(struct, current_vector, vector)

Rotate the structure so that the current_vector is aligned to a new vector

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to rotate. The coordinates of this structure will be modified by this method
  • current_vector (list) – The current vector that will be aligned to the new vector
  • vector (list) – The new vector that current_vector should be aligned to
Returns:

There is no return value, the structure is modified directly

bond_length_cache = {}
checkRequiredProperties(struct, propexps)

Check to see if the structure has the desired properties set on it

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to check
  • propexps (list of tuple) – (property string, explanation of what the property is) for each structure property to check
determineCouplerLocation(xyz, vector, bond_length)

Figure out the XYZ coordinates where the coupler atom should go

Parameters:
  • xyz (list) – The XYZ coordinates of the grower atom
  • vector (list) – The desired bond vector for coupling (goes from grower->coupler)
  • bond_length (float) – the bond length between grower and coupler
Return type:

list

Returns:

The XYZ coordinates where the coupler atom should be placed

finalizeSideGroup()

Find atoms in backbone (marked as BACKBONE_ATOM_PROP) but not in the shortest path (backbone_path_indexes) and then treat these atoms along with their side groups as the side groups of certain atom in shortest path (backbone_path_indexes)

findAttachedAtomIndex(mark_index, prop=None, propval=True)

Find the index of the atom attached to the atom with the given index, optionally setting a property/value on that atom

Parameters:
  • mark_index (int) – The index of the atom that we want to find an atom attached to.
  • prop (str) – An atom property name
  • propval – The value to set prop to on the found attached atom. The type of this object depends on the type of property being set
Return type:

int

Returns:

The index of an atom attached to the mark_index atom. If more than one atom is attached to mark_index atom, the first one is returned.

findBackbone2BranchingPoint(exclude_markers)

Find the branching point and the shortest path to the nearest atom in backbone_path_indexes. The braching point may have multiple branches connected to, but only one single pair of [backbone atom][branching atom] = [path with ends] is recorded.

Parameters:exclude_markers (list of int) – the atom ids of markers to be excluded
findRotatableBonds()

Find rotatable bond along the backbone path.

findSideGroup()

Find and mark the side group atoms. The side group is any heavy atom not part of the backbone and any hydrogen attached to one of those heavy atoms. Note that IUPAC specifically states that a “sidechain” is an oligomer or polymer, while a “side group” is a non-oligomer/polymer. So monomers have side groups, not sidechains.

getBondLength(atom1, atom2, cg_bond_factor=0.8)

Get the desired bond length between the grower atom of the existing unit and the coupling atom of this moiety

Parameters:
  • atom1 (_StructureAtom) – One of the atoms to form a bond in between.
  • atom2 (_StructureAtom) – The other atoms to form a bond in between.
  • cg_bond_factor (float) – The pre-factor to calcuate the bond length based on the particle radius.
Return type:

float

Returns:

The desired bond distance

getStructureForCoupling(orientation, location=None, vector=None, remove_marker=True, residue_number=None)

Get the appropriate structure to couple to the existing unit

Parameters:
  • orientation (str) – Should be the HEADFIRST or TAILFIRST constant, indicates which end of the moiety will bind
  • location (list) – XYZ coordinates that the coupling atom (head or tail depending on orientation) should be moved to (moving the rest of this moiety with it)
  • vector (list) – The vector that the coupler-coupling marker vector should be aligned to
  • remove_marker (bool) – Whether the marker atom should be removed.
  • residue_number (int or None) – If not None, the resnum property of every atom in the returned structure will be set to this value and the residue name will be assigned.
Return type:

(schrodinger.structure.Structure, AttachementAtoms)

Returns:

A copy of the structure of this moiety rotated and translated as requested so that it can bind in the specified orientation. An AttachedAtoms tuple that gives the coupler, grower and marker indexes for this structure.

markBackboneAtom(index)

Mark the atom as a backbone atom and make sure that if the atom is in a ring that all atoms in the ring are marked as backbone

Parameters:index (int) – The index of the atom to mark
moveHeadToOrigin()

Move the structure so that the head atom is at the origin

schrodinger.application.matsci.amorphous.remove_stale_props(st)

Remove stale properties from the given structure.

Parameters:st (schrodinger.structure.Structure) – the structure from which to remove the stale properties
class schrodinger.application.matsci.amorphous.Moieties(filename, logger, structs=None)

Bases: object

A holder and manager for the various moieties that make up the polymer

__init__(filename, logger, structs=None)

Create a Moieties object

Parameters:
  • filename (str) – The path to the file that holds the moiety structures
  • logger (logging.Logger) – The logger for this builder
  • structs (list) – List of structure moiety
hasCascader()

Has a cascader been defined?

Return type:bool
Returns:Whether a cascader was defined
hasBrancher()

Has a brancher been defined?

Return type:bool
Returns:Whether a brancher was defined
hasRings()

Do any moieties have rings?

Return type:bool
Returns:Whether any of the moieties have rings
getMonomer(letter)

Get the monomer with the given one-letter code

Parameters:letter (str) – The one-letter code for the desired monomer
Return type:Monomer
Returns:The monomer with the given one-letter code
getMoiety(letter)

Get the get one single moiety based on ‘INI’, ‘TRM’, ‘CAS’ or monomer one-letter code.

Parameters:letter (str) – The one-letter code for the desired monomer
Return type:Monomer, Initiator, Cascader, or Terminator
Returns:the initiator, cascader, terminat or one nonomer find by the one letter code
getOneLetterCodes()

Get all the allowed one-letter codes

Return type:list
Returns:All the defined one-letter codes
checkValidOneLetterCodes(codes)

Check that all the codes in the given string are valid

Parameters:codes (str) – A string with a series of one-letter codes
Return type:bool
Returns:Whether all the one-letter codes are associated with a Monomer
checkValidWeights(weights)

Validate the given weights

Parameters:weights (dict) – Keys are one-letter codes, values are integer weights for that monomer in a random copolymer
Return type:bool
Returns:Whether all the one-letter codes in weights are valid
getCascadeGenerations()

Get the number of cascade generations

Return type:int
Returns:The number of cascade generations (0 if none)
getAllMoietyNames()

Get the names of all Moieties - initiator, terminator, monomers, etc.

Return type:list
Returns:A list of all moiety names. Monomers first, then initiator, terminator and cascader (if defined)