Simpatico  v1.10
CoulombFactory.cpp
1 #ifndef MCMD_COULOMB_FACTORY_CPP
2 #define MCMD_COULOMB_FACTORY_CPP
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/CoulombFactory.h>
12 #include <mcMd/simulation/System.h>
13 
14 // CoulombPotential interfaces and implementation classes
15 
16 // Coulomb Potential interaction classes
17 #include <mcMd/potentials/coulomb/MdCoulombPotential.h>
18 #include <mcMd/potentials/coulomb/MdEwaldPotential.h>
19 #ifdef SIMP_FFTW
20 #include <mcMd/potentials/coulomb/MdSpmePotential.h>
21 #endif
22 
23 
24 namespace McMd
25 {
26 
27  //using namespace Simp;
28 
34  systemPtr_(&system)
35  {}
36 
37  /*
38  * Return a pointer to a new CoulombPotential, if possible.
39  */
41  CoulombFactory::factory(const std::string& name) const
42  {
43  MdCoulombPotential* ptr = 0;
44 
45  // Try subfactories first.
46  ptr = trySubfactories(name);
47  if (ptr) return ptr;
48 
49  if (name == "Ewald") {
50  ptr = new MdEwaldPotential(*systemPtr_);
51  }
52  #ifdef SIMP_FFTW
53  else if (name == "SPME") {
54  ptr = new MdSpmePotential(*systemPtr_);
55  }
56  #endif
57  return ptr;
58  }
59 
60 }
61 #endif
Coulomb potential for an Md simulation.
MdCoulombPotential * factory(const std::string &subclass) const
Return a pointer to a new CoulombPotential, if possible.
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
CoulombFactory(System &system)
Default constructor.
MdCoulombPotential * trySubfactories(const std::string &className) const
Search through subfactories for match.
Smooth Particle-Mesh Ewald Coulomb potential for MD simulations.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
Ewald Coulomb potential class for MD simulations.
Factory template.
Definition: Factory.h:32