Skip to content

Add new search algorithm#7337

Merged
mohanchen merged 13 commits into
deepmodeling:developfrom
19hello:module_neighlist
May 13, 2026
Merged

Add new search algorithm#7337
mohanchen merged 13 commits into
deepmodeling:developfrom
19hello:module_neighlist

Conversation

@19hello
Copy link
Copy Markdown
Collaborator

@19hello 19hello commented May 13, 2026

Reminder

  • Have you linked an issue with this pull request?
  • Have you added adequate unit tests and/or case tests for your pull request?
  • Have you noticed possible changes of behavior below or in the linked issue?
  • Have you explained the changes of codes in core modules of ESolver, HSolver, ElecState, Hamilt, Operator or Psi? (ignore if not applicable)

Linked Issue

Fix #...

Unit Tests and/or Case Tests for my changes

  • A unit test is added for each new feature or bug fix.

What's changed?

  • Example: My changes might affect the performance of the application under certain conditions, and I have tested the impact on various scenarios...

Any changes of core modules? (ignore if not applicable)

  • Example: I have added a new virtual function in the esolver base class in order to ...

Copilot AI review requested due to automatic review settings May 13, 2026 11:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new neighbor-list based search implementation under module_neighlist and wires it into the Lennard-Jones (LJ) ESolver path, alongside new unit tests and build-system integration.

Changes:

  • Added module_neighlist (neighbor search + binning + neighbor list allocator) and corresponding unit tests.
  • Introduced an IAtomProvider interface and made UnitCell implement it.
  • Switched ESolver_LJ::runner from the existing module_neighbor search path to the new NeighborSearch path.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
source/source_md/test/CMakeLists.txt Adds new neighlist sources to MD test dependencies.
source/source_esolver/esolver_lj.h Declares UnitCellPlus conversion helper used by the new neighbor search path.
source/source_esolver/esolver_lj.cpp Replaces old grid-based neighbor search with NeighborSearch usage in LJ runner.
source/source_cell/unitcell.h Makes UnitCell implement IAtomProvider for neighbor search consumption.
source/source_cell/module_neighlist/unitcell_plus.h Adds a lightweight test-friendly IAtomProvider implementation.
source/source_cell/module_neighlist/unitcell_interface.h Adds IAtomProvider abstraction for atom/lattice queries.
source/source_cell/module_neighlist/neighbor_search.h Declares the new neighbor search API and data members.
source/source_cell/module_neighlist/neighbor_search.cpp Implements neighbor search initialization, expansion, and neighbor building.
source/source_cell/module_neighlist/neighbor_list.h Adds a simple page allocator + neighbor list storage type.
source/source_cell/module_neighlist/neighbor_atom.h Adds NeighborAtom and InputAtoms structures used by the algorithm.
source/source_cell/module_neighlist/bin_manager.h Declares binning and neighbor construction helper.
source/source_cell/module_neighlist/bin_manager.cpp Implements bin construction, binning, and neighbor list building.
source/source_cell/module_neighlist/CMakeLists.txt Adds neighbor_search object library and conditional tests subdir.
source/source_cell/module_neighlist/test/CMakeLists.txt Adds new test targets for neighlist components.
source/source_cell/module_neighlist/test/neighbor_search_test.cpp Adds unit tests for NeighborSearch behavior/branches.
source/source_cell/module_neighlist/test/neighbor_list_test.cpp Adds unit tests for PageAllocator and NeighborList.
source/source_cell/module_neighlist/test/bin_manager_test.cpp Adds unit tests for BinManager behavior and edge cases.
source/source_cell/CMakeLists.txt Adds module_neighlist subdirectory to the cell build.
source/Makefile.Objects Adds neighlist objects to Makefile-based build.
CMakeLists.txt Links the new neighbor_search object library into the main target.
Comments suppressed due to low confidence (1)

source/source_cell/module_neighlist/neighbor_search.cpp:65

  • NeighborSearch::init hard-codes mpi_size = 1 while still accepting mpi_rank. For mpi_rank != 0 this produces invalid (x,y,z) decomposition and incorrect inside/ghost selection. Either pass mpi_size into init (or query it from an MPI communicator) and validate 0 <= mpi_rank < mpi_size, or remove the MPI-rank parameters until multi-rank decomposition is actually supported.
    int mpi_size = 1;
    int nx, ny, nz;
    decompose(mpi_size, nx, ny, nz);

    z = mpi_rank / (nx * ny);
    y = (mpi_rank % (nx * ny)) / nx;
    x = mpi_rank % (nx * ny) % nx;


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/source_esolver/esolver_lj.cpp
Comment thread source/source_esolver/esolver_lj.cpp
Comment thread source/source_cell/module_neighlist/neighbor_search.cpp
Comment thread source/source_cell/module_neighlist/bin_manager.cpp
Comment thread source/source_cell/module_neighlist/neighbor_search.h
@mohanchen mohanchen added Features Needed The features are indeed needed, and developers should have sophisticated knowledge Large Systems Issues related to large-size systems Refactor Refactor ABACUS codes labels May 13, 2026
@mohanchen mohanchen merged commit 43024cc into deepmodeling:develop May 13, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Features Needed The features are indeed needed, and developers should have sophisticated knowledge Large Systems Issues related to large-size systems Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants