Manager for binning atoms to accelerate neighbor search.
More...
#include <bin_manager.h>
|
| int | bin_index (int ix, int iy, int iz) const |
| | Compute the flat index for a bin from its 3D coordinates.
|
|
| double | sradius_ = 0.0 |
| | Search radius in lattice units.
|
| double | x_min_ = 0.0 |
| | Minimum coordinates of the binned region.
|
| double | y_min_ = 0.0 |
| double | z_min_ = 0.0 |
| double | x_max_ = 0.0 |
| | Maximum coordinates of the binned region.
|
| double | y_max_ = 0.0 |
| double | z_max_ = 0.0 |
| double | bin_sizex_ = 0.0 |
| | Size of each bin in each direction.
|
| double | bin_sizey_ = 0.0 |
| double | bin_sizez_ = 0.0 |
| int | nbinx_ = 1 |
| | Number of bins in each direction.
|
| int | nbiny_ = 1 |
| int | nbinz_ = 1 |
| std::vector< Bin > | bins_ |
| | All bins in the 3D grid (stored as flat array).
|
Manager for binning atoms to accelerate neighbor search.
This class implements a spatial binning strategy where atoms are sorted into a 3D grid of bins. Neighbor search then only needs to check adjacent bins, significantly reducing the search complexity.
The workflow is:
- Call init_bins() to set up the bin grid based on atom positions
- Call do_binning() to assign atoms to bins
- Call build_atom_neighbors() to construct the neighbor list
- Call clear() to reset for the next search
◆ bin_index()
| int BinManager::bin_index |
( |
int | ix, |
|
|
int | iy, |
|
|
int | iz ) const |
|
private |
Compute the flat index for a bin from its 3D coordinates.
- Parameters
-
| ix | X index of the bin. |
| iy | Y index of the bin. |
| iz | Z index of the bin. |
- Returns
- Flat index in the bins_ array.
◆ build_atom_neighbors()
Build neighbor list by searching adjacent bins.
For each atom, searches its containing bin and all adjacent bins to find neighbors within the search radius.
- Parameters
-
| neighbor_list | Output neighbor list to populate. |
| atoms | Atoms for which to build neighbors. |
| binned_atoms | All atoms assigned to bins by do_binning(). |
◆ clear()
| void BinManager::clear |
( |
| ) |
|
Clear all bins and reset internal state.
◆ do_binning()
| void BinManager::do_binning |
( |
const std::vector< NeighborAtom > & | atoms | ) |
|
Assign atoms to their corresponding bins.
Must be called after init_bins(). Each atom is placed into the bin that contains its spatial position.
- Parameters
-
| atoms | All atoms to assign to bins. |
◆ get_bin_atom_count()
| int BinManager::get_bin_atom_count |
( |
int | bin_index | ) |
const |
Get the number of atoms in a specific bin.
- Parameters
-
| bin_index | Index of the bin in the flat array. |
- Returns
- Number of atoms in that bin.
◆ get_nbinx()
| int BinManager::get_nbinx |
( |
| ) |
const |
Get the number of bins in X direction.
- Returns
- Number of bins in X.
◆ get_nbiny()
| int BinManager::get_nbiny |
( |
| ) |
const |
Get the number of bins in Y direction.
- Returns
- Number of bins in Y.
◆ get_nbinz()
| int BinManager::get_nbinz |
( |
| ) |
const |
Get the number of bins in Z direction.
- Returns
- Number of bins in Z.
◆ get_total_bins()
| int BinManager::get_total_bins |
( |
| ) |
const |
Get the total number of bins.
- Returns
- Total bin count (nbinx * nbiny * nbinz).
◆ init_bins()
| void BinManager::init_bins |
( |
double | sr, |
|
|
const std::vector< NeighborAtom > & | all_atoms ) |
Initialize the bin grid based on atom positions and search radius.
Computes the spatial bounds from atom positions and divides the region into bins of size approximately equal to the search radius.
- Parameters
-
| sr | Search radius in lattice units. |
| inside_atoms | Atoms inside the local MPI domain. |
| ghost_atoms | Ghost atoms from neighboring domains. |
◆ bin_sizex_
| double BinManager::bin_sizex_ = 0.0 |
|
private |
Size of each bin in each direction.
◆ bin_sizey_
| double BinManager::bin_sizey_ = 0.0 |
|
private |
◆ bin_sizez_
| double BinManager::bin_sizez_ = 0.0 |
|
private |
◆ bins_
| std::vector<Bin> BinManager::bins_ |
|
private |
All bins in the 3D grid (stored as flat array).
◆ nbinx_
| int BinManager::nbinx_ = 1 |
|
private |
Number of bins in each direction.
◆ nbiny_
| int BinManager::nbiny_ = 1 |
|
private |
◆ nbinz_
| int BinManager::nbinz_ = 1 |
|
private |
◆ sradius_
| double BinManager::sradius_ = 0.0 |
|
private |
Search radius in lattice units.
◆ x_max_
| double BinManager::x_max_ = 0.0 |
|
private |
Maximum coordinates of the binned region.
◆ x_min_
| double BinManager::x_min_ = 0.0 |
|
private |
Minimum coordinates of the binned region.
◆ y_max_
| double BinManager::y_max_ = 0.0 |
|
private |
◆ y_min_
| double BinManager::y_min_ = 0.0 |
|
private |
◆ z_max_
| double BinManager::z_max_ = 0.0 |
|
private |
◆ z_min_
| double BinManager::z_min_ = 0.0 |
|
private |
The documentation for this class was generated from the following files:
- /home/runner/work/abacus-develop/abacus-develop/source/source_cell/module_neighlist/bin_manager.h
- /home/runner/work/abacus-develop/abacus-develop/source/source_cell/module_neighlist/bin_manager.cpp