Simpatico  v1.10
McPairPotential.h
1 #ifndef MCMD_MC_PAIR_POTENTIAL_H
2 #define MCMD_MC_PAIR_POTENTIAL_H
3 
4 /*
5 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
6 *
7 * Copyright 2010 - 2017, The Regents of the University of Minnesota
8 * Distributed under the terms of the GNU General Public License.
9 */
10 
11 #include <util/param/ParamComposite.h> // base class
12 #include <mcMd/simulation/SystemInterface.h> // base class
13 #include <mcMd/potentials/pair/PairPotential.h> // base class
14 #include <mcMd/neighbor/CellList.h> // member
15 
16 #include <util/global.h>
17 
18 namespace McMd
19 {
20 
21  using namespace Util;
22 
23  class System;
24 
30  class McPairPotential : public ParamComposite, public PairPotential,
31  public SystemInterface
32  {
33 
34  public:
35 
39  McPairPotential(System& system);
40 
44  virtual ~McPairPotential();
45 
47 
48 
55  virtual double atomEnergy(const Atom& atom) const = 0;
56 
69  virtual double moleculeEnergy(const Molecule& molecule) const = 0;
70 
72 
74 
83  void buildCellList();
84 
90  void addAtom(Atom& atom);
91 
97  void deleteAtom(Atom& atom);
98 
107  void updateAtomCell(Atom &atom);
108 
119  void moveAtom(Atom& atom, const Vector &position);
120 
124  const CellList& cellList() const;
125 
127 
128  protected:
129 
132 
135 
136  };
137 
138  // Inline functions
139 
140  // Add an atom to CellList.
141  inline void McPairPotential::addAtom(Atom &atom)
142  { cellList_.addAtom(atom); }
143 
144  // Delete an atom from the CellList.
146  { cellList_.deleteAtom(atom); }
147 
148  // Update the cell list to reflect a new Atom position.
150  { cellList_.updateAtomCell(atom, atom.position()); }
151 
152  // Move atom to a new position.
153  inline void McPairPotential::moveAtom(Atom &atom, const Vector &position)
154  {
155  atom.position() = position;
156  cellList_.updateAtomCell(atom, position);
157  }
158 
159  // Get the cellList by const reference.
160  inline const CellList& McPairPotential::cellList() const
161  { return cellList_; }
162 
163 }
164 #endif
A Vector is a Cartesian vector.
Definition: Vector.h:75
An interface to a System.
const CellList & cellList() const
Get the cellList by const reference.
void addAtom(Atom &atom)
Add an Atom to the CellList.
void moveAtom(Atom &atom, const Vector &position)
Move an Atom position, and update the CellList.
A PairPotential for MC simulations (abstract).
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
File containing preprocessor macros for error handling.
CellList::NeighborArray neighbors_
Array to hold neighbors returned by a CellList.
CellList cellList_
Cell list for atom positions.
A point particle within a Molecule.
Utility classes for scientific computation.
Definition: accumulators.mod:1
A cell list for Atom objects in a periodic system boundary.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
Interface for a Pair Potential.
A physical molecule (a set of covalently bonded Atoms).
const Vector & position() const
Get the position Vector by const reference.
An object that can read multiple parameters from file.
void deleteAtom(Atom &atom)
Remove an Atom from the CellList.
void updateAtomCell(Atom &atom)
Update the cell list to reflect a new position.