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