xnn.ffnn.models.charmm.CharmmForceField#
- class xnn.ffnn.models.charmm.CharmmForceField(library, trainable=())[source]#
Bases:
ModuleThe trainable parameter tensors of a CHARMM parameter library.
- Parameters:
library (CharmmLibrary, str or Path) – The parameter library (or a shipped set such as
"charmm22", a.frcpath or a native JSON path, seeread_charmm()).trainable (sequence of str or "all", optional) – Groups to expose to the optimizer:
"rstar","epsilon","rstar14","epsilon14","nbfix_rmin","nbfix_eps","bond_k","bond_r0","angle_k","angle_theta0","ub_k","ub_s0","dihedral_k","improper_k";"all"unfreezes every group.
- Variables:
params (torch.nn.ParameterDict) –
rstar(T,)(Rmin/2) in Angstrom andepsilon(T,)in eV,rstar14/epsilon14(T,)the 1,4 values (equal to the regular ones where a type has none;own14marks the types whose values count),nbfix_rmin/nbfix_epsandnbfix_rmin14/nbfix_eps14(M,)the pair overrides,bond_k(NB,)in eV/A^2,bond_r0(NB,),angle_k(NA,)in eV/rad^2,angle_theta0(NA,)in rad,ub_k(NU,)in eV/A^2,ub_s0(NU,),dihedral_k(ND, 6)in eV (one column per Fourier term, zero where a row has fewer terms) andimproper_k(NI,)in eV/rad^2.dihedral_mask (dihedral_n, dihedral_cos, dihedral_sin,) – Periodicities, the cosine / sine of the phases and a 0/1 mask of the used term slots of the torsion rows (fixed buffers).
improper_sin (improper_cos,) – The cosine / sine of the improper reference angles (fixed buffers).
nbfix_keys (type_names, bond_keys, angle_keys, ub_keys, dihedral_keys, improper_keys,) – Row labels of the parameter tensors.
fudge_qq (coulomb_constant,) – The library’s Coulomb constant (kcal Angstrom / mol / e^2) and its 1,4 electrostatic scaling.
- resolve_urey_bradley(a, b, c)[source]#
Urey-Bradley row for the type triple, or
Nonewhen the angle has no such term.
- resolve_dihedral(a, b, c, d)[source]#
Dihedral-type row: the exact quadruple (either direction) wins over the
X-B-C-Xgeneric entry.
- resolve_improper(*args)[source]#
Improper-type row, by exact key or by the four types in evaluation order (central atom first).
- Return type:
- pair_tables()[source]#
The per-type-pair Lennard-Jones tables
(rmin, eps, rmin14, eps14).- Returns:
Four
(T, T)tensors: the Lorentz-Berthelot combination of the per-type parameters (the regular ones, and the 1,4 ones for the types that have their own), with the pair overrides written over the listed pairs.rminis the pair’s minimum distance in Angstrom,epsits well depth in eV.- Return type:
tuple of Tensor
- export_library()[source]#
The current (possibly trained) parameters as a
CharmmLibrary.- Returns:
In CHARMM units (kcal/mol, Angstrom, degrees); the residue templates keep the library’s charges (trained per-atom charges belong to the models, see
Charmm.export_library()).- Return type: