TLeapForceFieldSource

class openff.evaluator.forcefield.TLeapForceFieldSource(leap_source='leaprc.gaff2', cutoff=<Quantity(9.0, 'angstrom')>)[source]

A wrapper around Amber force fields which may be applied via the tleap software package.

Notes

Currently this only supports force fields which are installed alongside tleap.

__init__(leap_source='leaprc.gaff2', cutoff=<Quantity(9.0, 'angstrom')>)[source]

Constructs a new TLeapForceFieldSource object

Parameters
  • leap_source (str) – The parameter file which should be sourced by leap when applying the force field. Currently only ‘leaprc.gaff’ and ‘leaprc.gaff2’ are supported.

  • cutoff (pint.Quantity) – The non-bonded interaction cutoff.

Examples

To create a source for the GAFF force field with tip3p water:

>>> amber_gaff_source = TLeapForceFieldSource('leaprc.gaff')

To create a source for the GAFF 2 force field with tip3p water:

>>> amber_gaff_2_source = TLeapForceFieldSource('leaprc.gaff2')

Methods

__init__([leap_source, cutoff])

Constructs a new TLeapForceFieldSource object

from_json(file_path)

Create this object from a JSON file.

json([file_path, format])

Creates a JSON representation of this class.

parse_json(string_contents[, encoding])

Parses a typed json string into the corresponding class structure.

Attributes

cutoff

The non-bonded interaction cutoff.

leap_source

The parameter file which should be sourced by leap when applying the force field.

property leap_source

The parameter file which should be sourced by leap when applying the force field.

Type

list of str

property cutoff

The non-bonded interaction cutoff.

Type

pint.Quantity

classmethod from_json(file_path)

Create this object from a JSON file.

Parameters

file_path (str) – The path to load the JSON from.

Returns

The parsed class.

Return type

cls

json(file_path=None, format=False)

Creates a JSON representation of this class.

Parameters
  • file_path (str, optional) – The (optional) file path to save the JSON file to.

  • format (bool) – Whether to format the JSON or not.

Returns

The JSON representation of this class.

Return type

str

classmethod parse_json(string_contents, encoding='utf8')

Parses a typed json string into the corresponding class structure.

Parameters
  • string_contents (str or bytes) – The typed json string.

  • encoding (str) – The encoding of the string_contents.

Returns

The parsed class.

Return type

Any