Molecular Dynamics Simulation
1.0
|
A basic thermostat that can be used to control the temperature of a particle container. Allows for gradual scaling of the temperature towards a set target. More...
#include <AbsoluteThermostat.h>
Public Member Functions | |
AbsoluteThermostat (double target_temperature, double max_temperature_change=std::numeric_limits< double >::max(), ThirdDimension third_dimension=ThirdDimension::ENABLED) | |
Construct a new Thermostat object. More... | |
void | scaleTemperature (const std::unique_ptr< ParticleContainer > &particle_container) const override |
Scale the temperature of a particle container towards the target temperature. Capped by the maximum temperature change. More... | |
double | getContainerKineticEnergy (const std::unique_ptr< ParticleContainer > &particle_container) const |
Get the kinetic energy of all particles in a particle container. More... | |
double | getCurrentContainerTemperature (const std::unique_ptr< ParticleContainer > &particle_container) const override |
Get the current temperature of a particle container. More... | |
Public Member Functions inherited from Thermostat | |
Thermostat (double target_temperature, double max_temperature_change, ThirdDimension third_dimension) | |
Construct a new Thermostat object. More... | |
virtual | ~Thermostat ()=default |
Destroy the Thermostat object. More... | |
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 in the container to a random value according to the Maxwell-Boltzmann distribution (all previous velocities are discarded). Use this function for systems with no initial velocity. More... | |
double | getTargetTemperature () const |
Get the target temperature of the thermostat. More... | |
double | getMaxTemperatureChange () const |
Get the maximum temperature change of the thermostat. More... | |
ThirdDimension | getThirdDimension () const |
Get if the third dimension is enabled on this thermostat or not. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Thermostat | |
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 the Maxwell-Boltzmann distribution. This function can be used for particle generators since previous velocities are not discarded. More... | |
Protected Attributes inherited from Thermostat | |
const double | target_temperature |
The target temperature for thermostat applications. More... | |
const double | max_temperature_change |
The maximum temperature change allowed per thermostat application. More... | |
const ThirdDimension | third_dimension |
Defines whether the third dimension is enabled. More... | |
A basic thermostat that can be used to control the temperature of a particle container. Allows for gradual scaling of the temperature towards a set target.
This thermostat is a basic implementation of the Thermostat interface.
This Thermostats is "absolute" in the sense that it does not take the actual velocity of the particles into account when scaling the temperature. It simply freezes the particles until they are no longer moving, even if they have an initial velocity.
Definition at line 18 of file AbsoluteThermostat.h.
AbsoluteThermostat::AbsoluteThermostat | ( | double | target_temperature, |
double | max_temperature_change = std::numeric_limits<double>::max() , |
||
ThirdDimension | third_dimension = ThirdDimension::ENABLED |
||
) |
Construct a new Thermostat object.
target_temperature | The target temperature for thermostat applications. |
max_temperature_change | The maximum temperature change allowed per thermostat application. |
third_dimension | Wether the thermostat applies to a 3-dimensional domain or 2 dimensions. |
Definition at line 7 of file AbsoluteThermostat.cpp.
double AbsoluteThermostat::getContainerKineticEnergy | ( | const std::unique_ptr< ParticleContainer > & | particle_container | ) | const |
Get the kinetic energy of all particles in a particle container.
particle_container | The particle container to get the kinetic energy of. |
Definition at line 23 of file AbsoluteThermostat.cpp.
|
overridevirtual |
Get the current temperature of a particle container.
particle_container | The particle container to get the temperature of. |
Implements Thermostat.
Definition at line 33 of file AbsoluteThermostat.cpp.
|
overridevirtual |
Scale the temperature of a particle container towards the target temperature. Capped by the maximum temperature change.
particle_container | The particle container to scale the temperature of. |
Implements Thermostat.
Definition at line 10 of file AbsoluteThermostat.cpp.