xnn.ffnn.models.charmmlib.CharmmLibrary#

class xnn.ffnn.models.charmmlib.CharmmLibrary(atom_types=<factory>, bond_types=<factory>, angle_types=<factory>, urey_bradley_types=<factory>, dihedral_types=<factory>, improper_types=<factory>, nbfix_types=<factory>, coulomb_constant=332.0716, scale_14_coulomb=1.0, name='charmm', references=<factory>, templates=<factory>, fragments=<factory>, metadata=<factory>, notes=<factory>)[source]#

Bases: object

A parsed CHARMM parameter library, in CHARMM units.

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

Parameters and attributes#

atom_typesdict[str, dict]

name -> {"element", "mass", "rstar", "epsilon", "rstar14", "epsilon14", "connections", "comment"}; rstar is Rmin/2 in Angstrom and epsilon the well depth in kcal/mol; rstar14 / epsilon14 are the type’s own 1,4 values or None when it has none (the regular values then apply).

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.

urey_bradley_typesdict[str, dict]

"A-B-C" -> {"k", "s0"} for E = k (S - s0)^2 on the A…C distance (only the angles that carry a Urey-Bradley term).

dihedral_typesdict[str, dict]

"A-B-C-D" -> {"terms": [[K, n, delta], ...]} for E = sum K [1 + cos(n phi - delta)] per dihedral.

improper_typesdict[str, dict]

"I-J-K-L" -> {"k", "psi0"} for E = k (psi - psi0)^2 with psi the dihedral angle over the four atoms in the order given; keys are kept as written (the central atom first in CHARMM’s topology files, last in many rows of its parameter files) and match a quadruple in either direction.

nbfix_typesdict[str, dict]

"A-B" -> {"rmin", "eps", "rmin14", "eps14"} pair overrides of the Lennard-Jones parameters (rmin is the pair’s own minimum distance; the 1,4 entries may be None, meaning the same).

coulomb_constantfloat

The Coulomb constant in kcal Angstrom / (mol e^2).

scale_14_coulombfloat

Scaling of the 1,4 electrostatics (1 for CHARMM).

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", "impropers", ...}), consumed by assign_atom_types() and place_impropers().

metadatadict

The #metadata entries.

noteslist[str]

Anything the reader had to fill in.

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

urey_bradley(key)[source]#

The Urey-Bradley 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" as written or reversed (None if absent).

Parameters:

key (str)

Return type:

dict | None

nbfix(key)[source]#

The pair override of "A-B" in either orientation (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_charmm()).

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: