Line data Source code
1 : // Copyright (C) 2015 Technische Universitaet Muenchen
2 : // This file is part of the Mamico project. For conditions of distribution
3 : // and use, please see the copyright notice in Mamico's main folder, or at
4 : // www5.in.tum.de/mamico
5 : #ifndef _MOLECULARDYNAMICS_CONFIGURATIONS_SIMULATIONCONFIGURATION_H_
6 : #define _MOLECULARDYNAMICS_CONFIGURATIONS_SIMULATIONCONFIGURATION_H_
7 :
8 : #include "simplemd/MolecularDynamicsDefinitions.h"
9 : #include "tarch/configuration/Configuration.h"
10 : #include "tarch/la/Vector.h"
11 : #include <iostream>
12 :
13 : namespace simplemd {
14 : namespace configurations {
15 : class SimulationConfiguration;
16 : }
17 : } // namespace simplemd
18 :
19 : /** simulation configuration for MD. Currently includes information on timestepping only.
20 : * @author Philipp Neumann
21 : */
22 : class simplemd::configurations::SimulationConfiguration : public tarch::configuration::Configuration {
23 : public:
24 : SimulationConfiguration();
25 0 : virtual ~SimulationConfiguration() {}
26 :
27 : void parseSubtag(tinyxml2::XMLElement* node);
28 :
29 : /**
30 : * Return name of xml tag that is associated to the configuration.
31 : */
32 : std::string getTag() const;
33 :
34 : /**
35 : * Is config valid?
36 : *
37 : * This operation usually fails, if
38 : *
39 : * - parseSubtag() hasn't been called, i.e. configuration has not been
40 : * used, or
41 : * - parseSubtag() failed due to a wrong file.
42 : *
43 : * If a tag ain't optional and parseSubtag() was not called (first case)
44 : */
45 : bool isValid() const;
46 :
47 : /** getters for all parsed and computed quantities */
48 12 : const double& getDt() const { return _dt; }
49 : const unsigned int& getNumberOfTimesteps() const { return _numberOfTimesteps; }
50 : const unsigned int& computeMacroscopicQuantitiesEveryTimestep() const { return _computeMacroscopicQuantitiesEveryTimestep; }
51 : const bool& fixSeed() const { return _fixSeed; }
52 : const bool& useOverlappingCommunicationWithForceComputation() const { return _overlapCommWithForceComputation; }
53 :
54 : private:
55 : static const std::string DT;
56 : static const std::string NUMBER_OF_TIMESTEPS;
57 : static const std::string COMPUTE_QUANTITIES_EVERY_TIMESTEP;
58 : static const std::string FIX_SEED;
59 : static const std::string OVERLAP_COMMUNICATION_WITH_FORCE_COMPUTATION;
60 :
61 : double _dt;
62 : unsigned int _numberOfTimesteps;
63 :
64 : /** number of timesteps between subsequent macroscopic quantity evaluations */
65 : unsigned int _computeMacroscopicQuantitiesEveryTimestep;
66 :
67 : /** if true, the seed of the random number service is fixed in all simulation runs. */
68 : bool _fixSeed;
69 :
70 : /** if true, the force computation and the send/receive-operations for molecules at the process boundaries
71 : * are overlapped.
72 : */
73 : bool _overlapCommWithForceComputation;
74 :
75 : bool _isValid;
76 : };
77 :
78 : #endif // _MOLECULARDYNAMICS_CONFIGURATIONS_SIMULATIONCONFIGURATION_H_
|