Loading...
Searching...
No Matches
PLMD::LinkCells Class Reference

A class for doing link cells. More...

#include <LinkCells.h>

Classes

struct  CellCollection
 This struct contains the configuration of cells. More...
 

Public Member Functions

 LinkCells (Communicator &comm)
 
void addRequiredCells (const std::array< unsigned, 3 > &celn, unsigned &ncells_required, std::vector< unsigned > &cells_required, bool usePbc=true) const
 Get the list of cells we need to surround the a particular cell.
 
template<typename T, typename Y>
void buildCellLists (const T &pos, const Y &indices, const Pbc &pbc)
 
void buildCellLists (View< const Vector > pos, View< const unsigned > indices, const Pbc &pbc)
 Build the link cell lists.
 
unsigned convertIndicesToIndex (std::array< unsigned, 3 > cellCoord) const
 Take three indices and return the index of the corresponding cell.
 
void createNeighborList (unsigned nat, View< const Vector > pos, View< const unsigned > ind, View< const unsigned > tind, View< const Vector > neigh_pos, View< const unsigned > neigh_ind, const Pbc &pbc, unsigned &natoms_per_list, std::vector< std::size_t > &nlist)
 Create a neighbour list for the specified input atoms.
 
bool enabled () const
 Have the link cells been enabled.
 
unsigned findCell (const Vector &pos) const
 Find the cell index in which this position is contained.
 
std::array< unsigned, 3 > findMyCell (unsigned cellIndex) const
 Returns the "coordinate" of the cell index, assumes that cellIndex < getNumberOfCells()
 
std::array< unsigned, 3 > findMyCell (Vector pos) const
 Find the cell in which this position is contained.
 
const std::array< unsigned, 3 > & getCellLimits () const
 Get the number of cells per dimension.
 
template<typename T, typename Y>
CellCollection getCollection (const T &pos, const Y &indices)
 
CellCollection getCollection (View< const Vector > pos, View< const unsigned > indices)
 
double getCutoff () const
 Get the value of the cutoff.
 
unsigned getMaxInCell () const
 Get the number of atoms in the cell that contains the most atoms.
 
unsigned getNumberOfCells () const
 Get the total number of link cells.
 
void resetCollection (CellCollection &collection, View< const Vector > pos, View< const unsigned > indices)
 
void retrieveAtomsInCells (unsigned ncells_required, View< const unsigned > cells_required, unsigned &natomsper, std::vector< unsigned > &atoms, unsigned avoidIndex=std::numeric_limits< unsigned >::max()) const
 Retrieve the atoms in a list of cells.
 
void retrieveNeighboringAtoms (const Vector &pos, std::vector< unsigned > &cell_list, unsigned &natomsper, std::vector< unsigned > &atoms) const
 Retrieve the atoms we need to consider.
 
void setCutoff (double lcut)
 Set the value of the cutoff.
 
template<typename T>
void setupCells (const T &pos, const Pbc &pbc)
 
void setupCells (View< const Vector > pos, const Pbc &pbc)
 setups the cells
 

Private Attributes

std::vector< unsigned > allcells
 Work vector with the list of cells each atom is inside.
 
Communicatorcomm
 Symbolic link to plumed communicator.
 
bool cutoffwasset =false
 Check that the link cells were set up correctly.
 
CellCollection innerCollection
 The collection of indexes per cell created by buildCellLists.
 
double link_cutoff =0.0
 The cutoff to use for the sizes of the cells.
 
Pbc mypbc
 The pbc we are using for link cells.
 
std::array< unsigned, 3 > ncells {0,0,0}
 The number of cells in each direction.
 
bool nopbc =false
 Are there periodic boundary conditions setup.
 
std::array< unsigned, 3 > nstride {0,0,0}
 The number of cells to stride through to get the link cells.
 
Vector origin
 The location of the origin if we are not using periodic boundary conditions.
 

Detailed Description

A class for doing link cells.

Constructor & Destructor Documentation

◆ LinkCells()

PLMD::LinkCells::LinkCells ( Communicator & comm)
explicit

Member Function Documentation

◆ addRequiredCells()

void PLMD::LinkCells::addRequiredCells ( const std::array< unsigned, 3 > & celn,
unsigned & ncells_required,
std::vector< unsigned > & cells_required,
bool usePbc = true ) const

Get the list of cells we need to surround the a particular cell.

usePbc toggles the use of pbcs for the input cell (celln)

◆ buildCellLists() [1/2]

template<typename T, typename Y>
void PLMD::LinkCells::buildCellLists ( const T & pos,
const Y & indices,
const Pbc & pbc )
inline

◆ buildCellLists() [2/2]

void PLMD::LinkCells::buildCellLists ( View< const Vector > pos,
View< const unsigned > indices,
const Pbc & pbc )

Build the link cell lists.

◆ convertIndicesToIndex()

unsigned PLMD::LinkCells::convertIndicesToIndex ( std::array< unsigned, 3 > cellCoord) const

Take three indices and return the index of the corresponding cell.

◆ createNeighborList()

void PLMD::LinkCells::createNeighborList ( unsigned nat,
View< const Vector > pos,
View< const unsigned > ind,
View< const unsigned > tind,
View< const Vector > neigh_pos,
View< const unsigned > neigh_ind,
const Pbc & pbc,
unsigned & natoms_per_list,
std::vector< std::size_t > & nlist )

Create a neighbour list for the specified input atoms.

Parameters
natnumber of atoms
posposition of the "central atoms"
indindexes of the central atoms
tindtemporary indexes
neigh_posposition of the candidate neighbors
neigh_indindexes of the candidate neighbors
pbc
natoms_per_listoutput number of atom per list (mapped on tind) nlist[tind[i]]=natoms[i]
nlistoutput list of the central atoms plus their neigbors

◆ enabled()

bool PLMD::LinkCells::enabled ( ) const
inline

Have the link cells been enabled.

◆ findCell()

unsigned PLMD::LinkCells::findCell ( const Vector & pos) const

Find the cell index in which this position is contained.

◆ findMyCell() [1/2]

std::array< unsigned, 3 > PLMD::LinkCells::findMyCell ( unsigned cellIndex) const

Returns the "coordinate" of the cell index, assumes that cellIndex < getNumberOfCells()

◆ findMyCell() [2/2]

std::array< unsigned, 3 > PLMD::LinkCells::findMyCell ( Vector pos) const

Find the cell in which this position is contained.

◆ getCellLimits()

const std::array< unsigned, 3 > & PLMD::LinkCells::getCellLimits ( ) const
inline

Get the number of cells per dimension.

◆ getCollection() [1/2]

template<typename T, typename Y>
CellCollection PLMD::LinkCells::getCollection ( const T & pos,
const Y & indices )
inline

◆ getCollection() [2/2]

LinkCells::CellCollection PLMD::LinkCells::getCollection ( View< const Vector > pos,
View< const unsigned > indices )

◆ getCutoff()

double PLMD::LinkCells::getCutoff ( ) const

Get the value of the cutoff.

◆ getMaxInCell()

unsigned PLMD::LinkCells::getMaxInCell ( ) const

Get the number of atoms in the cell that contains the most atoms.

◆ getNumberOfCells()

unsigned PLMD::LinkCells::getNumberOfCells ( ) const
inline

Get the total number of link cells.

◆ resetCollection()

void PLMD::LinkCells::resetCollection ( LinkCells::CellCollection & collection,
View< const Vector > pos,
View< const unsigned > indices )

◆ retrieveAtomsInCells()

void PLMD::LinkCells::retrieveAtomsInCells ( unsigned ncells_required,
View< const unsigned > cells_required,
unsigned & natomsper,
std::vector< unsigned > & atoms,
unsigned avoidIndex = std::numeric_limits<unsigned>::max() ) const

Retrieve the atoms in a list of cells.

◆ retrieveNeighboringAtoms()

void PLMD::LinkCells::retrieveNeighboringAtoms ( const Vector & pos,
std::vector< unsigned > & cell_list,
unsigned & natomsper,
std::vector< unsigned > & atoms ) const

Retrieve the atoms we need to consider.

◆ setCutoff()

void PLMD::LinkCells::setCutoff ( double lcut)

Set the value of the cutoff.

◆ setupCells() [1/2]

template<typename T>
void PLMD::LinkCells::setupCells ( const T & pos,
const Pbc & pbc )
inline

◆ setupCells() [2/2]

void PLMD::LinkCells::setupCells ( View< const Vector > pos,
const Pbc & pbc )

setups the cells

Usually it only uses the pbcs if the pbc box is null (three zero vectors) it builds an orthorombic box from the given positions

Member Data Documentation

◆ allcells

std::vector<unsigned> PLMD::LinkCells::allcells
private

Work vector with the list of cells each atom is inside.

◆ comm

Communicator& PLMD::LinkCells::comm
private

Symbolic link to plumed communicator.

◆ cutoffwasset

bool PLMD::LinkCells::cutoffwasset =false
private

Check that the link cells were set up correctly.

◆ innerCollection

CellCollection PLMD::LinkCells::innerCollection
private

The collection of indexes per cell created by buildCellLists.

◆ link_cutoff

double PLMD::LinkCells::link_cutoff =0.0
private

The cutoff to use for the sizes of the cells.

◆ mypbc

Pbc PLMD::LinkCells::mypbc
private

The pbc we are using for link cells.

◆ ncells

std::array<unsigned,3> PLMD::LinkCells::ncells {0,0,0}
private

The number of cells in each direction.

◆ nopbc

bool PLMD::LinkCells::nopbc =false
private

Are there periodic boundary conditions setup.

◆ nstride

std::array<unsigned,3> PLMD::LinkCells::nstride {0,0,0}
private

The number of cells to stride through to get the link cells.

◆ origin

Vector PLMD::LinkCells::origin
private

The location of the origin if we are not using periodic boundary conditions.


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