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_MOLECULARDYNAMICSSIMULATION_H_
6 : #define _MOLECULARDYNAMICS_MOLECULARDYNAMICSSIMULATION_H_
7 :
8 : #include "simplemd/BoundaryTreatment.h"
9 : #include "simplemd/MolecularDynamicsDefinitions.h"
10 : #include "simplemd/ProfilePlotter.h"
11 : #include "simplemd/cell-mappings/ComputeMeanVelocityMapping.h"
12 : #include "simplemd/cell-mappings/ComputeTemperatureMapping.h"
13 : #include "simplemd/molecule-with-cell-mappings/LennardJonesForceMapping.h"
14 : #include "simplemd/cell-mappings/RDFMapping.h"
15 : #include "simplemd/configurations/MolecularDynamicsConfiguration.h"
16 : #include "simplemd/molecule-mappings/ConvertForcesFixedToFloatMapping.h"
17 : #include "simplemd/molecule-mappings/InitialPositionAndForceUpdate.h"
18 : #include "simplemd/molecule-mappings/VTKMoleculeWriter.h"
19 : #if BUILD_WITH_ADIOS2
20 : #include "simplemd/molecule-mappings/Adios2Writer.h"
21 : #endif
22 : #include "simplemd/molecule-mappings/VelocityStoermerVerletMapping.h"
23 : #include "simplemd/services/ExternalForceService.h"
24 : #include "simplemd/services/MolecularPropertiesService.h"
25 : #include "simplemd/services/MoleculeService.h"
26 : #include "simplemd/services/ParallelTopologyService.h"
27 : #include "tarch/utils/MultiMDService.h"
28 : #include "tarch/utils/RandomNumberService.h"
29 : #include "simplemd/MoleculeContainer.h"
30 : #include <iostream>
31 : #include <sstream>
32 :
33 : namespace simplemd {
34 : class MolecularDynamicsSimulation;
35 : }
36 :
37 : /** steers the MD simulation.
38 : *
39 : * @author Philipp Neumann
40 : */
41 : class simplemd::MolecularDynamicsSimulation {
42 : public:
43 : MolecularDynamicsSimulation(const simplemd::configurations::MolecularDynamicsConfiguration& configuration);
44 12 : virtual ~MolecularDynamicsSimulation() {}
45 :
46 : /** initialises all services */
47 : void initServices();
48 : /** variant for multi-MD simulations */
49 : void initServices(const tarch::utils::MultiMDService<MD_DIM>& multiMDService, unsigned int localMDSimulation);
50 :
51 : /** simulates one MD timestep. It's a virtual function as we (will definitely) need to extend this method when
52 : * going to coupled LB-MD simulations.
53 : */
54 : void simulateOneTimestep(const unsigned int& t);
55 :
56 : /** runs the time loop for the MD simulation */
57 : void runSimulation();
58 :
59 : /** shuts down all services and deletes pointers */
60 : void shutdownServices();
61 :
62 : void evaluateStatistics(const unsigned int& t);
63 :
64 : private:
65 : /** computes the number density for molecules given per direction and a certain domain size.
66 : * This is only used during initialisation.
67 : */
68 : double getNumberDensity(unsigned int numberMolecules, const tarch::la::Vector<MD_DIM, double>& domainSize) const;
69 :
70 : class simplemd::moleculemappings::ConvertForcesFixedToFloatMapping _convertForcesFixedToFloatMapping;
71 :
72 : protected:
73 : const simplemd::configurations::MolecularDynamicsConfiguration& _configuration;
74 :
75 : // molecule mappings
76 : simplemd::moleculemappings::VelocityStoermerVerletMapping* _timeIntegrator;
77 : simplemd::moleculemappings::VTKMoleculeWriter* _vtkMoleculeWriter;
78 : std::string _vtkFilestem;
79 :
80 : #if BUILD_WITH_ADIOS2
81 : simplemd::moleculemappings::Adios2Writer* _Adios2Writer;
82 : #endif
83 :
84 : // cell mappings
85 : simplemd::moleculewithcellmappings::LennardJonesForceMapping* _lennardJonesForce;
86 : simplemd::cellmappings::RDFMapping* _rdfMapping;
87 :
88 : // boundary treatment
89 : simplemd::BoundaryTreatment* _boundaryTreatment;
90 : tarch::la::Vector<MD_LINKED_CELL_NEIGHBOURS, simplemd::BoundaryType> _localBoundary;
91 :
92 : // number of this MD simulation on this local rank
93 : unsigned int _localMDSimulation;
94 : // for plotting
95 : simplemd::ProfilePlotter* _profilePlotter;
96 : // for parallel data exchange
97 : simplemd::services::ParallelTopologyService* _parallelTopologyService;
98 : // for molecule storage
99 : simplemd::services::MoleculeService* _moleculeService;
100 : std::string _checkpointFilestem;
101 : // for linked cell storage
102 : // molecular properties (potential parameters, mass etc)
103 : simplemd::services::MolecularPropertiesService* _molecularPropertiesService;
104 : // for external forces; has default constructor, hence we use it as object instead of ptr
105 : simplemd::services::ExternalForceService _externalForceService;
106 : };
107 : #endif // _MOLECULARDYNAMICS_MOLECULARDYNAMICSSIMULATION_H_
|