mooonpy.template.ntafile module
NTA-file writer for atom_typing/all2lmp consumption.
Format:
mooonpy NTA file for <basename> at <date>
style id
<atom_id> <nta_string>
<atom_id> <nta_string>
...
The file uses style id (per-atom-id NTA assignments). Atom NTA strings
come from atom.comment after canonicalization (only the NTA token is
kept, any verbose atom_typing-style preamble is stripped).
- mooonpy.template.ntafile.canonicalize_ntas(mol)[source]
Reduce every
atom.commentinmolto just its NTA token, in place.Idempotent: running it on a Molspace whose comments are already plain NTAs is a no-op.
- mooonpy.template.ntafile.extract_nta(comment)[source]
Pull the NTA token out of an atom_typing comment string.
atom_typing writes verbose comments like
"C Sp2 avg-angle: 120.000000 type: cp". After aReactionTemplate.changed_typrewrite the field may already be just"cp". This handles both: returns"cp"either way, or""for an empty comment.
- mooonpy.template.ntafile.write_ntafile(filename, mol, edge_external_ntas=None)[source]
Write a per-atom NTA assignment file for
mol.- Parameters:
filename (str or
Path) – Output path.mol – Molspace whose
atom.commentcarries the NTA tokens. The comment is canonicalized (verboseatom_typingpreambles stripped) before writing.edge_external_ntas (dict[int, list[str]] or None) – Optional
{edge_atom_id: [nta, ...]}mapping each template edge atom to the NTA strings of its bonded neighbors outside the template. When given (and non-empty), anedge idsection is appended so downstream charge-equilibration can account for the severed bonds. Empty lists are skipped.