xnn.hybnn.models.byteff.ByteFF#

class xnn.hybnn.models.byteff.ByteFF(structure=None, *, graph=None, bonded=None, nonbonded=None, members=1, supported_elements=(1, 6, 7, 8, 9, 15, 16, 17, 35, 53), cutoff=None, switch_width=0.0, coulomb_constant=332.0637141491396, fudge_qq=0.8333333333, fudge_lj=0.5, charge=0, use_fast='auto')[source]#

Bases: ClassicalFastPath, _GraphParameterizedFF

ByteFF: an AMBER-form force field whose parameters a graph transformer predicts.

Parameters:
  • structure (rdkit.Chem.Mol, str, ase.Atoms or list, optional) – The system to bind (see bind()); a model can be bound later.

  • graph (dict, optional) – Options of MolecularGraphTransformer.

  • bonded (dict, optional) – Options of BondedHead.

  • nonbonded (dict, optional) – Options of LennardJonesChargeHead.

  • members (int, optional) – Networks of the ensemble whose parameters are averaged. Default 1.

  • supported_elements (sequence of int, optional) – Elements an evaluation outside training accepts (all when empty).

  • cutoff (float, optional) – Nonbonded cutoff in Angstrom on the neighbor list; None (default) takes every pair of a structure (no cell).

  • switch_width (float, optional) – Width of a quintic switch to zero at the cutoff. Default 0.

  • coulomb_constant (float, optional) – In kcal Angstrom / (mol e^2).

  • fudge_qq (float, optional) – Scale factors of the 1,4 Coulomb and Lennard-Jones terms.

  • fudge_lj (float, optional) – Scale factors of the 1,4 Coulomb and Lennard-Jones terms.

  • charge (int, optional) – Total charge for bond perception when binding an ase.Atoms.

  • use_fast (bool or "auto", optional) – Evaluate the energy terms with the fused GPU kernels of classical_kernels (the same numbers to round-off, differentiable twice for force training, with parameter gradients) when the nonbonded pairs come from a neighbor list (a cutoff), on a CUDA device with Triton. Without a cutoff (molecule batches) the terms are compiled instead, which takes tens of seconds per batch shape: "auto" (default) compiles after compile_after evaluations of one shape, True at once. False evaluates every term eagerly.

Notes

forward returns e_bond, e_angle, e_torsion, e_improper, e_vdw, e_coulomb, e_vdw14 and e_coulomb14 besides the energies.

lammps_input(pos, cell=None)[source]#

The LAMMPS data file and commands that evaluate this model’s energy for the bound system.

The predicted parameters become LAMMPS styles in real units: harmonic bonds and angles (K = k / 2), dihedral fourier, improper cvff (d = -1, n = 2, center first), lj/cut/coul/cut with arithmetic mixing and the 1,4 scale factors, one atom type per atom of the distinct molecules; the charges are scaled to LAMMPS’s Coulomb constant. Without a cutoff the pair cutoff is the structure’s extent plus 2 Angstrom (every pair interacts). Used by write_lammps_input().

Parameters:
  • pos (array_like) – Positions (n, 3) in Angstrom, in the bound system’s order.

  • cell (array_like, optional) – An orthorhombic cell (3, 3), with a cutoff only.

Returns:

The data file text, the commands (read_data DATAFILE) and the energy offset (0).

Return type:

tuple

classmethod from_config(cfg)[source]#

Construct from a model config: the keyword options of the class from cfg.extra; all_pairs (default true) evaluates every pair, otherwise cfg.cutoff is the nonbonded cutoff.

Return type:

ByteFF