Simpatico  v1.10
ddMd/potentials/pair/PairFactory.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 <ddMd/potentials/pair/PairFactory.h>
9 #include <ddMd/simulation/Simulation.h>
10 
11 // PairPotential interface and implementation classes
12 #include <ddMd/potentials/pair/PairPotential.h>
13 #include <ddMd/potentials/pair/PairPotentialImpl.h>
14 
15 // Pair interaction classes
16 #include <simp/interaction/pair/LJPair.h>
17 #include <simp/interaction/pair/WcaPair.h>
18 #include <simp/interaction/pair/DpdPair.h>
19 
20 namespace DdMd
21 {
22 
23  using namespace Simp;
24 
30  simulationPtr_(&simulation)
31  {}
32 
33  /*
34  * Return a pointer to a new PairPotential, if possible.
35  */
37  PairFactory::factory(const std::string& name) const
38  {
39  PairPotential* ptr = 0;
40 
41  // Try subfactories first.
42  ptr = trySubfactories(name);
43  if (ptr) return ptr;
44 
45  if (name == "LJPair") {
46  ptr = new PairPotentialImpl<LJPair>(*simulationPtr_);
47  } else
48  if (name == "WcaPair") {
49  ptr = new PairPotentialImpl<WcaPair>(*simulationPtr_);
50  } else
51  if (name == "DpdPair") {
52  ptr = new PairPotentialImpl<DpdPair>(*simulationPtr_);
53  }
54  return ptr;
55  }
56 
57 }
PairFactory(Simulation &simulation)
Default constructor.
Parallel domain decomposition (DD) MD simulation.
Classes used by all simpatico molecular simulations.
Main object for a domain-decomposition MD simulation.
PairPotential * trySubfactories(const std::string &className) const
Search through subfactories for match.
PairPotential * factory(const std::string &subclass) const
Return a pointer to a new McPairInteration, if possible.
Implementation template for a PairPotential.
Factory template.
Definition: Factory.h:32
Abstract base class for computing nonbonded pair forces and energies.