schrodinger.application.matsci.coarsegrain module¶
Utilities for working with coarse grain structures
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.matsci.coarsegrain.
FusedRing
(rings)¶ Bases:
object
Manage a fused ring.
-
getAtomIndices
()¶ Return a list of atom indices.
Return type: list Returns: atom indices
-
static
getFusedRings
(st)¶ Return a list of fused ring objects for the given structure.
Parameters: st (structure.Structure) – the structure Return type: list Returns: contains FusedRing
-
-
class
schrodinger.application.matsci.coarsegrain.
Internals
(astructure, uniqueify=False)¶ Bases:
object
Manage the internal coordinates of a structure.
-
averageAndSort
(internals)¶ Average and sort the given internals.
Parameters: internals (dict) – keys are tuples of names of the constitutive atoms, values is a list of pair tuples containing (1) a tuple of atom indices and (2) a tuple of internal values Return type: dict Returns: sorted keys where keys are tuples of names of the constitutive atoms, values are pair tuples containing (1) tuple of tuples containing atom indices for all of the internals with the given key and (2) a tuple of average internal values
-
avgInternals
(internals)¶ Average the values of the internals in the given dictionary of internals.
Parameters: internals (dict) – keys are tuples of names of the constitutive atoms, values is a list of pair tuples containing (1) a tuple of atom indices and (2) a tuple of internal values Return type: dict Returns: keys are tuples of names of the constitutive atoms, values are pair tuples containing (1) tuple of tuples containing atom indices for all of the internals with the given key and (2) a tuple of average internal values
-
findNewBonds
(name_1, name_2, bonds_deep, exclude_what='Bonds')¶ Return the new bond pairs.
Parameters: - name_1 (str) – the name of the first particle
- name_2 (str) – the name of the second particle
- bonds_deep (int) – the number of bonds separating the particles
- exclude_what (str) – What nonbonds to exclude when regenerating the lists of included and excluded nonbonds after adding these bonds - should be one of the EXCLUDE_* constants, potentially combined for rings with get_combined_exclusion_str
Return type: list
Returns: contains schrodinger.structure._StructureAtom pair tuples for new bonds
-
getFusedRingNonBonds
()¶ Get fused ring nonbonds dictionary.
Return type: OrderedDict Returns: fused ring nonbonds recursively sorted
-
getIdxs
(atoms)¶ Return the atom indices for the given list of atoms.
Parameters: atoms (list) – contains structure._StructureAtom Return type: tuple Returns: contains atom indices
-
getNames
(atoms, uniqueify=False)¶ Return the atom names for the given list of atoms.
Parameters: - atoms (list) – contains structure._StructureAtom
- uniqueify (bool) – if True then relevant internal coordinates will be uniqueified by type
Return type: tuple
Returns: contains atom names
-
getNewAngles
(new_bonds)¶ Return the new angles.
Parameters: new_bonds (list) – contains schrodinger.structure._StructureAtom pair tuples for new bonds Return type: list Returns: contains schrodinger.structure._StructureAtom triples tuples for new angles
-
getNewDihedrals
(new_bonds)¶ Return the new dihedrals.
Parameters: new_bonds (list) – contains schrodinger.structure._StructureAtom pair tuples for new bonds Return type: list Returns: contains schrodinger.structure._StructureAtom quadruples tuples for new dihedrals
-
getNewImpropers
(new_bonds)¶ Return the new impropers.
Parameters: new_bonds (list) – contains schrodinger.structure._StructureAtom pair tuples for new bonds Return type: list Returns: contains schrodinger.structure._StructureAtom quadruples tuples for new impropers
-
handleRingExclusions
()¶ Handle ring exclusions.
-
mergeNonbonds
(nonbonds, new_nonbonds, sort=False)¶ Return a copy of the first nonbonds dict merged with the second.
Parameters: - nonbonds (dict) – keys are tuples of names of the constitutive atoms, values is a list of pair tuples containing (1) a tuple of atom indices and (2) a tuple of internal values or None if there isn’t one
- new_nonbonds (dict) – keys are tuples of names of the constitutive atoms, values is a list of pair tuples containing (1) a tuple of atom indices and (2) a tuple of internal values or None if there isn’t one
- sort (bool) – whether to sort the merged nonbonds
Return type: dict
Returns: merged nonbonds
-
orderInternalByName
(atoms)¶ Order the atoms of the given internal coordinate by name.
Parameters: atoms (list) – contains structure._StructureAtom of the internal coordinate to be ordered Return type: list Returns: atoms sorted by name
-
recursivelySort
(internals)¶ Return the given dictionary of internal coordinates recursively sorted by the names of the constitutive atoms.
Parameters: internals (dict) – keys are tuples of names of the constitutive atoms, values are pair tuples containing (1) tuple of tuples containing atom indices for all of the internals with the given key and (2) a tuple of average internal values Return type: OrderedDict Returns: internals recursively sorted
-
removeInternalsWithNewBonds
(exclude_what='Bonds')¶ Remove internals with new bonds.
Parameters: exclude_what (str) – What to exclude - should be one of the EXCLUDE_* constants, potentially combined for rings with get_combined_exclusion_str
-
setAllPairs
()¶ Set the all pairs dictionary.
-
setAngleNonBonds
()¶ Set angle nonbonds dictionary.
-
setAngles
()¶ Set angles dictionary.
-
setBasic
(exclude_what='Bonds')¶ Set basic dictionaries.
Parameters: exclude_what (str) – What nonbonds to exclude - should be one of the EXCLUDE_* constants, potentially combined for rings with get_combined_exclusion_str
-
setBondNonBonds
()¶ Set the bond nonbonds dictionary.
-
setBonds
()¶ Set the bonds dictionary.
-
setDihedralNonBonds
()¶ Set dihedral nonbonds dictionary.
-
setDihedrals
()¶ Set dihedrals dictionary.
-
setImpropers
()¶ Set impropers dictionary.
-
setIncludedExcludedNonBonds
(exclude_what='Bonds')¶ Define which non-bond interactions are included and excluded
Parameters: exclude_what (str) – What to exclude - should be one of the EXCLUDE_* constants, potentially combined for rings with get_combined_exclusion_str
-
setInternals
(internals, atoms, internals_excluded=None, data=None, uniqueify=False)¶ Set internals.
Parameters: - internals (dict) – keys are tuples of names of the constitutive atoms, values is a list of pair tuples containing (1) a tuple of atom indices and (2) a tuple of internal values
- atoms (list) – contains structure._StructureAtom for a given internal
- internals_excluded (dict or None) – contains internals that should be excluded from being set. keys are tuples of names of the constitutive atoms, values is a list of pair tuples containing (1) a tuple of atom indices and (2) a tuple of internal values or None if there isn’t one
- data (tuple or None) – a tuple of data for the given internal or None if it needs to be measured
- uniqueify (bool) – if True then relevant internal coordinates will be uniqueified by type
Return type: bool
Returns: True if the internal was set, or False if it was not set due to already appearing in the internals_excluded dict
-
setNonAngleNonBonds
()¶ Set the nonangle nonbonds dictionary.
-
setNonAngleNonDihedralNonBonds
()¶ Set the nonangle nondihedral nonbonds dictionary.
-
setNonBonds
(exclude_newbonds=True)¶ Set nonbonds dictionary.
Parameters: exclude_newbonds (bool) – If True, exclude new bonds added by the user. If False, only exclude pairs that are actually bonded.
-
setSites
()¶ Set the sites dictionary.
-
updateFusedRingIdxsForNewBonds
(new_bonds_tuples)¶ Update the fused ring idxs when a new set of bonds has been defined.
Parameters: new_bonds_tuples (list) – contains schrodinger.structure._StructureAtom pair tuples for new bonds
-
updateInternalsForNewBonds
(new_bonds_tuples, exclude_what='Bonds')¶ Update the internals when a new set of bonds has been defined
Parameters: - new_bonds_tuples (list) – contains schrodinger.structure._StructureAtom pair tuples for new bonds
- exclude_what (str) – What nonbonds to exclude when regenerating the lists of included and excluded nonbonds after adding these bonds - should be one of the EXCLUDE_* constants, potentially combined for rings with get_combined_exclusion_str
-
-
class
schrodinger.application.matsci.coarsegrain.
ParticleInfo
(key, name, rgb, radius, mass)¶ Bases:
tuple
-
key
¶ Alias for field number 0
-
mass
¶ Alias for field number 4
-
name
¶ Alias for field number 1
-
radius
¶ Alias for field number 3
-
rgb
¶ Alias for field number 2
-
-
schrodinger.application.matsci.coarsegrain.
compute_max_internal_distance
(struct)¶ Compute the largest distance between any pair of atoms that are a) bonded, b) 1-3 in an angle or c) 1-4 in a dihedral
Parameters: struct ( schrodinger.structure.Structure
) – The structure to compute the distance overReturn type: float Returns: The largest distance between any pair of atoms involved in a bond, angle or torsion
-
schrodinger.application.matsci.coarsegrain.
fix_linear_angles
(struct, internals=None, angles=None)¶ Return a copy of the given structure with linear angles fixed.
Parameters: - struct (structure.Structure) – the structure whose angles will be fixed
- internals (Internals or None) – the internals of the structure, if None it will be defined
- angles (list or None) – contains tuples of atom names of the angles to be fixed, if None then all will be fixed
Return type: Returns: the structure with angles fixed
-
schrodinger.application.matsci.coarsegrain.
get_angle_potential_type
(struct)¶ Return the type of angle potential for this structure
Parameters: struct ( schrodinger.structure.Structure
) – The structure to checkReturn type: str or None Returns: The value of the ANGLE_TYPE_KEY property on the structure, or None if the structure is not a coarse grain structure or does not have this property set
-
schrodinger.application.matsci.coarsegrain.
get_cg_cutoff_data
(model)¶ Return the coarse grain cutoff data, i.e. cutoff, margin, and r_clone.
Parameters: model ( schrodinger.application.desmond.cms.Cms
) – The model structureRaises: ValueError – if model is incorrect Return type: dict Returns: the coarse grain cutoff, far type, margin, and r_clone values. Each key in the dictionary is a format specifier from the MSJ_*_COARSE_GRAIN_HEADER string and the value is the value for that format specifier
-
schrodinger.application.matsci.coarsegrain.
get_coarse_grain_msj_family_header
(struct)¶ Get any additional header text that needs to be inserted into the task stage of the msj file if this structure is coarse grain. This header can then be inserted when creating the .msj file by using the extra_task_text keyword to the desmondutils.create_msj call. i.e. header = coarsegrain.get_coarse_grain_msj_family_header(system) desmondutils.create_msj(stages, extra_task_text=header)
Parameters: struct ( schrodinger.application.desmond.cms.Cms
) – The structure to get the header forReturn type: str Returns: The header text, if any, required for the current input. If no additional header text is required, an empty string is returned.
-
schrodinger.application.matsci.coarsegrain.
get_coarse_grain_msj_header
(struct)¶ Get the appropriate MSJ header text for this coarse grain structure
Parameters: struct ( schrodinger.application.desmond.cms.Cms
) – The structure to get the header forReturn type: str Returns: The header text appropriate for this structure. An empty string is returned if the structure is not coarse-grained. The LJ header is used for coarse-grained systems with unrecognized non-bond potential type.
-
schrodinger.application.matsci.coarsegrain.
get_combined_exclusion_str
(bad_str, exclude_rings=False)¶ Return a combined exclusion string.
Parameters: - bad_str (str) – a bond, angle, or dihedral string, i.e. one of EXCLUDE_BONDS, EXCLUDE_BONDS_ANGLES, or EXCLUDE_BONDS_ANGLES_DIHEDRALS
- exclude_rings (bool) – whether pairs in rings and fused-ring systems are also excluded
Return type: Returns: the combined exclusion string
-
schrodinger.application.matsci.coarsegrain.
get_martini_antifreeze_type_from_type
(atype)¶ Return the Martini antifreeze type from the type.
Parameters: atype (str) – the Martini type Return type: str Returns: the Martini antifreeze type
-
schrodinger.application.matsci.coarsegrain.
get_martini_bond_force_constant
(pair_type, martini_subtypes)¶ Return the Martini bond force constant parameter.
Parameters: - pair_type (tuple) – the bond pair type
- martini_subtypes (dict) – keys are site type tuples and values are Martini subtypes
Return type: float
Returns: the bond force constant parameter in (kcal/mol)/Ang.^2
-
schrodinger.application.matsci.coarsegrain.
get_martini_epsilon
(pair_type, martini_subtypes)¶ Return the Martini epsilon parameter.
Parameters: - pair_type (tuple) – the nonbond pair type
- martini_subtypes (dict) – keys are site type tuples and values are Martini subtypes
Return type: float
Returns: the epsilon parameter in kcal/mol
-
schrodinger.application.matsci.coarsegrain.
get_martini_eq_length
(pair_type, martini_subtypes)¶ Return the Martini equilibrium length parameter.
Parameters: - pair_type (tuple) – the bond pair type
- martini_subtypes (dict) – keys are site type tuples and values are Martini subtypes
Return type: float
Returns: the equilibrium length parameter in Angstrom
-
schrodinger.application.matsci.coarsegrain.
get_martini_ring_type_from_type
(atype)¶ Return the Martini ring type from the type.
Parameters: atype (str) – the Martini type Return type: str Returns: the Martini ring type
-
schrodinger.application.matsci.coarsegrain.
get_martini_sigma
(pair_type, martini_subtypes)¶ Return the Martini sigma parameter.
Parameters: - pair_type (tuple) – the nonbond pair type
- martini_subtypes (dict) – keys are site type tuples and values are Martini subtypes
Return type: float
Returns: the sigma parameter in Ang.
-
schrodinger.application.matsci.coarsegrain.
get_martini_type_from_super_type
(atype)¶ Return the Martini type from the super type, i.e. ring or antifreeze type.
Parameters: atype (str) – the Martini super type Return type: str Returns: the Martini type
-
schrodinger.application.matsci.coarsegrain.
get_nonbond_potential_type
(struct)¶ Return the type of non-bond potential for this structure
Parameters: struct ( schrodinger.structure.Structure
) – The structure to checkReturn type: str or None Returns: The value of the NB_TYPE_KEY property on the structure, or None if the structure is not a coarse grain structure or does not have this property set
-
schrodinger.application.matsci.coarsegrain.
get_type_dict_from_st
(st, type_dict=None)¶ Return a sorted type dict for the given structure.
Parameters: - st (
schrodinger.structure.Structure
) – the structure from which to obtain the type dict - type_dict (OrderedDict or None) – specify a type dict to include in the returned type dict (note that this type dict takes precedence over the type dict data for the given structure) or None if there isn’t one
Return type: OrderedDict
Returns: the sorted type dict, keys are particle names, values are ParticleInfo
- st (
-
schrodinger.application.matsci.coarsegrain.
is_coarse_grain
(struct, by_atom=False)¶ Check if struct is a coarse grain structure
Parameters: - struct (
schrodinger.structure.Structure
) – The structure to check - by_atom (bool) – If True, check each atom to see if it is coarse grain and return True if any atom is coarse grin. If False, check only for the coarse grain structure property. True is useful when the structure has been obtained via maestro.workspace_get, which removes structure-level properties, or if the structure may be a mixed atomistic/coarse-grained structure.
Return type: bool
Returns: True if it is a coarse grain structure, False if not
- struct (
-
schrodinger.application.matsci.coarsegrain.
is_harmonic_angle
(struct)¶ Check if this is a harmonic angle coarse grain structure
Parameters: struct ( schrodinger.structure.Structure
) – The structure to checkReturn type: bool Returns: True if this is a coarse grain harmonic angle structure, False if not
-
schrodinger.application.matsci.coarsegrain.
is_lennard_jones
(struct)¶ Check if this is a Lennard-Jones coarse grain structure
Parameters: struct ( schrodinger.structure.Structure
) – The structure to checkReturn type: bool Returns: True if this is a coarse grain Lennard-Jones structure, False if not
-
schrodinger.application.matsci.coarsegrain.
is_martini_antifreeze_type
(atype)¶ Return True if the given Martini type is an antifreeze type.
Parameters: atype (str) – the Martini type Return type: bool Returns: True if a Martini antifreeze type
-
schrodinger.application.matsci.coarsegrain.
is_martini_charge_type
(atype)¶ Return True if the given Martini type is a charge type.
Parameters: atype (str) – the Martini type Return type: bool Returns: True if a Martini charge type
-
schrodinger.application.matsci.coarsegrain.
is_martini_ring_type
(atype)¶ Return True if the given Martini type is a ring type.
Parameters: atype (str) – the Martini type Return type: bool Returns: True if a Martini ring type
-
schrodinger.application.matsci.coarsegrain.
is_repulsive_harmonic
(struct)¶ Check if this is a repulsive harmonic coarse grain structure
Parameters: struct ( schrodinger.structure.Structure
) – The structure to checkReturn type: bool Returns: True if this is a coarse grain repulsive harmoic structure, False if not
-
schrodinger.application.matsci.coarsegrain.
is_shifted_lennard_jones
(struct)¶ Check if this is a shifted Lennard-Jones coarse grain structure
Parameters: struct ( schrodinger.structure.Structure
) – The structure to checkReturn type: bool Returns: True if this is a coarse grain shifted Lennard-Jones structure, False if not
-
schrodinger.application.matsci.coarsegrain.
is_trigonometric_angle
(struct)¶ Check if this is a trigonometric angle coarse grain structure
Parameters: struct ( schrodinger.structure.Structure
) – The structure to checkReturn type: bool Returns: True if this is a coarse grain trigonometric angle structure, False if not
-
schrodinger.application.matsci.coarsegrain.
parse_combined_exclusion_str
(combined_str)¶ Parse a combined exclusion string.
Parameters: combined_str (str) – a combined exclusion string obtained from get_combined_exclusion_str Return type: str, bool Returns: a bond, angle, or dihedral string, i.e. one of EXCLUDE_BONDS, EXCLUDE_BONDS_ANGLES, or EXCLUDE_BONDS_ANGLES_DIHEDRALS, and whether pairs in rings and fused-ring systems are also excluded
-
schrodinger.application.matsci.coarsegrain.
setCGBondLengths
(st)¶ Set the bond lengths of the given CG structure according to the particle radii.
Parameters: st (structure.Structure) – the CG structure Return type: structure.Structure Returns: the CG structure with the new bond lengths
-
schrodinger.application.matsci.coarsegrain.
set_angle_potential_type
(struct, atype)¶ Mark the structure with the angle pontential type
Parameters: - struct (
schrodinger.structure.Structure
) – The structure to mark - atype (str) – Should be a module constant in the ANGLES_KEYS list
Raises: - ValueError – if atype is not in ANGLES_KEYS
- TypeError – if struct is not a coarse grain system
- struct (
-
schrodinger.application.matsci.coarsegrain.
set_as_coarse_grain
(struct)¶ Mark struct as a coarse grain structure
Parameters: struct ( schrodinger.structure.Structure
) – The structure to mark
-
schrodinger.application.matsci.coarsegrain.
set_atom_coarse_grain_properties
(struct, atom, name, rgb=(100, 100, 100), atom_type=400, formal_charge=0.0, partial_charge=0.0, radius=10.0, mass=12.0)¶ Set the properties required for a coarse grain particle atom
Parameters: - structure (
schrodinger.structure.Structure
) – The structure containing the atom - atom (
schrodinger.structure._StructureAtom
) – The atom to set properties on - name (str) – The name of the coarse grain particle.
- rgb (tuple) – The 0-255 tuple of red, green and blue that defines the atom color
- atom_type (int) – The mmod atom type
- formal_charge (int) – The formal charge
- partial_charge (float) – The partial charge
- radius (float) – The particle radius, in Angstrom
- mass (float) – The particle mass
- structure (
-
schrodinger.application.matsci.coarsegrain.
set_nonbond_potential_type
(struct, nbtype)¶ Mark the structure with the non-bond pontential type
Parameters: - struct (
schrodinger.structure.Structure
) – The structure to mark - nbtype (str) – Should be a module constant in the NONBOND_POTENTIALS list
Raises: - ValueError – if nbtype is not in NONBOND_POTENTIALS
- TypeError – if struct is not a coarse grain system
- struct (
-
schrodinger.application.matsci.coarsegrain.
system_has_charged_particles
(model)¶ Check if any particle in the given system has a charge based on the sites FFIO block
Parameters: model ( schrodinger.application.desmond.cms.Cms
orschrodinger.application.desmond.ffiostructure.FFIOStructure
) – The system to check the FFIO site block for chargesReturn type: bool Returns: True if an FFIO sites block exists in the given system and contains at least one charged particle. False if there is either no such block or the block contains only neutral particles
-
schrodinger.application.matsci.coarsegrain.
validate_no_cg
(struct=None, structs=None, rows=None)¶ Fail a validation check if any of the structures is a coarse grain structure
One and only one of struct, structs or rows should be given
Parameters: - struct (
schrodinger.structure.Structure
) – The structure, if only a single structure is to be tested - structs (list) – A list of structures to test
- rows (iterator of
schrodinger.project.ProjectRow
) – Project Table rows to check
Return type: (False, msg) or True
Returns: False and error message if the structure is coarse grain, True if everything is OK. Return value is acceptable for an AF2 valiator.
- struct (