ParM  parm
A molecular dynamics library
Public Member Functions | Protected Attributes | List of all members
PairList Class Reference

A mapping of Atom -> [list of Atom], used by NeighborList to keep track of what atoms are near what other atoms. More...

#include <trackers.hpp>

Public Member Functions

 PairList ()
 
void ensure (const AtomID a)
 Ensure that a given Atom is in the overall list. More...
 
void ensure (vector< AtomID > ps)
 Ensure that every Atom in input is in the overall list. More...
 
void ensure (AtomGroup &group)
 Ensure that every Atom in input is in the overall list. More...
 
bool has_pair (AtomID a1, AtomID a2)
 Check if a given pair is is the list. More...
 
void add_pair (AtomID a1, AtomID a2)
 Add a pair to the list. More...
 
void erase_pair (AtomID a1, AtomID a2)
 Remove a pair from the list. More...
 
set< AtomIDget_pairs (const AtomID a)
 Get all atoms neighboring an Atom that are "lesser" than the Atom. More...
 
set< AtomID >::iterator begin (const AtomID a)
 for iterating over neighbors More...
 
set< AtomID >::iterator end (const AtomID a)
 for iterating over neighbors More...
 
uint size () const
 for iterating over neighbors More...
 
void clear ()
 Clear the inner lists. More...
 

Protected Attributes

map< const AtomID, set< AtomID > > pairs
 

Detailed Description

A mapping of Atom -> [list of Atom], used by NeighborList to keep track of what atoms are near what other atoms.

Pairs are assumed to be symmetric, i.e. either (a1, a2) is stored or (a2, a1) is stored, and only one will be returned through the iterator.

Constructor & Destructor Documentation

PairList::PairList ( )
inline

Member Function Documentation

void PairList::add_pair ( AtomID  a1,
AtomID  a2 
)
inline

Add a pair to the list.

If already in the list, nothing changes.

set<AtomID>::iterator PairList::begin ( const AtomID  a)
inline

for iterating over neighbors

void PairList::clear ( )

Clear the inner lists.

set<AtomID>::iterator PairList::end ( const AtomID  a)
inline

for iterating over neighbors

void PairList::ensure ( const AtomID  a)
inline

Ensure that a given Atom is in the overall list.

void PairList::ensure ( vector< AtomID ps)
inline

Ensure that every Atom in input is in the overall list.

void PairList::ensure ( AtomGroup group)
inline

Ensure that every Atom in input is in the overall list.

void PairList::erase_pair ( AtomID  a1,
AtomID  a2 
)
inline

Remove a pair from the list.

If not already in the list, nothing changes.

set<AtomID> PairList::get_pairs ( const AtomID  a)
inline

Get all atoms neighboring an Atom that are "lesser" than the Atom.

Because of the way neighbors are stored, there is no easy way to actually get all neighbors of an Atom, but if get_pairs is called successively on all atoms, it will return each and every pair exactly once (including "false positives").

bool PairList::has_pair ( AtomID  a1,
AtomID  a2 
)
inline

Check if a given pair is is the list.

Note that has_pair(a1, a2) == has_pair(a2, a1).

uint PairList::size ( ) const
inline

for iterating over neighbors

Member Data Documentation

map<const AtomID, set<AtomID> > PairList::pairs
protected

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