xnn.ffnn.models.oplslib.from_forcefield#

xnn.ffnn.models.oplslib.from_forcefield(ff, strict=True)[source]#

Build an OPLSLibrary from a resolved .frc force field.

Atom types come from #atom_types; their per-term classes from #equivalence (identity when absent); charges and Lennard-Jones parameters are looked up through the nonbond equivalence, with any @type (rmin-eps, A-B, …) and @units converted to sigma/epsilon in Angstrom and kcal/mol. Bonded tables are copied under their canonical keys with * written as X.

Parameters:
  • ff (xnn.ffnn.common.frc.ForceField) – A force field of the OPLS functional form: quadratic_bond, quadratic_angle, torsion_opls, improper_opls and a nonbond(12-6) section with geometric combination.

  • strict (bool, optional) – If True (default) refuse a force field that also carries functional forms the OPLS model does not implement (e.g. the tabulated_angle of the CL&P PF6- anion). If False, load it anyway, ignore those sections and record them in notes; the library is then correct for every structure that uses none of the skipped types.

Returns:

The library, including the file’s SMARTS templates.

Return type:

OPLSLibrary

Raises:

ValueError – If the nonbond combination rule is not geometric (the OPLS model hard-codes geometric mixing), or a bonded section of a functional form the OPLS model does not implement is present.