Simpatico  v1.10
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Friends
McMd::PairSelector Class Reference

Detailed Description

Selection rule for pairs of Atoms.

A PairSelector object defines a selection rule for pairs of atoms in other analyzers that calculate, e.g., RDFs or nonbonded pair energies. The rule can require that the pair be intramolecular, intermolecular, or either, and can require that the typeId for each atom either match a particular value, or that it be left unconstrained.

A PairSelector has a pair type and two atom type indices.

The pair type is a PairType enum, which can be INTRA, INTER, or ALL.

The atom types ids are integers. A non-negative integer indicates an atom type id. A negative integer indicates that all types are accepted.

The bool match() method returns true if a pair satisfies the rule, or false otherwise.

Definition at line 32 of file PairSelector.h.

#include <PairSelector.h>

Public Types

Public Member Functions

 PairSelector ()
 Constructor. More...
 
void setAvoidDoubleCounting (bool avoidDoubleCounting)
 Set policy to avoid double counting (true) or to not avoid (false). More...
 
bool match (const Atom &atom1, const Atom &atom2) const
 Return true if pair of atoms matches the selector policy. More...
 
PairType pairType () const
 Return value of pair type. More...
 
int atom1TypeId () const
 Return value of type Id for atom 1 (-1 means accept all types). More...
 
int atom2TypeId () const
 Return value of type Id for atom 2 (-1 means accept all types). More...
 

Static Public Member Functions

static void commitMpiType ()
 Commit associated MPI DataType. More...
 

Friends

std::istream & operator>> (std::istream &in, PairSelector &selector)
 istream extractor (>>) for a PairSelector object. More...
 
std::ostream & operator<< (std::ostream &out, const PairSelector &selector)
 ostream inserter (<<) for a PairSelector object. More...
 
template<class Archive >
void serialize (Archive &ar, PairSelector &selector, const unsigned int version)
 Serialize a PairSelector. More...
 

Member Enumeration Documentation

Type of atom pair, based on identity of parent molecules.

Values:

  • INTRA : intra-molecular pair
  • INTER : inter-molecular pair
  • ALL : accept intra- and inter-molecular pairs

Definition at line 45 of file PairSelector.h.

Constructor & Destructor Documentation

McMd::PairSelector::PairSelector ( )

Constructor.

Definition at line 20 of file PairSelector.cpp.

Member Function Documentation

void McMd::PairSelector::setAvoidDoubleCounting ( bool  avoidDoubleCounting)

Set policy to avoid double counting (true) or to not avoid (false).

Parameters
avoidDoubleCountingPolicy: true to avoid, false otherwise.

Definition at line 30 of file PairSelector.cpp.

Referenced by McMd::McPairEnergyAverage::McPairEnergyAverage().

bool McMd::PairSelector::match ( const Atom atom1,
const Atom atom2 
) const

Return true if pair of atoms matches the selector policy.

Return true to accept this atom pair, false to reject.

Parameters
atom1first atom in pair.
atom2second atom in pair.

Definition at line 36 of file PairSelector.cpp.

References McMd::Atom::id(), McMd::Atom::molecule(), and McMd::Atom::typeId().

Referenced by McMd::McPairEnergyAverage::sample(), McMd::MdPairEnergyCoefficients::sample(), and McMd::RDF::sample().

PairSelector::PairType McMd::PairSelector::pairType ( ) const
inline

Return value of pair type.

Definition at line 117 of file PairSelector.h.

Referenced by McMd::RDF::output().

int McMd::PairSelector::atom1TypeId ( ) const
inline

Return value of type Id for atom 1 (-1 means accept all types).

Definition at line 123 of file PairSelector.h.

int McMd::PairSelector::atom2TypeId ( ) const
inline

Return value of type Id for atom 2 (-1 means accept all types).

Definition at line 129 of file PairSelector.h.

References operator<<, and operator>>.

void McMd::PairSelector::commitMpiType ( )
static

Commit associated MPI DataType.

Definition at line 168 of file PairSelector.cpp.

References Util::MpiStructBuilder::addMember(), Util::MpiStructBuilder::commit(), and Util::MpiStructBuilder::setBase().

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
PairSelector selector 
)
friend

istream extractor (>>) for a PairSelector object.

Format: pairType atom1TypeId atom2TypeId

Parameters
ininput stream
selectorPairSelector to be read from stream
Returns
modified input stream

Definition at line 82 of file PairSelector.cpp.

Referenced by atom2TypeId(), and McMd::serialize().

std::ostream& operator<< ( std::ostream &  out,
const PairSelector selector 
)
friend

ostream inserter (<<) for a PairSelector object.

Format: pairType atom1TypeId atom2TypeId

Parameters
outoutput stream
selectorPairSelector to be written to stream
Returns
modified output stream

Definition at line 93 of file PairSelector.cpp.

Referenced by atom2TypeId(), and McMd::serialize().

template<class Archive >
void serialize ( Archive &  ar,
PairSelector selector,
const unsigned int  version 
)
friend

Serialize a PairSelector.

Default implementation calls serialize method of data object. Can be overridden by any explicit specialization.

Parameters
ararchive object
selectorobject to be serialized
versionarchive version id

Definition at line 167 of file PairSelector.h.


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