34 const bool& do_pair,
const bool& do_pbc,
const Pbc& pbc,
35 const double& distance,
const unsigned& stride): reduced(false),
36 do_pair_(do_pair), do_pbc_(do_pbc), pbc_(&pbc),
37 distance_(distance), stride_(stride)
56 const Pbc& pbc,
const double& distance,
57 const unsigned& stride): reduced(false),
58 do_pbc_(do_pbc), pbc_(&pbc),
59 distance_(distance), stride_(stride){
80 pair<unsigned,unsigned> index;
82 index=pair<unsigned,unsigned>(ipair,ipair+
nlist0_);
87 unsigned K = unsigned(floor((sqrt(
double(8*ii+1))+1)/2));
88 unsigned jj = ii-K*(K-1)/2;
101 unsigned index0=index.first;
102 unsigned index1=index.second;
105 distance=
pbc_->
distance(positions[index0],positions[index1]);
107 distance=
delta(positions[index0],positions[index1]);
109 double value=
modulo2(distance);
117 for(
unsigned int i=0;i<
size();++i){
127 unsigned newindex0=0,newindex1=0;
131 vector<AtomNumber>::iterator p;
134 neighbors_[i]=pair<unsigned,unsigned>(newindex0,newindex1);
161 vector<unsigned> neighbors;
162 for(
unsigned int i=0;i<
size();++i){
Simple class to store the index of an atom.
std::vector< std::pair< unsigned, unsigned > > neighbors_
std::vector< PLMD::AtomNumber > & getFullAtomList()
Return the list of all atoms. These are needed to rebuild the neighbor list.
Class implementing fixed size vectors of doubles.
std::vector< unsigned > getNeighbors(unsigned i)
Get the list of neighbors of the i-th atom.
std::vector< PLMD::AtomNumber > requestlist_
std::vector< PLMD::AtomNumber > fullatomlist_
void setRequestList()
Extract the list of atoms from the current list of close pairs.
void update(const std::vector< PLMD::Vector > &positions)
Update the neighbor list and prepare the new list of atoms that will be requested to the main code...
void setLastUpdate(unsigned step)
Set the step of the last update.
Vector distance(const Vector &, const Vector &, int *nshifts) const
internal version of distance, also returns the number of attempted shifts (used in Pbc::test())...
std::pair< unsigned, unsigned > getClosePair(unsigned i) const
Get the i-th pair of the neighbor list.
VectorGeneric< n > delta(const VectorGeneric< n > &v1, const VectorGeneric< n > &v2)
std::pair< unsigned, unsigned > getIndexPair(unsigned i)
Return the pair of indexes in the positions array of the two atoms forming the i-th pair among all po...
double modulo2(const VectorGeneric< n > &v)
void initialize()
Initialize the neighbor list with all possible pairs.
unsigned getStride() const
Get the update stride of the neighbor list.
std::vector< PLMD::AtomNumber > & getReducedAtomList()
Update the indexes in the neighbor list to match the ordering in the new positions array and return t...
unsigned getLastUpdate() const
Get the last step in which the neighbor list was updated.
NeighborList(const std::vector< PLMD::AtomNumber > &list0, const std::vector< PLMD::AtomNumber > &list1, const bool &do_pair, const bool &do_pbc, const PLMD::Pbc &pbc, const double &distance=1.0e+30, const unsigned &stride=0)
unsigned size() const
Get the size of the neighbor list.