xnn.ffnn.models.amberlib.AmberLibrary#

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

Bases: object

A parsed AMBER parameter library, in AMBER units.

Energies are kcal/mol, lengths Angstrom, angles degrees. Bonded parameters are keyed by the atom types of the term joined with - ("CT-CT", "X-CT-CT-X"); X is the wildcard.

Parameters and attributes#

atom_typesdict[str, dict]

name -> {"element", "mass", "rstar", "epsilon", "cls_nonbond", "cls_bond", "cls_angle", "cls_torsion", "cls_oop", "connections", "comment"}; rstar is the van der Waals radius R* (half the like-pair minimum distance) in Angstrom and epsilon the well depth in kcal/mol.

bond_typesdict[str, dict]

"A-B" -> {"k", "r0"} for E = k (r - r0)^2.

angle_typesdict[str, dict]

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

dihedral_typesdict[str, dict]

"A-B-C-D" -> {"terms": [[K, n, gamma], ...]} for E = sum K [1 + cos(n phi - gamma)] per dihedral (K already divided by the number of paths of the AMBER file).

improper_typesdict[str, dict]

"I-J-K-L" -> {"terms": [[K, n, gamma], ...]} with K the central atom and L the distinguished outer atom, in the order written (the positions carry meaning, see match_improper()).

fudge_lj, fudge_qqfloat

Scaling factors of the 1,4 van der Waals and Coulomb interactions (1/2 and 1/1.2 for AMBER).

namestr

A short label for the parameter set.

referenceslist[str]

Literature provenance of the parameters.

templatesdict

Per-type SMARTS templates (type -> {"smarts": [...], ...}).

fragmentsdict

Residue templates (name -> {"SMARTS", "atom names", "atom types", "charges", ...}), consumed by assign_atom_types().

metadatadict

The #metadata entries.

noteslist[str]

Anything the reader had to fill in.

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

The equivalent type an atom type uses for term.

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

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

Returns:

The equivalent type; the type itself when none is recorded.

Return type:

str

bond(key)[source]#

The bond entry of "A-B" in either orientation (None if absent).

Parameters:

key (str)

Return type:

dict | None

angle(key)[source]#

The angle entry of "A-B-C" in either orientation (None if absent).

Parameters:

key (str)

Return type:

dict | None

torsion(key)[source]#

The torsion entry whose key is "A-B-C-D" or its reverse, exactly (no wildcard matching; None if absent).

Parameters:

key (str)

Return type:

dict | None

improper(key)[source]#

The improper entry of "I-J-K-L" (first two positions in either order; None if absent).

Parameters:

key (str)

Return type:

dict | None

residue_charges(name)[source]#

atom name -> charge of a residue template.

Parameters:

name (str) – A fragment (residue) name, e.g. "ALA".

Returns:

The template’s charges by atom name.

Return type:

dict

Raises:

KeyError – If the library has no such residue.

save(path)[source]#

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

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: