nbody_by_type.py reads a LAMMPS data file (or an excerpt of a LAMMPS) data file containing bonded many-body interactions by atom type (and bond type), and generates a list of additional interactions in LAMMPS format consistent with those type (to the standard out). Typical Usage: nbody_by_type.py X < old.data > new.data --or-- nbody_by_type.py X \ -atoms atoms.data \ -bonds bonds.data \ -nbody X.data \ -nbodybytype X_by_type.data > new_X.data In both cases "X" denotes the interaction type, which is either "Angles", "Dihedrals", or "Impropers". (Support for other interaction types can be added by the user. See below.) -------- Example 1 ------- nbody_by_type.py X < old.data > new.data In this example, nbody_by_type.py reads a LAMMPS data file "orig.data", and extracts the relevant section ("Angles", "Dihedrals", or "Impropers"). It also looks a section named "X By Type", (eg. "Angles By type", "Impropers By type", "Impropers By type") which contains a list of criteria for automatically defining additional interactions of that type. For example, this file might contain: Angle By Type 7 1 2 1 * * 8 2 2 * * * 9 3 4 3 * * The first column is an interaction type ID. The next 3 columns are atom type identifiers. The final 2 columns are bond type identifiers. The * is a wildcard symbol indicating there is no preference for bond types in this example. (Optionally, regular expressions can also be used to define a type match, by enclosing the atom or bond type in / slashes.) The first line tells us to that there should be a 3-body "Angle" interaction of type "7" whenever an atom of type 1 is bonded to an atom of type "2", which is bonded to another atom of type "1" again. The second line tells us that an angle is defined whenever three atoms are bonded together and the first two are of type "2". (Redundant angle interactions are filtered.) New interactions are created for every group of bonded atoms which match these criteria if they are bonded together in the relevant way for that interaction type (as determined by nbody_X.py), and printed to the standard output. For example, suppose you are automatically generating 3-body "Angle" interactions using: nbody_by_type Angles < old.data > new.data The file "new.data" will be identical to "old.data", however the "Angles By Type" section will be deleted, and the following lines of text will be added to the "Angles" section: 394 7 5983 5894 5895 395 7 5984 5895 5896 396 7 5985 5896 5897 : : : : : 847 9 14827 14848 14849 The numbers in the first column are counters which assign a ID to every interaction of that type, and start where the original "Angles" data left off (New angle ID numbers do not overlap with old ID numbers). The text in the second column ("7", "9", ...) matches the text from the first column of the "Angle By Type" section of the input file. -------- Example 2 ------- nbody_by_type.py X \ -atoms atoms.data \ -bonds bonds.data \ -nbody X.data \ -nbodybytype X_by_type.data \ -prefix "SOMESTRING" -suffix "ANOTHERSTRING" \ > new_X.data In particular, for Angle interactions: nbody_by_type.py Angles \ -atoms atoms.data \ -bonds bonds.data \ -nbody angles.data \ -nbodybytype angles_by_type.data \ > new_Angles.data When run this way, nbody_by_type.py behaves exactly the same way as in Example 1, however only the lines of text corresponding to the new generated interactions are printed, (not the entire data file). Also note, that when run this way, nbody_by_type.py does not read the LAMMPS data from the standard input. Instead, it reads each section of the data file from a different file indicated by the arguments following the "-atoms", "-bonds", "-nbody", and "-nbodybytype" flags. "Angles" is a 3-body interaction style. So when run this way, nbody_by_type.py will create a 5 (=3+2) column file (new_Angles.data). Note: the atom, bond and other IDs/types in need not be integers. Note: This program must be distributed with several python modules, including: nbody_Angles.py, nbody_Dihedrals.py, and nbody_Impropers.py. These contain bond definitions for angular, dihedral, and improper interactions. (In case any new interaction types are ever added to LAMMPS, with only a few lines of python it is easy to edit to define new bonded interaction types by supplying new "nbody_X.py" python module. Refer to the modules listed above for examples.) Note: Optional "-prefix" and "-suffix" arguments can be included to decorate the interaction IDs (first column). For example, -prefix "auto_" and -suffix "_angle", causes "new_Angles.data" to contain the following text: auto_394_angle 7 5983 5894 5895 auto_395_angle 7 5984 5895 5896 auto_396_angle 7 5985 5896 5897 : : : : : auto_847_angle 9 14827 14848 14849