#include <cell_lists.h>
Public Types | |
typedef CellListsContainer | container_type |
Public Member Functions | |
~CellLists () | |
CellLists (std::shared_ptr< distance_policy > dist, pele::Array< double > const boxv, const double rcut, const double ncellx_scale=1.0) | |
template<class callback_class > | |
CellListsLoop< callback_class > | get_atom_pair_looper (callback_class &callback) const |
size_t | get_nr_cells () const |
size_t | get_nr_cellsx () const |
size_t | get_nr_unique_pairs () const |
size_t | get_direct_nr_unique_pairs (const double max_distance, pele::Array< double > x) const |
size_t | get_maximum_nr_unique_pairs (pele::Array< double > x) const |
void | reset (pele::Array< double > coords) |
Protected Member Functions | |
void | setup (Array< double > coords) |
void | sanity_check () |
size_t | atom2xbegin (const size_t atom_index) const |
template<class T > | |
T | loop_pow (const T x, int ex) const |
size_t | atom2cell (const size_t i) |
pele::Array< double > | cell2coords (const size_t icell) const |
bool | cells_are_neighbors (const size_t icell, const size_t jcell) const |
double | get_minimum_corner_distance2 (pele::Array< double > ic, pele::Array< double > jc) const |
void | build_cell_neighbors_list () |
void | build_atom_neighbors_list_old () |
void | build_atom_neighbors_list () |
void | build_linked_lists () |
Protected Attributes | |
std::shared_ptr< distance_policy > | m_dist |
pele::Array< double > | m_coords |
size_t | m_natoms |
const double | m_rcut |
bool | m_initialised |
const pele::Array< double > | m_boxv |
const size_t | m_ncellx |
const size_t | m_ncells |
const double | m_rcell |
container_type | m_container |
const double | m_xmin |
const double | m_xmax |
Static Protected Attributes | |
static const size_t | m_ndim = distance_policy::_ndim |
cell list currently only work with box of equal side lengths cell lists are currently not implemented for non cubic boxes: in that case m_ncellx should be an array rather than a scalar and the definition of ncells and rcell would change to array. This implies that in all the function these would need to be replace with the correct array element. This adds room for errors so in this first implementation we do not account for that scenario
Definition at line 201 of file cell_lists.h.
typedef CellListsContainer pele::CellLists< distance_policy >::container_type |
Definition at line 203 of file cell_lists.h.
pele::CellLists< distance_policy >::~CellLists | ( | ) | [inline] |
Definition at line 226 of file cell_lists.h.
pele::CellLists< distance_policy >::CellLists | ( | std::shared_ptr< distance_policy > | dist, |
pele::Array< double > const | boxv, | ||
const double | rcut, | ||
const double | ncellx_scale = 1.0 |
||
) |
constructor
ncellx_scale scales the number of cells. The number of cells in each direction is computed from ncellx_scale * box_lenth / rcut
Definition at line 290 of file cell_lists.h.
size_t pele::CellLists< distance_policy >::atom2cell | ( | const size_t | i | ) | [protected] |
return the index of the cell that atom i is in
this function assumes that particles have been already put in box
Definition at line 489 of file cell_lists.h.
size_t pele::CellLists< distance_policy >::atom2xbegin | ( | const size_t | atom_index | ) | const [inline, protected] |
Definition at line 275 of file cell_lists.h.
void pele::CellLists< distance_policy >::build_atom_neighbors_list | ( | ) | [protected] |
void pele::CellLists< distance_policy >::build_atom_neighbors_list_old | ( | ) | [protected] |
void pele::CellLists< distance_policy >::build_cell_neighbors_list | ( | ) | [protected] |
build the list of neighboring cells.
Definition at line 619 of file cell_lists.h.
void pele::CellLists< distance_policy >::build_linked_lists | ( | ) | [protected] |
determine which cell each atom is in and populate the arrays hoc and ll
Definition at line 646 of file cell_lists.h.
pele::Array< double > pele::CellLists< distance_policy >::cell2coords | ( | const size_t | icell | ) | const [protected] |
returns the coordinates to the corner of the lower left corner of cell icell
lower-left means that the cartesian coordinates are smaller than all other corners.
Definition at line 522 of file cell_lists.h.
bool pele::CellLists< distance_policy >::cells_are_neighbors | ( | const size_t | icell, |
const size_t | jcell | ||
) | const [protected] |
return true if the cells are neighbors.
The cells are considered neighbors if atoms in the cells could possibly be closer than the cutoff distance
Definition at line 550 of file cell_lists.h.
CellListsLoop<callback_class> pele::CellLists< distance_policy >::get_atom_pair_looper | ( | callback_class & | callback | ) | const [inline] |
return the class which loops over the atom pairs with a callback function
Definition at line 243 of file cell_lists.h.
size_t pele::CellLists< distance_policy >::get_direct_nr_unique_pairs | ( | const double | max_distance, |
pele::Array< double > | x | ||
) | const |
Definition at line 352 of file cell_lists.h.
size_t pele::CellLists< distance_policy >::get_maximum_nr_unique_pairs | ( | pele::Array< double > | x | ) | const |
Definition at line 373 of file cell_lists.h.
double pele::CellLists< distance_policy >::get_minimum_corner_distance2 | ( | pele::Array< double > | ic, |
pele::Array< double > | jc | ||
) | const [protected] |
Definition at line 562 of file cell_lists.h.
size_t pele::CellLists< distance_policy >::get_nr_cells | ( | ) | const [inline] |
return the total number of cells
Definition at line 251 of file cell_lists.h.
size_t pele::CellLists< distance_policy >::get_nr_cellsx | ( | ) | const [inline] |
return the number of cells in the x direction
Definition at line 256 of file cell_lists.h.
size_t pele::CellLists< distance_policy >::get_nr_unique_pairs | ( | ) | const |
return the number of unique atom pairs.
These three functions are primarily used for debugging and testing
Definition at line 341 of file cell_lists.h.
T pele::CellLists< distance_policy >::loop_pow | ( | const T | x, |
int | ex | ||
) | const [protected] |
return x to the power ex
This is equivalent, but hopefully faster than std::pow(x, ex)
Definition at line 474 of file cell_lists.h.
void pele::CellLists< distance_policy >::reset | ( | pele::Array< double > | coords | ) |
reset the cell list iterator with a new coordinates array
re-build linked lists Algorithm 37 page 552 Understanding Molecular Simulation 2nd ed. start by setting head of chain (hoc of size ncells) to -1 (meaning end of chain) then update linked list so that atom i points to the next atom in the chain, obviously this starts from -1 if it is the only element in the chain. If the next atom i is in the same cell, then the hoc for that cell is set to be i and the linked list at position i will point to the index of the previous atom. This is done iteratively for all atoms.
Definition at line 443 of file cell_lists.h.
void pele::CellLists< distance_policy >::sanity_check | ( | ) | [protected] |
Definition at line 413 of file cell_lists.h.
void pele::CellLists< distance_policy >::setup | ( | Array< double > | coords | ) | [protected] |
Definition at line 380 of file cell_lists.h.
const pele::Array<double> pele::CellLists< distance_policy >::m_boxv [protected] |
Definition at line 212 of file cell_lists.h.
container_type pele::CellLists< distance_policy >::m_container [protected] |
m_container is the class which hold the actual cell lists
it also manages iterating through the pairs of atoms
Definition at line 222 of file cell_lists.h.
pele::Array<double> pele::CellLists< distance_policy >::m_coords [protected] |
Definition at line 208 of file cell_lists.h.
std::shared_ptr<distance_policy> pele::CellLists< distance_policy >::m_dist [protected] |
Definition at line 207 of file cell_lists.h.
bool pele::CellLists< distance_policy >::m_initialised [protected] |
Definition at line 211 of file cell_lists.h.
size_t pele::CellLists< distance_policy >::m_natoms [protected] |
Definition at line 209 of file cell_lists.h.
const size_t pele::CellLists< distance_policy >::m_ncells [protected] |
Definition at line 214 of file cell_lists.h.
const size_t pele::CellLists< distance_policy >::m_ncellx [protected] |
Definition at line 213 of file cell_lists.h.
const size_t pele::CellLists< distance_policy >::m_ndim = distance_policy::_ndim [static, protected] |
Definition at line 205 of file cell_lists.h.
const double pele::CellLists< distance_policy >::m_rcell [protected] |
Definition at line 215 of file cell_lists.h.
const double pele::CellLists< distance_policy >::m_rcut [protected] |
Definition at line 210 of file cell_lists.h.
const double pele::CellLists< distance_policy >::m_xmax [protected] |
Definition at line 224 of file cell_lists.h.
const double pele::CellLists< distance_policy >::m_xmin [protected] |
Definition at line 223 of file cell_lists.h.