Simpatico  v1.10
ddMd/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 <ddMd/potentials/bond/BondFactory.h>
9 #include <ddMd/simulation/Simulation.h>
10 
11 // BondPotential interface and implementation classes
12 #include <ddMd/potentials/bond/BondPotential.h>
13 #include <ddMd/potentials/bond/BondPotentialImpl.h>
14 
15 // Bond interaction classes
16 #include <simp/interaction/bond/HarmonicBond.h>
17 #include <simp/interaction/bond/HarmonicL0Bond.h>
18 #include <simp/interaction/bond/FeneBond.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 BondPotential, if possible.
35  */
37  BondFactory::factory(const std::string& name) const
38  {
39  BondPotential* ptr = 0;
40 
41  // Try subfactories first.
42  ptr = trySubfactories(name);
43  if (ptr) return ptr;
44 
45  if (name == "HarmonicBond") {
46  ptr = new BondPotentialImpl<HarmonicBond>(*simulationPtr_);
47  } else
48  if (name == "HarmonicL0Bond") {
49  ptr = new BondPotentialImpl<HarmonicL0Bond>(*simulationPtr_);
50  } else
51  if (name == "FeneBond") {
52  ptr = new BondPotentialImpl<FeneBond>(*simulationPtr_);
53  } // else
54  return ptr;
55  }
56 
57 }
Implementation template for a BondPotential.
Abstract base class for computing bond forces and energies.
Parallel domain decomposition (DD) MD simulation.
Classes used by all simpatico molecular simulations.
Main object for a domain-decomposition MD simulation.
BondFactory(Simulation &simulation)
Default constructor.
BondPotential * trySubfactories(const std::string &className) const
Search through subfactories for match.
BondPotential * factory(const std::string &subclass) const
Return a pointer to a new McBondInteration, if possible.
Factory template.
Definition: Factory.h:32