Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
PLMD::NeighborList Class Reference

#include <NeighborList.h>

Public Types

using pairAtomNumbers = std::pair< PLMD::AtomNumber, PLMD::AtomNumber >
 
using pairIDs = std::pair< unsigned, unsigned >
 

Public Member Functions

 NeighborList (const std::vector< PLMD::AtomNumber > &list0, const bool &serial, const bool &do_pbc, const PLMD::Pbc &pbc, Communicator &cm, const double &distance=1.0e+30, const unsigned &stride=0)
 
 NeighborList (const std::vector< PLMD::AtomNumber > &list0, const std::vector< PLMD::AtomNumber > &list1, const bool &serial, const bool &do_pair, const bool &do_pbc, const PLMD::Pbc &pbc, Communicator &cm, const double &distance=1.0e+30, const unsigned &stride=0)
 
 ~NeighborList ()
 
double distance () const
 Get the distance used to create the neighbor list. More...
 
pairIDs getClosePair (unsigned i) const
 Get the i-th pair of the neighbor list. More...
 
pairAtomNumbers getClosePairAtomNumber (unsigned i) const
 Get the i-th pair of AtomNumbers from the neighbor list. More...
 
std::vector< PLMD::AtomNumber > & getFullAtomList ()
 Return the list of all atoms. These are needed to rebuild the neighbor list. More...
 
unsigned getLastUpdate () const
 Get the last step in which the neighbor list was updated. More...
 
std::vector< unsigned > getNeighbors (unsigned i)
 Get the list of neighbors of the i-th atom. More...
 
std::vector< PLMD::AtomNumber > & getReducedAtomList ()
 Update the indexes in the neighbor list to match the ordering in the new positions array and return the new list of atoms that must be requested to the main code. More...
 
unsigned getStride () const
 Get the update stride of the neighbor list. More...
 
void setLastUpdate (unsigned step)
 Set the step of the last update. More...
 
unsigned size () const
 Get the size of the neighbor list. More...
 
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. More...
 

Private Member Functions

pairIDs getIndexPair (unsigned i)
 Return the pair of indexes in the positions array of the two atoms forming the i-th pair among all possible pairs. More...
 
void initialize ()
 Initialize the neighbor list with all possible pairs. More...
 
void setRequestList ()
 Extract the list of atoms from the current list of close pairs. More...
 

Private Attributes

Communicatorcomm
 
double distance_
 
bool do_pair_
 
bool do_pbc_
 
std::vector< PLMD::AtomNumberfullatomlist_ {}
 
unsigned lastupdate_ =0
 
size_t nallpairs_
 
std::vector< pairIDsneighbors_ {}
 
size_t nlist0_ =0
 
size_t nlist1_ =0
 
const PLMD::Pbcpbc_
 
bool reduced =false
 
std::vector< PLMD::AtomNumberrequestlist_ {}
 
bool serial_
 
unsigned stride_ =0
 
bool twolists_
 

Detailed Description

A class that implements neighbor lists from two lists or a single list of atoms

Member Typedef Documentation

◆ pairAtomNumbers

◆ pairIDs

using PLMD::NeighborList::pairIDs = std::pair<unsigned,unsigned>

Constructor & Destructor Documentation

◆ NeighborList() [1/2]

PLMD::NeighborList::NeighborList ( const std::vector< PLMD::AtomNumber > &  list0,
const std::vector< PLMD::AtomNumber > &  list1,
const bool &  serial,
const bool &  do_pair,
const bool &  do_pbc,
const PLMD::Pbc pbc,
Communicator cm,
const double &  distance = 1.0e+30,
const unsigned &  stride = 0 
)

◆ NeighborList() [2/2]

PLMD::NeighborList::NeighborList ( const std::vector< PLMD::AtomNumber > &  list0,
const bool &  serial,
const bool &  do_pbc,
const PLMD::Pbc pbc,
Communicator cm,
const double &  distance = 1.0e+30,
const unsigned &  stride = 0 
)

◆ ~NeighborList()

PLMD::NeighborList::~NeighborList ( )
default

Member Function Documentation

◆ distance()

double PLMD::NeighborList::distance ( ) const

Get the distance used to create the neighbor list.

◆ getClosePair()

NeighborList::pairIDs PLMD::NeighborList::getClosePair ( unsigned  i) const

Get the i-th pair of the neighbor list.

◆ getClosePairAtomNumber()

NeighborList::pairAtomNumbers PLMD::NeighborList::getClosePairAtomNumber ( unsigned  i) const

Get the i-th pair of AtomNumbers from the neighbor list.

◆ getFullAtomList()

std::vector< AtomNumber > & PLMD::NeighborList::getFullAtomList ( )

Return the list of all atoms. These are needed to rebuild the neighbor list.

◆ getIndexPair()

NeighborList::pairIDs PLMD::NeighborList::getIndexPair ( unsigned  i)
private

Return the pair of indexes in the positions array of the two atoms forming the i-th pair among all possible pairs.

◆ getLastUpdate()

unsigned PLMD::NeighborList::getLastUpdate ( ) const

Get the last step in which the neighbor list was updated.

◆ getNeighbors()

std::vector< unsigned > PLMD::NeighborList::getNeighbors ( unsigned  i)

Get the list of neighbors of the i-th atom.

◆ getReducedAtomList()

std::vector< AtomNumber > & PLMD::NeighborList::getReducedAtomList ( )

Update the indexes in the neighbor list to match the ordering in the new positions array and return the new list of atoms that must be requested to the main code.

◆ getStride()

unsigned PLMD::NeighborList::getStride ( ) const

Get the update stride of the neighbor list.

◆ initialize()

void PLMD::NeighborList::initialize ( )
private

Initialize the neighbor list with all possible pairs.

◆ setLastUpdate()

void PLMD::NeighborList::setLastUpdate ( unsigned  step)

Set the step of the last update.

◆ setRequestList()

void PLMD::NeighborList::setRequestList ( )
private

Extract the list of atoms from the current list of close pairs.

◆ size()

unsigned PLMD::NeighborList::size ( ) const

Get the size of the neighbor list.

◆ update()

void PLMD::NeighborList::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.

Member Data Documentation

◆ comm

Communicator& PLMD::NeighborList::comm
private

◆ distance_

double PLMD::NeighborList::distance_
private

◆ do_pair_

bool PLMD::NeighborList::do_pair_
private

◆ do_pbc_

bool PLMD::NeighborList::do_pbc_
private

◆ fullatomlist_

std::vector<PLMD::AtomNumber> PLMD::NeighborList::fullatomlist_ {}
private

◆ lastupdate_

unsigned PLMD::NeighborList::lastupdate_ =0
private

◆ nallpairs_

size_t PLMD::NeighborList::nallpairs_
private

◆ neighbors_

std::vector<pairIDs > PLMD::NeighborList::neighbors_ {}
private

◆ nlist0_

size_t PLMD::NeighborList::nlist0_ =0
private

◆ nlist1_

size_t PLMD::NeighborList::nlist1_ =0
private

◆ pbc_

const PLMD::Pbc* PLMD::NeighborList::pbc_
private

◆ reduced

bool PLMD::NeighborList::reduced =false
private

◆ requestlist_

std::vector<PLMD::AtomNumber> PLMD::NeighborList::requestlist_ {}
private

◆ serial_

bool PLMD::NeighborList::serial_
private

◆ stride_

unsigned PLMD::NeighborList::stride_ =0
private

◆ twolists_

bool PLMD::NeighborList::twolists_
private

The documentation for this class was generated from the following files: