xnn.ffnn.models.oplslib.OPLSLibrary#

class xnn.ffnn.models.oplslib.OPLSLibrary(atom_types=<factory>, bond_types=<factory>, angle_types=<factory>, dihedral_types=<factory>, improper_types=<factory>, fudge_lj=0.5, fudge_qq=0.5, name='opls', references=<factory>, templates=<factory>, fragments=<factory>, metadata=<factory>, notes=<factory>)[source]#

Bases: object

A parsed OPLS parameter library, in OPLS units.

All energies are kcal/mol, lengths Angstrom, angles degrees. Bonded parameters are keyed by the equivalent atom types of the term joined with - ("opls_18-opls_18", "opls_85-opls_18-opls_18-opls_85"), exactly as a .frc file keys them; dihedral and improper keys may use the wildcard X ("X-opls_86-opls_86-X"). Every atom type records, per term, which equivalent type its parameters are looked up under (cls_bond etc.; cls is a synonym of cls_bond).

Parameters and attributes#

atom_typesdict[str, dict]

name -> {"cls", "cls_nonbond", "cls_bond", "cls_angle", "cls_torsion", "cls_oop", "element", "mass", "charge", "sigma", "epsilon", "connections", "comment"} where element is the atomic number and sigma / epsilon the Lennard-Jones parameters (Angstrom, kcal/mol).

bond_typesdict[str, dict]

"A-B" -> {"k", "r0"} for E = k (r - r0)^2 (OPLS/AMBER convention, without the 1/2).

angle_typesdict[str, dict]

"A-B-C" -> {"k", "theta0"} for E = k (theta - theta0)^2 with theta0 in degrees.

dihedral_typesdict[str, dict]

"A-B-C-D" -> {"v": [V0, V1, V2, V3, V4]} Fourier coefficients (see fourier_to_rb() for the energy expression).

improper_typesdict[str, dict]

"I-J-K-L" -> {"v2"} for the improper energy V2/2 (1 - cos 2 phi), with K the central atom and X wildcards, resolved by resolve_improper_type(). Libraries written before this format may carry opaque keys referenced from improper_keys.

fudge_lj, fudge_qqfloat

Scaling factors for 1,4 Lennard-Jones and Coulomb interactions (0.5 and 0.5 for OPLS).

namestr

A short label for the parameter set.

referenceslist[str]

Literature provenance of the parameters.

templatesdict

SMARTS atom-typing templates (type -> {"smarts", "description", ...}) when the library came from a .frc file; consumed by assign_atom_types().

fragmentsdict

Whole-molecule typing fragments, likewise.

metadatadict

The #metadata entries (ff_form, charges).

noteslist[str]

Anything the reader had to fill in (e.g. atom types with no Lennard-Jones entry, set to zero).

cls(type_name, term='bond')[source]#

The equivalent type used for term by an atom type.

Parameters:
  • type_name (str) – An atom type of the library.

  • term (str) – "nonbond", "bond", "angle", "torsion" or "oop".

Returns:

The class (equivalent type); the type itself when unspecified.

Return type:

str

save(path)[source]#

Write the library as native JSON (read back by read_opls()).

Parameters:

path (str or Path) – Output file path (conventionally *.json).

Return type:

None

save_frc(path, name=None, version='1.0')[source]#

Write the library as a .frc force-field file.

See to_forcefield().

Parameters:
Return type:

Path

Parameters: