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