8 #include "PairSelector.h" 9 #include <mcMd/chemistry/Atom.h> 10 #include <util/param/Parameter.h> 24 avoidDoubleCounting_(false)
31 { avoidDoubleCounting_ = avoidDoubleCounting; }
48 if (&atom1 == &atom2) {
53 if (atom1TypeId_ >= 0 && atom1.
typeId() != atom1TypeId_) {
56 if (atom2TypeId_ >= 0 && atom2.
typeId() != atom2TypeId_) {
61 if (avoidDoubleCounting_) {
62 if (atom1TypeId_ < 0 && atom2TypeId_ < 0) {
63 if (atom1.
id() > atom2.
id()) {
68 if (atom1.
id() > atom2.
id()) {
84 in >> selector.pairType_;
85 in >> selector.atom1TypeId_;
86 in >> selector.atom2TypeId_;
96 out << selector.pairType_;
98 out << selector.atom1TypeId_;
100 out << selector.atom2TypeId_;
111 if (buffer ==
"intra" || buffer ==
"Intra" || buffer ==
"INTRA") {
112 type = PairSelector::INTRA;
114 if (buffer ==
"inter" || buffer ==
"Inter" || buffer ==
"INTER") {
115 type = PairSelector::INTER;
117 if (buffer ==
"all" || buffer ==
"All" || buffer ==
"ALL") {
118 type = PairSelector::ALL;
130 if (type == PairSelector::INTRA) {
133 if (type == PairSelector::INTER) {
136 if (type == PairSelector::ALL) {
160 #include <util/mpi/MpiStructBuilder.h> 175 builder.
addMember(&
object.atom1TypeId_, MPI::INT);
176 builder.
addMember(&
object.atom2TypeId_, MPI::INT);
183 #endif // ifdef UTIL_MPI void addMember(void *memberAddress, MPI::Datatype type, int count=1)
Add a new member variable to the type map.
static void commitMpiType()
Commit associated MPI DataType.
Molecule & molecule() const
Get the parent Molecule by reference.
friend std::ostream & operator<<(std::ostream &out, const PairSelector &selector)
ostream inserter (<<) for a PairSelector object.
void setBase(void *objectAddress)
Set address of an class instance.
void commit(MPI::Datatype &newType)
Build and commit a user-defined MPI Struct datatype.
bool match(const Atom &atom1, const Atom &atom2) const
Return true if pair of atoms matches the selector policy.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
int typeId() const
Get type index for this Atom.
A point particle within a Molecule.
Utility classes for scientific computation.
PairSelector()
Constructor.
friend std::istream & operator>>(std::istream &in, PairSelector &selector)
istream extractor (>>) for a PairSelector object.
int id() const
Get global index for this Atom within the Simulation.
Selection rule for pairs of Atoms.
void setAvoidDoubleCounting(bool avoidDoubleCounting)
Set policy to avoid double counting (true) or to not avoid (false).
A MpiStructBuilder objects is used to create an MPI Struct datatype.
PairType
Type of atom pair, based on identity of parent molecules.
static const int Width
Width of output field for a scalar variable.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).