Simpatico  v1.10
MdSimulation.h
1 #ifndef MCMD_MD_SIMULATION_H
2 #define MCMD_MD_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 "MdSystem.h" // member
13 #include "MdAnalyzerManager.h" // member
14 #include "MdCommandManager.h" // member
15 
16 namespace McMd
17 {
18 
19  using namespace Util;
20 
26  class MdSimulation : public Simulation
27  {
28 
29  public:
30 
32 
33  #ifdef UTIL_MPI
34 
37  MdSimulation(MPI::Intracomm& communicator);
38  #endif
39 
43  MdSimulation();
44 
48  virtual ~MdSimulation();
49 
51 
52 
79  void setOptions(int argc, char **argv);
80 
108  void readParam();
109 
120  void readParam(std::istream &in);
121 
127  virtual void readParameters(std::istream &in);
128 
130 
132 
138  void load(const std::string& filename);
139 
145  virtual void loadParameters(Serializable::IArchive &ar);
146 
154  void save(const std::string& filename);
155 
161  virtual void save(Serializable::OArchive &ar);
162 
164 
166 
172  void readCommands();
173 
179  void readCommands(std::istream& in);
180 
196  bool readCommand(std::string command, std::istream& in);
197 
199 
201 
225  void simulate(int endStep, bool isContinuation = false);
226 
253  void analyzeConfigs(int min, int max, std::string basename);
254 
266  void analyzeTrajectory(int min, int max,
267  std::string classname, std::string filename);
268 
270 
272 
276  const MdSystem& system() const;
277 
281  MdSystem& system();
282 
286  virtual bool isValid() const;
287 
289 
290  private:
291 
293  MdSystem system_;
294 
296  MdAnalyzerManager mdAnalyzerManager_;
297 
299  MdCommandManager mdCommandManager_;
300 
302  std::string saveFileName_;
303 
305  int saveInterval_;
306 
308  bool isInitialized_;
309 
311  bool isRestarting_;
312 
313  };
314 
315  // Inline method definitions
316 
317  // Get the System being simulated by const reference.
318  inline const MdSystem& MdSimulation::system() const
319  { return system_; }
320 
321  // Get the System being simulated by reference.
323  { return system_; }
324 
325 }
326 #endif
Manager for Analyzer objects in an MdSimulation.
The main object in a simulation, which coordinates others.
Saving / output archive for binary ostream.
Utility classes for scientific computation.
Definition: accumulators.mod:1
Command interpreter and Command Manager for an MdSimulation.
const MdSystem & system() const
Get the MdSystem being simulated by const reference.
Definition: MdSimulation.h:318
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).
A System for Molecular Dynamics simulation.
Definition: MdSystem.h:68
A molecular dynamics simulation of a single MdSystem.
Definition: MdSimulation.h:26