Simpatico  v1.10
mcMd/potentials/external/ExternalFactory.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 <mcMd/potentials/external/ExternalFactory.h>
9 
10 #include <mcMd/simulation/System.h>
11 
12 // ExternalPotential interfaces and implementation classes
13 #include <mcMd/potentials/external/ExternalPotential.h>
14 #include <mcMd/potentials/external/ExternalPotentialImpl.h>
15 
16 // Interaction classes
17 #include <simp/interaction/external/BoxExternal.h>
18 #include <simp/interaction/external/OrthoBoxExternal.h>
19 #include <simp/interaction/external/OrthoBoxExternal.h>
20 #include <simp/interaction/external/SlitExternal.h>
21 #include <simp/interaction/external/LamellarOrderingExternal.h>
22 #include <simp/interaction/external/SimplePeriodicExternal.h>
23 #include <simp/interaction/external/PeriodicExternal.h>
24 #include <simp/interaction/external/GeneralPeriodicExternal.h>
25 #include <simp/interaction/external/NucleationExternal.h>
26 #include <simp/interaction/external/SphericalTabulatedExternal.h>
27 
28 namespace McMd
29 {
30 
31  using namespace Simp;
32 
37  : systemPtr_(&system)
38  {}
39 
40  /*
41  * Return a pointer to a new ExternalPotential, if possible.
42  */
43  ExternalPotential* ExternalFactory::factory(const std::string& name) const
44  {
45  ExternalPotential* ptr = 0;
46 
47  ptr = trySubfactories(name);
48  if (ptr) return ptr;
49 
50  if (name == "BoxExternal") {
51  ptr = new ExternalPotentialImpl<BoxExternal>(*systemPtr_);
52  } else
53  if (name == "OrthoBoxExternal") {
54  ptr = new ExternalPotentialImpl<OrthoBoxExternal>(*systemPtr_);
55  } else
56  if (name == "SlitExternal") {
57  ptr = new ExternalPotentialImpl<SlitExternal>(*systemPtr_);
58  } else
59  if (name == "LamellarOrderingExternal") {
61  } else
62  if (name == "SimplePeriodicExternal") {
63  ptr = new ExternalPotentialImpl<SimplePeriodicExternal>(*systemPtr_);
64  } else
65  if (name == "PeriodicExternal") {
66  ptr = new ExternalPotentialImpl<PeriodicExternal>(*systemPtr_);
67  } else
68  if (name == "GeneralPeriodicExternal") {
70  } else
71  if (name == "NucleationExternal") {
72  ptr = new ExternalPotentialImpl<NucleationExternal>(*systemPtr_);
73  }
74  return ptr;
75  }
76 
77 }
ExternalPotential * factory(const std::string &subclass) const
Return a pointer to a new ExternalInteration, if possible.
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
Classes used by all simpatico molecular simulations.
Abstract External Potential class.
ExternalPotential * trySubfactories(const std::string &className) const
Search through subfactories for match.
Template implementation of ExternalPotential.
ExternalFactory(System &system)
Default constructor.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).