Simpatico  v1.10
SpeciesFactory.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 "SpeciesFactory.h"
9 
10 // Subclasses of Species
11 #include <simp/species/Point.h>
12 #include <simp/species/Homopolymer.h>
13 #include <simp/species/Diblock.h>
14 #include <simp/species/Multiblock.h>
15 #include <simp/species/HomoRing.h>
16 #include <mcMd/species/HomopolymerSG.h>
17 
18 namespace McMd
19 {
20 
21  using namespace Util;
22  using namespace Simp;
23 
24  /*
25  * Return a pointer to a instance of Species subclass speciesName.
26  */
27  Species* SpeciesFactory::factory(const std::string &className) const
28  {
29  Species *ptr = 0;
30 
31  ptr = trySubfactories(className);
32  if (ptr) return ptr;
33 
34  // Try explicit class names
35  if (className == "Species") {
36  ptr = new Species();
37  } else
38  if (className == "Point") {
39  ptr = new Point();
40  }
41 
42  #ifdef SIMP_BOND
43  else
44  if (className == "Homopolymer") {
45  ptr = new Homopolymer();
46  } else
47  if (className == "Diblock") {
48  ptr = new Diblock();
49  } else
50  if (className == "Multiblock") {
51  ptr = new Multiblock();
52  } else
53  if (className == "HomoRing") {
54  ptr = new HomoRing();
55  } else
56  if (className == "HomopolymerSG") {
57  ptr = new HomopolymerSG();
58  }
59  #endif
60 
61  return ptr;
62  }
63 
64 }
A Homopolymer with a mutable type, for semigrand ensemble.
Definition: HomopolymerSG.h:30
A linear diblock copolymer chain.
Definition: Diblock.h:27
Classes used by all simpatico molecular simulations.
A linear MULTIBLOCK copolymer chain.
Definition: Multiblock.h:26
Simp::Species * factory(const std::string &speciesName) const
Method to create any species supplied with Simpatico.
Utility classes for scientific computation.
Definition: accumulators.mod:1
A Homopolymer species of chain molecules.
Definition: Homopolymer.h:34
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
A Species represents a set of chemically similar molecules.
A species of homogeneous ring molecules.
Definition: HomoRing.h:29
A Species in which each Molecule contains only one Atom.
Definition: Point.h:24