schrodinger.application.matsci.nano.xtal module¶
Classes and functions for creating crystals by unit cell.
Copyright Schrodinger, LLC. All rights reserved.
-
schrodinger.application.matsci.nano.xtal.
is_infinite
(astructure)¶ Return a boolean indicating whether the given structure is infinitely bonded, meaning that it has bonds that cross the periodic boundary which can not be eliminated by means of molecule contraction. If any molecule in the given structure is infinitely bonded then the structure itself is considered infinite. As examples of infinite systems consider graphene, gold, infinite polymer, etc.
Parameters: astructure ( schrodinger.structure.Structure
) – the structure whose infiniteness is in question, can be a unit cell or an ASURaises: ValueError – if there is an issue with the input Return type: bool Returns: True if infinite, False otherwise
-
schrodinger.application.matsci.nano.xtal.
store_chorus_box_props
(struct, ax, ay=0.0, az=0.0, bx=0.0, by=None, bz=0.0, cx=0.0, cy=0.0, cz=None)¶ Add properties to the structure that define the periodic boundary condition in the way Desmond wants it defined.
Parameters: struct ( schrodinger.structure.Structure
) – The structure to add the properties to@ax: float :param ax: The value of the ax box property
@ay: float :param ay: The value of the ay box property. Defaults to 0.
@az: float :param az: The value of the az box property. Defaults to 0.
@bx: float :param bx: The value of the bx box property. Defaults to 0.
@by: float :param by: The value of the by box property. If not given, this value is set
the same as ax.@bz: float :param bz: The value of the bz box property. Defaults to 0.
@cx: float :param cx: The value of the cx box property. Defaults to 0.
@cy: float :param cy: The value of the cy box property. Defaults to 0.
@cz: float :param cz: The value of the cz box property. If not given, this value is set
the same as ax.
-
schrodinger.application.matsci.nano.xtal.
clear_asu_and_fractional_properties
(struct)¶ Clear the atomic ASU and Fractional coordinate properties
Parameters: struct ( schrodinger.structure.Structure
) – The structure to clear the ASU and fractional properties from
-
schrodinger.application.matsci.nano.xtal.
get_cov_radii
()¶ Return a dictionary of atomic covalent radii.
Return type: dict Returns: dictionary where keys are atomic numbers and values are atomic covalent radii in Angstrom
-
schrodinger.application.matsci.nano.xtal.
get_cov_radius
(st, idx)¶ Return the covalent radius in Angstrom of the given atom or coarse grain particle index.
Parameters: - st (schrodinger.structure.Structure) – the structure
- idx (int) – the atom or coarse grain particle index
Return type: float
Returns: the covalent radius in Angstrom
-
schrodinger.application.matsci.nano.xtal.
get_max_cov_radius
(st)¶ For atomic input return the maximum covalent radius in Angstrom over all atoms in the periodic table, for CG input return the same but over all particles in the given structure.
Parameters: st (schrodinger.structure.Structure) – the structure Return type: float Returns: the maximum covalent radius in Angstrom
-
schrodinger.application.matsci.nano.xtal.
get_cov_parameter
(st, atomistic_cov_param)¶ Return the covalent parameter in Angstrom for the given structure.
Parameters: - st (schrodinger.structure.Structure) – the structure
- atomistic_cov_param (float) – the atomistic covalent parameter in Angstrom
Return type: float
Returns: the covalent parameter in Angstrom
-
schrodinger.application.matsci.nano.xtal.
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
Return type: list
Returns: contains the a, b, c, alpha, beta, and gamma parameters
-
schrodinger.application.matsci.nano.xtal.
get_lattice_vectors
(a_param, b_param, c_param, alpha_param, beta_param, gamma_param)¶ Get the 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
Return type: numpy.array, numpy.array, numpy.array
Returns: the lattice vectors of the parallelepiped
-
class
schrodinger.application.matsci.nano.xtal.
ParserWrapper
(args, scriptname, description)¶ Bases:
object
Manages the argparse module to parse user command line arguments.
-
SPACE_GROUP
= None¶
-
A_PARAM
= None¶
-
B_PARAM
= None¶
-
C_PARAM
= None¶
-
ALPHA_PARAM
= None¶
-
BETA_PARAM
= None¶
-
GAMMA_PARAM
= None¶
-
MIN_ANGLE
= 0.0¶
-
MAX_ANGLE
= 180.0¶
-
NCELLA
= 1¶
-
NCELLB
= 1¶
-
NCELLC
= 1¶
-
ORIGIN
= [0.0, 0.0, 0.0]¶
-
CHOICE_ON
= 'on'¶
-
CHOICE_OFF
= 'off'¶
-
BONDING_CHOICES
= ['on', 'off']¶
-
BONDING_DEFAULT
= 'off'¶
-
BOND_ORDERS_CHOICES
= ['on', 'off']¶
-
BOND_ORDERS_DEFAULT
= 'off'¶
-
TRANSLATE_CHOICES
= ['on', 'off']¶
-
TRANSLATE_DEFAULT
= 'off'¶
-
COV_MIN
= 0.4¶
-
COV_OFFSET
= 0.45¶
-
COV_FACTOR
= 1.0¶
-
PRINT_INFO
= False¶
-
PBC_BONDING
= True¶
-
loadIt
()¶ Load ParserWrapper with options.
-
parseArgs
(args)¶ Parse the command line arguments.
Parameters: args (tuple) – command line arguments
-
-
class
schrodinger.application.matsci.nano.xtal.
CheckInput
¶ Bases:
object
Check user input.
-
TITLE_KEY
= 's_m_title'¶
-
ENTRY_NAME_KEY
= 's_m_entry_name'¶
-
SAME_LENGTH_THRESH
= 0.001¶
-
checkInputFile
(input_file)¶ Check input file.
Parameters: input_file (str) – the name of the input file
-
checkASU
(asu, logger=None)¶ Check the asymmetric unit structure object.
Parameters: - asu (schrodinger.Structure.structure) – the structure object of the asymmetric unit
- logger (logging.getLogger) – output logger
-
checkFractionalDefs
(asu, logger=None)¶ Check the fractional coordinate definitions.
Parameters: - asu (schrodinger.Structure.structure) – the structure object of the asymmetric unit
- logger (logging.getLogger) – output logger
Return type: bool
Returns: fractional_coords, flag to indicate if the set of fractional coordinate properties exist
-
checkFractionalRedundancies
(asu, fract_offset, logger=None)¶ Check the redundancy of fractional coordinate definitions.
Parameters: - asu (schrodinger.Structure.structure) – the structure object of the asymmetric unit
- fract_offset (float) – the threshold used to compare floating point fractional coordinate values and in particular those that are on the cell boundary
- logger (logging.getLogger) – output logger
-
checkSpaceGroup
(space_group, space_group_short_names, space_group_full_names, logger=None)¶ Check the specified space group.
Parameters: - space_group (str) – the specified space group
- space_group_short_names (list of strs) – the short names of the space groups supported by this script
- space_group_full_names (list of strs) – the full names of the space groups supported by this script
- logger (logging.getLogger) – output logger
-
checkLatticeAngleValues
(alpha, beta, gamma, logger=None)¶ Check the values of the specified lattice angles.
Parameters: - alpha (float) – lattice angle alpha in degrees
- beta (float) – lattice angle beta in degrees
- gamma (float) – lattice angle gamma in degrees
- logger (logging.getLogger) – output logger
Return type: float, float, float
Returns: alpha_new, beta_new, gamma_new, updated lattice angles
-
checkLatticeParameters
(a_param, b_param, c_param, alpha_param, beta_param, gamma_param, logger=None)¶ Check the specified lattice parameters.
Parameters: - a_param (float) – lattice vector a in Angstrom
- b_param (float) – lattice vector b in Angstrom
- c_param (float) – lattice vector c in Angstrom
- alpha_param (float) – lattice angle alpha in degrees
- beta_param (float) – lattice angle beta in degrees
- gamma_param (float) – lattice angle gamma in degrees
- logger (logging.getLogger) – output logger
Return type: six floats
Returns: a_param, b_param, c_param, alpha_param, beta_param, gamma_param
-
checkLatticeMaxVolume
(a_param, b_param, c_param, logger=None)¶ Using the lattice lengths check the maximum volume.
Parameters: - a_param (float) – lattice vector a in Angstrom
- b_param (float) – lattice vector b in Angstrom
- c_param (float) – lattice vector c in Angstrom
- logger (logging.getLogger) – output logger
-
checkNumUnitCellParams
(ncella, ncellb, ncellc, logger=None)¶ Check the number of unit cells requested by the user.
Parameters: - ncella (int) – number of unit cells along lattice vector a
- ncellb (int) – number of unit cells along lattice vector b
- ncellc (int) – number of unit cells along lattice vector c
- logger (logging.getLogger) – output logger
-
checkOrigin
(origin)¶ Check the origin.
Parameters: origin (list or None) – the unit cell origin, list of three floats, in fractional coordinates or None if not provided Return type: list Returns: the unit cell origin, list of three floats, in fractional coordintes
-
checkBondingAndTranslate
(bonding, bond_orders, translate, logger=None)¶ Check the bonding and translate options.
Parameters: - bonding (str) – specify how the bonding should be handled
- bond_orders (str) – specify how the bond orders should be handled
- translate (str) – specify how the translation to the first unit cell should be handled
- logger (logging.getLogger) – output logger
-
-
class
schrodinger.application.matsci.nano.xtal.
CrystalSystems
¶ Bases:
object
Manage the properties of the seven crystal systems.
-
TRICLINIC_NAME
= 'triclinic'¶
-
MONOCLINIC_NAME
= 'monoclinic'¶
-
ORTHORHOMBIC_NAME
= 'orthorhombic'¶
-
TETRAGONAL_NAME
= 'Tetragonal'¶
-
TRIGONAL_NAME
= 'trigonal'¶
-
HEXAGONAL_NAME
= 'hexagonal'¶
-
CUBIC_NAME
= 'cubic'¶
-
class
Triclinic
(name)¶ Bases:
object
Manage the triclinic system.
-
class
Monoclinic
(name)¶ Bases:
object
Manage the monoclinic system.
-
class
Orthorhombic
(name)¶ Bases:
object
Manage the orthorhombic system.
-
class
Tetragonal
(name)¶ Bases:
object
Manage the tetragonal system.
-
class
Trigonal
(name)¶ Bases:
object
Manage the trigonal system.
-
class
Hexagonal
(name)¶ Bases:
object
Manage the hexagonal system.
-
class
Cubic
(name)¶ Bases:
object
Manage the cubic system.
-
getCrystalSystem
(name)¶ Return the crystal system object for the crystem system of the provided name.
Parameters: name (str) – crystal system name Return type: one of the seven crystal system objects Returns: crystal_system_obj
-
-
class
schrodinger.application.matsci.nano.xtal.
SpaceGroup
(definition_id, space_group_id, ichoice, num_choices, space_group_short_name, space_group_full_name, point_group_name, centering_opers, primary_opers, symmetry_opers, centering_opers_strs, primary_opers_strs, symmetry_opers_strs, crystal_system, xyzasu, spgsetting)¶ Bases:
object
Collect the properties of a space group.
-
DEFINITION_ID
= 'Def. ID'¶
-
SPACE_GROUP_ID
= 'Space Group ID'¶
-
CRYSTAL_SYSTEM
= 'Crystal System'¶
-
SHORT_HERMANN_MAUGUIN_SYMBOL
= 'Short H.-M. Symbol'¶
-
FULL_HERMANN_MAUGUIN_SYMBOL
= 'Full H.-M. Symbol'¶
-
POINT_GROUP_NAME
= 'Point Group'¶
-
NUM_CENTERING_OPERS
= 'N Centering Ops.'¶
-
NUM_PRIMARY_OPERS
= 'N Primary Ops.'¶
-
NUM_SYMMETRY_OPERS
= 'N Symmetry Ops.'¶
-
CENTERING_OPERS
= 'Centering Operators'¶
-
PRIMARY_OPERS
= 'Primary Operators'¶
-
SYMMETRY_OPERS
= 'Symmetry Operators'¶
-
SPACE_GROUP_SETTING
= 'Space Group Setting'¶
-
ID_TAG
= 'spgid '¶
-
SHORT_NAME_TAG
= 'sspgname '¶
-
FULL_NAME_TAG
= 'fspgname '¶
-
POINT_GROUP_TAG
= 'pgname '¶
-
CRYSTAL_SYSTEM_TAG
= 'crysym '¶
-
SETTING_TAG
= 'setting '¶
-
ASU_TAG
= 'xyzasu '¶
-
PRIMARY_OPERATIONS_TAG
= 'primoper '¶
-
CENTERING_OPERATIONS_TAG
= 'centoper '¶
-
END_OF_DEF_TAG
= 'endofdef'¶
-
printSymmetryOpers
(logger=None)¶ Log a formatted print of all of the symmetry operators for this space group.
Parameters: logger (logging.getLogger) – output logger
-
printDatabaseEntry
(logger=None)¶ Print a space group object in mmspg/spgbase.dat format.
Parameters: logger (logging.getLogger) – output logger
-
-
class
schrodinger.application.matsci.nano.xtal.
SpaceGroups
¶ Bases:
object
Manage space group objects.
-
NUM_SPACE_GROUPS
= 230¶
-
CRYSTAL_SYSTEMS
= <schrodinger.application.matsci.nano.xtal.CrystalSystems object>¶
-
CENTERING
= 'centering'¶
-
PRIMARY
= 'primary'¶
-
SYMMETRY
= 'symmetry'¶
-
getAllSpaceGroups
()¶ Make a list of all SpaceGroup objects each of which contains some space group parameters from mmspg/spgbase.dat.
-
getSpgObjByName
(name)¶ Get a space group object by name.
Parameters: name (str) – name can be a full Hermann-Mauguin symbol, checked first, or a short symbol, checked second. The first space group encountered with such a name is returned. Return type: SpaceGroup Returns: spgobj, the desired spgobj with name
-
printAllSpgInfo
(verbose, logger)¶ Print all space group information.
Parameters: - verbose (bool) – verbose log
- logger (logging.getLogger) – output logger
-
-
schrodinger.application.matsci.nano.xtal.
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. 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
Return type: dict
Returns: renumber_map, keys are original indices, values are new indices or None if the atom was deleted
-
schrodinger.application.matsci.nano.xtal.
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
Return type: float
Returns: the maximum bonding distance
-
schrodinger.application.matsci.nano.xtal.
connect_atoms
(astructure, atoms_to_connect=None, cov_min=0.4, cov_offset=0.45, cov_factor=1.0, delete_existing=True, 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
- 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
Return type: list, dict, dict
Returns: 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)
-
schrodinger.application.matsci.nano.xtal.
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
Return type: bool
Returns: True if the coordinate is before the lower edge, False otherwise
-
schrodinger.application.matsci.nano.xtal.
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
Return type: bool
Returns: True if the coordinate is on the lower edge, False otherwise
-
schrodinger.application.matsci.nano.xtal.
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
Return type: bool
Returns: True if the coordinate is inside the cell, False otherwise
-
schrodinger.application.matsci.nano.xtal.
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
Return type: bool
Returns: True if the coordinate is on the upper edge, False otherwise
-
schrodinger.application.matsci.nano.xtal.
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
Return type: bool
Returns: True if the coordinate is after the upper edge, False otherwise
-
schrodinger.application.matsci.nano.xtal.
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 in fractional coordinates
- 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
-
schrodinger.application.matsci.nano.xtal.
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
-
schrodinger.application.matsci.nano.xtal.
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
-
schrodinger.application.matsci.nano.xtal.
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 Return type: int Returns: gcd, the GCD
-
schrodinger.application.matsci.nano.xtal.
get_carts_from_anchor_string
(anchor)¶ Return the Cartesian coordinates from the given ‘s_mae_pbc_position’ anchor string, i.e. ‘anchor_x_y_z’.
Parameters: anchor (str) – the anchor string Raises: ValueError – if the given string is not an anchor string Return type: list Returns: the Cartesians floats
-
class
schrodinger.application.matsci.nano.xtal.
Crystal
(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=None, bonding='off', bond_orders='off', translate='off', cov_offset=0.45, fract_offset=0.0001, use_existing_pbc_bonds=False, logger=None)¶ Bases:
object
Main class for generating crystals.
-
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'¶
-
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_az']¶
-
CHORUS_BOX_B_KEYS
= ['r_chorus_box_bx', 'r_chorus_box_by', 'r_chorus_box_bz']¶
-
CHORUS_BOX_C_KEYS
= ['r_chorus_box_cx', 'r_chorus_box_cy', 'r_chorus_box_cz']¶
-
NUM_DECIMAL_COORDS
= 4¶
-
MSGWIDTH
= 80¶
-
GENERAL_VEC_1
= matrix([[ 1.], [ 0.], [ 0.]])¶
-
GENERAL_VEC_2
= matrix([[ 0.], [ 1.], [ 0.]])¶
-
GENERAL_VEC_3
= matrix([[ 0.], [ 0.], [ 1.]])¶
-
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'¶
-
handleSettings
()¶ Handle the settings of this crystal build.
-
doBonding
()¶ Determine if this script should handle the bonding both inside and between unit cells.
Return type: bool Returns: True if this script should handle the bonding, False otherwise.
-
doBondOrders
()¶ Determine if this script should handle the assignment of bond orders both inside and between unit cells.
Return type: bool Returns: True if this script should handle the assignment, False otherwise.
-
doTranslation
()¶ Determine if a translation to the first unit cell should be performed.
Return type: bool Returns: True if this translation should be performed, False otherwise.
-
getLatticeParameters
()¶ Get lattice parameters.
-
checkInputParams
()¶ Check input parameters.
-
updateLatticeProperties
()¶ Update the lattice properties for the asymmetric unit structure.
-
setCrystalSymmetry
()¶ Set the crystal symmetry.
-
determineBasisVectors
()¶ Determine the lattice vectors in the cartesian basis and the cartesian vectors in the lattice basis. Also determine the reciprocal lattice vectors.
-
buildCrystalUnitCell
(mmcrystal_handle)¶ Build a crystal unit cell.
Parameters: mmcrystal_handle (handle) – the mmcrystal handle
-
labelSymEquivPos
()¶ Label the symmetry equivalent positions.
-
labelAsuAtoms
(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
-
doPropertyEvaluation
()¶ 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.
-
setStructureProperties
()¶ Set some structure properties.
-
setChorusProperties
(astructure, ncella=1, ncellb=1, ncellc=1)¶ Set the chorus structure properties on the given structure.
Parameters: - astructure (
schrodinger.structure.Structure
) – the structure that needs the chorus properties - ncella (int) – the number of cells along a
- ncellb (int) – the number of cells along b
- ncellc (int) – the number of cells along c
- astructure (
-
printCrystalParams
()¶ Print some crystal parameters.
-
updateFractionals
(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
(astructure)¶ Set the ASU atom labels to false for this structure.
Parameters: astructure (schrodinger.Structure.structure) – the structure object to be updated
-
buildCrystalSuperCell
(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
-
setOrigin
()¶ Set the origin.
-
orchestrate
()¶ Orchestrate the construction of the crystal.
-
-
schrodinger.application.matsci.nano.xtal.
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
Return type: three numpy.array
Returns: the three reciprocal lattice vectors
-
schrodinger.application.matsci.nano.xtal.
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
Return type: int
Returns: the number of integers traversed
-
schrodinger.application.matsci.nano.xtal.
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
Return type: int
Returns: the signal
-
schrodinger.application.matsci.nano.xtal.
assign_bond_orders
(astructure, 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
- logger (logging.getLogger or None) – output logger or None if there isn’t one
Return type: schrodinger.Structure.structure
Returns: a copy of the input structure with the bond orders assigned
-
schrodinger.application.matsci.nano.xtal.
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
-
schrodinger.application.matsci.nano.xtal.
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
Return type: schrodinger.Structure.structure
Returns: a copy of the input structure with the bond orders assigned
-
schrodinger.application.matsci.nano.xtal.
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 Return type: tuple Returns: contains the nine chorus properties
-
schrodinger.application.matsci.nano.xtal.
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 Return type: list Returns: a, b, c, alpha, beta, and gamma lattice properties
-
schrodinger.application.matsci.nano.xtal.
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 Return type: list Returns: contains the nine chorus properties
-
schrodinger.application.matsci.nano.xtal.
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 Return type: float Returns: Cell volume in Angstrom^3
-
schrodinger.application.matsci.nano.xtal.
get_volume_from_vecs
(vecs)¶ Return cell volume (in Angstrom^3) from lattice vectors.
Parameters: params (list) – lattice vectors parameters Return type: float Returns: Cell volume in Angstrom^3
-
schrodinger.application.matsci.nano.xtal.
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
Return type: set
Returns: contains tuples of unique atom index pairs within the specified distance
-
class
schrodinger.application.matsci.nano.xtal.
PBCBond
(atom1, atom2, order, also_reg_bond)¶ Bases:
object
Class to manage a PBC bond, i.e. a long bond connecting two real atoms on opposite sides of a unit cell that is used in lieu of the bond between the real and image atoms.
-
PBC_BOND_THRESHOLD
= 0.001¶
-
PBC_BOND_KEY
= 'b_matsci_PBC_bond'¶
-
ALSO_REG_BOND_KEY
= 'b_matsci_also_reg_bond'¶
-
PBC_BOND_COLOR_KEY
= 'i_m_color'¶
-
PBC_BOND_COLOR
= 4¶
-
AHEAD
= 'ahead'¶
-
BEHIND
= 'behind'¶
-
setDeltasToNeighboringCells
(atom1_vec, atom2_vec, spanning_vectors)¶ Set two dictionaries, one for moving to neighboring cells ahead and one for moving behind. Keys are tuples of integer cell deltas and values are (tail, head) tuples giving a directionality of this PBC bond along the given direction.
Parameters: - atom1_vec (numpy.array) – vector to the first atom of the PBC bond
- atom2_vec (numpy.array) – vector to the second atom of the PBC bond
- spanning_vectors (dict) – keys are tuples of cell index triples, values are tuples of normalized spanning vectors for the cell and their original lengths
-
getNeighborPBCBond
(cell_indices, ncella, ncellb, ncellc, cell_size, cell_delta, tail_head)¶ Return a (tail, head) ordered tuple of atom indices for the neighboring PBC bond in the cell given by the cell delta. If this cell is the first or last cell then it will wrap around to the ending or beginning cell, respectively.
Parameters: - cell_indices (tuple) – a triple of cell indices
- ncella (int) – the number of cells along a
- ncellb (int) – the number of cells along b
- ncellc (int) – the number of cells along c
- cell_size (int) – the number of atoms in a cell
- cell_delta (tuple) – a triple of cell deltas which provide the neighboring cells location
- tail_head (tuple) – provides the tail and head atom indices for this PBC bond given the cell delta
Return type: tuple
Returns: atom indices for the neighboring PBC bond
-
offsetAtomData
(offset)¶ Offset the atom data of this instance.
Parameters: offset (int) – the offset to use
-
-
class
schrodinger.application.matsci.nano.xtal.
PBCBonds
(cell_indices=None, pbc_bonds_dict=None, cell_size=None, cov_offset=0.45)¶ Bases:
object
Class to manage a collection of PBC bonds.
-
FIRST_CELL
= (1, 1, 1)¶
-
setPBCBonds
(pbc_bonds_dict)¶ Create a dictionary of PBCBond objects from a dictionary containing PBC bonds.
Parameters: pbc_bonds_dict (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
-
updatePBCBondOrders
(astructure)¶ Update the bond orders in this instance given a structure with updated PBC bond orders.
Parameters: astructure (schrodinger.Structure.structure) – the structure with the updated PBC bond orders
-
setDeltasToNeighboringCells
(astructure, lattice_vectors)¶ For each PBC bond in this cell determine the cell deltas that are needed to move ahead and behind to relevant neighboring cells.
Parameters: - astructure (schrodinger.Structure.structure) – the structure with the PBC bonds
- lattice_vectors (list of numpy.array) – the lattice a, b, and c vectors
-
cleanUpPBCBonds
(astructure, pairs, delete)¶ Clean up the specified PBC bonds in the structure.
Parameters: - astructure (schrodinger.Structure.structure) – the structure with the PBC bonds
- pairs (list) – tuples of PBC bonding atom index pairs
- delete (bool) – if True then the PBC bonds will be deleted
-
getOffsetPBCBonds
(cell_indices, offset)¶ Return a PBCBonds instance for the provided cell indices in which the atom indices have been offset by the given amount.
Parameters: - cell_indices (tuple) – a triple of cell indices indicating to which cell the offset PBC bonds belong
- offset (int) – the offset to use in setting the atom indices
Return type: Returns: a PBCBonds object for the given cell containing the offset atoms
-
connectToCells
(astructure, ncella, ncellb, ncellc, direction)¶ Connect the PBC bonds in this cell with those relevant neighboring cells ahead of or behind this one so as to create real bonds from pairs of PBC bonds or new PBC bonds. If this cell is the first or last along a given direction then if possible it will create new PBC bonds by wrapping around to ending or beginning cells, respectively.
Parameters: - astructure (schrodinger.Structure.structure) – the structure for which the connections are sought
- ncella (int) – the number of cells along a
- ncellb (int) – the number of cells along b
- ncellc (int) – the number of cells along c
- direction (str) – the direction in which to go for the next PBC bond, either PBCBond.AHEAD or PBCBond.BEHIND
-
-
schrodinger.application.matsci.nano.xtal.
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
-
schrodinger.application.matsci.nano.xtal.
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
Return type: int
Returns: the number of atoms between the two cells
-
schrodinger.application.matsci.nano.xtal.
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
-
schrodinger.application.matsci.nano.xtal.
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
Return type: tuple
Returns: a (is_pbc_bond, also_reg_bond, bond_distance) tuple
-
schrodinger.application.matsci.nano.xtal.
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 Return type: tuple Returns: contains the six lattice parameter properties
-
schrodinger.application.matsci.nano.xtal.
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 Return type: dict Returns: keys are tuples of cell index triples, values are tuples of normalized spanning vectors and their original lengths
-
schrodinger.application.matsci.nano.xtal.
get_element_priority
(pair)¶ Return the formula ordering priority of the element in the given pair.
Parameters: pair (tuple) – (element, number) tuple Return type: int Returns: the element priority
-
schrodinger.application.matsci.nano.xtal.
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 Return type: str Returns: the formatted unit cell formula
-
schrodinger.application.matsci.nano.xtal.
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
Return type: numpy.array
Returns: the given vector in the fractional basis
-
schrodinger.application.matsci.nano.xtal.
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
Return type: numpy.array
Returns: the given vector in the Cartesian basis
-
schrodinger.application.matsci.nano.xtal.
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
Return type: numpy array
@rparam: Coordinates in fractional coordinates
-
schrodinger.application.matsci.nano.xtal.
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
Return type: numpy array
@rparam: Coordinates in Cartesian coordinates
-
schrodinger.application.matsci.nano.xtal.
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
Return type: Returns: the built cell
- asu (
-
schrodinger.application.matsci.nano.xtal.
get_vectors_from_chorus
(astructure)¶ Return the three lattice vectors from the nine lattice chorus properties.
Parameters: astructure ( schrodinger.structure.Structure
) – the structure that has the chorus propertiesRaises: ValueError – if any chorus property is missing Return type: list Returns: the three lattice vectors
-
schrodinger.application.matsci.nano.xtal.
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
Return type: tuple of matrices
@rparam: Matrices that convert fractional atomic coordinates to Cartesian and back
-
schrodinger.application.matsci.nano.xtal.
create_new_box
(struct, minval=0.0)¶ Create a new box that is large enough to encompass the X, Y and Z lengths of the system
Parameters: - struct (
schrodinger.structure.Structure
) – The structure to work on - minval (float) – Minimum length of the cell edge or 0. if vdW is fine
- struct (
-
schrodinger.application.matsci.nano.xtal.
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
- astructure (
-
schrodinger.application.matsci.nano.xtal.
make_p1
(astructure, logger=None, in_place=False)¶ Make a P1 cell.
Parameters: - astructure (
schrodinger.structure.Structure
) – the structure to make P1 - logger (
logging.Logger
or None) – if not None then the logger for printing - in_place (bool) – if True then operate directly on the given structure as opposed to a copy of it
Return type: Returns: the P1 cell
- astructure (
-
schrodinger.application.matsci.nano.xtal.
sync_pbc
(st, create_pbc=False, in_place=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
- in_place (bool) – if True then operate directly on the given structure as opposed to a copy of it
Return type: structure.Structure or bool
Returns: the structure with a synchronized PBC or False if there was no PBC and one wasn’t created
-
schrodinger.application.matsci.nano.xtal.
get_pbc_bonds_dict
(astructure)¶ Return a PBC bonds dict for the given structure.
Parameters: astructure ( schrodinger.structure.Structure
) – the structure with the PBC bonds from which to create the dictReturn type: dict Returns: 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
-
schrodinger.application.matsci.nano.xtal.
set_representation_bond
(abond)¶ Set the representation of the given bond.
Parameters: abond (schrodinger.structure._StructureBond) – the bond to set the representation for
-
schrodinger.application.matsci.nano.xtal.
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
- astructure (
-
schrodinger.application.matsci.nano.xtal.
transform_pbc
(struct_in, supercell_matrix, scale_only=False, cell_only=False, origin_shift=None)¶ Create a new structure based on the transformation matrix. If both ‘scale_only’ and ‘cell_only’ are False (default behavior), atoms will be added or subtracted based on the expansion/contraction of the PBC.
Parameters: - struct_in (
schrodinger.structure.Structure
) – Structure to which transformation will be applied - supercell_matrix (3 x 3 floats) – Transformation matrix
- scale_only (bool) – If True, scale atoms to the new cell defined by supercell_matrix, this keeps constant fractional coordinates and number of atoms from the original ‘struct’
- cell_only (bool) – If True, change cell frame to a new cell. This keeps constant Cartesian coordinates and number of atoms from the original ‘struct’. Note that if supercell cell is smaller than original cell, atoms could be cut by the new smaller cell frame
- origin_shift (list of 3 floats) – Origin shift in fractional coordinates
- struct – Transformed structure
Rtype struct: - struct_in (
-
schrodinger.application.matsci.nano.xtal.
get_simple_supercell_matrix
(supercell_matrix)¶ Get minimal diagonal elements of a simple supercell matrix starting from (non)-diagonal supercell matrix. Supercell matrix can be: -1, 1, 1 2, -3, 4 -5, 6, 7 Resulting simple supercell (described by the matrix) must be able to hold the supercell above.
In the case of a smaller lattice, for example: 0.5 0 0 0 0.5 0 0 0 0.5
[1, 1, 1] will be returned
Parameters: supercell_matrix (3 x 3 list of floats) – Supercell matrix Return type: list of three ints Returns: Diagonal elements of the simple supercell matrix (must be positive nonzero integers)
-
schrodinger.application.matsci.nano.xtal.
get_simple_supercell
(struct, supercell_matrix)¶ Get supercell structure.
Parameters: - struct (
structure.Structure
) – Input structure - supercell_matrix (List of 3 floats) – Diagonal elements of the supercell matrix
Return type: structure.Structure
Returns: Supercell structure
- struct (
-
schrodinger.application.matsci.nano.xtal.
get_transformation_matrix
(vecs, new_vecs)¶ Get transformation matrix between old and new set of lattice vectors.
Parameters: - vecs (3 x 3 float list) – Old lattice vectors
- new_vecs (3 x 3 float list) – New lattice vectors
Return type: 3 x 3 float list
Returns: Transformation matrix
-
schrodinger.application.matsci.nano.xtal.
set_physical_properties
(struct)¶ Set cell formula, volume and density to struct.
Type: structure.Structure
Param: Input structure
-
schrodinger.application.matsci.nano.xtal.
pdist_vec_row_col
(d, i)¶ Convert from triangular indices of distance matrix to indices of the square form.
Parameters: - d (int) – row length of the original triangular matrix
- i (numpy.array(int)) – Condensed triangular indices, 0-indexed
rtype: numpy.array(int), numpy.array(int) return: row and column indices (0-indexed) from the corresponding square
form
-
schrodinger.application.matsci.nano.xtal.
move_atoms_into_cell
(struct, frac_coords=None, overlap_tresh=0.25, fract_offset=0.0001)¶ Get structure with all the atoms moved into the first cell.
Type: structure.Structure
Param: Input structure
Parameters: - frac_coords (numpy arrays of arrays of 3 floats or None) – Fractional coordinates
- overlap_tresh (float) – Distance between two atoms, such that they are considered overlapping
- fract_offset (float) – The threshold used to compare floating point fractional coordinate values and in particular those that are on the cell boundary
Return type: structure.Structure
Returns: Structure with all the atoms moved inside first unit cell
-
schrodinger.application.matsci.nano.xtal.
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: astructure ( schrodinger.structure.Structure
) – the structure with lattice vectors defined by chorus box propertiesReturn type: list of tuples Returns: each (numpy.array, float) tuple contains (1) the unit lattice vector and (2) the length of the original vector
-
schrodinger.application.matsci.nano.xtal.
label_pbc_bonds
(astructure)¶ Label PBC bonds.
Parameters: astructure ( schrodinger.structure.Structure
) – the structure with the bonds to label
-
schrodinger.application.matsci.nano.xtal.
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
-
schrodinger.application.matsci.nano.xtal.
get_spg_from_spglib
(space_groups, spg_type_in, spg_symm, double_named_groups={'Pncb', 'Pnmm', 'Bbeb', 'Pmnm', 'Bbcb', 'Pcna'})¶ Get space group from mmspg given space group type obtained from spglib.
Parameters: - space_groups (
SpaceGroups
) – SpaceGroups object containing space groups known to mmspg - spg_type_in (dict) – Dataset containing space group properties, for keys see: https://atztogo.github.io/spglib/python-spglib.html#get-symmetry-dataset String values are in unicode !
- spg_symm (dict of two keys: 'rotations': list of 3 x 3 matrices, 'translations': list of 1 x 3 matrices) – dictionary of list of rotations and translations
- double_named_groups (set) – Doubly named space groups in spglib
Return type: SpaceGroup
, namedtuple or None, namedtupleReturns: If space group from spglib matched one from mmspg, return SpaceGroup object and named tuple formed from spg_type_in dict. Otherwise, None and named tuple formed from spg_type_in dict is returned
- space_groups (
-
schrodinger.application.matsci.nano.xtal.
equal_rotations
(rotations1, rotations2)¶ Check if rotations are equal.
Parameters: - rotations1 (3D numpy.array) – Array of rotation matrices (2D arrays) associated with a space group
- rotations2 (3D numpy.array) – Array of rotation matrices (2D arrays) associated with a space group
Return type: bool
Returns: True, if rotations are the same, otherwise False
-
schrodinger.application.matsci.nano.xtal.
get_std_cell_from_spglib_dataset
(struct, dataset, space_groups)¶ Get standardized cell (structure) from spglib dataset and copy all the structure properties (except symmetry related) from struct_in.
Parameters: - struct (
schrodinger.structure.Structure
) – Structure to get structure properties from - dataset (dict) – Dataset containing cell and space group properties, see: https://atztogo.github.io/spglib/python-spglib.html#get-symmetry-dataset
- space_groups (
SpaceGroups
or None) – SpaceGroups object containing space groups known to mmspg or None if default SpaceGroups instance is desired
Return type: Returns: Standardized structure or error message
- struct (
-
schrodinger.application.matsci.nano.xtal.
assign_space_group
(struct_in, symprec=0.01, space_groups=None, update_title=False, search_std_cell=False)¶ Set space group and space group id to the input structure. An error message is returned on failure.
Type: Param: Input structure that will be modified
Parameters: - symprec (float) – Symmetry tolerance used for atomic coordinates to assign space group
- space_groups (
SpaceGroups
or None) – SpaceGroups object containing space groups known to mmspg or None if default SpaceGroups instance is desired - update_title (bool) – Update structure title with a newly assigned space group
- search_std_cell (bool) – If True, search for standardized cell
Return type: str or None or
schrodinger.structure.Structure
Returns: If error occurs, text of the error is returned. Otherwise, if search_std_cell is True, standardized structure is returned, else None is returned
-
schrodinger.application.matsci.nano.xtal.
get_normal_surf
(struct)¶ Enforce system to have C-axis normal to the a-b plane. This is done by straining the structure.
Type: schrodinger.structure.Structure
Param: Input structure Return type: schrodinger.structure.Structure
Returns: Output structure with C-axis normal to the a-b plane
-
schrodinger.application.matsci.nano.xtal.
get_normal_surf_from_HKL
(hkl, vecs, max_normal_search=10)¶ Calculate transformation matrix with c-axis most normal to a-b plane from HKL plane indices and lattice vectors.
Parameters: - hkl (list of 3 integers) – Miller plane indices
- vecs (list of 3 lists of floats) – Lattice vectors
- max_normal_search (int) – Maximum number of linear combinations of lattice vectors to be considered when search most normal surface
Return type: bool, numpy.array 3 x 3 of integers
Returns: True, if normal is found, otherwise False and transformation matrix
-
schrodinger.application.matsci.nano.xtal.
lcm
(numbers)¶ Get the lowest common multiple of a sequence of numbers.
Parameters: numbers (list of integers) – Sequence of integers Return type: int Returns: Lowest common multiple
-
schrodinger.application.matsci.nano.xtal.
reduce_vector
(vector)¶ Get reduced vector of a transformation matrix.
Parameters: vector (list of integers) – Components of a vector of transformation matrix Return type: list of integers Returns: Components of a reduced vector of transformation matrix
-
schrodinger.application.matsci.nano.xtal.
get_symmops_from_spglib
(symm)¶ Get set of symmetry operators from a set of rotations and translations. Symmetry operator is defined with a 4 x 4 matrix, top left 3 x 3 is rotation matrix, top right column 1 x 3 is translation, rest, bottom row is [0 0 0 1]
Parameters: symm (dict of two keys: 'rotations': list of 3 x 3 matrices, 'translations': list of 1 x 3 matrices) – dictionary of list of rotations and translations Returns: list of 4x4 matrices Return type: list of symmetry operators
-
schrodinger.application.matsci.nano.xtal.
get_struct_from_CIF
(cif_fn)¶ Get structure from CIF file.
Parameters: cif_fn (str) – CIF file name Return type: schrodinger.structure.Structure
Returns: Structure from CIF file Raises: ValueError – If file doesn’t exist or the structure could not be read
-
schrodinger.application.matsci.nano.xtal.
is_P1
(st)¶ Return True if the given structure is P1.
Parameters: st (schrodinger.structure.Structure) – the structure in question Return type: bool Returns: True if the given structure is P1
-
schrodinger.application.matsci.nano.xtal.
sort_atoms_by_dist
(atoms, point=None)¶ Return a list of (atom, distance) pair tuples in order of increasing distance (in Ang.) from the given point.
Parameters: - atoms (list) – the atoms to sort by distance
- point (numpy.array or None) – the point from which to measure distance, if None then (0, 0, 0) is used
Return type: list
Returns: contains (atom, distance) pair tuples in order of increasing distance
-
schrodinger.application.matsci.nano.xtal.
get_bonding_cell_deltas
(atom1, atom2, lattice_vecs)¶ For bonded atom1 and atom2 return a list of cell delta tuples, i.e. elements of module level constant AHEAD_TRIPLES which are factors for the a, b, and c lattice vectors, pointing to cells where the images of of the given atom2 are covalently bound to the given real atom1.
Parameters: - atom1 (schrodinger.structure._StructureAtom) – the first atom of the bond
- atom2 (schrodinger.structure._StructureAtom) – the second atom of the bond
- lattice_vecs (list of numpy.array) – contains the a, b, and c lattice vectors
Return type: list
Returns: contains cell delta triples
-
schrodinger.application.matsci.nano.xtal.
get_image_coords
(atom, lattice_vecs, cell_deltas, direction)¶ Get image coordinates for the given atom in directions given by the lattice vectors, cell deltas, and direction.
Parameters: - atom (schrodinger.structure._StructureAtom) – the atom for which to get the image coordinates
- lattice_vecs (list of numpy.array) – contains the a, b, and c lattice vectors
- cell_deltas (list) – contains cell delta triples
- direction (str) – the direction to move for locating images, either FORWARD or REVERSE module level constant
Return type: list
Returns: contains numpy.array of the remaining bonding positions
-
schrodinger.application.matsci.nano.xtal.
place_and_bond_atoms
(st, atom1, atom2, coords)¶ Place copies of atom2 in the locations given by coords and bond them to atom1.
Parameters: - st (schrodinger.structure.Structure) – the structure in which atoms will be placed
- atom1 (schrodinger.structure._StructureAtom) – the first atom
- atom2 (schrodinger.structure._StructureAtom) – the second atom
- coords (list) – contains numpy.array of the bonding positions
-
schrodinger.application.matsci.nano.xtal.
del_chorus_props
(st)¶ Delete the chorus box properties from the given structure.
Parameters: st (schrodinger.structure.Structure) – the structure having the chorus box properties deleted
-
schrodinger.application.matsci.nano.xtal.
complete_bonding
(st)¶ For a copy of the given periodic structure locate bonds that both exist within the cell and across the cell and complete the bonding for such bonds, meaning that bonded atoms will be defined at all image positions.
Parameters: st (schrodinger.structure.Structure) – the structure for which the bonding will be completed Return type: schrodinger.structure.Structure or None Returns: the completed structure or None if no completion is necessary
-
schrodinger.application.matsci.nano.xtal.
translate_atoms
(cell)¶ Translate all atoms to the first unit cell.
Parameters: cell (schrodinger.structure.Structure) – the structure to translate, must have chorus properties defined
-
schrodinger.application.matsci.nano.xtal.
get_cell_fast
(asu, symm_ops)¶ Get crystal cell with all applied symmetry operators on the ASU.
Parameters: - asu (
structure.Structure
) – Asymmetric unit - symm_ops (list) – List of symmetry operations (4 x 4 matrices)
Return type: structure.Structure
Returns: Crystal cell
- asu (