peleffy.forcefield.parameters.OpenForceFieldParameterWrapper¶
-
class
peleffy.forcefield.parameters.
OpenForceFieldParameterWrapper
(parameters_dict={}, forcefield_name=None)[source]¶ It defines a parameters wrapper for an OpenFF force field.
-
__init__
(parameters_dict={}, forcefield_name=None)¶ It initializes a parameter wrapper object.
- Parameters
parameters_dict (dict) – A dictionary keyed by parameter type that contains the parameters to store. Default is an empty dict
forcefield_name (str) – The name of the force field the parameters belong to
-
add_parameters
(label, parameters)¶ It adds a list of parameters of the same type to the collection.
- Parameters
label (str) – The label to describe the parameter type
parameters (list) – The list of parameters to include to the collection
-
clear
() → None. Remove all items from D.¶
-
copy
() → a shallow copy of D¶
-
static
from_impact_template
(molecule, impact_template_path)¶ It returns a parameter wrapper out of an impact template.
- Parameters
molecule (a peleffy.topology.Molecule) – The peleffy’s Molecule object
impact_template_path (str) – The path to the impact template from where the parameters will be fetched
- Returns
params – The resulting parameters wrapper
- Return type
a BaseParameterWrapper object
Examples
Obtain a parameter wrapper from an Impact template.
>>> from peleffy.topology import Molecule
>>> molecule = Molecule('molecule.pdb') >>> impact_template_path = 'molz'
>>> from peleffy.forcefield.parameters import OpenForceFieldParametersWrapper
>>> wrapper_off = OpenForceFieldParametersWrapper() >>> parameters = wrapper_off.from_impact_template( molecule, impact_template_path)
-
static
from_json
(input_path)¶ It loads a json file containing the parameters into the parameter wrapper.
- Parameters
input_path (str) – The path to the json file to load the parameters from
- Returns
parameters – The resulting parameters wrapper
- Return type
a BaseParameterWrapper object
-
static
from_label_molecules
(molecule, parameters, openff_version)[source]¶ It parses the parameters coming from the label_molecules() method from OpenFF toolkit.
- Parameters
molecule (an peleffy.topology.Molecule) – The peleffy’s Molecule object
parameters_dict (dict) – A dictionary keyed by parameter type that contains the parameters to store
openff_version (str) – The version of the OpenFF force field the parameters belong to
- Returns
parameters – The resulting parameters wrapper
- Return type
an OpenForceFieldParameterWrapper object
-
fromkeys
(value=None, /)¶ Create a new dictionary with keys from iterable and values set to value.
-
get
(key, default=None, /)¶ Return the value for key if key is in the dictionary, else default.
-
is_empty
()¶ If the are no parameters stored in this wrapper, it returns True.
- Returns
answer – Whether this parameter wrapper is empty or not
- Return type
bool
-
items
() → a set-like object providing a view on D’s items¶
-
keys
() → a set-like object providing a view on D’s keys¶
-
pop
(k[, d]) → v, remove specified key and return the corresponding value.¶ If key is not found, d is returned if given, otherwise KeyError is raised
-
popitem
() → (k, v), remove and return some (key, value) pair as a¶ 2-tuple; but raise KeyError if D is empty.
-
setdefault
(key, default=None, /)¶ Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
-
to_json
(output_path)¶ It saves this parameter wrapper as a json file.
- Parameters
output_path (str) – The path to save the output json file
-
to_string
()¶ It returns a string representation of the parameters stored in the wrapper.
- Returns
string_repr – The string representation
- Return type
str
-
update
([E, ]**F) → None. Update D from dict/iterable E and F.¶ If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
-
values
() → an object providing a view on D’s values¶
Attributes
atom_iterator
It returns an iterator that goes through all atom parameters.
forcefield_name
name
It returns the name of the current parameter wrapper.
-