Add NeighborSearch AdjacentAtomInfo compatibility adapter#7359
Closed
PKUJZX wants to merge 1 commit into
Closed
Conversation
Collaborator
|
Nice try. I suggest not rushing to apply the nearest neighbor search algorithm to LCAO for now. Since LCAO covers a wide range of applications, potential bugs may easily occur. It can be firstly adopted in empirical potential functions and machine learning potential function models. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #7358.
This PR adds the first compatibility layer needed before
module_neighlistcan be considered as a replacement candidate for the existingmodule_neighborpath.The change is intentionally small and non-invasive:
Grid_Driver::Find_atom,atom_arrange::search, orESolver_LJ.NeighborSearchoutput against the existingAdjacentAtomInfocontract.What changed
NeighborAtomascell_x/cell_y/cell_z.NeighborSearch::setMemberVariables.convert_neighbor_search_to_adjs(...), which convertsNeighborSearchresults intoAdjacentAtomInfo.AdjacentAtomInfobehavior:adj_numcounts only non-self neighbors.box = (0, 0, 0).What this PR deliberately does not do
This PR does not attempt a backend switch or broader refactor. In particular, it does not:
Grid_Driverimplementation,Those should remain separate follow-up PRs after this adapter is proven.
Test coverage
I added old-vs-new equivalence tests that compare the adapter output against the existing
Grid_Driverimplementation.Covered scenarios:
(-1, 0, 0)and(1, 0, 0).NeighborSearchunit coverage proving generated periodic images retaincell_x/cell_y/cell_z.The tests compare neighbor identity using
(type, atom index, box)and compare coordinates with floating-point tolerance. They also assert the self-last contract.Verification
Environment dependencies were installed and the planned CMake/CTest flow was run successfully:
cmake -B build-neighlist-pr1 -DBUILD_TESTING=ON cmake --build build-neighlist-pr1 --target MODULE_CELL_NEIGHBOR_neighbor_search MODULE_CELL_NEIGHBOR_neighlist_adapter -j2 ctest --test-dir build-neighlist-pr1 -R "MODULE_CELL_NEIGHBOR_(neighbor_search|neighlist_adapter)" --output-on-failure