xnn.ffnn.common.typing.assign_atom_types#
- xnn.ffnn.common.typing.assign_atom_types(structure, forcefield, *, charge=0, bonds=None, return_mol=False)[source]#
Assign the force field’s atom types to a structure.
- Parameters:
structure (object) – Anything
to_rdkit()accepts.forcefield (ForceField, str or object) – A resolved force field, a spec for
read_forcefield()("oplsaa", a.frcpath, …), or any object exposingtemplates/fragmentsdicts in the same shape (anOPLSLibraryread from a.frcfile does). It must carry templates.charge (int, optional) – Total charge, for bond perception from coordinates.
bonds (sequence of (int, int), optional) – Known connectivity (see
to_rdkit()).return_mol (bool, optional) – Also return the RDKit molecule (whose bonds give the topology).
- Returns:
list of str – The atom type per atom, in input order.
rdkit.Chem.Mol – Only when
return_molis set.
- Raises:
AtomTypingError – If any atom matches no template, or two fragments disagree.
ValueError – If the force field has no templates.