Simpatico  v1.10
McSimulation.h
1 #ifndef MCMD_MC_SIMULATION_H
2 #define MCMD_MC_SIMULATION_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 <mcMd/simulation/Simulation.h> // base class
12 #include <mcMd/mcSimulation/McSystem.h> // member
13 #include <mcMd/mcSimulation/McAnalyzerManager.h> // member
14 #include <mcMd/mcSimulation/McCommandManager.h> // member
15 #include <mcMd/mcMoves/McMoveManager.h> // member
16 #include <util/global.h>
17 
18 namespace Util { template <typename T> class Factory; }
19 
20 namespace McMd
21 {
22 
23  using namespace Util;
24 
25  class McMove;
26 
32  class McSimulation : public Simulation
33  {
34 
35  public:
36 
38 
39  #ifdef UTIL_MPI
40 
43  McSimulation(MPI::Intracomm& communicator);
44  #endif
45 
49  McSimulation();
50 
54  virtual ~McSimulation();
55 
57 
58 
85  void setOptions(int argc, char **argv);
86 
114  void readParam();
115 
127  virtual void readParam(std::istream &in);
128 
134  virtual void readParameters(std::istream &in);
135 
137 
139 
145  virtual void loadParameters(Serializable::IArchive &ar);
146 
152  void load(const std::string& filename);
153 
159  virtual void save(Serializable::OArchive &ar);
160 
166  void save(const std::string& filename);
167 
174  template <class Archive>
175  void serialize(Archive& ar, unsigned int version);
176 
178 
180 
186  void readCommands(std::istream& in);
187 
194  void readCommands();
195 
211  bool readCommand(std::string command, std::istream& in);
212 
214 
216 
234  void simulate(int endStep, bool isContinuation = false);
235 
261  void analyzeConfigs(int min, int max, std::string basename);
262 
275  void analyzeTrajectory(int min, int max,
276  std::string classname, std::string filename);
277 
279 
281 
285  McSystem& system();
286 
290  const McSystem& system() const;
291 
295  Factory<McMove>& mcMoveFactory();
296 
300  virtual bool isValid() const;
301 
303 
304  protected:
305 
309  McMoveManager& mcMoveManager();
310 
311  private:
312 
314  McSystem system_;
315 
317  McMoveManager mcMoveManager_;
318 
320  McAnalyzerManager mcAnalyzerManager_;
321 
323  McCommandManager mcCommandManager_;
324 
326  std::istream* paramFilePtr_;
327 
329  std::string saveFileName_;
330 
332  int saveInterval_;
333 
335  bool isInitialized_;
336 
338  bool isRestarting_;
339 
340  };
341 
342  // Inline member functions
343 
344  /*
345  * Get the McSystem by reference.
346  */
347  inline McSystem& McSimulation::system()
348  { return system_; }
349 
350  /*
351  * Get the McSystem by const reference.
352  */
353  inline const McSystem& McSimulation::system() const
354  { return system_; }
355 
356  /*
357  * Get the McMoveManager (protected).
358  */
359  inline
360  McMoveManager& McSimulation::mcMoveManager()
361  { return mcMoveManager_; }
362 
363 }
364 #endif
A System for use in a Markov chain Monte Carlo simulation.
Definition: McSystem.h:52
File containing preprocessor macros for error handling.
Manager for Analyzer objects in an McSimulation.
The main object in a simulation, which coordinates others.
Saving / output archive for binary ostream.
A Monte-Carlo simulation of one McSystem.
Definition: McSimulation.h:32
Utility classes for scientific computation.
Definition: accumulators.mod:1
Command interpreter and Manager for an McSimulation.
virtual void load(Serializable::IArchive &ar)
Load all parameters from an input archive.
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
Manager for a set of McMove objects.
Definition: McMoveManager.h:33