Simpatico  v1.10
mcMd/potentials/bond/BondFactory.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/bond/BondFactory.h>
9 #include <mcMd/simulation/System.h>
10 
11 // BondPotential interfaces and implementation classes
12 #include <mcMd/potentials/bond/BondPotential.h>
13 #include <mcMd/potentials/bond/BondPotentialImpl.h>
14 
15 // Bond Potential interaction classes
16 #include <simp/interaction/bond/HarmonicBond.h>
17 #include <simp/interaction/bond/HarmonicL0Bond.h>
18 #include <simp/interaction/bond/FeneBond.h>
19 #include <simp/interaction/bond/CompositeBond.h>
20 
21 #include <simp/interaction/pair/DpdPair.h>
22 #include <simp/interaction/pair/LJPair.h>
23 
24 namespace McMd
25 {
26 
27  using namespace Simp;
28 
34  systemPtr_(&system)
35  {}
36 
37  /*
38  * Return a pointer to a new BondPotential, if possible.
39  */
41  BondFactory::factory(const std::string& name) const
42  {
43  BondPotential* ptr = 0;
44 
45  // Try subfactories first.
46  ptr = trySubfactories(name);
47  if (ptr) return ptr;
48 
49  if (name == "HarmonicBond") {
50  ptr = new BondPotentialImpl<HarmonicBond>(*systemPtr_);
51  } else
52  if (name == "HarmonicL0Bond") {
53  ptr = new BondPotentialImpl<HarmonicL0Bond>(*systemPtr_);
54  } else
55  if (name == "FeneBond") {
56  ptr = new BondPotentialImpl<FeneBond>(*systemPtr_);
57  }
58  #ifndef SIMP_NOPAIR
59  else
60  if (name == "CompositeBond<HarmonicL0Bond,DpdPair>") {
62  }
63  #endif
64  return ptr;
65  }
66 
67 }
BondPotential * factory(const std::string &subclass) const
Return a pointer to a new BondPotential, if possible.
Implementation template for a BondPotential.
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
BondFactory(System &system)
Default constructor.
Classes used by all simpatico molecular simulations.
BondPotential * trySubfactories(const std::string &className) const
Search through subfactories for match.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
Abstract Bond Potential class.
Factory template.
Definition: Factory.h:32