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.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.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()

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_FF_LOCATION_TYPE for FF_PARAMETERS_INSTALLED_PATH and LOCAL_FF_LOCATION_TYPE for FF_PARAMETERS_LOCAL_PATH.

Return type:dict
Returns:top level keys are either INSTALLED_FF_LOCATION_TYPE or LOCAL_FF_LOCATION_TYPE while inner OrderedDicts have force field names as keys and absolute paths to force field files as values, inner dictionaries are sorted
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 file
  • ffname (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_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_FF_LOCATION_TYPE or LOCAL_FF_LOCATION_TYPE
  • local_type_includes_cwd (bool) – whether the LOCAL_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.load_force_field_parameters(path)

Load force field parameters.

Parameters:path (str) – The path to the force field file to read
Return type:dict or None
Returns:the force field parameters dictionary or None if there isn’t one
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

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
createFFIOBlock()

Create a ffio block in the structure.

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)

Write *cms file.

Parameters:
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.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:
  • fobject – 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

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.
CONSTANT_PROPERTIES = {}
CSTART = 1
FUNCTION = ''
NAMED_PROPERTIES = ['ai', 'aj', 'ak', 'al']
__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
addConstantProperties(fobject)

Add any properties that are constant for all instances of this class

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:
  • fobject – The object to add the parameters to
  • named_props (tuple) – Property values in the same order as the NAMED_PROPERTIES list
addParams(fobject)

Add the parameters taken from the database data to the FFIO block. These parameters generally have generic cx (x=integer) names.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.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.
CONSTANT_PROPERTIES = {}
CSTART = 1
FUNCTION = ''
NAMED_PROPERTIES = ['ai', 'aj', 'ak', 'al']
PARAM_ORDER = []
__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
addConstantProperties(fobject)

Add any properties that are constant for all instances of this class

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:
  • fobject – The object to add the parameters to
  • named_props (tuple) – Property values in the same order as the NAMED_PROPERTIES list
addParams(fobject)

Add the parameters taken from the database data to the FFIO block. These parameters generally have generic cx (x=integer) names.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.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.
CONSTANT_PROPERTIES = {}
FUNCTION = ''
NAMED_PROPERTIES = ['ai', 'aj', 'ak', 'al']
PARAM_ORDER = []
__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
addConstantProperties(fobject)

Add any properties that are constant for all instances of this class

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:
  • fobject – The object to add the parameters to
  • named_props (tuple) – Property values in the same order as the NAMED_PROPERTIES list
addParams(fobject)

Add the parameters taken from the database data to the FFIO block. These parameters generally have generic cx (x=integer) names.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.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.
CONSTANT_PROPERTIES = {}
CSTART = 0
FUNCTION = ''
NAMED_PROPERTIES = ['ai', 'aj', 'ak', 'al']
__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
addConstantProperties(fobject)

Add any properties that are constant for all instances of this class

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:
  • fobject – The object to add the parameters to
  • named_props (tuple) – Property values in the same order as the NAMED_PROPERTIES list
addParams(fobject)

Add the parameters taken from the database data to the FFIO block. These parameters generally have generic cx (x=integer) names.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.
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
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
CONSTANT_PROPERTIES = {}
CSTART = 1
FUNCTION = ''
NAMED_PROPERTIES = ['ai', 'aj', 'ak', 'al']
PARAM_ORDER = []
__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
addConstantProperties(fobject)

Add any properties that are constant for all instances of this class

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:
  • fobject – The object to add the parameters to
  • named_props (tuple) – Property values in the same order as the NAMED_PROPERTIES list
addParams(fobject)

Add the parameters taken from the database data to the FFIO block. These parameters generally have generic cx (x=integer) names.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.
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.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
CONSTANT_PROPERTIES = {}
CSTART = 1
PARAM_ORDER = []
__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
addConstantProperties(fobject)

Add any properties that are constant for all instances of this class

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:
  • fobject – The object to add the parameters to
  • named_props (tuple) – Property values in the same order as the NAMED_PROPERTIES list
addParams(fobject)

Add the parameters taken from the database data to the FFIO block. These parameters generally have generic cx (x=integer) names.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.
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.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.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSite
Parameters:
  • fobject – 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
CSTART = 1
FUNCTION = ''
PARAM_ORDER = []
__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
addConstantProperties(fobject)

Add any properties that are constant for all instances of this class

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – The object to add the parameters to
addParams(fobject)

Add the parameters taken from the database data to the FFIO block. These parameters generally have generic cx (x=integer) names.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.FFIOVdwTypesCombined(cutoff, dielectric, charge_i, charge_j, *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}
__init__(cutoff, dielectric, charge_i, charge_j, *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

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.
CSTART = 1
PARAM_ORDER = []
addConstantProperties(fobject)

Add any properties that are constant for all instances of this class

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:
  • fobject – The object to add the parameters to
  • named_props (tuple) – Property values in the same order as the NAMED_PROPERTIES list
addParams(fobject)

Add the parameters taken from the database data to the FFIO block. These parameters generally have generic cx (x=integer) names.

:type
fobject:schrodinger.application.desmond.ffiostructure._FFIOSubBlock
Parameters:fobject – 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.
exception schrodinger.application.matsci.cgforcefield.MissingParameterError

Bases: Exception

Raised if the force field is missing required data for a structure

__init__

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.application.matsci.cgforcefield.VDWData(vtype, charge)

Bases: tuple

__contains__

Return key in self.

__init__

Initialize self. See help(type(self)) for accurate signature.

__len__

Return len(self).

charge

Alias for field number 1

count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

vtype

Alias for field number 0

class schrodinger.application.matsci.cgforcefield.ShadowData(name1, name2, depth)

Bases: tuple

__contains__

Return key in self.

__init__

Initialize self. See help(type(self)) for accurate signature.

__len__

Return len(self).

count(value) → integer -- return number of occurrences of value
depth

Alias for field number 2

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

name1

Alias for field number 0

name2

Alias for field number 1

class schrodinger.application.matsci.cgforcefield.ForceField(path=None, data=None)

Bases: object

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)

Create a ForceField instance

Parameters:
  • path (str) – The path to the force field file. Not used if data is provided
  • data (dict) – The dictionary that defines the force field. If not provided, the database will be read from path.
Raises:

ValueError – if neither path nor data have been provided

getKeyData(key, fail_on_missing=True)

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

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.
getDatabaseData(names, key, fail_on_missing=True)

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 constants
  • fail_on_missing (bool) – Whether missing database data should cause a MissingParameterError. If False, no error is raised and None is returned
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)

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

Add some force field properties to the structures.

Parameters:
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:ShadowData
Returns:A ShadowData namedtuple that provides the names of the two particles and the number of bonds that seperate them.
applyFF(struct, internals=None, filename=None, ff_name=None)

Apply the force field to the structure

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to apply the force field
  • internals (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
Return type:

schrodinger.application.desmond.cms.Cms

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
schrodinger.application.matsci.cgforcefield.create_cg_system(struct, ff_path, filename=None, pbc_position=None)

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 to
  • ff_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
Return type:

schrodinger.application.desmond.cms.Cms

Returns:

The Cms object that results from applying the force field to the structure