Skip to content

Toward Type Labels#2531

Merged
akohlmey merged 164 commits intolammps:developfrom
jrgissing:type-labels
Sep 9, 2022
Merged

Toward Type Labels#2531
akohlmey merged 164 commits intolammps:developfrom
jrgissing:type-labels

Conversation

@jrgissing
Copy link
Member

@jrgissing jrgissing commented Dec 17, 2020

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.

  • begin general label map class
  • add new 'type label' sections to data file
  • add write_data support
  • support for multiple data files
    • function to merge label maps
    • function to map one label map to another
    • support for selected atom type sections
    • support for remaining sections and bond, etc. types
  • support for molecule files
  • add labelmap command (see attached examples)
  • support for restart files
  • add labelmap functions to variable command
  • direct support for pair, bond, etc. coeff commands
  • support for multiple maps
    • roll back support for multiple maps
  • write_data nolabelmap option
  • docs draft
  • backtest/try to break
  • option to directly replace numeric types with labels in data file read/write
  • convert internal label maps to C++ map
  • error/warning docs (post-review)
  • propagate enhancements for Atoms section of data file to all label map types and data file sections.
  • implement unit tests for all supported features, molecular systems, reading multiple data files, molecule files
  • document type label sections in data files in read_data docs
  • document what are allowed characters for type labels
  • add convenience function that identifies valid labels
  • document how to handle special characters in type labels
  • update variable function to look up types for labels
  • explore options to have a variable function returning the label string for the numeric type

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

@jrgissing jrgissing requested a review from sjplimp as a code owner December 17, 2020 14:39
@jrgissing
Copy link
Member Author

@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
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
also, relax I <= J requirement for pair_coeff, as 'required' by type labels
@jrgissing
Copy link
Member Author

So please have a careful look at the code and add notes or questions, where you see problems or need explanations from me. I hope to be able to merge this PR before Friday.

in general, looks great! I started taking a closer look and will post comments as I go

@akohlmey akohlmey requested review from akohlmey and sjplimp September 7, 2022 16:33
@akohlmey akohlmey self-assigned this Sep 7, 2022
@jrgissing
Copy link
Member Author

ok, this PR looks good to me!

@akohlmey
Copy link
Member

akohlmey commented Sep 7, 2022

ok, this PR looks good to me!

Do you want me to wait until I have feedback from Ellad and Ryan?

@jrgissing
Copy link
Member Author

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

@yafshar
Copy link
Collaborator

yafshar commented Sep 8, 2022

This PR looks good to me.
@jrgissing @akohlmey, is there any plan to add the provided examples to LAMMPS? or should we add them as unit tests?

@akohlmey
Copy link
Member

akohlmey commented Sep 8, 2022

This PR looks good to me. @jrgissing @akohlmey, is there any plan to add the provided examples to LAMMPS? or should we add them as unit tests?

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.

@akohlmey
Copy link
Member

akohlmey commented Sep 9, 2022

@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.
This will also be needed for other features that are built on top of it.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add support for symbolic atom, bond, angle, dihedral and improper types

5 participants