Package schrodinger :: Package application :: Package matsci :: Package nano :: Module xtal :: Class Crystal
[hide private]
[frames] | no frames]

Class Crystal

object --+
         |
        Crystal

Main class for generating crystals.

Instance Methods [hide private]
 
__init__(self, asymmetric_unit, space_group=None, a_param=None, b_param=None, c_param=None, alpha_param=None, beta_param=None, gamma_param=None, ncella=1, ncellb=1, ncellc=1, origin=[0.0, 0.0, 0.0], bonding='none', bond_orders='none', translate='none', keep_edge_atoms=False, cov_offset=0.45, intact_molecules=None, fract_offset=0.0001, no_pbc_bonding=False, logger=None)
Create an instance.
 
handleSettings(self)
Handle the settings of this crystal build.
bool
doBonding(self)
Determine if this script should handle the bonding both inside and between unit cells.
bool
doBondOrders(self)
Determine if this script should handle the assignment of bond orders both inside and between unit cells.
bool
doTranslation(self)
Determine if the atoms should be translated to the first unit cell.
 
getLatticeParameters(self)
Get lattice parameters.
 
checkInputParams(self)
Check input parameters.
 
updateLatticeProperties(self)
Update the lattice properties for the asymmetric unit structure.
 
setAsuColor(self)
Set the color scheme to use for the ASU structure.
mmcrystal handle
setCrystalSymmetry(self)
Set the crystal symmetry.
 
determineBasisVectors(self)
Determine the lattice vectors in the cartesian basis and the cartesian vectors in the lattice basis.
 
setUnitCellLowerBounds(self)
Set the lower bounds of the unit cell.
 
buildCrystalUnitCell(self, mmcrystal_handle)
Build a crystal unit cell.
 
labelSymEquivPos(self)
Label the symmetry equivalent positions.
 
labelAsuAtoms(self, astructure)
Label the atoms that make up an ASU, i.e.
 
completeUnitCellBoundary(self, astructure)
Complete the unit cell boundary so that atoms are defined on both edges.
 
doPropertyEvaluation(self)
Compute some properties of the unit cell.
 
setStructureProperties(self)
Set some structure properties.
 
printCrystalParams(self)
Print some crystal parameters.
 
updateFractionals(self, next_cell, indexa, indexb, indexc)
Update the fractional coordinates of the next unit cell.
 
setAsuAtomsFalse(self, astructure)
Set the ASU atom labels to false for this structure.
bool
cellFromOuterLayer(self, indexa, indexb, indexc, ncella, ncellb, ncellc)
Return True if the query cell is in the outer layer of cells of a super cell build with three or more cells along each lattice vector.
 
buildCrystalSuperCell(self, ncella, ncellb, ncellc)
Build a crystal super cell.
int, int, int
increaseExtentsBy(self, extra)
Increase the extents by some amount.
dict or None
getIntactMolecules(self, crystal_super_cell)
Get the original super cell including intact molecules at the boundary from the larger super cell.
 
translateSupercell(self, delta_a, delta_b, delta_c)
Translate the super cell by the given amount along each of the lattice vectors and update the fractional coordinates.
 
buildCrystalSuperCellWithIntactMolecules(self, ncella, ncellb, ncellc)
Build a crystal super cell while keeping intact molecules at the unit cell boundaries.
dict
getRealPBCBonds(self, ncella, ncellb, ncellc)
From all bonds made in building the crystal super cell (plus two extra unit cell along each lattice vector), obtain only those bonds that involve the outer layer of cells bonded to the inner cells.
tuple, int
getImageCellInfo(self, real_cell, ncella, ncellb, ncellc)
Given the real cell tuple return both the image cell tuple as well as the number of cells between the real and image according to a traversal path of c then b then a.
int
getImageAtomIndex(self, real_index, ncella, ncellb, ncellc, real_cell=None)
Return the image atom index from the real atom index.
list
getImageAtomsForRealPBCBonds(self, real_pbc_bonds, ncella, ncellb, ncellc)
For all real PBC bonds collect the image atom indices for the outside atoms and return a list of unique tuples containing information about both real and image bonds.
dict
getAromaticPBCRingBonds(self, bonding_triples, ncella, ncellb, ncellc)
For all aromatic rings that cross the PBC collect and return a dictionary containing bonding and bond order information for real and image rings.
 
makePBCBonds(self, bonding_triples)
Make the PBC bonds.
 
setAromaticPBCRingBonds(self, aromatic_pbc_ring_bonds)
Set the bond orders for aromatic PBC ring bonds.
 
trimOuterCells(self, ncella, ncellb, ncellc)
Remove the extra layer of outer cells from the crystal super cell.
 
handlePBCBonding(self, ncella, ncellb, ncellc)
Handle the PBC bonding.
 
orchestrate(self)
Orchestrate the construction of the crystal.

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

Class Variables [hide private]
  SPACE_GROUP_KEY = 's_pdb_PDB_CRYST1_Space_Group'
  A_KEY = 'r_pdb_PDB_CRYST1_a'
  B_KEY = 'r_pdb_PDB_CRYST1_b'
  C_KEY = 'r_pdb_PDB_CRYST1_c'
  ALPHA_KEY = 'r_pdb_PDB_CRYST1_alpha'
  BETA_KEY = 'r_pdb_PDB_CRYST1_beta'
  GAMMA_KEY = 'r_pdb_PDB_CRYST1_gamma'
  SPACE_GROUP_ID_KEY = 'i_matsci_Space_Group_ID'
  LATTICE_VECTOR_A_KEY = 's_matsci_Lattice_Vector_A/(3*Ang.)'
  LATTICE_VECTOR_B_KEY = 's_matsci_Lattice_Vector_B/(3*Ang.)'
  LATTICE_VECTOR_C_KEY = 's_matsci_Lattice_Vector_C/(3*Ang.)'
  LATTICE_VECTOR_COORDS = 6
  CHORUS_BOX_BASE_KEY = 'r_chorus_box_'
  CHORUS_BOX_AX_KEY = 'r_chorus_box_ax'
  CHORUS_BOX_AY_KEY = 'r_chorus_box_ay'
  CHORUS_BOX_AZ_KEY = 'r_chorus_box_az'
  CHORUS_BOX_BX_KEY = 'r_chorus_box_bx'
  CHORUS_BOX_BY_KEY = 'r_chorus_box_by'
  CHORUS_BOX_BZ_KEY = 'r_chorus_box_bz'
  CHORUS_BOX_CX_KEY = 'r_chorus_box_cx'
  CHORUS_BOX_CY_KEY = 'r_chorus_box_cy'
  CHORUS_BOX_CZ_KEY = 'r_chorus_box_cz'
  CHORUS_BOX_A_KEYS = ['r_chorus_box_ax', 'r_chorus_box_ay', 'r_...
  CHORUS_BOX_B_KEYS = ['r_chorus_box_bx', 'r_chorus_box_by', 'r_...
  CHORUS_BOX_C_KEYS = ['r_chorus_box_cx', 'r_chorus_box_cy', 'r_...
  NUM_DECIMAL_COORDS = 4
  MSGWIDTH = 80
  GENERAL_VEC_1 = matrix([[ 1...
  GENERAL_VEC_2 = matrix([[ 0...
  GENERAL_VEC_3 = matrix([[ 0...
  F1F2F3_FORMAT = '(%.4f, %.4f, %.4f)'
  F1F2F3_KEY = 's_matsci_f1f2f3'
  F1_KEY = 'r_matsci_f1'
  F2_KEY = 'r_matsci_f2'
  F3_KEY = 'r_matsci_f3'
  FRACT_KEYS = ['r_matsci_f1', 'r_matsci_f2', 'r_matsci_f3']
  SYMMETRY_LABEL_KEY = 'i_matsci_Symmetry_Label'
  ASU_LABEL_KEY = 'b_matsci_ASU_Atom'
  CM_TO_ANGSTROM = 100000000.0
  UNIT_CELL_FORMULA_KEY = 's_m_Unit_Cell_Formula'
  UNIT_CELL_VOLUME_KEY = 'r_m_Unit_Cell_Volume/Ang.^3'
  UNIT_CELL_DENSITY_KEY = 'r_m_Unit_Cell_Density/g/cm^3'
  FORMULA_ENTRY_PATTERN = re.compile(r'([A-Z][a-z]?)(\d*)')
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, asymmetric_unit, space_group=None, a_param=None, b_param=None, c_param=None, alpha_param=None, beta_param=None, gamma_param=None, ncella=1, ncellb=1, ncellc=1, origin=[0.0, 0.0, 0.0], bonding='none', bond_orders='none', translate='none', keep_edge_atoms=False, cov_offset=0.45, intact_molecules=None, fract_offset=0.0001, no_pbc_bonding=False, logger=None)
(Constructor)

 

Create an instance.

Parameters:
  • asymmetric_unit (schrodinger.Structure.structure) - the ASU
  • space_group (str) - the full or short Hermann-Mauguin symbol of the space group
  • a_param (float) - the lattice parameter a in Angstrom
  • b_param (float) - the lattice parameter b in Angstrom
  • c_param (float) - the lattice parameter c in Angstrom
  • alpha_param (float) - the lattice parameter alpha in degrees
  • beta_param (float) - the lattice parameter beta in degrees
  • gamma_param (float) - the lattice parameter gamma in degrees
  • ncella (int) - the number of unit cells to generate along lattice vector a
  • ncellb (int) - the number of unit cells to generate along lattice vector b
  • ncellc (int) - the number of unit cells to generate along lattice vector c
  • origin (list) - the origin of the unit cell, i.e. list of three floats
  • bonding (str) - specifies how the bonding should be handled, takes a string in BONDING_CHOICES
  • bond_orders (str) - specifies how the bond orders should be handled, takes a string in BOND_ORDERS_CHOICES
  • translate (str) - specifies how the translation to the first unit cell should be handled, takes a string in TRANSLATE_CHOICES
  • keep_edge_atoms (bool) - whether or not to keep redundant edge atoms
  • cov_offset (float) - the maximum distance for drawn bonds is the sum of the covalent radii of the two atoms plus this offset in angstrom
  • intact_molecules (str) - specify how molecules should be clipped at the unit or super cell boundaries
  • fract_offset (float) - the threshold used to compare floating point fractional coordinate values and in particular those that are on the cell boundary
  • no_pbc_bonding (bool) - disable the creation of PBC bonds
  • logger (logging.getLogger) - output logger
Overrides: object.__init__

doBonding(self)

 

Determine if this script should handle the bonding both inside and between unit cells.

Returns: bool
True if this script should handle the bonding, False otherwise.

doBondOrders(self)

 

Determine if this script should handle the assignment of bond orders both inside and between unit cells.

Returns: bool
True if this script should handle the assignment, False otherwise.

doTranslation(self)

 

Determine if the atoms should be translated to the first unit cell.

Returns: bool
True if this translation should be performed, False otherwise.

setCrystalSymmetry(self)

 

Set the crystal symmetry.

Returns: mmcrystal handle
mmcrystal_handle, mmcrystal handle with symmetry set

determineBasisVectors(self)

 

Determine the lattice vectors in the cartesian basis and the cartesian vectors in the lattice basis. Also determine the reciprocal lattice vectors.

buildCrystalUnitCell(self, mmcrystal_handle)

 

Build a crystal unit cell.

Parameters:
  • mmcrystal_handle - mmcrystal handle with symmetry set

labelAsuAtoms(self, astructure)

 

Label the atoms that make up an ASU, i.e. the symmetry unique atoms.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure whose atoms will be labeled

completeUnitCellBoundary(self, astructure)

 

Complete the unit cell boundary so that atoms are defined on both edges.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object for which the boundary will be completed

doPropertyEvaluation(self)

 

Compute some properties of the unit cell. In order for the properties to be consistent with their standard definitions the provided unit cell must be void of the redundant edge, meaning that the fractionals must be defined on n < f < n + 1 rather than n < f <= n + 1, as well as any other redundancies.

updateFractionals(self, next_cell, indexa, indexb, indexc)

 

Update the fractional coordinates of the next unit cell.

Parameters:
  • next_cell (schrodinger.Structure.structure) - the structure object to be updated
  • indexa (int) - the a-position of this cell
  • indexb (int) - the b-position of this cell
  • indexc (int) - the c-position of this cell

setAsuAtomsFalse(self, astructure)

 

Set the ASU atom labels to false for this structure.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object to be updated

cellFromOuterLayer(self, indexa, indexb, indexc, ncella, ncellb, ncellc)

 

Return True if the query cell is in the outer layer of cells of a super cell build with three or more cells along each lattice vector.

Parameters:
  • indexa (int) - query index along a
  • indexb (int) - query index along b
  • indexc (int) - query index along c
  • ncella (int) - the number of cells along a
  • ncellb (int) - the number of cells along b
  • ncellc (int) - the number of cells along c
Returns: bool
True if the query cell is in the outer layer of cells, False otherwise

buildCrystalSuperCell(self, ncella, ncellb, ncellc)

 

Build a crystal super cell.

Parameters:
  • ncella (int) - the number of unit cells to generate along lattice vector a
  • ncellb (int) - the number of unit cells to generate along lattice vector b
  • ncellc (int) - the number of unit cells to generate along lattice vector c

increaseExtentsBy(self, extra)

 

Increase the extents by some amount.

Parameters:
  • extra (int) - the amount by which to increase the extents
Returns: int, int, int
ncella, ncellb, ncellc, the numbers of unit cells to generate along lattice vector a, b, and c

getIntactMolecules(self, crystal_super_cell)

 

Get the original super cell including intact molecules at the boundary from the larger super cell.

Parameters:
  • crystal_super_cell (schrodinger.Structure.structure) - the structure object for the supercell
Returns: dict or None
renumber map for deleted atoms or None if no atoms were deleted

translateSupercell(self, delta_a, delta_b, delta_c)

 

Translate the super cell by the given amount along each of the lattice vectors and update the fractional coordinates.

Parameters:
  • delta_a (int) - amount to translate along a
  • delta_b (int) - amount to translate along b
  • delta_c (int) - amount to translate along c

buildCrystalSuperCellWithIntactMolecules(self, ncella, ncellb, ncellc)

 

Build a crystal super cell while keeping intact molecules at the unit cell boundaries.

Parameters:
  • ncella (int) - the number of unit cells to generate along lattice vector a
  • ncellb (int) - the number of unit cells to generate along lattice vector b
  • ncellc (int) - the number of unit cells to generate along lattice vector c

getRealPBCBonds(self, ncella, ncellb, ncellc)

 

From all bonds made in building the crystal super cell (plus two extra unit cell along each lattice vector), obtain only those bonds that involve the outer layer of cells bonded to the inner cells.

Parameters:
  • ncella (int) - the number of unit cells along lattice vector a
  • ncellb (int) - the number of unit cells along lattice vector b
  • ncellc (int) - the number of unit cells along lattice vector c
Returns: dict
real PBC bonds, keys are tuples of super cell pairs (where each of the two pairs is another tuple containing a triple of integer cell indices), values are lists of bonding atom index pairs that span the boundary of the cell pair, this boundary can be a face, edge, or corner, these results are ordered like (outer cell, inner cell): [ (outer index, inner index), ...]

getImageCellInfo(self, real_cell, ncella, ncellb, ncellc)

 

Given the real cell tuple return both the image cell tuple as well as the number of cells between the real and image according to a traversal path of c then b then a.

Parameters:
  • real_cell (tuple) - a triple of real cell indices
  • ncella (int) - the number of unit cells along lattice vector a
  • ncellb (int) - the number of unit cells along lattice vector b
  • ncellc (int) - the number of unit cells along lattice vector c
Returns: tuple, int
a triple of image cell indices and the number of cells between real and image

getImageAtomIndex(self, real_index, ncella, ncellb, ncellc, real_cell=None)

 

Return the image atom index from the real atom index.

Parameters:
  • real_index (int) - the super cell index of the query real atom
  • ncella (int) - the number of unit cells along lattice vector a
  • ncellb (int) - the number of unit cells along lattice vector b
  • ncellc (int) - the number of unit cells along lattice vector c
  • real_cell (tuple or None) - a triple of cell indicies for the query real atom, if None then will be determined using the fractional coordinates of the query atom
Returns: int
the super cell index of the image atom

getImageAtomsForRealPBCBonds(self, real_pbc_bonds, ncella, ncellb, ncellc)

 

For all real PBC bonds collect the image atom indices for the outside atoms and return a list of unique tuples containing information about both real and image bonds.

Parameters:
  • real_pbc_bonds (dict) - real PBC bonds, keys are tuples of super cell pairs ordered like (outer cell, inner cell), values are lists of (outer index, inner index) bonding atom index pairs that span the boundary of the cell pair
  • ncella (int) - the number of unit cells along lattice vector a
  • ncellb (int) - the number of unit cells along lattice vector b
  • ncellc (int) - the number of unit cells along lattice vector c
Returns: list
contains unique real and image bonding tuples, where each tuple is an atom index triple like (real outside, real inside, image inside)

getAromaticPBCRingBonds(self, bonding_triples, ncella, ncellb, ncellc)

 

For all aromatic rings that cross the PBC collect and return a dictionary containing bonding and bond order information for real and image rings.

Parameters:
  • bonding_triples (list) - contains PBC bonding information as unique tuples with (1) outside atom index for a PBC bond, (2) inside atom index for a PBC bond, and (3) the inside image of (1).
  • ncella (int) - the number of unit cells along lattice vector a
  • ncellb (int) - the number of unit cells along lattice vector b
  • ncellc (int) - the number of unit cells along lattice vector c
Returns: dict
keys tuples containing two two-index tuples for real and image bonding atom pairs that are for bonds in aromatic rings that cross the PBC, values are real bond orders for that bond

makePBCBonds(self, bonding_triples)

 

Make the PBC bonds.

Parameters:
  • bonding_triples (list) - contains PBC bonding information as unique tuples with (1) outside atom index for a PBC bond, (2) inside atom index for a PBC bond, and (3) the inside image of (1).

setAromaticPBCRingBonds(self, aromatic_pbc_ring_bonds)

 

Set the bond orders for aromatic PBC ring bonds.

Parameters:
  • aromatic_pbc_ring_bonds (dict) - keys tuples containing two two-index tuples for real and image bonding atom pairs that are for bonds in aromatic rings that cross the PBC, values are real bond orders for that bond

trimOuterCells(self, ncella, ncellb, ncellc)

 

Remove the extra layer of outer cells from the crystal super cell.

Parameters:
  • ncella (int) - the number of unit cells along lattice vector a
  • ncellb (int) - the number of unit cells along lattice vector b
  • ncellc (int) - the number of unit cells along lattice vector c

handlePBCBonding(self, ncella, ncellb, ncellc)

 

Handle the PBC bonding.

Parameters:
  • ncella (int) - the number of unit cells along lattice vector a
  • ncellb (int) - the number of unit cells along lattice vector b
  • ncellc (int) - the number of unit cells along lattice vector c

Class Variable Details [hide private]

CHORUS_BOX_A_KEYS

Value:
['r_chorus_box_ax', 'r_chorus_box_ay', 'r_chorus_box_az']

CHORUS_BOX_B_KEYS

Value:
['r_chorus_box_bx', 'r_chorus_box_by', 'r_chorus_box_bz']

CHORUS_BOX_C_KEYS

Value:
['r_chorus_box_cx', 'r_chorus_box_cy', 'r_chorus_box_cz']

GENERAL_VEC_1

Value:
matrix([[ 1.],
        [ 0.],
        [ 0.]])

GENERAL_VEC_2

Value:
matrix([[ 0.],
        [ 1.],
        [ 0.]])

GENERAL_VEC_3

Value:
matrix([[ 0.],
        [ 0.],
        [ 1.]])