Simpatico  v1.10
mcMd/configIos/ConfigIoFactory.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 "ConfigIoFactory.h"
9 
10 // Subclasses of ConfigIo
11 #include "McConfigIo.h"
12 #include "MdConfigIo.h"
13 #include "DdMdConfigIo.h"
14 #include "LammpsConfigIo.h"
15 #include "SmpConfigIo.h"
16 
17 namespace McMd
18 {
19 
20  using namespace Util;
21 
22  /*
23  * Constructor
24  */
26  : systemPtr_(&system)
27  {}
28 
29  /*
30  * Return a pointer to a instance of ConfigIo subclass className.
31  */
32  ConfigIo* ConfigIoFactory::factory(const std::string &className) const
33  {
34  ConfigIo *ptr = 0;
35 
36  // Try subfactories first.
37  ptr = trySubfactories(className);
38  if (ptr) return ptr;
39 
40  if (className == "McConfigIo") {
41  ptr = new McConfigIo(*systemPtr_);
42  } else
43  if (className == "MdConfigIo") {
44  ptr = new MdConfigIo(*systemPtr_);
45  } else
46  if (className == "LammpsConfigIo") {
47  ptr = new LammpsConfigIo(*systemPtr_);
48  } else
49  if (className == "DdMdConfigIo") {
50  ptr = new DdMdConfigIo(*systemPtr_);
51  } else
52  if (className == "DdMdConfigIo_Molecule") {
53  bool hasMolecules = true;
54  ptr = new DdMdConfigIo(*systemPtr_, hasMolecules);
55  } else
56  if (className == "SmpConfigIo") {
57  ptr = new SmpConfigIo(*systemPtr_);
58  }
59  return ptr;
60  }
61 
62 }
ConfigIo for Lammps data files.
ConfigIo for DdMd data files.
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
Common configuration file format for simpatico.
Definition: SmpConfigIo.h:31
ConfigIo * trySubfactories(const std::string &className) const
Search through subfactories for match.
Utility classes for scientific computation.
Definition: accumulators.mod:1
ConfigIoFactory(System &system)
Constructor.
ConfigIo * factory(const std::string &speciesName) const
Method to create any species supplied with Simpatico.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
ConfigIo for MD simulations (includes velocities).
Definition: MdConfigIo.h:29
ConfigIo for MC simulations (no atom velocities).
Definition: McConfigIo.h:29
System configuration file reader and writer.