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.
Functions [hide private]
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
connect_atoms(astructure, atoms_to_connect=None, connect_with=None, min_distance=0.4, cov_offset=0.45, cov_factor=1.0, delete_existing=True, organic_structure=None, cov_radii_props=True)
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)
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 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
is_bonding_infinite(astructure, percent_metal_threshold=25.0)
Return True if the bonding is of infinite extent, i.e.
 
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 [1, n] 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.
Variables [hide private]
  __doc__ = ...
  _version = '$Revision 0.0 $'
  BC_BOX_SHAPE_KEY = 's_m_BC_Box_Shape'
  BC_BOX_A_KEY = 'r_m_BC_Box_A'
  BC_BOX_B_KEY = 'r_m_BC_Box_B'
  BC_BOX_C_KEY = 'r_m_BC_Box_C'
  BC_BOX_ALPHA_KEY = 'r_m_BC_Box_Alpha'
  BC_BOX_BETA_KEY = 'r_m_BC_Box_Beta'
  BC_BOX_GAMMA_KEY = 'r_m_BC_Box_Gamma'
  BC_BOX_SHAPE = 'Triclinic'
  PRESERVE_BONDING_KEY = 'b_matsci_Preserve_Bonding'
  P1_SPACE_GROUP_SYMBOL = 'P 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
  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]

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 deleteing 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) - indicies 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 indicies, values are new indicies 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, connect_with=None, min_distance=0.4, cov_offset=0.45, cov_factor=1.0, delete_existing=True, organic_structure=None, cov_radii_props=True)

 

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 indicies to consider connecting, if None then all atoms will be considered
  • connect_with (list) - if specified means that connections should not be sought within atoms_to_connect but rather between atoms_to_connect and this list of atom indicies
  • min_distance (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 or connect_with 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 and for non-organic structures bond orders will never be assigned
  • cov_radii_props (bool) - set the atomic covalent radii used in the connectivity protocol as atom properties
Returns: list, dict
maximally_bonded_atoms, contains the indicies 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 a dictionary where keys are tuples of bonding atom indices and values are bond orders

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)

 

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 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

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

is_bonding_infinite(astructure, percent_metal_threshold=25.0)

 

Return True if the bonding is of infinite extent, i.e. the real and image cells are covalently bound along at least a single lattice vector.

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 bonding is of infinite extent

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 [1, n] return a signal from a modified sawtooth function. This function is linear on (1, n) but is n-1 for x = 1 and is 2 for x = n.

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

Variables Details [hide private]

__doc__

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

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

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,
...