Molecular Dynamics Simulation  1.0
DiffusionFunctionInterceptor.h
Go to the documentation of this file.
1 #pragma once
2 #include <chrono>
3 #include <memory>
4 #include <vector>
5 
8 
10  public:
15 
22  void onSimulationStart(Simulation& simulation) override;
23 
31  void operator()(size_t iteration, Simulation& simulation) override;
32 
40  void onSimulationEnd(size_t iteration, Simulation& simulation) override;
41 
50  explicit operator std::string() const override;
51 
55  void logSummary(int depth) const override;
56 
57  private:
59  std::unique_ptr<CSVWriter> csv_writer;
60  std::vector<std::array<double, 3>> old_particle_positions;
62 
63  void saveCurrentParticlePositions(const Simulation& simulation);
64  double calculateCurrentDiffusion(const Simulation& simulation) const;
65 };
void saveCurrentParticlePositions(const Simulation &simulation)
void operator()(size_t iteration, Simulation &simulation) override
This function is called on every nth iteration. It counts the number of particle updates which have b...
std::unique_ptr< CSVWriter > csv_writer
void onSimulationEnd(size_t iteration, Simulation &simulation) override
This function is empty as the thermostat doesnt need to do anything at the end of the simulation.
void logSummary(int depth) const override
Logs the summary of the radial distribution function.
std::vector< std::array< double, 3 > > old_particle_positions
void onSimulationStart(Simulation &simulation) override
This function is sets the particle_updates to 0 and initializes the start time of the simulation.
DiffusionFunctionInterceptor(double sample_every_x_percent)
Construct a new Thermostat Interceptor object.
double calculateCurrentDiffusion(const Simulation &simulation) const
Class to run a simulation.
Definition: Simulation.h:20