Molecular Dynamics Simulation  1.0
Thermostat.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <limits>
4 #include <memory>
5 
7 #include "utils/Enums.h"
8 
13 class Thermostat {
14  public:
23 
27  virtual ~Thermostat() = default;
28 
34  virtual void scaleTemperature(const std::unique_ptr<ParticleContainer>& particle_container) const = 0;
35 
42  virtual double getCurrentContainerTemperature(const std::unique_ptr<ParticleContainer>& particle_container) const = 0;
43 
52  void setTemperature(double new_temperature, const std::unique_ptr<ParticleContainer>& particle_container);
53 
62  static void setParticleTemperature(double new_temperature, Particle& particle, ThirdDimension third_dimension);
63 
69  [[nodiscard]] double getTargetTemperature() const;
70 
76  [[nodiscard]] double getMaxTemperatureChange() const;
77 
83  [[nodiscard]] ThirdDimension getThirdDimension() const;
84 
85  protected:
89  const double target_temperature;
90 
94  const double max_temperature_change;
95 
100 };
ThirdDimension
Enum class to define the dimension count of the simulation (2D or 3D). Affects primarily the dimensio...
Definition: Enums.h:7
Class to represent a particle.
Definition: Particle.h:26
A thermostat that can be used to control the temperature of a particle container. Allows for gradual ...
Definition: Thermostat.h:13
Thermostat(double target_temperature, double max_temperature_change, ThirdDimension third_dimension)
Construct a new Thermostat object.
Definition: Thermostat.cpp:7
const double max_temperature_change
The maximum temperature change allowed per thermostat application.
Definition: Thermostat.h:94
virtual void scaleTemperature(const std::unique_ptr< ParticleContainer > &particle_container) const =0
Scale the temperature of a particle container towards the target temperature. Capped by the maximum t...
ThirdDimension getThirdDimension() const
Get if the third dimension is enabled on this thermostat or not.
Definition: Thermostat.cpp:38
virtual ~Thermostat()=default
Destroy the Thermostat object.
const double target_temperature
The target temperature for thermostat applications.
Definition: Thermostat.h:89
virtual double getCurrentContainerTemperature(const std::unique_ptr< ParticleContainer > &particle_container) const =0
Get the current temperature of a particle container.
void setTemperature(double new_temperature, const std::unique_ptr< ParticleContainer > &particle_container)
Set the initial temperature of a particle container. This function sets the velocity of all particles...
Definition: Thermostat.cpp:26
double getMaxTemperatureChange() const
Get the maximum temperature change of the thermostat.
Definition: Thermostat.cpp:36
const ThirdDimension third_dimension
Defines whether the third dimension is enabled.
Definition: Thermostat.h:99
static void setParticleTemperature(double new_temperature, Particle &particle, ThirdDimension third_dimension)
Set the temperature of a particle. This method adds a random velocity to the particle according to th...
Definition: Thermostat.cpp:20
double getTargetTemperature() const
Get the target temperature of the thermostat.
Definition: Thermostat.cpp:34