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

Class AmorphousCellBuilder

               object --+    
                        |    
BuilderWithClashDetection --+
                            |
                           AmorphousCellBuilder

Builder for an amorphous cell

Instance Methods [hide private]
 
__init__(self, scaffold=None, system=True, population=1, density=0.5, amorphous_vdw_scale=1.0, obey=OBEY_DENSITY, tries_per_dc=5, tries_per_placement=5, title="", allow_increased_density=True, forcefield=OPLS2005, **kwargs)
Create an AmorphousCellBuilder object
 
setDensityIncreaseAllowed(self, is_allowed)
Set whether increased cell densities can be attempted after a successful cell is built using OBEY_CLASH
schrodinger.structure.Structure or None
build(self, generate_only=False, center=True)
Build the cell and do all the post-processing
schrodinger.structure.Structure
postTreatBuiltCell(self, 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)
schrodinger.structure.Structure or None
buildCellDriver(self)
Driver function for cell building.
list
getBuildingBlocks(self, number)
Get the structures to place into the amorphous cell.
schrodinger.structure.Structure or None
buildCell(self, num_structs, density, avdw_scale)
Make a single attempt at building the cell.
bool
placeStructureInCell(self, cell, struct, avdw_scale)
Place a structure in the cell.
list
duplicateRings(self, 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.
schrodinger.structure.Structure
locateAndRotate(self, struct)
Randomly rotate a copy of struct and translate it to a position in the cell
float
adjustACellDensity(self, 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
float
adjustACellClashVDWScale(self, 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
dict
checkForClashes(self, 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.
dict
checkForInterStructureClashes(self, 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.
float
getPBCSide(self, cell)
Get the length of one side of the periodic boundary condition
schrodinger.structure.Structure
getNewCellStructure(self, volume)
Get a new, empty structure with the periodic boundary condition set
float
getDesiredVolume(self, structures, density)
Get the volume of a cube that will have the given density when the given structures are placed entirely inside it

Inherited from BuilderWithClashDetection: buildingBlocksHaveRings, checkForIntraStructureClashes, colorByMolecule, findRingSpears, findRings, getClashes, getInfraStructure, log, removeIgnoredClashes

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

Static Methods [hide private]

Inherited from BuilderWithClashDetection: countClashes

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, scaffold=None, system=True, population=1, density=0.5, amorphous_vdw_scale=1.0, obey=OBEY_DENSITY, tries_per_dc=5, tries_per_placement=5, title="", allow_increased_density=True, forcefield=OPLS2005, **kwargs)
(Constructor)

 

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_placement (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'.

    See the parent class for additional keyword documentation

Overrides: object.__init__

setDensityIncreaseAllowed(self, 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(self, 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 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
Returns: schrodinger.structure.Structure or None
The created structure or None if no structure was found

postTreatBuiltCell(self, 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:
Returns: schrodinger.structure.Structure
The modified cell

buildCellDriver(self)

 

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.

Returns: schrodinger.structure.Structure or None
The built cell, or None if an error occurred

getBuildingBlocks(self, 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
Returns: list
list of schrodinger.structure.Structure objects to place into the cell

buildCell(self, num_structs, density, avdw_scale)

 

Make a single attempt at building the cell. Create the structures and try to place them

Parameters:
  • num_structs (int) - The number of structures to put into the cell
  • density (float) - The density of the cell
  • avdw_scale (float) - The VDW scale factor for clash cutoffs
Returns: schrodinger.structure.Structure or None
The built cell, or None if an error occurred

placeStructureInCell(self, 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:
Returns: bool
Whether the structure was placed in the cell successfully

duplicateRings(self, 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_struct - schrodinger.structure.Structure
  • new_struct - The new structure the ring objects should reference
Returns: list
List of schrodinger.structure._Ring objects that reference atoms in new_structure

locateAndRotate(self, struct)

 

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

Parameters:
Returns: schrodinger.structure.Structure
A copy of struct that has been randomly rotated and translated

adjustACellDensity(self, 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)
Returns: float
The adjusted density

adjustACellClashVDWScale(self, 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)
Returns: float
The adjusted scale factor

checkForClashes(self, 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.
Returns: dict
Any clashes found. Keys are atom indexes values are all the atom indexes that clash with that atom

checkForInterStructureClashes(self, 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.
Returns: dict
Any clashes found. Keys are atom indexes values are all the atom indexes that clash with that atom

getPBCSide(self, cell)

 

Get the length of one side of the periodic boundary condition

Parameters:
Returns: float
The length of one side of the periodic boundary condition. 0 is returned if no PBC has been set on the cell

getNewCellStructure(self, volume)

 

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

Parameters:
  • volume (float) - The desired volume of the periodic boundary condition
Returns: schrodinger.structure.Structure
The structure to add the properties to

getDesiredVolume(self, structures, density)

 

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)
Returns: float
The desired box side