schrodinger.application.matsci.cgforcefield module¶
Constants, functions and classes for assigning coarse-grained force fields to structures
Copyright Schrodinger, LLC. All rights reserved.
- schrodinger.application.matsci.cgforcefield.get_rev_dict(x)¶
- schrodinger.application.matsci.cgforcefield.get_density_from_scale_factor(density, scale_factor)¶
Get the coarse grain density in g/cm^3 after applying scale factor to it
- Parameters
density (float) – current density
scale_factor (float) – scaling factor to scale the density by
- Return type
float
- Returns
scaled density in g/cm^3
- schrodinger.application.matsci.cgforcefield.get_scale_factor_from_density(old_density, new_density)¶
Get the scale factor for change from old density to the new density
- Parameters
old_density (float) – old density of the system in g/cm^3
new_density (float) – new (desired) density of the system in g/cm^3
- Return type
float
- Returns
scale factor to change the old density to new density
- schrodinger.application.matsci.cgforcefield.get_reduced_density_from_cutoff(nparticles, volume, cutoff)¶
Get reduced density (number) from DPD cutoff in Ang.
- Parameters
nparticles (int) – number of particles in the system
volume (float) – volume of the system
cutoff (float) – DPD potential cutoff
- Return type
float
- Returns
reduced density of the DPD simulation
- schrodinger.application.matsci.cgforcefield.get_cutoff_from_reduced_density(nparticles, volume, reduced_density)¶
Get the DPD cutoff in Ang. from the reduced density
- Parameters
nparticles (int) – number of particles in the system
volume (float) – volume of the system
reduced_density (float) – reduced density of the DPD simulation
- Return type
float
- Returns
DPD potential cutoff
- schrodinger.application.matsci.cgforcefield.get_scaled_volume(initial_volume, scale_factor)¶
Return the new volume for coarse grain system after applying scale factor
- Parameters
initial_volume (float) – volume before applying the scale factor
scale_factor (float) – scale factor to apply volume
- Return type
float
- Returns
new volume
- schrodinger.application.matsci.cgforcefield.get_dpd_scale_factor_from_FF(struct, forcefield)¶
Return the new volume for coarse grain system after applying scale factor
- Parameters
struct (
schrodinger.structure.Structure
) – the structureforcefield (ForceField) – the force field object
- Return type
float
- Returns
new volume
- schrodinger.application.matsci.cgforcefield.write_force_field_to_json(ff_data, ff_file_path)¶
Write force field data to a json file
- Parameters
ff_data (dict) – The dictionary that defines the force field
ff_file_path (str) – filename path for the json file
- schrodinger.application.matsci.cgforcefield.scale_cell(astructure, scale_factor)¶
Scale the cell of the given structure according to the given scale factor.
- Parameters
astructure (structure.Structure) – the structure whose cell will be scaled
scale_factor (float) – the uniform scale factor
- schrodinger.application.matsci.cgforcefield.is_like_lennard_jones(nonbond_type)¶
Return True if the given type is like Lennard-Jones.
- Parameters
nonbond_type (str) – the nonbond type
- Return type
bool
- Returns
True if like Lennard-Jones
- schrodinger.application.matsci.cgforcefield.is_dpd(cgff_path)¶
Return True if any of the non-bonded parameter is repulsive harmonic
- Parameters
path (str) – The path to the force field file to read
- Return type
bool
- Returns
True if any of the non-bonded parameter is repulsive harmonic
- schrodinger.application.matsci.cgforcefield.get_type_dict_from_ff_file(ff_file)¶
Return a sorted type dict for the given force field file.
- Parameters
ff_file (str) – path to the force field file from which to obtain the type dict
- Return type
OrderedDict
- Returns
the sorted type dict, keys are particle names, values are ParticleInfo
- schrodinger.application.matsci.cgforcefield.get_all_force_field_paths(allow_enc=False, include=False)¶
Get a dictionary of force field names and force field file paths for all defined CG force fields, keyed at the top level by location, INSTALLED_CG_FF_LOCATION_TYPE for FF_PARAMETERS_INSTALLED_PATH and LOCAL_CG_FF_LOCATION_TYPE for FF_PARAMETERS_LOCAL_PATH.
- Parameters
allow_enc (bool) – whether to allow encrypted force field files
include (bool) – whether to recurse any included force field paths
- Return type
dict
- Returns
top level keys are either INSTALLED_CG_FF_LOCATION_TYPE or LOCAL_CG_FF_LOCATION_TYPE while inner dictionaries have force field names as keys and absolute paths to force field files as values
- schrodinger.application.matsci.cgforcefield.add_local_type_force_field_to_job_builder(builder, ffname, local_type_includes_cwd=True)¶
Set up the Launch API Job Builder to use the given local type force field.
- Parameters
builder (
schrodinger.job.launchapi.JobSpecificationArgsBuilder
) – The job builder to use for setting the FF as an input fileffname (str) – The name of the force field to use (should be the user-facing name, not the force field file name)
local_type_includes_cwd (bool) – whether the LOCAL_CG_FF_LOCATION_TYPE also includes the CWD
- schrodinger.application.matsci.cgforcefield.force_field_name_to_file_name(ffname)¶
Convert the user-facing force field name to a file name - without the full path
- Parameters
ffname (str) – The name of the force field
- Return type
str
- Returns
The name of the force field file
- schrodinger.application.matsci.cgforcefield.get_force_field_file_path(force_field_name, location_type='local', local_type_includes_cwd=False, check_existence=False)¶
Return the force field file path given the force field name and location type.
- Parameters
force_field_name (str) – the force field name
location_type (str) – the location type, either INSTALLED_CG_FF_LOCATION_TYPE or LOCAL_CG_FF_LOCATION_TYPE
local_type_includes_cwd (bool) – whether the LOCAL_CG_FF_LOCATION_TYPE also includes the CWD
check_existence (bool) – check the existence of the path
- Raise
ValueError: If the directory the file should be found in does not exist and cannot be made, or if an existence check is being performed and the path doesn’t exist
- Return type
str
- Returns
the force field file path
- schrodinger.application.matsci.cgforcefield.get_force_field_name(force_field_file_path)¶
Return the force field name given the force field file path.
- Parameters
force_field_file_path (str) – the force field file path
- Return type
str
- Returns
the force field name
- schrodinger.application.matsci.cgforcefield.get_included_force_field_paths(ff_parameter_dict, installed=True, local=True)¶
Return the list of included force field paths from the given force field dictionary.
- Parameters
ff_parameter_dict (dict) – the force field parameter dictionary
installed (bool) – if True then include force field paths from the installed location
local (bool) – if True then include force field paths from the local location
- Raises
ValueError – if there is an issue
- Return type
list[str]
- Returns
the included force field paths
- schrodinger.application.matsci.cgforcefield.is_force_field_encrypted(path=None, data=None, include=False)¶
Return True if the given path or data is for an encrypted force field.
- Parameters
path (str or None) – the path to the force field file to read, if None then data must be given
data (dict or None) – the force field parameter dictionary, if None then path must be given
include (bool) – whether to recurse any included force field paths
- Raises
ValueError – if there is an issue
- Return type
bool
- Returns
whether the force field is encrypted
- schrodinger.application.matsci.cgforcefield.recurse_include(ff_parameters_dict)¶
Return a copy of the given force field parameters dictionary where any included force field paths are recursed.
- Parameters
ff_parameters_dict (dict) – the force field parameters dictionary
- Return type
dict
- Returns
the recursed force field parameters dictionary
- schrodinger.application.matsci.cgforcefield.load_force_field_parameters(path, include=False)¶
Load force field parameters.
- Parameters
path (str) – the path to the force field file to read
include (bool) – whether to recurse any included force field paths
- Return type
dict
- Returns
the force field parameters dictionary
- schrodinger.application.matsci.cgforcefield.is_type_name_encrypted(type_name, type_key, ff_parameters_dict)¶
Return whether the given type name is encrypted.
- Parameters
type_name (str) – the type name
type_key (str) – the type key
ff_parameters_dict (dict) – the force field parameters dictionary
- Return type
bool
- Returns
True if the given type name is encrypted
- schrodinger.application.matsci.cgforcefield.get_type_name(types)¶
Get combined name for a parameter based on the given particle names
- Parameters
types (tuple) – A tuple of particle names that should be joined together for form the type name
- Return type
str
- Returns
The particle names in types joined by the TYPE_SEPARATOR character
- schrodinger.application.matsci.cgforcefield.split_type_name(name)¶
Split a type name up into particle types based on the TYPE_SEPARATOR delimiter
- Parameters
name (str) – A string with the particle type names joined by the TYPE_SEPARATOR delimiter
- Return type
list
- Returns
The list of particle type names that formed name
- schrodinger.application.matsci.cgforcefield.get_vdw_type_name(ff_type, name)¶
Get the VDW type name based on the given FF type and site name.
- Parameters
ff_type (str) – The FF type
name (str) – The name of the site for this vdw type
- Return type
str
- Returns
The VDW type name for this particle name
- schrodinger.application.matsci.cgforcefield.create_ffio_block(struct)¶
Given a structure, create an empty ffio block for it. Return structure copy and its ffio block.
- Parameters
struct (structure.Structure) – Input structure
- Return type
- Returns
Input structure copy, FFIO block
- class schrodinger.application.matsci.cgforcefield.QEMDCms(struct)¶
Bases:
object
Class to generate a CMS from the QE MD output.
- __init__(struct)¶
Create an instance.
- Parameters
struct (structure.Structure) – Input structure
- write(cms_fn)¶
Write
*cms
file.- Parameters
cms_fn (str) – CMS output file name
- setMass()¶
Set masses in the ffio.site sites from the self.st atoms’ masses.
- class schrodinger.application.matsci.cgforcefield.CGFFIOStructure(st)¶
Bases:
object
Manage building a coarse grain structure.
- __init__(st)¶
Create an instance.
- Parameters
st (structure.Structure) – the structure for which the coarse grain structure is needed
- setName(name='general')¶
Set the name.
- Parameters
name (str) – the name
- setCombiningRule(combining_rule='geometric')¶
Set the combining rule.
- Parameters
combining_rule (str) – the combining rule
- setDescription(description=None)¶
Set the description.
- Parameters
description (str or None) – the description or None if there isn’t one
- setFFType(ff_type='general')¶
Set the FF type.
- Parameters
ff_type (str or None) – the FF type, if None then GENERAL_TYPE is used
- writeCMS(st, file_name, encrypt=False)¶
Write
*cms
file.- Parameters
st (structure.Structure) – the full system structure
file_name (str) – the file name
encrypt (bool) – whether to encrypt the FF parameters in the cms
- class schrodinger.application.matsci.cgforcefield.FFIOParam(data, ff_type='general')¶
Bases:
object
The base class for FFIO parameters such as bonds, angles, VDW parameters, exclusions, etc.
- PARAM_ORDER = []¶
- NAMED_PROPERTIES = ['ai', 'aj', 'ak', 'al']¶
- CONSTANT_PROPERTIES = {}¶
- FUNCTION = ''¶
- CSTART = 1¶
- __init__(data, ff_type='general')¶
Create an instance
- Parameters
data (dict or None) – The two-level dictionary of forcefield data for this parameter. The top-level dictionary has one key - the function parameter for this object. The value is another dictionary. The keys in the inner dictionary are force field parameter names and the values are the values for those parameters. These values in most classes are converted to FFIO cx parameters using the PARAM_ORDER list.
ff_type (str) – the force field type, either GENERAL_TYPE or MARTINI_TYPE
- extractData(data)¶
Extract the data from the database parameters
- Parameters
data (dict) – The two-level dictionary of forcefield data for this parameter. The top-level dictionary has one key - the function parameter for this object. The value is another dictionary. The keys in the inner dictionary are force field parameter names and the values are the values for those parameters. These values in most classes are converted to FFIO cx parameters using the PARAM_ORDER list.
- getObject(fst)¶
Reimplement in subclasses to return the proper FFIO block object for the class
- Parameters
fst (
CGFFIOStructure
) – The structure to get the block object from- Return type
schrodinger.application.desmond.ffiostructure._FFIOSubBlock
- Returns
The block object for this parameter
- addParams(fobject)¶
Add the parameters taken from the database data to the FFIO block. These parameters generally have generic cx (x=integer) names.
- Parameters
fobject (ffiostructure._FFIOSubBlock) – The object to add the parameters to
- addNamedProperties(fobject, named_props)¶
Add the parameters passed to the addToFST method to the FFIO block. These parameters generally have custom names.
- Parameters
fobject (ffiostructure._FFIOSubBlock) – The object to add the parameters to
named_props (tuple) – Property values in the same order as the NAMED_PROPERTIES list
- addConstantProperties(fobject)¶
Add any properties that are constant for all instances of this class
- Parameters
fobject (ffiostructure._FFIOSubBlock) – The object to add the parameters to
- addToFFST(fst, *named_props)¶
Add a block with associated properties to the CGFFIO structure
- Parameters
fst (
CGFFIOStructure
) – The ffio structure to add the block to
@keywrd named_props: method arguments. There should be as many arguments and in the same order as the NAMED_PROPERTIES list
- Return type
schrodinger.application.desmond.ffiostructure._FFIOSubBlock
- Returns
The FFIO object with all parameters added to it.
- class schrodinger.application.matsci.cgforcefield.FFIOBond(data, ff_type='general')¶
Bases:
schrodinger.application.matsci.cgforcefield.FFIOParam
The class that handles the FFIO bond block
- PARAM_ORDER = ['eq_length/Ang.', 'force_constant/(kcal/mol)/Ang.^2']¶
- getObject(fst)¶
Return the ffio bond block
- Parameters
fst (
CGFFIOStructure
) – The structure to get the block object from- Return type
schrodinger.application.desmond.ffiostructure._FFIOBond
- Returns
The block object for this parameter
- extractData(data)¶
Extract the data from the database parameters
- Parameters
data (dict) – The two-level dictionary of forcefield data for this parameter. The top-level dictionary has one key - the function parameter for this object. The value is another dictionary. The keys in the inner dictionary are force field parameter names and the values are the values for those parameters. These values in most classes are converted to FFIO cx parameters using the PARAM_ORDER list.
- class schrodinger.application.matsci.cgforcefield.FFIOAngle(data, ff_type='general')¶
Bases:
schrodinger.application.matsci.cgforcefield.FFIOParam
The class that handles the FFIO angle block
- getObject(fst)¶
Return the ffio angle block
- Parameters
fst (
CGFFIOStructure
) – The structure to get the block object from- Return type
schrodinger.application.desmond.ffiostructure._FFIOAngle
- Returns
The block object for this parameter
- extractData(data)¶
Extract the data from the database parameters. Modified from the parent class because the cx parameters must be computed from the database data rather than using the data directly.
- Parameters
data (dict) – The two-level dictionary of forcefield data for this parameter. The top-level dictionary has one key - the function parameter for this object. The value is another dictionary. The keys in the inner dictionary are force field parameter names and the values are the values for those parameters.
- class schrodinger.application.matsci.cgforcefield.FFIODihedral(data, ff_type='general')¶
Bases:
schrodinger.application.matsci.cgforcefield.FFIOParam
The class that handles the FFIO dihedral block
- CSTART = 0¶
- getObject(fst)¶
Return the ffio dihedral block
- Parameters
fst (
CGFFIOStructure
) – The structure to get the block object from- Return type
schrodinger.application.desmond.ffiostructure._FFIODihedral
- Returns
The block object for this parameter
- extractData(data)¶
Extract the data from the database parameters. Modified from the parent class because the cx parameters must be computed from the database data rather than using the data directly and to add additional parameters that fill out the required c0-c6 parameter block.
- Parameters
data (dict) – The two-level dictionary of forcefield data for this parameter. The top-level dictionary has one key - the function parameter for this object. The value is another dictionary. The keys in the inner dictionary are force field parameter names and the values are the values for those parameters.
- class schrodinger.application.matsci.cgforcefield.FFIOImproper(data, ff_type='general')¶
Bases:
schrodinger.application.matsci.cgforcefield.FFIODihedral
The class that handles the FFIO improper block, which is just part of the dihedral block
- PARAM_ORDER = ['eq_angle/deg.', 'force_constant/(kcal/mol)/rad.^2']¶
- extractData(data)¶
Extract the data from the database parameters. Modified from the parent class to add additional parameters that fill out the required c0-c6 parameter block.
- Parameters
data (dict) – The two-level dictionary of forcefield data for this parameter. The top-level dictionary has one key - the function parameter for this object. The value is another dictionary. The keys in the inner dictionary are force field parameter names and the values are the values for those parameters. These values in most classes are converted to FFIO cx parameters using the PARAM_ORDER list.
- class schrodinger.application.matsci.cgforcefield.FFIOExclusion(data, ff_type='general')¶
Bases:
schrodinger.application.matsci.cgforcefield.FFIOParam
The class that handles the FFIO exclusion list block
- getObject(fst)¶
Return the ffio exclusion block
- Parameters
fst (
CGFFIOStructure
) – The structure to get the block object from- Return type
schrodinger.application.desmond.ffiostructure._FFIOExclusion
- Returns
The block object for this parameter
- class schrodinger.application.matsci.cgforcefield.FFIOVdwType(data, ff_type='general')¶
Bases:
schrodinger.application.matsci.cgforcefield.FFIOParam
The class that handles the FFIO VdW type list block
- NAMED_PROPERTIES = ['name']¶
- FUNCTION = 'polynomial_cij'¶
- getObject(fst)¶
Return the ffio Vdwtype block
- Parameters
fst (
CGFFIOStructure
) – The structure to get the block object from- Return type
schrodinger.application.desmond.ffiostructure._FFIOVdwtype
- Returns
The block object for this parameter
- class schrodinger.application.matsci.cgforcefield.FFIOSite(data, ff_type='general')¶
Bases:
schrodinger.application.matsci.cgforcefield.FFIOParam
The class that handles the FFIO site block
- NAMED_PROPERTIES = ['site', 'vdwtype', 'mass', 'charge']¶
- CONSTANT_PROPERTIES = {'type': 'atom'}¶
- getObject(fst)¶
Return the ffio Site block
- Parameters
fst (
CGFFIOStructure
) – The structure to get the block object from- Return type
schrodinger.application.desmond.ffiostructure._FFIOSite
- Returns
The block object for this parameter
- extractData(data)¶
Extract the data from the database parameters. Modified from the parent class because unlike other blocks, sites do not have cx parameters but do have named parameters that appear in the database dictionary.
- Parameters
data (dict) – The two-level dictionary of forcefield data for this parameter. The top-level dictionary has one key - the function parameter for this object. The value is another dictionary. The keys in the inner dictionary are force field parameter names and the values are the values for those parameters.
- setDielectricConstant(dielectric)¶
Set the dielectric constant for the site.
- Parameters
dielectric (float) – the dielectric constant
- addNamedProperties(fobject, named_props)¶
Add the parameters passed to the addToFST method to the FFIO block. These parameters generally have custom names. Modified from the parent class to include the mass and charge parameters which have been extracted from the database dictionary.
- Parameters
fobject (ffiostructure._FFIOSite) – The object to add the parameters to
named_props (list) – Two item list, first item is the name of the site and second is the vdw type of the site
- class schrodinger.application.matsci.cgforcefield.FFIOVdwTypesCombined(cutoff, dielectric, charge_i, charge_j, coulomb_type, *args, **kwargs)¶
Bases:
schrodinger.application.matsci.cgforcefield.FFIOParam
The class that handles the FFIO combined VdW block
- FUNCTION = 'polynomial_cij'¶
- NAMED_PROPERTIES = ['name1', 'name2']¶
- CONSTANT_PROPERTIES = {'t1': 1}¶
- DEFAULT_COULOMB = {'Lennard-Jones': 'ewald', 'Shifted Lennard-Jones': 'shifted_lj'}¶
- __init__(cutoff, dielectric, charge_i, charge_j, coulomb_type, *args, **kwargs)¶
Create an instance
- Parameters
cutoff (float) – The force field cutoff parameter in Angstroms
dielectric (float) – The force field dielectric constant
charge_i (float) – the charge on the first site
charge_j (float) – the charge on the second site
coulomb_type (str or None) – the coulomb method to use for electrostatic interactions. If None the method would be selected depending on the type of non-bonded interaction.
See parent class for additional argument documentation
- getObject(fst)¶
Return the ffio VdwTypeCombined block
- Parameters
fst (
CGFFIOStructure
) – The structure to get the block object from- Return type
schrodinger.application.desmond.ffiostructure._FFIOVdwtypescombined
- Returns
The block object for this parameter
- extractData(data)¶
Extract the data from the database parameters. Modified from the parent class because the cx parameters must be computed from the database data rather than using the data directly.
- Parameters
data (dict) – The two-level dictionary of forcefield data for this parameter. The top-level dictionary has one key - the function parameter for this object. The value is another dictionary. The keys in the inner dictionary are force field parameter names and the values are the values for those parameters.
- getAlphaParameter()¶
Return the alpha parameter.
- Return type
float
- Returns
the alpha parameter
- getWidthParameter(cutoff, ewald_epsilon=1e-09)¶
Return the Ewald charge distribution width parameter.
- Parameters
cutoff (float) – The cutoff parameter in Angstroms
ewald_epsilon (float) – parameter in reciprocal Ang. used to determine the width
- Return type
float
- Returns
the width in reciprocal Ang.
- getScaledEwaldConstants()¶
Scale the given Ewald constant given the cutoff and exponent.
- Return type
dict
- Returns
Keys are index and values are scaled Ewald constants to use for the parameter with that index
- getEwaldRealSpaceFFIOConstants()¶
Return the Ewald real space Coulomb potential FFIO constants.
- Return type
dict
- Returns
The real space FFIO constants. Keys are 1-based parameter index as in r_ffio_c<idx>, and values are the constants
- getShiftedLennardJonesFFIOConstants(epsilon, sigma, key=(12, 6, 9.0, 12.0))¶
Return the shifted Lennard-Jones potential FFIO constants.
- Parameters
epsilon (float) – the epsilon parameter in kcal/mol
sigma (float) – the sigma parameter in Ang.
key (str) – the key that indexes the fit constants, should be keys for the sigma dicts used in SHIFTED_LJ_FIT
- Return type
dict
- Returns
The shifted Lennard-Jones FFIO constants. Keys are 1-based parameter index as in r_ffio_c<idx>, and values are the constants
- getShiftedCoulombFFIOConstants(key=(0.0, 12.0))¶
Return the shifted Coulomb potential FFIO constants.
- Parameters
key (str) – the key that indexes the fit constants, should be keys used in SHIFTED_COULOMB_FIT
- Return type
dict
- Returns
The shifted Coulomb FFIO constants. Keys are 1-based parameter index as in r_ffio_c<idx>, and values are the constants
- getFFIOConstants()¶
Return the FFIO constants.
- Return type
list
- Returns
the FFIO constants as a list in order from 0 to NTERMS. All constants, including those defined as zero, are included in the list.
- exception schrodinger.application.matsci.cgforcefield.MissingParameterError¶
Bases:
Exception
Raised if the force field is missing required data for a structure
- exception schrodinger.application.matsci.cgforcefield.MixedPotentialsException¶
Bases:
Exception
- class schrodinger.application.matsci.cgforcefield.VDWData(vtype, charge)¶
Bases:
tuple
- charge¶
Alias for field number 1
- vtype¶
Alias for field number 0
- class schrodinger.application.matsci.cgforcefield.ShadowData(name1, name2, depth)¶
Bases:
tuple
- depth¶
Alias for field number 2
- name1¶
Alias for field number 0
- name2¶
Alias for field number 1
- class schrodinger.application.matsci.cgforcefield.AngleAdaptationMixin¶
Bases:
object
Manage adapting the angles of a FF that has already been applied to a structure.
- static isBackboneAtom(atom)¶
Return True if the given atom is a backbone atom.
- Parameters
atom (
schrodinger.structure._StructureAtom
) – the atom- Return type
bool
- Returns
True if the given atom is a backbone atom
- isSideChainAtom(atom)¶
Return True if the given atom is a sidechain atom.
- Parameters
atom (
schrodinger.structure._StructureAtom
) – the atom- Return type
bool
- Returns
True if the given atom is a sidechain atom
- static isKeepSideChainAtom(atom)¶
Return True if the given atom is a sidechain atom for which the backbone-backbone-sidechain angle will be kept.
- Parameters
atom (
schrodinger.structure._StructureAtom
) – the atom- Return type
bool
- Returns
True if the given atom is a sidechain atom for which the backbone-backbone-sidechain angle will be kept
- getBondedSideChainAtoms(atom)¶
Return a tuple of side chain atoms bonded to the given atom.
- Parameters
atom (
schrodinger.structure._StructureAtom
) – the atom- Return type
tuple[
schrodinger.structure._StructureAtom
]- Returns
contains the bonded side chain atoms
- getBackboneIdxs(**kwargs)¶
- getTerminiIdxs(**kwargs)¶
- getOrderedBackbone(**kwargs)¶
- getLeftAngles(fst, mol_idx)¶
For the given molecule return a set of (backbone_l, backbone, sidechain) angles where backbone_l is to the left of backbone.
- Parameters
fst (
ffiostructure.FFIOStructure
) – the FFIO structuremol_idx (int) – the molecule index
- Return type
list[tuple]
- Returns
the left angles, each tuple is a triple of atom indices
- deleteAngles(fst)¶
Delete angles.
- Parameters
fst (
ffiostructure.FFIOStructure
) – the FFIO structure
- adaptAngles(cgfst)¶
Adapt the angles of the FF applied to the given structure.
- Parameters
cgfst (
CGFFIOStructure
) – the CG FFIO structure
- class schrodinger.application.matsci.cgforcefield.RestraintAdaptationMixin¶
Bases:
object
Manage adapting the restraints of a FF that has already been applied to a structure.
- addRestraints(fst)¶
Add restraints.
- Parameters
fst (
ffiostructure.FFIOStructure
) – the FFIO structure- Raises
RuntimeError – if there is an issue
- adaptRestraints(cgfst)¶
Adapt the restraints of the FF applied to the given structure.
- Parameters
cgfst (
CGFFIOStructure
) – the CG FFIO structure
- class schrodinger.application.matsci.cgforcefield.ForceField(path=None, data=None, coulomb_type=None)¶
Bases:
schrodinger.application.matsci.cgforcefield.AngleAdaptationMixin
,schrodinger.application.matsci.cgforcefield.RestraintAdaptationMixin
Reads in force field data and applies it to a structure
- FP_CLASSES = {'angles': <class 'schrodinger.application.matsci.cgforcefield.FFIOAngle'>, 'bonds': <class 'schrodinger.application.matsci.cgforcefield.FFIOBond'>, 'impropers': <class 'schrodinger.application.matsci.cgforcefield.FFIOImproper'>, 'sites': <class 'schrodinger.application.matsci.cgforcefield.FFIOSite'>}¶
- __init__(path=None, data=None, coulomb_type=None)¶
Create a ForceField instance
- Parameters
path (str) – The path to the force field file. Not used if data is provided. Can be encrypted using the enc module.
data (dict) – The dictionary that defines the force field. If not provided, the database will be read from path. Can include encrypted force field paths.
coulomb_type (str or None) – The coulomb method to use for electrostatic interactions. If None the method would be selected depending on the type of non-bonded interaction.
- Raises
ValueError – if neither path nor data have been provided
- getKeyData(key, fail_on_missing=True, data=None)¶
Get the force field data for key
- Parameters
key (str) – A top level key for the force field data dictionary
fail_on_missing (bool) – True if an exception should be raised if the key is not in the force field data. If False, None will be returned for a missing key
data (dict or None) – the force field parameters dictionary, if None the stored attribute is used
- Returns
the value associated with key, or None if key is missing and fail_on_missing is False
- Raises
MissingParameterError – If key is missing and fail_on_missing is True
- defineInternals(struct, data=None)¶
Define the internal coordinates (bonds, angles, dihedrals, included and excluded nonbonds, etc) for the structure
- Parameters
struct (
schrodinger.structure.Structure
) – The structure to use when defining internals.data (dict or None) – the force field parameters dictionary, if None the stored attribute is used
- getDatabaseData(names, key, fail_on_missing=True, data=None)¶
Get the database data of type key for the particles with the given names. The names be ordered in the same way they would be ordered by the coarsegrain.Internals class and the proper number of names must be provided for the desired type - two for bonds, three for angles, etc.
- Parameters
names (tuple) – The names of the particles to retrieve data for
key (str) – One of the top level keys in the database dictionary. Should be one of the
*_INTERNAL_KEY
constantsfail_on_missing (bool) – Whether missing database data should cause a MissingParameterError. If False, no error is raised and None is returned
data (dict or None) – the force field parameters dictionary, if None the stored attribute is used
- Return type
dict or None
- Returns
A dictionary of database data. The key is the function type and the value is a dictionary of parameter keys and values. None is returned if no data exists and fail_on_missing is False.
- Raises
MissingParameterError – If fail_on_missing is True and there is no data
- getFFIOParam(names, key, fail_on_missing=True, data=None)¶
Get the FFIOParam object for the given particle names and key
- Parameters
names (tuple) – The names of the particles to retrieve data for
key (str) – One of the top level keys in the database dictionary. Should be one of the
*_INTERNAL_KEY
constants that is a key in the FP_CLASSES dictionary.fail_on_missing (bool) – Whether missing database data should cause a MissingParameterError. If False, no error is raised and None is returned
data (dict or None) – the force field parameters dictionary, if None the stored attribute is used
- Return type
FFIOParam
or None- Returns
The FFIOParam object that handles the data for this internal. None is returned if no data exists and fail_on_missing is False.
- addProperties(struct, fst, data=None)¶
Add some force field properties to the structures.
- Parameters
struct (
schrodinger.structure.Structure
) – The structure to add properties tofst (
CGFFIOStructure
) – The FFIO structure to add properties todata (dict or None) – the force field parameters dictionary, if None the stored attribute is used
- static getPotentialType(data, key, default)¶
Return the most common potential type for this forcefield for the given key.
- Parameters
data (dict) – the FF dictionary
key (str) – the top level key of the block to inspect
default (str) – a default potential type in case one is not present in the given FF dictionary
- Return type
str
- Returns
the potential type
- static getSiteType(data)¶
Determine the site type for this forcefield by inspecting one of the site parameter blocks. We assume all blocks use the same type so an arbitrary block is chosen.
- Parameters
data (dict) – the FF dictionary
- Return type
str
- Returns
the site type such as SITES_GENERAL_ATOM_KEY
- static getAngleType(data)¶
Determine the angle type for this forcefield by inspecting one of the angle parameter blocks. We assume all blocks use the same type so an arbitrary block is chosen.
- Parameters
data (dict) – the FF dictionary
- Return type
str
- Returns
the angle type such as ANGLES_HARMONIC_KEY
- static getDihedralType(data)¶
Determine the dihedral type for this forcefield by inspecting one of the dihedral parameter blocks. We assume all blocks use the same type so an arbitrary block is chosen.
- Parameters
data (dict) – the FF dictionary
- Return type
str
- Returns
the dihedral type such as DIHEDRALS_OPLS_PROPER_KEY
- static getNonBondType(data)¶
Determine the nonbond type for this forcefield by inspecting one of the nonbond parameter blocks. We assume all blocks use the same type so an arbitrary block is chosen.
- Parameters
data (dict) – the FF dictionary
- Return type
str
- Returns
the nonbond type such as coarsegrain.LENNARD_JONES
- static definedShadowBonds(data)¶
A generator over all defined shadow bonds in the force field. A shadow bond is a bond that doesn’t physically exist in the structure but exists in the forcefield as a bonding attraction between two particles.
- Parameters
data (dict) – The dictionary defining the force field, such as provided by load_force_field_parameters.
- Return type
- Returns
A ShadowData namedtuple that provides the names of the two particles and the number of bonds that seperate them.
- adaptFF(cgfst)¶
Adapt the applied FF to the structure.
- Parameters
cgfst (
CGFFIOStructure
) – the CG FFIO structure
- applyFF(struct, internals=None, filename=None, ff_name=None, encrypt=None, adapt_ff=False)¶
Apply the force field to the structure
- Parameters
struct (
schrodinger.structure.Structure
) – The structure to apply the force fieldinternals (
schrodinger.appliction.matsci.coarsegrain.Internals
) – The set of internal coordinates computed from the structure. If not provided, they will be computed.filename (str) – If provided, a Cms structure with the applied force field will be written to this file path
ff_name (str or None) – the name of the forcefield used if self.ff_name is None, if None and self.ff_name is None then the default of FFIO_NAME will be used
encrypt (bool or None) – whether to encrypt the FF parameters in the written cms, if None and an encrypted CG FF file was used at instantiation then the cms is automatically encrypted
adapt_ff (bool) – applies structure specific modifications to the FF after its raw application to the given structure
- Return type
- Returns
The CMS structure with the force field applied
- Raises
MissingParameterError – If required data is missing from the force
TypeError – If struct is not a coarse grain structure
KeyError – If struct does not have chorus box PBC properties
LicenseError – If the license is not available for using coarse grain force fields
- schrodinger.application.matsci.cgforcefield.create_cg_system(struct, ff_path, filename=None, pbc_position=None, coulomb_type=None, encrypt=None, adapt_ff=False, scale=False)¶
Apply the force field located at ff_path to struct and return the resulting CMS object
- Parameters
struct (
schrodinger.structure.Structure
) – The structure to apply the forcefield toff_path (str) – The path to the force field file
filename (str) – If given, the CMS structure will be written to this file
pbc_position (str or None) – Set the pbc position. If not None, pbc_position must be either xtal.CENTER_PBC_POSITION or xtal.ANCHOR_PBC_POSITION
coulomb_type (str or None) – The coulomb method to use for electrostatic interactions. If None the method would be selected depending on the type of non-bonded interaction.
encrypt (bool or None) – whether to encrypt the FF parameters in the returned cms, if None and an encrypted CG FF file has been given then the cms is automatically encrypted
adapt_ff (bool) – applies structure specific modifications to the FF after its raw application to the given structure
scale (bool) – Scale the lattice vector to get density representative of the force field parameters
- Return type
- Returns
The Cms object that results from applying the force field to the structure
- schrodinger.application.matsci.cgforcefield.validate_options(parser, args, ff_flag, cg_ff_loc_type_flag, input_file_flag=None, input_sts=None)¶
Validate options.
- Parameters
parser (argparse.ArgumentParser) – argument parser to validate
args (list) – the arguments to parse
ff_flag (str) – the force field flag
cg_ff_loc_type_flag (str) – the coarse-grained force field location type flag
input_file_flag (str or None) – the input file flag or None if using input_sts
input_sts (list or None) – the input structures or None if using input_file_flag
- Return type
named tuple
- Returns
argparse parsed specified options
- schrodinger.application.matsci.cgforcefield.add_local_type_force_field_to_job_builder_w_check(builder, options, ff_flag, cg_ff_loc_type_flag, input_file_flag=None, input_sts=None)¶
Check and set up the Launch API Job Builder to use the given local type force field.
- Parameters
builder (
schrodinger.job.launchapi.JobSpecificationArgsBuilder
) – the job builder to use for setting the FF as an input fileoptions (named tuple) – argparse parsed specified options
ff_flag (str) – the force field flag
cg_ff_loc_type_flag (str) – the coarse-grained force field location type flag
input_file_flag (str or None) – the input file flag or None if using input_sts
input_sts (list or None) – the input structures or None if using input_file_flag
- class schrodinger.application.matsci.cgforcefield.MartiniProteinFFCleaner(struct)¶
Bases:
object
A class to clean up the Martini protein force field FFIO block
- PREV_BACKBONE_SITE_PROP = 'i_m_previous_backbone_site_relative'¶
- RESTRAINT_PROP = 's_m_relative_restraint'¶
- BACKBONE_SUFFIX = '_B'¶
- SIDE_CHAIN_ATOMS = ['PHE_S3', 'TYR_S3']¶
- EXCLUSION_BIG_RING_SIZE = 20¶
- __init__(struct)¶
Initialize the FFIO block cleaner
- Parameters
struct (schrodinger.application.desmond.ffiostructure.FFIOStructure) – The structure to clean
- isBackboneAtom(atom)¶
Determine if an atom is a backbone atom.
- Parameters
atom (schrodinger.structure._StructureAtom) – The atom to check
- Returns
True if the atom is a backbone atom, False otherwise
- Return type
bool
- isProteinStructure()¶
Determine if the structure is a protein structure.
- Returns
True if the structure is a protein structure, False otherwise
- Return type
bool
- getBondedSideChainAtom(atom)¶
Get the bonded side chain atom for a backbone atom, in the case of multiple side chain atoms, the last side chain atom is returned.
- Parameters
atom (schrodinger.structure._StructureAtom) – The backbone atom
- Returns
The bonded side chain atom or None if there is no side chain atom
- Return type
schrodinger.structure._StructureAtom or None
- isBackboneSidechain(angle_aids)¶
Determine if the angle is a backbone-sidechain angle.
- Parameters
angle_aids (tuple(int)) – The atom indices of the angle
- Returns
True if the angle is a backbone-sidechain angle, False otherwise
- Return type
bool
- findNTerminiAtomIds(molecule)¶
Find the N-terminus backbone sites in a molecule using the PREV_BACKBONE_SITE_PROP property.
- Parameters
molecule (schrodinger.structure.Molecule) – The molecule to find the N-terminus backbone sites in
- Returns
The set of N-terminus backbone atom indices
- Return type
set(int)
- findBackboneAtomsIds(start_atom)¶
Find the backbone atoms sequentially from the starting atom.
- Parameters
start_atom (schrodinger.structure.Atom) – The atom to start the search from
- Returns
The list of backbone atom indices
- Return type
list(int)
- findBackboneAngles(backbone)¶
Find the backbone angles in a molecule
- Parameters
backbone (list(int)) – The backbone atom indices
- Returns
The set of backbone angles
- Return type
set(tuple(int))
- deleteExtraAngles()¶
Delete the extra angles in the component
- addHarmonicRestraints()¶
Add harmonic restraints to the component using the value set in the atom property
- mergeRings(simple_rings)¶
Merge rings that share atoms into a single rings
- Parameters
simple_rings (list(list(int))) – The simple rings to merge
- Returns
The merged rings
- Return type
list(set(int))
- adjustExclusions()¶
Delete exclusions between atoms that are part of the same large ring but not part of a small ring.
- clean()¶
Cleanup the ffio structure
- schrodinger.application.matsci.cgforcefield.cleanup_martini_protein(cmsfile)¶
Cleanup a Martini protein force field parameters in the cms file
- Parameters
cmsfile (str) – The path of cms file to cleanup