Simpatico  v1.10
MdEwaldPotential.h
1 #ifndef MCMD_MD_EWALD_POTENTIAL_H
2 #define MCMD_MD_EWALD_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/misc/Setable.h> // member template
24 #include <util/containers/Array.h> // member class template
25 
26 #include <complex>
27 
28 namespace McMd
29 {
30 
31  class Simulation;
32  class System;
33 
34  typedef std::complex<double> DCMPLX;
35 
36  using namespace Util;
37  using namespace Simp;
38 
48  {
49 
50  public:
51 
57  MdEwaldPotential(System& system);
58 
62  virtual ~MdEwaldPotential();
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  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  double base0_, base1_, base2_;
167  double upper0_, upper1_, upper2_;
168  GArray<DCMPLX> fexp0_;
169  GArray<DCMPLX> fexp1_;
170  GArray<DCMPLX> fexp2_;
171 
173  GArray<IntVector> intWaves_;
174 
175  //real space vector indices.
176  GArray<Vector> reals_;
177 
179  GArray<double> ksq_;
180 
182  GArray<double> g_;
183 
185  GArray<DCMPLX> rho_;
186 
188  double kSpaceCutoff_;
189 
190  /*
191  * Calculate Fourier coefficients of charge density.
192  */
193  void computeKSpaceCharge();
194 
195  };
196 
197 }
198 #endif
199 
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.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
Ewald Coulomb potential class for MD simulations.