Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add faster method for multi neighboring #2536

Merged
merged 80 commits into from May 12, 2021
Merged

Conversation

jtclemm
Copy link
Collaborator

@jtclemm jtclemm commented Dec 20, 2020

Summary

This pull request contains a slightly modified implementation of a new polydisperse neighboring method developed by Tom Shire, Kevin Stratford, and Kevin Hanley (references below). In the current multi implementation, there is a single binlist with a bin size set by the smallest interaction length. A separate stencil is then constructed for each atom type. For each itype, the stencil extends to the maximum interaction distance with other particles. In the new implementation, a separate binlist is used for each atom type and ~ntype^2 stencils are then constructed for itype-jtype pairs. Stencils extend up to the itype-jtype interaction distance.

This approach greatly speeds up the construction of neighbor lists and may also allow fewer ghost atoms to be communicated. If Newton is on and there are only half neighborlists, one only needs to loop through small particles to look for large neighbors to find cross-interactions. Therefore, small ghost atoms only need to be communicated a distance set by the small-small interaction. In all cases tested, the new method improves performance over the old multi method by a factor of 3+. Therefore, we renamed the old method multi/old and replaced multi with this new method.

In addition to upgrading multi, this pull request also cleans up redundancies in the nstencil classes. Previously, most stencil classes had a full, half+newton, and half+newtoff variety. However, the full and half+newtoff classes were redundant as both created what one might consider a fully "spherical" stencil. This contrasts to half+newton where stencils only included bins to the upper right creating a "hemi-spherical" stencil. To remove this redundancy, all half+newtoff stencils were removed and half+newton stencils were renamed half stencils. The logic in neighbor->choose_stencil() was accordingly updated.

Related Issue(s)

NA

Author(s)

Tom Shire (U. Glasgow)
Kevin Stratford (U. Edinburgh)
Kevin Hanley (U. Edinburgh)
Joel Clemmer (SNL - jtclemm@sandia.gov)

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

No foreseen issues, input scripts using the old multi style will automatically use the new multi style

Implementation Notes

This PR is still in progress. Remaining tasks include:

  • Allow users to create custom categories by grouping different types to avoid ntype^2 overhead
  • Add check in comm_init() to confirm a full neighborlist isn't used with hierachical communication (small-to-large lookups)
  • Resize bins and atom2bin arrays (# atoms in group vs nall)
  • Check compatibility of new stencils with Kokkos
  • Add examples
  • Update documentation when arguments are finalized (reference new paper)
  • Add size_one methods to granular pairstyles
  • Add option to specify collections by cutoff intervals
  • Add option to specify non-sequential collections of types
  • Revamp multi neighbor and comm to use a new, separate collection array of size nlocal+nghost

Extra items (probably a different PR):

  1. Update fix pour to work with >1 atom types
  2. Update fix pour/adapt to work with multi if atom radii can change

Post Submission Checklist

  • The feature or features in this pull request is complete
  • Licensing information is complete
  • Corresponding author information is complete
  • The source code follows the LAMMPS formatting guidelines
  • Suitable new documentation files and/or updates to the existing docs are included
  • The added/updated documentation is integrated and tested with the documentation build system
  • The feature has been verified to work with the conventional build system
  • The feature has been verified to work with the CMake based build system
  • Suitable tests have been added to the unittest tree.
  • A package specific README file has been included or updated
  • One or more example input decks are included

Further Information, Files, and Links

Relevant links:
Journal article for old method
Journal article for new method
Technical document for new method
Original implementation of new method

@akohlmey akohlmey self-assigned this May 12, 2021
@akohlmey akohlmey added test_for_regression Enable to trigger regression tests test_runs Enable to trigger run tests labels May 12, 2021
@akohlmey akohlmey removed test_for_regression Enable to trigger regression tests test_runs Enable to trigger run tests work_in_progress labels May 12, 2021
@akohlmey
Copy link
Member

@jtclemm testing has been mostly successful. I have updated the branch to the latest upstream version and did some (mostly) cosmetic changes. When running the in.comm_modify-002.txt
input from our extended test suite, I get the following (unexpected) segmentation fault.

Program received signal SIGSEGV, Segmentation fault.
0x00007fffec668806 in LAMMPS_NS::Comm::modify_params (this=0x289030, narg=8, arg=0x2bb5a0)
    at /home/akohlmey/compile/lammps/src/comm.cpp:361
361	        cutusermulti[i-1] = cut;

This looks like either something is not properly initialized when processing the input or some check requiring additional input or a different order of inputs needs to be added.

@akohlmey akohlmey added test_for_regression Enable to trigger regression tests test_runs Enable to trigger run tests and removed test_for_regression Enable to trigger regression tests test_runs Enable to trigger run tests labels May 12, 2021
@akohlmey
Copy link
Member

FYI, all other failing tests have been updated to be compatible with the new code or are due to a bug in upstream that is fixed in a different pending PR. So addressing the one problem from above should be sufficient for now. In a future pull request we will have to look into creating some proper unit tests for this new feature (and other neighbor list features).

@jtclemm
Copy link
Collaborator Author

jtclemm commented May 12, 2021

FYI, all other failing tests have been updated to be compatible with the new code or are due to a bug in upstream that is fixed in a different pending PR. So addressing the one problem from above should be sufficient for now. In a future pull request we will have to look into creating some proper unit tests for this new feature (and other neighbor list features).

Thank you for running the tests, I spent all my time verifying user-specified collections worked and forgot to check default cases. The problematic input script should now work with no memory errors.

@akohlmey akohlmey added test_for_regression Enable to trigger regression tests test_runs Enable to trigger run tests labels May 12, 2021
@akohlmey akohlmey removed test_for_regression Enable to trigger regression tests test_runs Enable to trigger run tests labels May 12, 2021
@akohlmey akohlmey requested a review from sjplimp May 12, 2021 17:58
@akohlmey akohlmey merged commit e960674 into lammps:master May 12, 2021
@jtclemm jtclemm deleted the multi_epcc branch May 12, 2021 20:07
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.

None yet

4 participants