Neighbor search algorithm for building atom neighbor lists.
More...
#include <neighbor_search.h>
|
| double | cross_product_norm (double a1, double a2, double a3, double b1, double b2, double b3) |
| void | init_from_unitcell_ (const UnitCell &ucell, double sr) |
| | Check and compute expansion layer counts.
|
| void | init_from_mdcell_ (const MDCell &cell, double sr) |
| void | check_expand_condition (const UnitCell &ucell, int &glayerX_minus, int &glayerX, int &glayerY_minus, int &glayerY, int &glayerZ_minus, int &glayerZ) |
| void | set_member_variables (const UnitCell &ucell, int glayerX_minus, int glayerX, int glayerY_minus, int glayerY, int glayerZ_minus, int glayerZ) |
| | Set member variables by generating periodic images.
|
| void | filter_candidate_neighbors_ (double cutoff, double lat0) |
Neighbor search algorithm for building atom neighbor lists.
This class implements a neighbor search algorithm that finds all atoms within a given cutoff radius. It uses a binning strategy for efficiency and supports MPI parallelization by decomposing the simulation domain.
The workflow is:
- Call init() to initialize with unit cell and search radius
- Call build_neighbors() to construct the neighbor list
- Access results via get_neighbor_list()
◆ NeighborSearch()
| NeighborSearch::NeighborSearch |
( |
| ) |
|
|
default |
◆ ~NeighborSearch()
| NeighborSearch::~NeighborSearch |
( |
| ) |
|
|
default |
◆ build_neighbors()
| void NeighborSearch::build_neighbors |
( |
| ) |
|
Build the neighbor list for all inside atoms.
Must be called after init(). Uses binning to efficiently find all neighbors within the search radius.
◆ check_expand_condition()
| void NeighborSearch::check_expand_condition |
( |
const UnitCell & | ucell, |
|
|
int & | glayerX_minus, |
|
|
int & | glayerX, |
|
|
int & | glayerY_minus, |
|
|
int & | glayerY, |
|
|
int & | glayerZ_minus, |
|
|
int & | glayerZ ) |
|
private |
◆ cross_product_norm()
| double NeighborSearch::cross_product_norm |
( |
double | a1, |
|
|
double | a2, |
|
|
double | a3, |
|
|
double | b1, |
|
|
double | b2, |
|
|
double | b3 ) |
|
private |
◆ filter_candidate_neighbors_()
| void NeighborSearch::filter_candidate_neighbors_ |
( |
double | cutoff, |
|
|
double | lat0 ) |
|
private |
◆ get_all_atoms()
| const std::vector< NeighborAtom > & NeighborSearch::get_all_atoms |
( |
| ) |
const |
Get all atoms (including periodic images).
- Returns
- Const reference to the vector of all atoms.
◆ get_ghost_atoms()
| const std::vector< NeighborAtom > & NeighborSearch::get_ghost_atoms |
( |
| ) |
const |
Get ghost atoms (neighbors of inside atoms).
- Returns
- Const reference to the vector of ghost atoms.
◆ get_inside_atoms()
| const std::vector< NeighborAtom > & NeighborSearch::get_inside_atoms |
( |
| ) |
const |
Get atoms inside the local MPI domain.
- Returns
- Const reference to the vector of inside atoms.
◆ get_neighbor_list() [1/2]
Get the constructed neighbor list.
- Returns
- Reference to the NeighborList object.
◆ get_neighbor_list() [2/2]
| const NeighborList & NeighborSearch::get_neighbor_list |
( |
| ) |
const |
Get the constructed neighbor list (const version).
- Returns
- Const reference to the NeighborList object.
◆ get_search_radius()
| double NeighborSearch::get_search_radius |
( |
| ) |
const |
Get the search radius.
- Returns
- Search radius in lattice units.
◆ init()
| void NeighborSearch::init |
( |
BaseCell & | cell, |
|
|
double | sr ) |
Initialize the neighbor search with unit cell and search radius.
This method sets up the domain decomposition, identifies inside and ghost atoms, and prepares internal data structures.
- Parameters
-
| ucell | Unit cell providing atom positions and lattice info. |
| sr | Search radius (cutoff distance) in Bohr. |
◆ init_from_mdcell_()
| void NeighborSearch::init_from_mdcell_ |
( |
const MDCell & | cell, |
|
|
double | sr ) |
|
private |
◆ init_from_unitcell_()
| void NeighborSearch::init_from_unitcell_ |
( |
const UnitCell & | ucell, |
|
|
double | sr ) |
|
private |
Check and compute expansion layer counts.
Determines how many periodic images are needed to cover the search radius in each lattice direction.
- Parameters
-
| ucell | Unit cell providing lattice vectors. |
◆ refresh_mdcell()
| void NeighborSearch::refresh_mdcell |
( |
const MDCell & | cell, |
|
|
double | cutoff ) |
Refresh positions and derive the physical-cutoff list from a cached cutoff-plus-skin candidate list for an MDCell.
◆ set_member_variables()
| void NeighborSearch::set_member_variables |
( |
const UnitCell & | ucell, |
|
|
int | glayerX_minus, |
|
|
int | glayerX, |
|
|
int | glayerY_minus, |
|
|
int | glayerY, |
|
|
int | glayerZ_minus, |
|
|
int | glayerZ ) |
|
private |
Set member variables by generating periodic images.
Populates all_atoms_ with atoms from the unit cell and all required periodic images.
- Parameters
-
| ucell | Unit cell providing atom positions. |
◆ all_atoms_
All atoms including periodic images.
◆ bin_manager_
Bin manager for efficient neighbor search.
◆ candidate_neighbor_list_
◆ ghost_atoms_
Ghost atoms (neighbors from other domains or images).
◆ inside_atoms_
Atoms inside the local MPI domain.
◆ neighbor_list_
The constructed neighbor list.
◆ neighbor_reserve_factor
| int NeighborSearch::neighbor_reserve_factor = 2 |
|
staticconstexprprivate |
Reserve factor for neighbor list capacity estimation.
◆ positive_layer_offset
| int NeighborSearch::positive_layer_offset = 1 |
|
staticconstexprprivate |
Offset added to expansion layers in positive directions.
◆ search_radius_
| double NeighborSearch::search_radius_ = 0.0 |
|
private |
Search radius in lattice units.
The documentation for this class was generated from the following files:
- /home/runner/work/abacus-develop/abacus-develop/source/source_cell/module_neighlist/neighbor_search.h
- /home/runner/work/abacus-develop/abacus-develop/source/source_cell/module_neighlist/neighbor_search.cpp