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.

blocks
Type:

dict

Type:

list

modifications
Type:

dict

renamed_residues
Type:

dict

name
Type:

str

variables
Type:

dict

property features

List the features declared by the links.

Return type:

set

has_feature(feature)[source]

Test if a feature is declared by the links.

Parameters:

feature (str) – The name of the feature of interest.

Return type:

bool

read_from(directory)[source]

Populate or update the force field from a directory.

The provided directory must contain a subdirectory with the same name as the force field.

property reference_graphs

Returns all known blocks.

Return type:

dict

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 of ForceField 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:

dict

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.

Return type:

ForceField

Raises:

KeyError – There is no force field with the requested name in the distributed library.

vermouth.forcefield.iter_force_field_files(directory, extensions=dict_keys(['.rtp', '.ff', '.bib']))[source]

Returns a generator over the path of all the force field files in the directory.