xnn.ffnn.models.topology#

Fixed molecular topology for valence force fields (OPLS and friends).

Classical valence force fields such as OPLS assign every atom a fixed atom type and evaluate bonded terms over a fixed connectivity: bonds, the angles and proper dihedrals implied by those bonds, and explicitly declared improper dihedrals at trigonal centers. The same connectivity determines the nonbonded bookkeeping – 1,2 and 1,3 pairs are excluded, 1,4 pairs are scaled.

MolecularTopology holds exactly that information for one structure: the per-atom type names, the bond list, and everything derived from it (angles, dihedrals, exclusions, 1,4 pairs). It is deliberately independent of any parameter library – type names are opaque strings resolved by the model that consumes the topology – so the same class can serve other fixed-topology force fields later.

A topology can be built from an explicit bond list (MolecularTopology.from_bonds()), from an ASE Atoms object with bonds guessed from covalent radii (MolecularTopology.from_ase()), or loaded from the JSON file written by MolecularTopology.save(). MolecularTopology.replicate() tiles a molecule into a multi-molecule system (e.g. a liquid box built with ase.build).

Functions

guess_bonds(positions, atomic_numbers[, ...])

Guess covalent bonds from interatomic distances.

read_topology(path)

Read a topology JSON file written by MolecularTopology.save().

Classes

MolecularTopology(types, bonds[, ...])

Atom types and fixed valence connectivity for one structure.