Simpatico  v1.10
SimulationAccess.h
1 #ifndef DDMD_SIMULATION_ACCESS_H
2 #define DDMD_SIMULATION_ACCESS_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 <ddMd/chemistry/AtomType.h> // member template parametr
12 #include <ddMd/chemistry/MaskPolicy.h> // enumeration
13 #include <simp/boundary/Boundary.h> // typedef
14 #include <util/containers/RArray.h> // member template
15 
16 namespace Util {
17  class FileMaster;
18  class Random;
19 }
20 
21 namespace Simp {
22  class EnergyEnsemble;
23  class BoundaryEnsemble;
24 }
25 
26 namespace DdMd
27 {
28 
29  class Simulation;
30  class AtomStorage;
31  template <int N> class GroupStorage;
32  class PairPotential;
33  #ifdef SIMP_BOND
34  class BondPotential;
35  #endif
36  #ifdef SIMP_ANGLE
37  class AnglePotential;
38  #endif
39  #ifdef SIMP_DIHEDRAL
40  class DihedralPotential;
41  #endif
42  #ifdef SIMP_EXTERNAL
43  class ExternalPotential;
44  #endif
45  class Domain;
46  class Exchanger;
47  class AtomType;
48 
49  using namespace Util;
50  using namespace Simp;
51 
67  {
68 
69  public:
70 
76  SimulationAccess(Simulation& simulation);
77 
82 
84 
86 
88  Simulation& simulation();
89 
91  Boundary& boundary();
92 
94  AtomStorage& atomStorage();
95 
96  #ifdef SIMP_BOND
97  GroupStorage<2>& bondStorage();
99  #endif
100 
101  #ifdef SIMP_ANGLE
102  GroupStorage<3>& angleStorage();
104  #endif
105 
106  #ifdef SIMP_DIHEDRAL
107  GroupStorage<4>& dihedralStorage();
109  #endif
110 
112  PairPotential& pairPotential();
113 
114  #ifdef SIMP_BOND
115  BondPotential& bondPotential();
117  #endif
118 
119  #ifdef SIMP_ANGLE
120  AnglePotential& anglePotential();
122  #endif
123 
124  #ifdef SIMP_DIHEDRAL
125  DihedralPotential& dihedralPotential();
127  #endif
128 
129  #ifdef SIMP_EXTERNAL
130  ExternalPotential& externalPotential();
132  #endif
133 
135  EnergyEnsemble& energyEnsemble();
136 
138  BoundaryEnsemble& boundaryEnsemble();
139 
141  Random& random();
142 
144  Domain& domain();
145 
147  Exchanger& exchanger();
148 
150  FileMaster& fileMaster();
151 
153  int nAtomType();
154 
155  #ifdef SIMP_BOND
156  int nBondType();
158  #endif
159 
160  #ifdef SIMP_ANGLE
161  int nAngleType();
163  #endif
164 
165  #ifdef SIMP_DIHEDRAL
166  int nDihedralType();
168  #endif
169 
170  #ifdef SIMP_EXTERNAL
171  bool hasExternal();
173  #endif
174 
176  AtomType& atomType(int i);
177 
179  MaskPolicy maskedPairPolicy() const;
180 
182  bool reverseUpdateFlag() const;
183 
185 
186  private:
187 
189  RArray<AtomType> atomTypes_;
190 
192  Simulation* simulationPtr_;
193 
195  Boundary* boundaryPtr_;
196 
198  AtomStorage* atomStoragePtr_;
199 
200  #ifdef SIMP_BOND
201  GroupStorage<2>* bondStoragePtr_;
203  #endif
204 
205  #ifdef SIMP_ANGLE
206  GroupStorage<3>* angleStoragePtr_;
208  #endif
209 
210  #ifdef SIMP_DIHEDRAL
211  GroupStorage<4>* dihedralStoragePtr_;
213  #endif
214 
216  PairPotential* pairPotentialPtr_;
217 
218  #ifdef SIMP_BOND
219  BondPotential* bondPotentialPtr_;
221  #endif
222 
223  #ifdef SIMP_ANGLE
224  AnglePotential* anglePotentialPtr_;
226  #endif
227 
228  #ifdef SIMP_DIHEDRAL
229  DihedralPotential* dihedralPotentialPtr_;
231  #endif
232 
233  #ifdef SIMP_EXTERNAL
234  ExternalPotential* externalPotentialPtr_;
236  #endif
237 
239  EnergyEnsemble* energyEnsemblePtr_;
240 
242  BoundaryEnsemble* boundaryEnsemblePtr_;
243 
245  Random* randomPtr_;
246 
248  Domain* domainPtr_;
249 
251  Exchanger* exchangerPtr_;
252 
254  FileMaster* fileMasterPtr_;
255 
257  int nAtomType_;
258 
259  #ifdef SIMP_BOND
260  int nBondType_;
262  #endif
263 
264  #ifdef SIMP_ANGLE
265  int nAngleType_;
267  #endif
268 
269  #ifdef SIMP_DIHEDRAL
270  int nDihedralType_;
272  #endif
273 
274  #ifdef SIMP_EXTERNAL
275  bool hasExternal_;
277  #endif
278 
287  MaskPolicy maskedPairPolicy_;
288 
292  bool reverseUpdateFlag_;
293 
294  };
295 
296  // Inline method definitions
297 
298  inline Simulation& SimulationAccess::simulation()
299  { return *simulationPtr_; }
300 
301  inline Boundary& SimulationAccess::boundary()
302  { return *boundaryPtr_; }
303 
304  inline AtomStorage& SimulationAccess::atomStorage()
305  { return *atomStoragePtr_; }
306 
307  #ifdef SIMP_BOND
308  inline GroupStorage<2>& SimulationAccess::bondStorage()
309  {
310  assert(bondStoragePtr_);
311  return *bondStoragePtr_;
312  }
313  #endif
314 
315  #ifdef SIMP_ANGLE
316  inline GroupStorage<3>& SimulationAccess::angleStorage()
317  {
318  assert(angleStoragePtr_);
319  return *angleStoragePtr_;
320  }
321  #endif
322 
323  #ifdef SIMP_DIHEDRAL
324  inline GroupStorage<4>& SimulationAccess::dihedralStorage()
325  {
326  assert(dihedralStoragePtr_);
327  return *dihedralStoragePtr_;
328  }
329  #endif
330 
331  inline PairPotential& SimulationAccess::pairPotential()
332  {
333  assert(pairPotentialPtr_);
334  return *pairPotentialPtr_;
335  }
336 
337  #ifdef SIMP_BOND
338  inline BondPotential& SimulationAccess::bondPotential()
339  {
340  assert(bondPotentialPtr_);
341  return *bondPotentialPtr_;
342  }
343  #endif
344 
345  #ifdef SIMP_ANGLE
346  inline AnglePotential& SimulationAccess::anglePotential()
347  {
348  assert(anglePotentialPtr_);
349  return *anglePotentialPtr_;
350  }
351  #endif
352 
353  #ifdef SIMP_DIHEDRAL
354  inline DihedralPotential& SimulationAccess::dihedralPotential()
355  {
356  assert(dihedralPotentialPtr_);
357  return *dihedralPotentialPtr_;
358  }
359  #endif
360 
361  #ifdef SIMP_EXTERNAL
362  inline ExternalPotential& SimulationAccess::externalPotential()
363  {
364  assert(externalPotentialPtr_);
365  return *externalPotentialPtr_;
366  }
367  #endif
368 
369  inline EnergyEnsemble& SimulationAccess::energyEnsemble()
370  { return *energyEnsemblePtr_; }
371 
372  inline BoundaryEnsemble& SimulationAccess::boundaryEnsemble()
373  { return *boundaryEnsemblePtr_; }
374 
375  inline Random& SimulationAccess::random()
376  { return *randomPtr_; }
377 
378  inline Domain& SimulationAccess::domain()
379  { return *domainPtr_; }
380 
381  inline Exchanger& SimulationAccess::exchanger()
382  { return *exchangerPtr_; }
383 
384  inline FileMaster& SimulationAccess::fileMaster()
385  { return *fileMasterPtr_; }
386 
387  inline int SimulationAccess::nAtomType()
388  { return nAtomType_; }
389 
390  #ifdef SIMP_BOND
391  inline int SimulationAccess::nBondType()
392  { return nBondType_; }
393  #endif
394 
395  #ifdef SIMP_ANGLE
396  inline int SimulationAccess::nAngleType()
397  { return nAngleType_; }
398  #endif
399 
400  #ifdef SIMP_DIHEDRAL
401  inline int SimulationAccess::nDihedralType()
402  { return nDihedralType_; }
403  #endif
404 
405  #ifdef SIMP_EXTERNAL
406  inline bool SimulationAccess::hasExternal()
407  { return hasExternal_; }
408  #endif
409 
410  inline AtomType& SimulationAccess::atomType(int i)
411  { return atomTypes_[i]; }
412 
413  inline MaskPolicy SimulationAccess::maskedPairPolicy() const
414  { return maskedPairPolicy_; }
415 
416  inline bool SimulationAccess::reverseUpdateFlag() const
417  { return reverseUpdateFlag_; }
418 
419 }
420 #endif
Provides access to members of Simulation object.
Abstract base class for computation of angle force and energies.
An orthorhombic periodic unit cell.
Calculates external forces and energies for a parent Simulation.
Statistical ensemble for changes in the periodic unit cell size.
Abstract base class for computing bond forces and energies.
Parallel domain decomposition (DD) MD simulation.
Classes used by all simpatico molecular simulations.
Main object for a domain-decomposition MD simulation.
A statistical ensemble for energy.
Utility classes for scientific computation.
Definition: accumulators.mod:1
MaskPolicy
Enumeration of policies for suppressing ("masking") some pair interactions.
Abstract base class for computing dihedral forces and energies.
A container for all the atoms and ghost atoms on this processor.
Decomposition of the system into domains associated with processors.
Definition: Domain.h:31
A FileMaster manages input and output files for a simulation.
Definition: FileMaster.h:142
Class for exchanging Atoms, Ghosts and Groups between processors.
Definition: Exchanger.h:35
An Array that acts as a reference to another Array or C array.
Definition: RArray.h:46
Random number generator.
Definition: Random.h:46
Descriptor for a type of Atom.
Abstract base class for computing nonbonded pair forces and energies.