Package schrodinger :: Package application :: Package matsci :: Module amorphous :: Class BuilderWithClashDetection
[hide private]
[frames] | no frames]

Class BuilderWithClashDetection

object --+
         |
        BuilderWithClashDetection
Known Subclasses:

The base class for the amorphous builder classes

Instance Methods [hide private]
 
__init__(self, basename='cell', backend=None, logger=None, color=None, vdw_scale=1.0)
Create a Builder object
 
log(self, msg, level=20)
Log a message
bool
buildingBlocksHaveRings(self)
Override in subclasses to check if any of the building blocks have rings.
list
findRings(self, struct)
Find all the rings in the provided structure.
dict
findRingSpears(self, ring_struct, spear_struct=None, rings=None, ring_based=True, pbc=None)
Find all cases where a bond spears a ring
dict
removeIgnoredClashes(self, all_clashes, ignored_clashes)
Get only those clashes that are not ignored.
tuple
getInfraStructure(self, struct)
Get an infrastructure Structure object and an associated bitset struct.atom_total long
dict
getClashes(self, struct1, cutoff, struct2=None, pbc=None)
Find clashes - either intrastructure if struct2 is None, or interstructure if struct2 is not None.
dict
checkForIntraStructureClashes(self, struct, scale=None, pbc=None, rings=None, ignore=None)
Check for any intrastructure clashes
 
colorByMolecule(self, struct)
Color each molecule in struct a different color

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
countClashes(clashes)
Count the total number of clashes
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

 

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
Overrides: object.__init__

log(self, 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(self)

 

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.

Returns: bool
If any of the building blocks have rings

findRings(self, 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:
Returns: list
List of schrodinger.structure._Ring objects in the given structure.

findRingSpears(self, 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
    
Returns: dict
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(self, 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
Returns: dict
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(self, struct)

 

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

Parameters:
Returns: tuple
First item of the tuple is a schrodinger.infra.structure.Structure object. Second item is a bitset that is struct.atom_total long

getClashes(self, struct1, cutoff, struct2=None, pbc=None)

 

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
    
Returns: dict
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(self, struct, scale=None, pbc=None, rings=None, ignore=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.
  • ignore (dict) - A dictionary of clashes - any clash in this dictionary will be ignored. These are typically existing clashes that we have already tried and failed to remove. keys are atom indexes, values are lists of atom indexes that clash with the key atom.
Returns: dict
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.

countClashes(clashes)
Static Method

 

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(self, struct)

 

Color each molecule in struct a different color

Parameters: