Simpatico  v1.10
MdSpmePotential.h
1 #ifndef MCMD_MD_SPME_POTENTIAL_H
2 #define MCMD_MD_SPME_POTENTIAL_H
3 
4 /*
5 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
6 *
7 * Copyright 2010 - 2012, David Morse (morse012@umn.edu)
8 * Distributed under the terms of the GNU General Public License.
9 */
10 
11 #include <mcMd/potentials/coulomb/MdCoulombPotential.h> // base class
12 #include <mcMd/potentials/coulomb/EwaldRSpaceAccumulator.h> // member
13 #include <mcMd/chemistry/AtomType.h> // member template parameter
14 
15 #include <simp/interaction/coulomb/EwaldInteraction.h> // member
16 #include <simp/boundary/Boundary.h> // typedef
17 
18 #include <util/space/IntVector.h> // member template parameter
19 #include <util/space/Vector.h> // member template parameter
20 #include <util/space/Tensor.h> // member template parameter
21 #include <util/containers/Pair.h> // member template parameter
22 #include <util/containers/GArray.h> // member template
23 #include <util/containers/GridArray.h> // member template
24 #include <util/misc/Setable.h> // member template
25 #include <util/containers/Array.h> // member class template
26 
27 #include <complex>
28 #include <fftw3.h>
29 
30 namespace McMd
31 {
32 
33  class Simulation;
34  class System;
35 
36  typedef std::complex<double> DCMPLX;
37 
38  using namespace Util;
39  using namespace Simp;
40 
50  {
51 
52  public:
53 
57  MdSpmePotential(System& system);
58 
62  virtual ~MdSpmePotential();
63 
65 
66 
72  virtual void readParameters(std::istream& in);
73 
79  virtual void loadParameters(Serializable::IArchive &ar);
80 
86  virtual void save(Serializable::OArchive &ar);
87 
89 
91 
98  void set(std::string name, double value);
99 
105  double get(std::string name) const;
106 
108 
110 
114  virtual void makeWaves();
115 
119  virtual int nWave() const;
120 
124  virtual void addForces();
125 
129  virtual void computeEnergy();
130 
134  virtual void computeStress();
135 
137 
139 
140  EwaldRSpaceAccumulator& rSpaceAccumulator()
141  { return rSpaceAccumulator_; }
142 
143  EwaldInteraction& ewaldInteraction()
144  { return ewaldInteraction_; }
145 
147 
148  private:
149 
150  // Ewald Interaction - core Ewald computations
151  EwaldInteraction ewaldInteraction_;
152 
153  // Pointer to parent Simulation
154  Simulation* simulationPtr_;
155 
156  // Pointer to parent System
157  System* systemPtr_;
158 
159  // Pointer to boundary of associated System.
160  Boundary* boundaryPtr_;
161 
162  // Pointer to array of atom types
163  const Array<AtomType>* atomTypesPtr_;
164 
166  IntVector gridDimensions_;
167 
169  GridArray<DCMPLX> rhoR_;
170 
172  GridArray<DCMPLX> rhoK_;
173 
176 
178  GridArray<double> sqWaves_;
179 
181  GridArray<Vector> vecWaves_;
182 
184  GridArray<DCMPLX> xfield_;
185 
187  GridArray<DCMPLX> yfield_;
188 
190  GridArray<DCMPLX> zfield_;
191 
193  int order_;
194 
196  fftw_plan forward_plan;
197 
199  fftw_plan xfield_backward_plan, yfield_backward_plan, zfield_backward_plan;
200 
204  template<class T>
205  void setGridToZero(GridArray<T>& grid);
206 
210  void setGridDimensions();
211 
215  void computeWaves();
216 
220  double bfactor(double m , int dim);
221 
225  void assignCharges();
226 
230  double basisSpline(double x);
231 
232  };
233 
234 }
235 #endif
Coulomb potential for an Md simulation.
An orthorhombic periodic unit cell.
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
Array container class template.
Definition: AutoCorrArray.h:28
Classes used by all simpatico molecular simulations.
The main object in a simulation, which coordinates others.
Saving / output archive for binary ostream.
Implementation of r-space and k-space Ewald Coulomb interactions.
Utility classes for scientific computation.
Definition: accumulators.mod:1
Utility class to store r-space Coulomb energy and stress.
Smooth Particle-Mesh Ewald Coulomb potential for MD simulations.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
An IntVector is an integer Cartesian vector.
Definition: IntVector.h:73