Simpatico  v1.10
MdIntegratorFactory.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 "MdIntegratorFactory.h"
9 
10 // Subclasses of MdIntegrator
11 #include "NveVvIntegrator.h"
12 #include "NvtNhIntegrator.h"
13 #include "NvtLangevinIntegrator.h"
14 #include "NvtDpdVvIntegrator.h"
15 #include "NphIntegrator.h"
16 
17 namespace McMd
18 {
19 
20  using namespace Util;
21 
22  /*
23  * Constructor
24  */
26  : systemPtr_(&system)
27  {}
28 
29  /*
30  * Return a pointer to a instance of MdIntegrator subclass className.
31  */
32  MdIntegrator* MdIntegratorFactory::factory(const std::string &className) const
33  {
34  MdIntegrator *ptr = 0;
35 
36  // Try subfactories first
37  ptr = trySubfactories(className);
38  if (ptr) return ptr;
39 
40  // Try to match classname
41  if (className == "NveVvIntegrator") {
42  ptr = new NveVvIntegrator(*systemPtr_);
43 
44  } else
45  if (className == "NvtNhIntegrator") {
46  ptr = new NvtNhIntegrator(*systemPtr_);
47  } else
48  if (className == "NvtLangevinIntegrator") {
49  ptr = new NvtLangevinIntegrator(*systemPtr_);
50  } else
51  if (className == "NvtDpdVvIntegrator") {
52  ptr = new NvtDpdVvIntegrator(*systemPtr_);
53  }
54  if (className == "NphIntegrator") {
55  ptr = new NphIntegrator(*systemPtr_);
56  }
57  return ptr;
58  }
59 
60 }
An NVE Verlet molecular dynamics integrator.
A NVT molecular dynamics integrator with a Langevin thermostat.
Abstract base for molecular dynamics integrators.
Definition: MdIntegrator.h:30
MdIntegratorFactory(MdSystem &system)
Constructor.
MdIntegrator * trySubfactories(const std::string &className) const
Search through subfactories for match.
Utility classes for scientific computation.
Definition: accumulators.mod:1
A velocity-Verlet dissipative particle dynamics (DPD) integrator.
An explictly reversible/measure-preserving Parrinello-Rahman type NPH integrator. ...
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
A Nose-Hoover NVT molecular dynamics integrator.
A System for Molecular Dynamics simulation.
Definition: MdSystem.h:68
MdIntegrator * factory(const std::string &speciesName) const
Method to create any species supplied with Simpatico.