xnn.ffnn.common.frc.ForceField#

class xnn.ffnn.common.frc.ForceField(name, file, version)[source]#

Bases: object

One resolved force-field variant: merged sections plus lookups.

Built by FrcFile.forcefield(); not constructed directly.

Variables:
  • name (str) – The variant name (the #define).

  • file (FrcFile) – The file it was resolved from.

  • sections (dict) – kind -> {key: Row} for every parameter section of the variant.

  • columns (labels, modifiers, annotations,) – Per kind: the labels merged, the @ modifiers, the > annotations, and the value-column names.

  • templates (dict) – atom type -> {"smarts": [...], "description": str, "overrides": [...], "version": str} in file order (later templates take precedence when typing).

  • fragments (dict) – fragment name -> entry (SMARTS, atom types, optional charges).

  • metadata (dict) – The #metadata parameters (ff_form, charges, …).

Parameters:
property ff_form: str#

The ff_form metadata entry ("oplsaa", "reaxff", …).

property terms: dict[str, list[str]]#

Interaction class -> section kinds present ("bond" -> …).

kinds_of(term)[source]#

Section kinds implementing interaction class term.

Parameters:

term (str)

Return type:

list[str]

property atom_types: dict[str, dict]#

type -> {"Mass", "El", "connections", "Comment"}.

rows(kind)[source]#

key -> Row of a section kind (empty if absent).

Parameters:

kind (str)

Return type:

dict

references_used()[source]#

The #reference blocks cited by the merged rows, deduplicated.

Return type:

list[Reference]

equivalent(atom_type, term)[source]#

The equivalent type used for term ("nonbond", "bond", "angle", "torsion", "oop"); the type itself if none.

Parameters:
Return type:

str

charge(atom_type)[source]#

Partial charge of an atom type (direct, then NonB equivalent, else 0).

Parameters:

atom_type (str)

Return type:

float

nonbond(atom_type, kind='nonbond(12-6)')[source]#

Lennard-Jones parameters of an atom type, (sigma [Å], epsilon [kcal/mol]) for nonbond(12-6) ((rmin, epsilon) for nonbond(9-6)).

Every @type / @units variant a section may use was already normalised to this form when the file was read. Looks up the type, then its nonbond equivalent, then a * wildcard row; None if nothing matches.

Parameters:
Return type:

tuple[float, float] | None

combination(kind='nonbond(12-6)')[source]#

The @combination rule of a nonbond section (default geometric).

Parameters:

kind (str)

Return type:

str

bond(i, j)[source]#

(kind, key, Row) for a bond between types i and j, or None.

Parameters:
angle(i, j, k)[source]#

(kind, key, Row) for an angle (j central), or None.

Parameters:
torsion(i, j, k, l)[source]#

(kind, key, Row) for a proper torsion, wildcards in SEAMM order.

Parameters:
improper(i, j, k, l)[source]#

(kind, key, Row) for an improper with k central, or None.

The wildcard order follows SEAMM: exact; one outer wildcard (each position); two outer wildcards; all outer wildcards.

Parameters: