Simpatico  v1.10
Generator.h
1 #ifndef MCMD_GENERATOR_H
2 #define MCMD_GENERATOR_H
3 
4 /*
5 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
6 *
7 * Copyright 2010 - 2017, The Regents of the University of Minnesota
8 * Distributed under the terms of the GNU General Public License.
9 */
10 
11 #include <simp/boundary/Boundary.h> // typedef
12 #include <util/containers/Array.h> // function argument, template
13 
14 namespace Simp {
15  class Species;
16 }
17 
18 namespace McMd
19 {
20 
21  using namespace Util;
22  using namespace Simp;
23 
24  class Simulation;
25  class System;
26  class Atom;
27  class Molecule;
28  class CellList;
29  #ifdef SIMP_BOND
30  class BondPotential;
31  #endif
32 
38  class Generator
39  {
40  public:
41 
42  // Non-static member functions
43 
50  Generator(Species& species, System& system);
51 
55  virtual ~Generator();
56 
57  #ifdef SIMP_BOND
58 
63  void setBondPotential(BondPotential& bondPotential);
64  #endif
65 
75  virtual bool generate(int nMolecule,
76  Array<double> const & diameters,
77  CellList& cellList);
78 
79  // Static member function
80 
89  static
90  void setupCellList(int atomCapacity,
91  Boundary& boundary,
92  const Array<double>& diameters,
93  CellList& cellList);
94 
95  protected:
96 
114  bool attemptPlaceAtom(Atom& atom,
115  const Array<double>& diameters,
116  CellList& cellList);
117 
126  virtual
127  bool attemptPlaceMolecule(Molecule& molecule,
128  const Array<double>& diameters,
129  CellList& cellList) = 0;
130 
134  const Species& species();
135 
139  Simulation& simulation();
140 
144  System& system();
145 
149  const Boundary& boundary() const;
150 
151  #ifdef SIMP_BOND
152 
155  const BondPotential& bondPotential();
156  #endif
157 
158  private:
159 
161  const Species* speciesPtr_;
162 
164  Simulation* simulationPtr_;
165 
167  System* systemPtr_;
168 
170  Boundary* boundaryPtr_;
171 
173  #ifdef SIMP_BOND
174  const BondPotential* bondPotentialPtr_;
175  #endif
176 
177  };
178 
179  // Inline functions
180 
181  /*
182  * Get the associated Species by reference.
183  */
184  inline const Species& Generator::species()
185  { return *speciesPtr_; }
186 
190  inline Simulation& Generator::simulation()
191  { return *simulationPtr_; }
192 
193  /*
194  * Get the associated System by reference.
195  */
196  inline System& Generator::system()
197  { return *systemPtr_; }
198 
199  /*
200  * Get the associated Boundary by reference.
201  */
202  inline const Boundary& Generator::boundary() const
203  { return *boundaryPtr_; }
204 
205  #ifdef SIMP_BOND
206  /*
207  * Get the associated BondPotential by reference.
208  */
209  inline const BondPotential& Generator::bondPotential()
210  { return *bondPotentialPtr_; }
211  #endif
212 
213 }
214 #endif
An orthorhombic periodic unit cell.
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
Classes used by all simpatico molecular simulations.
The main object in a simulation, which coordinates others.
A point particle within a Molecule.
Utility classes for scientific computation.
Definition: accumulators.mod:1
Generates initial configurations for molecules of one species.
Definition: Generator.h:38
A cell list for Atom objects in a periodic system boundary.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
Abstract Bond Potential class.
A physical molecule (a set of covalently bonded Atoms).
A Species represents a set of chemically similar molecules.