bonded interactions by type

I've been playing around with the idea of letting LAMMPS users specify
bonded interactions by type. Without modifying lammps, I've attached
a preprocessing utility which augments the LAMMPS data format with
these sections: "Angles By Type", "Dihedrals By Type", "Impropers By
Type"

Example:

Angles By Type

    7 1 2 1 * *
    8 2 2 * 11
    9 3 4 3 * *

(After the 1 in the first column, the next 3 columns correspond to
atom types, and the final 2 columns correspond to bond types.)

I've attached a utility "nbody_by_type.py", a preprocessor, which
strips out these sections from a data file and replaces them with the
corresponding "Angles" "Dihedrals" or "Impropers" entries.
"nbody_by_type.py" generates interactions by examining the
bond-network of the system, and searching for 3-body and 4-body
subgraphs corresponding to angle, dihedral, and improper interactions.
(I suppose you could also use it to identify sub-chemical-compounds
like sugar rings. Not sure how useful that would be for lammps users.)

-- Example usage: --

./nbody_by_type.py Angles < test_nbody_by_type.data > new.data

More details are in "docs_nbody_by_type.txt" (attached).

Mostly I posted this message in order to propose this new feature.
(Hopefully the code I wrote is useful for implementing it.)

-- Code details/status: --

I have tested this code (..with Angles at least).
It might have been premature to post this code at this point.
Unfortunately this program requires a number of other python files
(hopefully all also attached), and I haven't yet written a nice
installer for them. (In progress.) For now you can just save them in
the same directory and run it from that directory.

These files probably do contain bugs. I am actively working on this
project and will fix them. If you are interested, I will post
follow-up message here containing where to download updates.. (Or
email me for the location ) I won't post follow-up code here.

-- Moltemplate --

This program will be part of a much larger preprocessing program
("moltemplate") I will post on this mailing list in a few days.

Andrew

docs_nbody_by_type.txt (5.35 KB)

test_nbody_by_type.data (1.3 KB)

nbody_by_type_lib.py (13.2 KB)

nbody_graph_search.py (35.9 KB)

nbody_Angles.py (1.64 KB)

nbody_Dihedrals.py (1.81 KB)

nbody_Impropers.py (1.69 KB)

extract_lammps_data.py (3.15 KB)

lttree_styles.py (7.06 KB)

ttree_lex.py (55.6 KB)

nbody_by_type.py (23.2 KB)