Conversation
put labels in atom.cpp for easy access
type labels for atoms
will greatly reduce code # of lines
find integer type from type label
|
@sjplimp it is already clear that this is much cleaner approach than previous attempts. Would you like to take a look at these initial changes? |
also add errors to enforce order of read_data sections
not yet tested
also refactor label map initialization, memory cleanup
subsequent data files merge types with first starting with support for selected atom types sections, will attach small example to PR
replace types directly for molecule files
pair_coeff, bond_coeff, angle_coeff, dihedral_coeff, improper_coeff
can be created with labelmap via mapID keyword referenced like mymapID::C where C is an atom type, for example
in general, looks great! I started taking a closer look and will post comments as I go |
… and handling of ',' in labels
|
ok, this PR looks good to me! |
Do you want me to wait until I have feedback from Ellad and Ryan? |
we resolved all outstanding issues that I know of, but it wouldn't hurt to wait for a confirmation from them |
|
This PR looks good to me. |
There are already significant number of unit tests included in this PR. In fact, that is how I noticed a bunch of issues and oversights or inconsistencies. This already covers a lot of the added functionality. There is always room for improvement though. I have very deliberately not (yet) integrated any of the examples because a) there are still parts of LAMMPS that need to be adjusted to accept labels instead of numeric types and b) we should wait and see a bit how this is used to have representative examples in the examples tree. As with the implementation, this can have a significant long-term impact and provide a blueprint for others, so they need to be particularly well designed and checked. |
|
@stukowski you may need to review type label support in Ovito after we have reworked this pull request some more and have converged to formats and interfaces that have a good chance to become permanent. Since this is a significant change and write support for symbolic types in data files in LAMMPS is still somewhat lacking (reading is more complete), there may be minor changes. The general intent is however at this point to stick to the format and strategies implemented here if possible. I have started with adapting VMD for it today. Writing data files already works (which is easier since VMD already has all types as symbols internally). Ping me personally, if you want me to ship you some example data files to make sure those are mutually compatible. Similarly, I'd love to have a couple of test cases for data files with symbolic types written by OVITO to make sure that VMD stays compatible, if possible. I've changed the CGCMM marker in the first line to LABELMAP as indicator since some of the comments are different since adding the symbolic types as comments would be redundant. |
Summary
Add general support for mapping each numeric type to an alphanumeric 'label' for atom types, bond types, etc.
Closes: #2002
End Goal:
(a) Ability for users to define maps, and optionally use a label type
anywhere a numeric type is used in LAMMPS input (input script, data
file, molecule file) or output (dump files, restart files). For input, using
a mix of numeric and label types is fine.
(b) Make it simpler for users to define systems using multiple data
and/or molecule files. B/c use of label types makes it simpler to
avoid and resolve numeric type conflicts across multiple files.
Related Issue(s)
removed I <= J requirement for pair_coeff, so that type labels can be used without knowing their numeric counterpart
Author(s)
Jake Gissinger (NASA), Yaser Afshar (UMN), Steve Plimpton (SNL), Axel Kohlmeyer (Temple U)
Licensing
By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).
Backward Compatibility
Implementation Notes
Further Information, Files, and Links
single-data-file simple test
simple_test_labels.zip
multi-data-file simple test (support for selected atom-type sections):
labels_test.zip
multi-data-file test (includes bond, angles, dihedrals, impropers):
multidata_example.zip
multi-data-file-and-molecule
multidata_and_molecule.zip
multiple data files, molecule template, labelmap command
type labels are added/changed by second data file, used by molecule template, and modified by labelmap command
reflected in final write_data
add_command_example.zip
in addition to above, add simple example of using 'map/assign' option of 'labelmap' command
add_map_assign.zip
in addition to above, update to new keywords (map/assign -> mapID) and add 'mass command' example
update_keywords+mass_command.zip