mcpele
1.0.0
The Monte Carlo Python Energy Landscape Explorer
|
#include <neighbor_iterator.h>
Public Types | |
typedef std::vector< std::pair < size_t, size_t > > | container_type |
typedef container_type::const_iterator | const_iterator |
Public Member Functions | |
~CellIter () | |
CellIter (std::shared_ptr< distance_policy > dist, pele::Array< double > const boxv, const double rcut, const double ncellx_scale=1.0) | |
const_iterator | begin () const |
const_iterator | end () 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 () |
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 |
pele::Array< long int > | m_hoc |
pele::Array< long int > | m_ll |
std::vector< std::pair< size_t, size_t > > | m_cell_neighbor_pairs |
std::vector< std::pair< size_t, size_t > > | m_atom_neighbor_list |
const double | m_xmin |
const double | m_xmax |
Static Protected Attributes | |
static const size_t | m_ndim = distance_policy::_ndim |
Definition at line 67 of file neighbor_iterator.h.
typedef container_type::const_iterator pele::CellIter< distance_policy >::const_iterator |
Definition at line 70 of file neighbor_iterator.h.
typedef std::vector<std::pair<size_t, size_t> > pele::CellIter< distance_policy >::container_type |
Definition at line 69 of file neighbor_iterator.h.
pele::CellIter< distance_policy >::~CellIter | ( | ) | [inline] |
Definition at line 114 of file neighbor_iterator.h.
pele::CellIter< distance_policy >::CellIter | ( | 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 172 of file neighbor_iterator.h.
size_t pele::CellIter< 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 352 of file neighbor_iterator.h.
size_t pele::CellIter< distance_policy >::atom2xbegin | ( | const size_t | atom_index | ) | const [inline, protected] |
Definition at line 160 of file neighbor_iterator.h.
const_iterator pele::CellIter< distance_policy >::begin | ( | ) | const [inline] |
access to the atom pairs via iterator
Definition at line 130 of file neighbor_iterator.h.
void pele::CellIter< distance_policy >::build_atom_neighbors_list | ( | ) | [protected] |
build the list of neighboring atoms
Definition at line 509 of file neighbor_iterator.h.
void pele::CellIter< distance_policy >::build_cell_neighbors_list | ( | ) | [protected] |
build the list of neighboring cells.
Definition at line 482 of file neighbor_iterator.h.
void pele::CellIter< distance_policy >::build_linked_lists | ( | ) | [protected] |
determine which cell each atom is in and populate the arrays hoc and ll
Definition at line 541 of file neighbor_iterator.h.
pele::Array< double > pele::CellIter< 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 385 of file neighbor_iterator.h.
bool pele::CellIter< 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 413 of file neighbor_iterator.h.
const_iterator pele::CellIter< distance_policy >::end | ( | ) | const [inline] |
Definition at line 131 of file neighbor_iterator.h.
size_t pele::CellIter< distance_policy >::get_direct_nr_unique_pairs | ( | const double | max_distance, |
pele::Array< double > | x | ||
) | const |
Definition at line 214 of file neighbor_iterator.h.
size_t pele::CellIter< distance_policy >::get_maximum_nr_unique_pairs | ( | pele::Array< double > | x | ) | const |
Definition at line 235 of file neighbor_iterator.h.
double pele::CellIter< distance_policy >::get_minimum_corner_distance2 | ( | pele::Array< double > | ic, |
pele::Array< double > | jc | ||
) | const [protected] |
Definition at line 425 of file neighbor_iterator.h.
size_t pele::CellIter< distance_policy >::get_nr_cells | ( | ) | const [inline] |
return the total number of cells
Definition at line 136 of file neighbor_iterator.h.
size_t pele::CellIter< distance_policy >::get_nr_cellsx | ( | ) | const [inline] |
return the number of cells in the x direction
Definition at line 141 of file neighbor_iterator.h.
size_t pele::CellIter< distance_policy >::get_nr_unique_pairs | ( | ) | const [inline] |
return the number of unique atom pairs.
These three functions are primarily used for debugging and testing
Definition at line 148 of file neighbor_iterator.h.
T pele::CellIter< 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 337 of file neighbor_iterator.h.
void pele::CellIter< 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 305 of file neighbor_iterator.h.
void pele::CellIter< distance_policy >::sanity_check | ( | ) | [protected] |
Definition at line 275 of file neighbor_iterator.h.
void pele::CellIter< distance_policy >::setup | ( | Array< double > | coords | ) | [protected] |
Definition at line 242 of file neighbor_iterator.h.
std::vector<std::pair<size_t, size_t> > pele::CellIter< distance_policy >::m_atom_neighbor_list [protected] |
m_atom_neighbor_list is where the vector of atom neighbors is stored.
This is constructed when reset() is called. begin() and end() return iterators over this vector
Definition at line 110 of file neighbor_iterator.h.
const pele::Array<double> pele::CellIter< distance_policy >::m_boxv [protected] |
Definition at line 79 of file neighbor_iterator.h.
std::vector<std::pair<size_t, size_t> > pele::CellIter< distance_policy >::m_cell_neighbor_pairs [protected] |
vector of pairs of neighboring cells
Definition at line 103 of file neighbor_iterator.h.
pele::Array<double> pele::CellIter< distance_policy >::m_coords [protected] |
Definition at line 75 of file neighbor_iterator.h.
std::shared_ptr<distance_policy> pele::CellIter< distance_policy >::m_dist [protected] |
Definition at line 74 of file neighbor_iterator.h.
pele::Array<long int> pele::CellIter< distance_policy >::m_hoc [protected] |
m_hoc is a head of chain list.
m_hoc[icell] is the index of the first atom in cell icell. This is used in conjuction with m_ll
Definition at line 90 of file neighbor_iterator.h.
bool pele::CellIter< distance_policy >::m_initialised [protected] |
Definition at line 78 of file neighbor_iterator.h.
pele::Array<long int> pele::CellIter< distance_policy >::m_ll [protected] |
m_ll is an array of linked atom indices.
m_ll[atom_i] is the index of the next atom in the same cell as atom_i. if m_ll[atom_i] is -1 then there are no more atoms in this cell.
Definition at line 98 of file neighbor_iterator.h.
size_t pele::CellIter< distance_policy >::m_natoms [protected] |
Definition at line 76 of file neighbor_iterator.h.
const size_t pele::CellIter< distance_policy >::m_ncells [protected] |
Definition at line 81 of file neighbor_iterator.h.
const size_t pele::CellIter< distance_policy >::m_ncellx [protected] |
Definition at line 80 of file neighbor_iterator.h.
const size_t pele::CellIter< distance_policy >::m_ndim = distance_policy::_ndim [static, protected] |
Definition at line 72 of file neighbor_iterator.h.
const double pele::CellIter< distance_policy >::m_rcell [protected] |
Definition at line 82 of file neighbor_iterator.h.
const double pele::CellIter< distance_policy >::m_rcut [protected] |
Definition at line 77 of file neighbor_iterator.h.
const double pele::CellIter< distance_policy >::m_xmax [protected] |
Definition at line 112 of file neighbor_iterator.h.
const double pele::CellIter< distance_policy >::m_xmin [protected] |
Definition at line 111 of file neighbor_iterator.h.