Simpatico  v1.10
mcMd/potentials/dihedral/DihedralFactory.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/dihedral/DihedralFactory.h>
9 #include <mcMd/simulation/System.h>
10 #include <mcMd/potentials/dihedral/DihedralPotential.h>
11 #include <mcMd/potentials/dihedral/DihedralPotentialImpl.h>
12 
13 // Dihedral interaction classes
14 #include <simp/interaction/dihedral/CosineDihedral.h>
15 #include <simp/interaction/dihedral/MultiHarmonicDihedral.h>
16 
17 namespace McMd
18 {
19 
20  using namespace Simp;
21 
26  : systemPtr_(&system)
27  {}
28 
29  /*
30  * Return a pointer to a new DihedralPotential, if possible.
31  */
32  DihedralPotential* DihedralFactory::factory(const std::string& name) const
33  {
34  DihedralPotential* ptr = 0;
35 
36  ptr = trySubfactories(name);
37  if (ptr) return ptr;
38 
39  if (name == "CosineDihedral") {
40  ptr = new DihedralPotentialImpl<CosineDihedral>(*systemPtr_);
41  } else
42  if (name == "MultiHarmonicDihedral") {
43  ptr = new DihedralPotentialImpl<MultiHarmonicDihedral>(*systemPtr_);
44  }
45  return ptr;
46  }
47 
48 }
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
Classes used by all simpatico molecular simulations.
DihedralPotential * factory(const std::string &subclass) const
Return a pointer to a new DihedralPotential, if possible.
Interface for a Dihedral Potential.
DihedralPotential * trySubfactories(const std::string &className) const
Search through subfactories for match.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
Implementation template for an DihedralPotential.
DihedralFactory(System &system)
Default constructor.