vermouth.forcefield module¶
Provides a class used to describe a forcefield and all associated data.
-
class
vermouth.forcefield.
ForceField
(directory=None, name=None)[source]¶ Bases:
object
Description of a force field.
A force field can be created empty or read from a directory. In any case, a force field must be named. If read from a directory, the base name of the directory is used as force field name, unless the name attribute is provided. If the force field is created empty, then name must be provided.
Parameters: - directory (str or pathlib.Path, optional) – A directory to read the force field from.
- name (str, optional) – The name of the force field.
-
has_feature
(feature)[source]¶ Test if a feature is declared by the links.
Parameters: feature (str) – The name of the feature of interest. Returns: Return type: bool
-
vermouth.forcefield.
find_force_fields
(directory, force_fields=None)[source]¶ Read all the force fields in the given directory.
A force field is defined as a directory that contains at least one RTP file. The name of the force field is the base name of the directory.
If the force field argument is not
None
, then it must be a dictionary with force field names as keys and instances ofForceField
as values. The force fields in the dictionary will be updated if force fields with the same names are found in the directory.Parameters: - directory (pathlib.Path or str) – The path to the directory containing the force fields.
- force_fields (dict) – A dictionary of force fields to update.
Returns: A dictionary of force fields read or updated. Keys are force field names as strings, and values are instances of
ForceField
. If a dictionary was provided as the “force_fields” argument, then the returned dictionary is the same instance as the one provided but with updated content.Return type:
-
vermouth.forcefield.
get_native_force_field
(name)[source]¶ Get a force field from the distributed library knowing its name.
Parameters: name (str) – The name of the requested force field. Returns: Return type: ForceField Raises: KeyError
– There is no force field with the requested name in the distributed library.