forcefield
¶
Force fields are fun.
The forcefield structure is modeled off of the structures.py file, where each forcefield is considered a chain of residues of atoms.
Code author: Todd Dolinsky
Code author: Yong Huang
-
class
pdb2pqr.forcefield.
Forcefield
(ff_name, definition, userff, usernames=None)[source]¶ Parameter definitions for a given forcefield.
Note
Pass ff and ff names file like objects rather than sorting out whether to use user-created files here.
The forcefield class contains definitions for a given forcefield. Each forcefield object contains a dictionary of residues, with each residue containing a dictionary of atoms. Dictionaries are used instead of lists as the ordering is not important. The forcefield definition files are unedited, directly from the forcefield - all transformations are done within.
-
__init__
(ff_name, definition, userff, usernames=None)[source]¶ Initialize the class by parsing the definition file.
Todo
Why are files being loaded so deep in this function?
Parameters: - ff_name (str) – the name of the forcefield (can be None)
- definition (Definition) – the definition object for the Forcefield
- userff (str) – path for user-defined forcefields file
- usernames (str) – path to user-defined atom/residue names file
Raises: ValueError – if invalid force field names specified
-
classmethod
get_amber_params
(residue, name)[source]¶ Get AMBER forcefield definitions.
Todo
Should this be a staticmethod or a classmethod?
Todo
Figure out why residue.type has
int
valuesParameters: Returns: (forcefield name of residue, forcefield name of atom)
Return type:
-
classmethod
get_charmm_params
(residue, name)[source]¶ Get CHARMM forcefield definitions.
Todo
Should this be a staticmethod or a classmethod?
Todo
Figure out why residue.type has
int
valuesParameters: Returns: (forcefield name of residue, forcefield name of atom)
Return type:
-
get_group
(resname, atomname)[source]¶ Get the group/type associated with the input fields.
Parameters: Returns: group name or empty string
Return type:
-
get_names
(resname, atomname)[source]¶ Get forcefield names associated with residue and atom.
The names passed in point to ForcefieldResidue and ForcefieldAtom objects which may have different names; grab these names and return.
Parameters: Returns: (forcefield’s name for this residue, forcefield’s name for this atom)
Return type:
-
get_params
(resname, atomname)[source]¶ Get the charge and radius parameters for an atom in a residue.
The residue itself is needed instead of simply its name because the forcefield may use a different residue name than the standard amino acid name.
Todo
Why do both
get_params()
andget_params1()
exist?Parameters: Returns: (charge of the atom, radius of the atom)
Return type:
-
get_params1
(residue, name)[source]¶ Get the charge and radius parameters for an atom in a residue.
The residue itself is needed instead of simply its name because the forcefield may use a different residue name than the standard amino acid name.
Todo
Why do both
get_params()
andget_params1()
exist?Parameters: Returns: (charge of the atom, radius of the atom)
Return type:
-
classmethod
get_parse_params
(residue, name)[source]¶ Get PARSE forcefield definitions.
Todo
Should this be a staticmethod or a classmethod?
Parameters: Returns: (forcefield name of residue, forcefield name of atom)
Return type:
-
get_residue
(resname)[source]¶ Return the residue object with the given resname.
Parameters: resname (str) – the name of the residue Returns: residue object Return type: ForcefieldResidue
-
-
class
pdb2pqr.forcefield.
ForcefieldAtom
(name, charge, radius, resname, group='')[source]¶ ForcefieldAtom class.
Contains fields that are related to the forcefield at the atom level.
-
get
(name)[source]¶ Get a member of the ForcefieldAtom class.
Parameters: name (str) – the name of the member, including:
- name: The atom name (returns string)
- charge: The charge on the atom (returns float)
- radius: The radius of the atom (returns float)
- epsilon: The epsilon assocaited with the atom (returns float)
Returns: the value of the member Raises: KeyError – if member does not exist
-
-
class
pdb2pqr.forcefield.
ForcefieldHandler
(map_, reference)[source]¶ Process XML-format force field parameter files.
-
characters
(text)[source]¶ Parse text information within XML tag.
Parameters: text – the text value between the XML tags
-
classmethod
find_matching_names
(regname, map_)[source]¶ Find strings in the map that match the given regular expression.
Todo
Should this be a staticmethod instead of classmethod?
Parameters: Returns: a list of regular expression match objects for dictionary keys that match the regular expression.
Return type: [re.Match]
-
-
class
pdb2pqr.forcefield.
ForcefieldResidue
(name)[source]¶ ForcefieldResidue class
The ForceFieldResidue class contains a mapping of all atoms within the residue for easy searching.
-
__init__
(name)[source]¶ Initialize the ForceFieldResidue object.
Parameters: name (str) – the name of the residue
-
add_atom
(atom)[source]¶ Add an atom to the ForcefieldResidue object.
Parameters: atom (Atom) – the atom to be added
-
get_atom
(atomname)[source]¶ Return the atom object with the given atomname.
Parameters: resname (str) – the name of the atom Returns: the atom object Return type: ForcefieldAtom
-