Simpatico  v1.10
McPairPotential.cpp
1 /*
2 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
3 *
4 * Copyright 2010 - 2017, The Regents of the University of Minnesota
5 * Distributed under the terms of the GNU General Public License.
6 */
7 
8 #include "McPairPotential.h"
9 #include <mcMd/simulation/System.h>
10 #include <mcMd/simulation/Simulation.h>
11 #include <mcMd/chemistry/Atom.h>
12 #include <mcMd/chemistry/Molecule.h>
13 #include <simp/boundary/Boundary.h>
14 #include <util/global.h>
15 
16 #include <fstream>
17 
18 namespace McMd
19 {
20 
21  using namespace Util;
22  using namespace Simp;
23 
24  /*
25  * Default constructor.
26  */
28  : ParamComposite(),
29  SystemInterface(system)
30  { setClassName("McPairPotential"); }
31 
32  /*
33  * Destructor.
34  */
36  {}
37 
38  /*
39  * Build the CellList.
40  */
42  {
43  // Set up a grid of empty cells.
45 
46  // Add all atoms to cellList_
48  Molecule::AtomIterator atomIter;
49  for (int iSpec=0; iSpec < simulation().nSpecies(); ++iSpec) {
50  for (begin(iSpec, molIter); molIter.notEnd(); ++molIter) {
51  for (molIter->begin(atomIter); atomIter.notEnd(); ++atomIter) {
52  boundary().shift(atomIter->position());
53  cellList_.addAtom(*atomIter);
54  }
55  }
56  }
57 
58  }
59 
60 }
virtual double maxPairCutoff() const =0
Return maximum cutoff distance.
void buildCellList()
Build the CellList with current configuration.
An interface to a System.
bool notEnd() const
Is the current pointer not at the end of the array?
Definition: ArrayIterator.h:83
McPairPotential(System &system)
Constructor.
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
CellList cellList_
Cell list for atom positions.
Simulation & simulation() const
Get the parent Simulation by reference.
bool notEnd() const
Is the current pointer not at the end of the PArray?
Utility classes for scientific computation.
Definition: accumulators.mod:1
void setup(const Boundary &boundary, double cutoff)
Setup grid of empty cells.
void shift(Vector &r) const
Shift Cartesian Vector r to its primary image.
Forward iterator for an Array or a C array.
Definition: ArrayIterator.h:39
Forward iterator for a PArray.
Definition: ArraySet.h:19
virtual ~McPairPotential()
Destructor.
void begin(int speciesId, System::MoleculeIterator &iterator)
Initialize an iterator for molecules of one species in this SystemInterface.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSpecies() const
Get the number of Species in this Simulation.
void setClassName(const char *className)
Set class name string.
Boundary & boundary() const
Get the Boundary by reference.
An object that can read multiple parameters from file.
void addAtom(Atom &atom)
Add a Atom to the appropriate cell, based on its position.