Simpatico  v1.10
generatorFactory.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 "generatorFactory.h"
9 #include <mcMd/generators/Generator.h>
10 #include <mcMd/generators/PointGenerator.h>
11 #include <mcMd/generators/LinearGenerator.h>
12 #include <simp/species/Point.h>
13 #include <simp/species/Linear.h>
14 #include <mcMd/mcSimulation/McSystem.h>
15 #include <mcMd/mdSimulation/MdSystem.h>
16 
17 #include <simp/species/Species.h>
18 
19 namespace McMd
20 {
21 
22  using namespace Simp;
23 
24  class System;
25 
27  {
28  Generator* ptr = 0;
29  if (dynamic_cast<Point*>(&species)) {
30  ptr = new PointGenerator(species, system);
31  }
32  #ifdef SIMP_BOND
33  else
34  if (dynamic_cast<Linear*>(&species)) {
35  ptr = new LinearGenerator(species, system);
36  ptr->setBondPotential(system.bondPotential());
37  }
38  #endif
39  return ptr;
40  }
41 
43  {
44  Generator* ptr = 0;
45  if (dynamic_cast<Point*>(&species)) {
46  ptr = new PointGenerator(species, system);
47  }
48  #ifdef SIMP_BOND
49  else
50  if (dynamic_cast<Linear*>(&species)) {
51  ptr = new LinearGenerator(species, system);
52  ptr->setBondPotential(system.bondPotential());
53  }
54  #endif
55  return ptr;
56  }
57 
58 }
void setBondPotential(BondPotential &bondPotential)
Create an association with a BondPotential.
Definition: Generator.cpp:45
A System for use in a Markov chain Monte Carlo simulation.
Definition: McSystem.h:52
BondPotential & bondPotential() const
Return the BondPotential by reference.
Definition: McSystem.h:405
Generates random configurations for linear molecules.
Classes used by all simpatico molecular simulations.
Generator * generatorFactory(Species &species, McSystem &system)
Instantiates generator for on species in an McSystem.
Generates initial configurations for molecules of one species.
Definition: Generator.h:38
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
A System for Molecular Dynamics simulation.
Definition: MdSystem.h:68
A Species represents a set of chemically similar molecules.
Generator for monoatomic molecules (atoms).
BondPotential & bondPotential() const
Return BondPotential by reference.
Definition: MdSystem.h:537