Package schrodinger :: Package application :: Package matsci :: Module cgforcefield :: Class ForceField
[hide private]
[frames] | no frames]

Class ForceField

object --+
         |
        ForceField

Reads in force field data and applies it to a structure

Instance Methods [hide private]
 
__init__(self, path=None, data=None)
Create a ForceField instance
 
getKeyData(self, key, fail_on_missing=True)
Get the force field data for key
 
defineInternals(self, struct)
Define the internal coordinates (bonds, angles, dihedrals, included and excluded nonbonds, etc) for the structure
dict or None
getDatabaseData(self, names, key, fail_on_missing=True)
Get the database data of type key for the particles with the given names.
FFIOParam or None
getFFIOParam(self, names, key, fail_on_missing=True)
Get the FFIOParam object for the given particle names and key
 
addProperties(self, struct)
Add some force field properties to the structure
dict
_applySites(self, fst)
Apply the force field site data
 
_applyBAD(self, fst)
Apply the force field bond, angle and dihedral data
 
_applyExclusions(self, fst)
Apply the exclusions to the fst structure
 
_applyVdwCombined(self, fst, vdw_sites)
Apply the force field vdw combined (nonbond) data
 
_findShadowBonds(self)
Find all the pairs that are not actually bonded but are considered bonded because the user defined them as such in the Force Field panel.
schrodinger.application.desmond.cms.Cms
applyFF(self, struct, internals=None, filename=None, ff_name=None)
Apply the force field to the structure

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
str
getNonBondType(data)
Determine the nonbond type for this forcefield by inspecting one of the nonbond parameter blocks.
ShadowData
definedShadowBonds(data)
A generator over all defined shadow bonds in the force field.
Class Variables [hide private]
  FP_CLASSES = {'angles': <class 'schrodinger.application.matsci...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, path=None, data=None)
(Constructor)

 

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
Overrides: object.__init__

getKeyData(self, 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:

defineInternals(self, struct)

 

Define the internal coordinates (bonds, angles, dihedrals, included and excluded nonbonds, etc) for the structure

Parameters:

getDatabaseData(self, 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
Returns: dict or None
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:

getFFIOParam(self, 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
Returns: FFIOParam or None
The FFIOParam object that handles the data for this internal. None is returned if no data exists and fail_on_missing is False.

addProperties(self, struct)

 

Add some force field properties to the structure

Parameters:

getNonBondType(data)
Static Method

 

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.

Returns: str
The nonbond type such as coarsegrain.LENNARD_JONES

_applySites(self, fst)

 

Apply the force field site data

Parameters:
Returns: dict
Keys are particle names, values are VDWData namedtuples
Raises:

_applyBAD(self, fst)

 

Apply the force field bond, angle and dihedral data

Parameters:
Raises:

_applyExclusions(self, fst)

 

Apply the exclusions to the fst structure

Parameters:

_applyVdwCombined(self, fst, vdw_sites)

 

Apply the force field vdw combined (nonbond) data

Parameters:
  • fst (CGFFIOStructure) - The FFIO structure to apply the data to
  • vdw_sites (dict) - Keys are particle names, values are VDWData namedtuples
Raises:

definedShadowBonds(data)
Static Method

 

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.
Returns: ShadowData
A ShadowData namedtuple that provides the names of the two particles and the number of bonds that seperate them.

applyFF(self, 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
Returns: schrodinger.application.desmond.cms.Cms
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

Class Variable Details [hide private]

FP_CLASSES

Value:
{'angles': <class 'schrodinger.application.matsci.cgforcefield.FFIOAng\
le'>,
 'bonds': <class 'schrodinger.application.matsci.cgforcefield.FFIOBond\
'>,
 'dihedrals': <class 'schrodinger.application.matsci.cgforcefield.FFIO\
Dihedral'>,
 'sites': <class 'schrodinger.application.matsci.cgforcefield.FFIOSite\
'>}