xnn.ffnn.models.oplslib.from_forcefield#
- xnn.ffnn.models.oplslib.from_forcefield(ff, strict=True)[source]#
Build an
OPLSLibraryfrom a resolved.frcforce 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@unitsconverted to sigma/epsilon in Angstrom and kcal/mol. Bonded tables are copied under their canonical keys with*written asX.- Parameters:
ff (xnn.ffnn.common.frc.ForceField) – A force field of the OPLS functional form:
quadratic_bond,quadratic_angle,torsion_opls,improper_oplsand anonbond(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. thetabulated_angleof the CL&PPF6-anion). IfFalse, load it anyway, ignore those sections and record them innotes; 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:
- 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.