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

Module xtal

Classes and functions for creating crystals by unit cell.

Copyright Schrodinger, LLC. All rights reserved.

Classes [hide private]
  ParserWrapper
Manages the argparse module to parse user command line arguments.
  CheckInput
Check user input.
  CrystalSystems
Manage the properties of the seven crystal systems.
  SpaceGroup
Collect the properties of a space group.
  SpaceGroups
Manage space group objects.
  Crystal
Main class for generating crystals.
  PBCBond
Class to manage a PBC bond, i.e.
  PBCBonds
Class to manage a collection of PBC bonds.
Functions [hide private]
 
clear_asu_and_fractional_properties(struct)
Clear the atomic ASU and Fractional coordinate properties
dict
get_cov_radii()
Return a dictionary of atomic covalent radii.
list
get_params_from_vectors(a_vec, b_vec, c_vec)
Return the lattice parameters from the given lattice vectors.
numpy.array, numpy.array, numpy.array, numpy.array
get_lattice_vectors(a_param, b_param, c_param, alpha_param, beta_param, gamma_param)
Get the origin and lattice vectors of the specified parallelepiped.
dict
delete_duplicate_atoms(astructure, atoms_to_check=None, duplicate_thresh=0.25, transform=None, fract_offset=0.0001)
Delete duplicate atoms that are within the defined threshold.
float
max_connect_distance(cov_rad_a, cov_rad_b, cov_factor=1.0, cov_offset=0.45)
Return the maximum bonding distance for the given covalent radii and distance equation parameters.
list, dict, dict
connect_atoms(astructure, atoms_to_connect=None, cov_min=0.4, cov_offset=0.45, cov_factor=1.0, delete_existing=True, organic_structure=None, cov_radii_props=True, pbc_bonding=True, only_pbc_bonds=False, check_also_reg_bond=False)
Connect the atoms in a structure.
bool
before_lower_edge(coord, lower_bound)
Return True if this fractional coordinate value is before the lower edge of the cell.
bool
on_lower_edge(coord, lower_bound, fract_offset=0.0001)
Return True if this fractional coordinate value is on the lower edge of the cell.
bool
inside_cell(coord, lower_bound, upper_bound, fract_offset=0.0001)
Return True if this fractional coordinate value is inside the cell.
bool
on_upper_edge(coord, lower_bound, fract_offset=0.0001)
Return True if this fractional coordinate value is on the upper edge of the cell.
bool
after_upper_edge(coord, lower_bound, fract_offset=0.0001)
Return True if this fractional coordinate value is after the upper edge of the cell.
 
translate_to_cell(astructure, fract_offset=0.0001, origin=[0.0, 0.0, 0.0], transform=None, extents=None)
Translate the fractional coordinate definitions of the atoms of the given structure so that they are all in the cell defined with the given origin and given extents and optionally also actually transform the Cartesian coordinates of the atoms using the specified fractional-to-Cartesian transform.
 
translate_molecules_to_cell(astructure, fract_offset=0.0001, origin=[0.0, 0.0, 0.0], transform=None, extents=None)
Translate the fractional coordinate definitions of the atoms of the given structure so that the molecules to which they belong have at least a single atom in the cell defined with the given origin and given extents and optionally also actually transform the Cartesian coordinates of the atoms using the specified fractional-to-Cartesian transform.
 
trans_atoms_fract_to_cart(astructure, transform)
Transform the atoms in a structure from the fractional basis to the Cartesian basis.
 
trans_atoms_cart_to_fract(astructure, transform)
Transform the atoms in a structure from the Cartesian basis to the fractional basis.
int
get_gcd_list_ints(list_of_ints)
Return the greatest common divisor (GCD) of a list of integers.
bool
is_organic_structure(astructure, percent_metal_threshold=25.0)
Return True if the structure contains more than one type of element and no more than the given percentage of metal elements.
bool
is_closed_shell_organic_structure(astructure, percent_metal_threshold=25.0)
Return True if the structure is both organic and closed shell, i.e.
bool
has_organic_molecule(astructure, percent_metal_threshold=25.0)
Return True if the provided structure contains at least one organic molecule.
bool
has_closed_shell_organic_molecule(astructure, percent_metal_threshold=25.0)
Return True if the provided structure contains at least one closed-shell organic molecule.
bool
has_closed_shell_organic_molecules(astructure, percent_metal_threshold=25.0)
Return True if the provided structure contains only closed-shell organic molecules.
 
transfer_atom_bonds_and_props(index_a, index_b, astructure, props=None)
Transfer the bonds and specified properties of the atom indexed with index_b to the atom indexed with index_a.
three numpy.array
get_reciprocal_lattice_vectors(a_vec, b_vec, c_vec)
Return the reciprocal lattice vectors.
int
get_collapsed_index(abc, alimit, blimit, climit)
Given a three dimensional grid of integers defined on [1, limit] for the given a, b, and c limits and a traversal path of c then b then a return the number of integers traversed in order to reach the given abc integer index triple.
int
modified_sawtooth(n, x)
Given a positive integer variable x in [0, n+1] return a signal from a modified sawtooth function.
schrodinger.Structure.structure
assign_bond_orders(astructure)
Return a copy of the input structure that has bond orders assigned.
 
fix_metal_bonding(astructure)
Fix metal bonding in the given structure.
schrodinger.Structure.structure
assign_bond_orders_w_mmlewis(astructure, fix_metals=True, logger=None)
Return a copy of the input structure that has bond orders assigned.
tuple
get_chorus_properties(astructure)
Return a tuple containing the nine chorus properties of the given structure.
list
get_params_from_chorus(chorus_properties)
Return the a, b, c, alpha, beta, and gamma lattice properties from the nine chorus properties.
list
get_chorus_from_params(params)
Return the nine chorus properties, i.e.
float
get_volume_from_params(params)
Return cell volume (in Angstrom^3) from cell parameters.
set
get_cell_pairs(astructure, cell_distance, pbc_bonding=True, atom_indices=None, chorus_properties=None)
Using a distance cell that optionally honors a PBC return a list of tuples of atom index pairs that are within the specified distance.
 
add_labeled_pbc_bond(astructure, atom1, atom2, order, is_pbc_bond=False, also_reg_bond=False, color=4)
Add the specified bond to the provided structure and label it depending on if it is a PBC bond.
int
get_natom_btw_two_cells(cell1, cell2, extents, size)
Using a traversal path of c then b then a, return the number of atoms between two cells, of the given size, in a super cell with the given extents.
 
delete_pbc_bonds(astructure)
Delete any PBC bonds from the given structure.
tuple
is_pbc_bond(astructure, atom1, atom2, check_also_reg_bond=False, unit_lattice_vectors=None)
Return a (is_pbc_bond, also_reg_bond, bond_distance) tuple that indicates (1) whether the specified bond is a PBC bond, (2) if checked whether that PBC bond is also a regular bond, and (3) the bond length.
tuple
get_lattice_param_properties(astructure)
Return a tuple containing the six lattice parameter properties of the given structure.
dict
get_normalized_spanning_vectors(lattice_vectors)
Return the thirteen unique normalized spanning vectors for the cell.
str
get_unit_cell_formula(unit_cell)
Return the formatted unit cell formula of the given unit cell.
numpy.array
trans_cart_to_fract(cart_vec, a_param, b_param, c_param, alpha_param, beta_param, gamma_param)
Transform the given vector in the Cartesian basis to the fractional basis.
numpy.array
trans_fract_to_cart(fract_vec, a_param, b_param, c_param, alpha_param, beta_param, gamma_param)
Transform the given vector in the fractional basis to the Cartesian basis.
numpy array
trans_cart_to_frac_from_vecs(coords, a_vec, b_vec, c_vec, rec=False)
Transform coordinates from (reciprocal) Cartesian to (reciprocal) fractional using lattice vectors.
numpy array
trans_frac_to_cart_from_vecs(coords, a_vec, b_vec, c_vec, rec=False)
Transform coordinates from (reciprocal) fractional to (reciprocal) Cartesian using lattice vectors.
schrodinger.structure.Structure
get_cell(asu, space_group=None, lattice_params=None, extents=None, xtal_kwargs=None)
Build and return a crystalline cell using the given asymmetric unit, space group, lattice parameters, and extents.
list
get_vectors_from_chorus(astructure)
Return the three lattice vectors from the nine lattice chorus properties.
tuple of matrices
get_conv_from_vecs(a_vec, b_vec, c_vec)
Generate matrices to convert from fractional to Cartesian and back.
 
create_new_box(struct)
Create a new box that is large enough to encompass the X, Y and Z lengths of the system
 
set_lattice_properties(astructure, lattice_properties)
Set the given lattice properties on the structure.
schrodinger.structure.Structure or cms.Cms
make_p1(astructure, force_field='OPLS_2005', prep_desmond=False, logger=None)
Make a P1 cell and prepare for Desmond.
structure.Structure or bool
sync_pbc(st, create_pbc=False)
Return the given structure with a synchronized PBC, if create_pbc is True and the structure lacks a PBC then one will be created, otherwise this function will return False if there is no PBC.
dict
get_pbc_bonds_dict(astructure)
Return a PBC bonds dict for the given structure.
 
set_representation_bond(abond)
Set the representation of the given bond.
 
set_pbc_properties(astructure, chorus_properties)
Set the chorus and PDB properties on the given structure using the given chorus properties.
list of tuples
get_unit_lattice_vector_info(astructure)
Return a list of tuples containing unit lattice vector information, i.e.
 
label_pbc_bonds(astructure)
Label PBC bonds.
 
label_pbc_bond(abond, also_reg_bond=False, color=4)
Label this PBC bond.
Variables [hide private]
  __doc__ = ...
  _version = '$Revision 0.0 $'
  PRESERVE_BONDING_KEY = 'b_matsci_Preserve_Bonding'
  P1_SPACE_GROUP_SYMBOL = 'P 1'
  P1_SPACE_GROUP_ID = 1
  COV_RADIUS_KEY = 'r_matsci_COV_radius/Ang.'
  FRACT_OFFSET = 0.0001
  PERCENT_METAL_THRESHOLD = 25.0
  METAL_ASL = 'metals'
  PROTEIN_ASL = 'protein'
  MMPDB_MAX_ELEMENTS = 103
  AHEAD_BASE_TRIPLES = [(1, 0, 0), (0, 1, 0), (0, 0, 1)]
  AHEAD_TRIPLES = [(1, 0, 0), (0, 1, 0), (0, 0, 1), (0, 1, 1), (...
  LATTICE_PARAMS_KEYS = ['a_param', 'b_param', 'c_param', 'alpha...
  EXTENTS_KEYS = ['ncella', 'ncellb', 'ncellc']
  ATOM_TO_BOND_REPR_DICT = {0: 1, 1: 1, 2: 2, 3: 3}
  PBC_POSITION_KEY = 's_mae_pbc_position'
  CENTER_PBC_POSITION = 'center_structure'
  MMPDB_COV_RADII = {1: 0.32, 2: 0.93, 3: 1.23, 4: 0.9, 5: 0.82,...
  MAX_MMPDB_COV_RADIUS = 2.6
  __package__ = 'schrodinger.application.matsci.nano'
Function Details [hide private]

clear_asu_and_fractional_properties(struct)

 

Clear the atomic ASU and Fractional coordinate properties

Parameters:

get_cov_radii()

 

Return a dictionary of atomic covalent radii.

Returns: dict
dictionary where keys are atomic numbers and values are atomic covalent radii in Angstrom

get_params_from_vectors(a_vec, b_vec, c_vec)

 

Return the lattice parameters from the given lattice vectors.

Parameters:
  • a_vec (numpy.array) - the a lattice vector
  • b_vec (numpy.array) - the b lattice vector
  • c_vec (numpy.array) - the c lattice vector
Returns: list
contains the a, b, c, alpha, beta, and gamma parameters

get_lattice_vectors(a_param, b_param, c_param, alpha_param, beta_param, gamma_param)

 

Get the origin and lattice vectors of the specified parallelepiped.

Parameters:
  • a_param (float) - the length of the parallelepiped along edge a
  • b_param (float) - the length of the parallelepiped along edge b
  • c_param (float) - the length of the parallelepiped along edge c
  • alpha_param (float) - the angle between edges b and c
  • beta_param (float) - the angle between edges a and c
  • gamma_param (float) - the angle between edges a and b
Returns: numpy.array, numpy.array, numpy.array, numpy.array
the origin and lattice vectors of the parallelepiped

delete_duplicate_atoms(astructure, atoms_to_check=None, duplicate_thresh=0.25, transform=None, fract_offset=0.0001)

 

Delete duplicate atoms that are within the defined threshold. Of the redundant atoms that with the lowest index is kept. Prior to deleting the duplicates transfer the bonds and some atom properties of at least one of the duplicate atoms to the single atom that is kept. If transform is not None then this function will use the periodic boundary conditions defined in transform when determining redundant atoms.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object from which the duplicate atoms will be deleted
  • atoms_to_check (set) - indices of atoms that are to be checked for duplicate copies, for a given redundant set of atoms any index can be passed in
  • duplicate_thresh (float) - distance used to define duplicate atoms, conservatively chosen based on considering the resolutions of some crystal structures and the wavelengths of light used to obtain the diffraction patterns
  • transform (numpy.array or None) - if not None then specifies that the Cartesians also be transformed using this fractional-to-Cartesian transformation matrix
  • fract_offset (float) - the threshold used to compare floating point fractional coordinate values and in particular those that are on the cell boundary
Returns: dict
renumber_map, keys are original indices, values are new indices or None if the atom was deleted

max_connect_distance(cov_rad_a, cov_rad_b, cov_factor=1.0, cov_offset=0.45)

 

Return the maximum bonding distance for the given covalent radii and distance equation parameters.

Parameters:
  • cov_rad_a (float) - covalent radii for atom a
  • cov_rad_b (float) - covalent radii for atom b
  • cov_factor (float) - the maximum distance for a connection is the sum of the covalent radii of the two atoms weighted by this factor plus the cov_offset in angstrom, increasing this value will increase the number of connections, this value is unit-less
  • cov_offset (float) - the maximum distance for a connection is the sum of the covalent radii of the two atoms weighted by cov_factor plus this offset in angstrom, increasing this value will increase the number of connections
Returns: float
the maximum bonding distance

connect_atoms(astructure, atoms_to_connect=None, cov_min=0.4, cov_offset=0.45, cov_factor=1.0, delete_existing=True, organic_structure=None, cov_radii_props=True, pbc_bonding=True, only_pbc_bonds=False, check_also_reg_bond=False)

 

Connect the atoms in a structure.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object for which the connections are wanted
  • atoms_to_connect (list) - atom indices to consider connecting, if None then all atoms will be considered
  • cov_min (float) - the minimum distance for a connection in angstrom
  • cov_offset (float) - the maximum distance for a connection is the sum of the covalent radii of the two atoms weighted by cov_factor plus this offset in angstrom, increasing this value will increase the number of connections
  • cov_factor (float) - the maximum distance for a connection is the sum of the covalent radii of the two atoms weighted by this factor plus the cov_offset in angstrom, increasing this value will increase the number of connections, this value is unit-less
  • delete_existing (bool) - indicates whether existing connections should first be deleted, i.e. any bonds to atoms in atoms_to_connect will be deleted
  • organic_structure (bool or None) - True if this structure is known to be organic, False if this structure is known to not be organic, and None if it is unknown in which case it will be determined, this information is used to assign single, rather than zero-order, bonds for metal atoms in non-organic structures
  • cov_radii_props (bool) - set the atomic covalent radii used in the connectivity protocol as atom properties
  • pbc_bonding (bool) - if True and if the input structure has the chorus properties defined, then PBC bonds will be created
  • only_pbc_bonds (bool) - if True then only PBC bonds will be created, i.e. regular bonds will not be created
  • check_also_reg_bond (bool) - if True then PBC bonds will be checked to see if they are also regular bonds, meaning that one of the atoms of the PBC bond is covalently bound to two copies of the other atom, one inside the cell and one outside the cell
Returns: list, dict, dict
maximally_bonded_atoms, contains the indices of any maximally bonded atoms, there is currently a hard coded limit on the number of bonds an atom can have according to mm.MMCT_MAXBOND which has a value of 16, and two dictionaries (one for regular bonds and one for PBC bonds) where keys are tuples of bonding atom indices and values are bond orders (for regular bonds) or tuples of bond orders and booleans indicating whether the PBC bond is also a regular bond (for PBC bonds)

before_lower_edge(coord, lower_bound)

 

Return True if this fractional coordinate value is before the lower edge of the cell.

Parameters:
  • coord (float) - the fractional coordinate being tested
  • lower_bound (float) - the lower bound for this fractional coordinate
Returns: bool
True if the coordinate is before the lower edge, False otherwise

on_lower_edge(coord, lower_bound, fract_offset=0.0001)

 

Return True if this fractional coordinate value is on the lower edge of the cell.

Parameters:
  • coord (float) - the fractional coordinate being tested
  • lower_bound (float) - the lower bound for this fractional coordinate
  • fract_offset (float) - used to make floating point comparisons
Returns: bool
True if the coordinate is on the lower edge, False otherwise

inside_cell(coord, lower_bound, upper_bound, fract_offset=0.0001)

 

Return True if this fractional coordinate value is inside the cell.

Parameters:
  • coord (float) - the fractional coordinate being tested
  • lower_bound (float) - the lower bound for this fractional coordinate
  • upper_bound (float) - the upper bound for this fractional coordinate
  • fract_offset (float) - used to make floating point comparisons
Returns: bool
True if the coordinate is inside the cell, False otherwise

on_upper_edge(coord, lower_bound, fract_offset=0.0001)

 

Return True if this fractional coordinate value is on the upper edge of the cell.

Parameters:
  • coord (float) - the fractional coordinate being tested
  • lower_bound (float) - the lower bound for this fractional coordinate
  • fract_offset (float) - used to make floating point comparisons
Returns: bool
True if the coordinate is on the upper edge, False otherwise

after_upper_edge(coord, lower_bound, fract_offset=0.0001)

 

Return True if this fractional coordinate value is after the upper edge of the cell.

Parameters:
  • coord (float) - the fractional coordinate being tested
  • lower_bound (float) - the lower bound for this fractional coordinate
  • fract_offset (float) - used to make floating point comparisons
Returns: bool
True if the coordinate is after the upper edge, False otherwise

translate_to_cell(astructure, fract_offset=0.0001, origin=[0.0, 0.0, 0.0], transform=None, extents=None)

 

Translate the fractional coordinate definitions of the atoms of the given structure so that they are all in the cell defined with the given origin and given extents and optionally also actually transform the Cartesian coordinates of the atoms using the specified fractional-to-Cartesian transform.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object whose atoms will be translated
  • fract_offset (float) - the threshold used to compare floating point fractional coordinate values and in particular those that are on the cell boundary
  • origin (list) - the origin of the cell to which to translate
  • transform (numpy.array or None) - if not None then specifies that the Cartesians also be transformed using this fractional-to-Cartesian transformation matrix
  • extents (list) - the number of cells along each lattice vector

translate_molecules_to_cell(astructure, fract_offset=0.0001, origin=[0.0, 0.0, 0.0], transform=None, extents=None)

 

Translate the fractional coordinate definitions of the atoms of the given structure so that the molecules to which they belong have at least a single atom in the cell defined with the given origin and given extents and optionally also actually transform the Cartesian coordinates of the atoms using the specified fractional-to-Cartesian transform.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object whose molecules will be translated
  • fract_offset (float) - the threshold used to compare floating point fractional coordinate values and in particular those that are on the cell boundary
  • origin (list) - the origin of the cell to which to translate
  • transform (numpy.array or None) - if not None then specifies that the Cartesians also be transformed using this fractional-to-Cartesian transformation matrix
  • extents (list) - the number of cells along each lattice vector

trans_atoms_fract_to_cart(astructure, transform)

 

Transform the atoms in a structure from the fractional basis to the Cartesian basis.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object to be transformed
  • transform (numpy.array) - the fractional-to-Cartesian transformation matrix

trans_atoms_cart_to_fract(astructure, transform)

 

Transform the atoms in a structure from the Cartesian basis to the fractional basis.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object to be transformed
  • transform (numpy.array) - the Cartesian-to-fractional transformation

get_gcd_list_ints(list_of_ints)

 

Return the greatest common divisor (GCD) of a list of integers.

Parameters:
  • list_of_ints (list) - the list of ints for which the GCD is desired
Returns: int
gcd, the GCD

is_organic_structure(astructure, percent_metal_threshold=25.0)

 

Return True if the structure contains more than one type of element and no more than the given percentage of metal elements.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object to be tested
  • percent_metal_threshold (float) - a structure can contain up to this percentage of metal elements and still be considered organic
Returns: bool
True if organic, False otherwise

is_closed_shell_organic_structure(astructure, percent_metal_threshold=25.0)

 

Return True if the structure is both organic and closed shell, i.e. all non-metal atoms have complete valencies. Note that proteins are automatically considered closed-shell to safeguard against the possible lack of hydrogens.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object to be tested
  • percent_metal_threshold (float) - a structure can contain up to this percentage of metal elements and still be considered organic
Returns: bool
True if closed shell organic, False otherwise

has_organic_molecule(astructure, percent_metal_threshold=25.0)

 

Return True if the provided structure contains at least one organic molecule.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object to be tested
  • percent_metal_threshold (float) - a structure can contain up to this percentage of metal elements and still be considered organic
Returns: bool
True if the structure has an organic molecule

has_closed_shell_organic_molecule(astructure, percent_metal_threshold=25.0)

 

Return True if the provided structure contains at least one closed-shell organic molecule.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object to be tested
  • percent_metal_threshold (float) - a structure can contain up to this percentage of metal elements and still be considered organic
Returns: bool
True if the structure has a closed-shell organic molecule

has_closed_shell_organic_molecules(astructure, percent_metal_threshold=25.0)

 

Return True if the provided structure contains only closed-shell organic molecules.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object to be tested
  • percent_metal_threshold (float) - a structure can contain up to this percentage of metal elements and still be considered organic
Returns: bool
True if the structure contains only closed-shell organic molecules

transfer_atom_bonds_and_props(index_a, index_b, astructure, props=None)

 

Transfer the bonds and specified properties of the atom indexed with index_b to the atom indexed with index_a.

Parameters:
  • index_a (int) - the index of the atom to be updated
  • index_b (int) - the index of the atom with the data that is to be transfered
  • astructure (schrodinger.Structure.structure) - the structure containing these two atoms
  • props (list or None) - a list of keys of atom properties to be transferred, if None then some default keys are set

get_reciprocal_lattice_vectors(a_vec, b_vec, c_vec)

 

Return the reciprocal lattice vectors.

Parameters:
  • a_vec (numpy.array) - the a lattice vector
  • b_vec (numpy.array) - the b lattice vector
  • c_vec (numpy.array) - the c lattice vector
Returns: three numpy.array
the three reciprocal lattice vectors

get_collapsed_index(abc, alimit, blimit, climit)

 

Given a three dimensional grid of integers defined on [1, limit] for the given a, b, and c limits and a traversal path of c then b then a return the number of integers traversed in order to reach the given abc integer index triple.

Parameters:
  • abc (tuple) - the integer indices
  • alimit (int) - the upper bound on a (unused)
  • blimit (int) - the upper bound on b
  • climit (int) - the upper bound on c
Returns: int
the number of integers traversed

modified_sawtooth(n, x)

 

Given a positive integer variable x in [0, n+1] return a signal from a modified sawtooth function. This function is linear on [1, n] but is n for x = 0 and is 1 for x = n+1.

Parameters:
  • n (int) - the period
  • x (int) - the variable
Returns: int
the signal

assign_bond_orders(astructure)

 

Return a copy of the input structure that has bond orders assigned.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object for which bond orders will be assigned
Returns: schrodinger.Structure.structure
a copy of the input structure with the bond orders assigned

fix_metal_bonding(astructure)

 

Fix metal bonding in the given structure.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object for which metal bonding will be fixed

assign_bond_orders_w_mmlewis(astructure, fix_metals=True, logger=None)

 

Return a copy of the input structure that has bond orders assigned.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure object for which bond orders will be assigned
  • fix_metals (bool) - fix metals coming from mmlewis
  • logger (logging.getLogger or None) - output logger or None if there isn't one
Returns: schrodinger.Structure.structure
a copy of the input structure with the bond orders assigned

get_chorus_properties(astructure)

 

Return a tuple containing the nine chorus properties of the given structure.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure that has the chorus properties defined
Returns: tuple
contains the nine chorus properties

get_params_from_chorus(chorus_properties)

 

Return the a, b, c, alpha, beta, and gamma lattice properties from the nine chorus properties.

Parameters:
  • chorus_properties (list) - contains the nine chorus properties, i.e. ax, ay, az, bx, ..., cz
Returns: list
a, b, c, alpha, beta, and gamma lattice properties

get_chorus_from_params(params)

 

Return the nine chorus properties, i.e. [ax, ay, az, bx, ..., cz], from the six lattice parameters a, b, c, alpha, beta, and gamma.

Parameters:
  • params (list) - contains the a, b, c, alpha, beta, and gamma lattice parameters
Returns: list
contains the nine chorus properties

get_volume_from_params(params)

 

Return cell volume (in Angstrom^3) from cell parameters.

Parameters:
  • params (list) - contains the a, b, c, alpha, beta, and gamma lattice parameters
Returns: float
Cell volume in Angstrom^3

get_cell_pairs(astructure, cell_distance, pbc_bonding=True, atom_indices=None, chorus_properties=None)

 

Using a distance cell that optionally honors a PBC return a list of tuples of atom index pairs that are within the specified distance.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure containing the pairs
  • cell_distance (float) - the distance used in the distance cell, if using a PBC then min([cell_distance, a, b, c]) is actually what is used
  • pbc_bonding (bool) - if True and the chorus box properties exist on the incoming structure then the distance cell will honor the PBC, otherwise any PBC is not considered
  • atom_indices (list or None) - a list of atom indices to search for pairs, each atom is searched for pairs that may or may not already be in this list, if None then all atoms are searched
  • chorus_properties (list or None) - contains the nine chorus box properties that define a PBC, i.e. [ax, ay, az, bx, ..., cz], if None then the chorus structure properties will be used if available and if not available then no PBC will be used in the DistanceCell
Returns: set
contains tuples of unique atom index pairs within the specified distance

add_labeled_pbc_bond(astructure, atom1, atom2, order, is_pbc_bond=False, also_reg_bond=False, color=4)

 

Add the specified bond to the provided structure and label it depending on if it is a PBC bond.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure to which the bond will be added
  • atom1 (int) - the first atom index of the bond
  • atom2 (int) - the second atom index of the bond
  • order (int) - the bond order
  • is_pbc_bond (bool) - if True then the specified bond is a PBC bond so we will label it as so
  • also_reg_bond (bool) - if True indicates that the given PBC bond is also a regular bond, meaning that one of the atoms of the PBC bond is covalently bound to two copies of the other atom, one inside the cell and one outside the cell
  • color (int or None) - if integer specifies that PBC bonds, that are not also regular bonds, should be colored with this color

get_natom_btw_two_cells(cell1, cell2, extents, size)

 

Using a traversal path of c then b then a, return the number of atoms between two cells, of the given size, in a super cell with the given extents.

Parameters:
  • cell1 (tuple) - a triple of cell indices for the first cell
  • cell2 (tuple) - a triple of cell indices for the second cell
  • extents (list) - contains the number of cells along a, b, and c lattice vectors in the super cell
  • size (int) - the number of atoms in a cell
Returns: int
the number of atoms between the two cells

delete_pbc_bonds(astructure)

 

Delete any PBC bonds from the given structure.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure from which the bonds will be deleted

is_pbc_bond(astructure, atom1, atom2, check_also_reg_bond=False, unit_lattice_vectors=None)

 

Return a (is_pbc_bond, also_reg_bond, bond_distance) tuple that indicates (1) whether the specified bond is a PBC bond, (2) if checked whether that PBC bond is also a regular bond, and (3) the bond length.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure that has the bond
  • atom1 (schrodinger.structure._StructureAtom) - the first atom of the bond
  • atom2 (schrodinger.structure._StructureAtom) - the second atom of the bond
  • check_also_reg_bond (bool) - check if the PBC bond is also a regular bond, meaning that one of the atoms of the PBC bond is covalently bound to two copies of the other atom, one inside the cell and one outside the cell
  • unit_lattice_vectors (list of (numpy.array, float) tuples or None) - contains normalized a, b, and c lattice vectors and their original lengths, is None if no check for PBC bonds that are also regular bonds is being performed
Returns: tuple
a (is_pbc_bond, also_reg_bond, bond_distance) tuple

get_lattice_param_properties(astructure)

 

Return a tuple containing the six lattice parameter properties of the given structure.

Parameters:
  • astructure (schrodinger.Structure.structure) - the structure that has the lattice parameter properties defined
Returns: tuple
contains the six lattice parameter properties

get_normalized_spanning_vectors(lattice_vectors)

 

Return the thirteen unique normalized spanning vectors for the cell.

Parameters:
  • lattice_vectors (list of numpy.array) - the lattice a, b, and c vectors
Returns: dict
keys are tuples of cell index triples, values are tuples of normalized spanning vectors and their original lengths

get_unit_cell_formula(unit_cell)

 

Return the formatted unit cell formula of the given unit cell.

Parameters:
  • unit_cell (schrodinger.Structure.structure) - the structure object for the unit cell
Returns: str
the formatted unit cell formula

trans_cart_to_fract(cart_vec, a_param, b_param, c_param, alpha_param, beta_param, gamma_param)

 

Transform the given vector in the Cartesian basis to the fractional basis.

Parameters:
  • cart_vec (numpy.array) - the vector to be transformed from the Cartesian basis to the fractional basis
  • a_param (float) - the lattice a parameter
  • b_param (float) - the lattice b parameter
  • c_param (float) - the lattice c parameter
  • alpha_param (float) - the lattice alpha parameter
  • beta_param (float) - the lattice beta parameter
  • gamma_param (float) - the lattice gamma parameter
Returns: numpy.array
the given vector in the fractional basis

trans_fract_to_cart(fract_vec, a_param, b_param, c_param, alpha_param, beta_param, gamma_param)

 

Transform the given vector in the fractional basis to the Cartesian basis.

Parameters:
  • fract_vec (numpy.array) - the vector to be transformed from the fractional basis to the Cartesian basis
  • a_param (float) - the lattice a parameter
  • b_param (float) - the lattice b parameter
  • c_param (float) - the lattice c parameter
  • alpha_param (float) - the lattice alpha parameter
  • beta_param (float) - the lattice beta parameter
  • gamma_param (float) - the lattice gamma parameter
Returns: numpy.array
the given vector in the Cartesian basis

trans_cart_to_frac_from_vecs(coords, a_vec, b_vec, c_vec, rec=False)

 

Transform coordinates from (reciprocal) Cartesian to (reciprocal) fractional using lattice vectors.

Parameters:
  • coords (numpy.array) - a list of Cartesian coordinates
  • a_vec (list of 3 floats) - 'a' lattice vector
  • b_vec (list of 3 floats) - 'b' lattice vector
  • c_vec (list of 3 floats) - 'c' lattice vector
  • rec (bool) - If True, work in reciprocal space
Returns: numpy array

trans_frac_to_cart_from_vecs(coords, a_vec, b_vec, c_vec, rec=False)

 

Transform coordinates from (reciprocal) fractional to (reciprocal) Cartesian using lattice vectors.

Parameters:
  • coords (numpy.array) - a list of fractional coordinates
  • a_vec (list of 3 floats) - 'a' lattice vector
  • b_vec (list of 3 floats) - 'b' lattice vector
  • c_vec (list of 3 floats) - 'c' lattice vector
  • rec (bool) - If True, work in reciprocal space
Returns: numpy array

get_cell(asu, space_group=None, lattice_params=None, extents=None, xtal_kwargs=None)

 

Build and return a crystalline cell using the given asymmetric unit, space group, lattice parameters, and extents.

Parameters:
  • asu (schrodinger.structure.Structure) - the asymmetric unit
  • space_group (str or None) - the full or short Hermann-Mauguin symbol of the space group or None in which case the asu structure property Crystal.SPACE_GROUP_KEY will be used
  • lattice_params (list or None) - the six lattice parameters or None in which case the asu structure properties Crystal.A_KEY, Crystal.B_KEY, Crystal.C_KEY, Crystal.ALPHA_KEY, Crystal.BETA_KEY, and Crystal.GAMMA_KEY will be used
  • extents (list or None) - the integer extents along the a, b, and c lattice vectors or None if there are none
  • xtal_kwargs (dict or None) - extra xtal.Crystal kwargs or None if there are none
Returns: schrodinger.structure.Structure
the built cell

get_vectors_from_chorus(astructure)

 

Return the three lattice vectors from the nine lattice chorus properties.

Parameters:
Returns: list
the three lattice vectors
Raises:
  • ValueError - if any chorus property is missing

get_conv_from_vecs(a_vec, b_vec, c_vec)

 

Generate matrices to convert from fractional to Cartesian and back.

Parameters:
  • a_vec (list of 3 floats) - 'a' lattice vector
  • b_vec (list of 3 floats) - 'b' lattice vector
  • c_vec (list of 3 floats) - 'c' lattice vector
Returns: tuple of matrices

create_new_box(struct)

 

Create a new box that is large enough to encompass the X, Y and Z lengths of the system

Parameters:

set_lattice_properties(astructure, lattice_properties)

 

Set the given lattice properties on the structure.

Parameters:
  • astructure (schrodinger.structure.Structure) - the structure on which to set the lattice properties
  • lattice_properties (list) - a, b, c, alpha, beta, and gamma lattice properties

make_p1(astructure, force_field='OPLS_2005', prep_desmond=False, logger=None)

 

Make a P1 cell and prepare for Desmond.

Parameters:
  • astructure (schrodinger.structure.Structure) - the structure to make P1
  • force_field (str) - the name of the force field to use. The default is 'OPLS_2005'. Note that any custom directory needed for OPLS3 is taken care of via the runtime environment as long as the script was launched via launcher with the oplsdir argument.
  • prep_desmond (bool) - run the Desmond system build
  • logger (logging.Logger or None) - if not None then the logger for printing
Returns: schrodinger.structure.Structure or cms.Cms
the prepared structure depending on whether prep_desmond was used

sync_pbc(st, create_pbc=False)

 

Return the given structure with a synchronized PBC, if create_pbc is True and the structure lacks a PBC then one will be created, otherwise this function will return False if there is no PBC.

Parameters:
  • st (structure.Structure) - the structure with the PBC to be synchronized
  • create_pbc (bool) - if True and the given structure lacks a PBC then a minimal PBC will be created, if False and if the given structure lacks a PBC then this function will return False
Returns: structure.Structure or bool
the structure with a synchronized PBC or False if there was no PBC and one wasn't created

get_pbc_bonds_dict(astructure)

 

Return a PBC bonds dict for the given structure.

Parameters:
Returns: dict
keys are tuples of PBC bond atom index pairs, values are tuples of bond orders and booleans indicating whether the PBC bond is also a regular bond

set_representation_bond(abond)

 

Set the representation of the given bond.

Parameters:
  • abond (schrodinger.structure._StructureBond) - the bond to set the representation for

set_pbc_properties(astructure, chorus_properties)

 

Set the chorus and PDB properties on the given structure using the given chorus properties.

Parameters:
  • astructure (schrodinger.structure.Structure) - the structure on which the properties are set
  • chorus_properties (list) - contains the nine chorus properties, i.e. ax, ay, az, bx, ..., cz

get_unit_lattice_vector_info(astructure)

 

Return a list of tuples containing unit lattice vector information, i.e. the unit lattice vectors and their original lengths.

Parameters:
Returns: list of tuples
each (numpy.array, float) tuple contains (1) the unit lattice vector and (2) the length of the original vector

label_pbc_bonds(astructure)

 

Label PBC bonds.

Parameters:

label_pbc_bond(abond, also_reg_bond=False, color=4)

 

Label this PBC bond.

Parameters:
  • abond (schrodinger.structure._StructureBond) - the PBC bond to label
  • also_reg_bond (bool) - if True indicates that the given PBC bond is also a regular bond, meaning that one of the atoms of the PBC bond is covalently bound to two copies of the other atom, one inside the cell and one outside the cell
  • color (int or None) - if integer specifies that a PBC bond, that is not also a regular bond, should be colored with this color, if None then no coloring is performed

Variables Details [hide private]

__doc__

Value:
"""
Classes and functions for creating crystals by unit cell.

Copyright Schrodinger, LLC.  All rights reserved."""

AHEAD_TRIPLES

Value:
[(1, 0, 0),
 (0, 1, 0),
 (0, 0, 1),
 (0, 1, 1),
 (0, 1, -1),
 (1, 0, 1),
 (1, 1, 0),
 (1, 1, 1),
...

LATTICE_PARAMS_KEYS

Value:
['a_param',
 'b_param',
 'c_param',
 'alpha_param',
 'beta_param',
 'gamma_param']

MMPDB_COV_RADII

Value:
{1: 0.32,
 2: 0.93,
 3: 1.23,
 4: 0.9,
 5: 0.82,
 6: 0.77,
 7: 0.75,
 8: 0.73,
...