Molecular Dynamics Simulation
1.0
|
A relative 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 <RelativeThermostat.h>
Public Member Functions | |
RelativeThermostat (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, std::array< double, 3 > average_velocity) const |
Get the kinetic energy of a particle. More... | |
double | getCurrentContainerTemperature (const std::unique_ptr< ParticleContainer > &particle_container, std::array< double, 3 > average_velocity) const |
Get the current temperature of a particle. 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 relative 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 "relative" in the sense that it takes the actual "average" velocity of the particles into account when scaling the temperature. This means that the particles jiggle gets reduced, but in total the particles will still move if given an initial velocity.
Definition at line 19 of file RelativeThermostat.h.
RelativeThermostat::RelativeThermostat | ( | 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 RelativeThermostat.cpp.
double RelativeThermostat::getContainerKineticEnergy | ( | const std::unique_ptr< ParticleContainer > & | particle_container, |
std::array< double, 3 > | average_velocity | ||
) | const |
Get the kinetic energy of a particle.
particle_container | The particle container to get the kinetic energy of. |
average_velocity | The average velocity of all particles in the container. |
Definition at line 36 of file RelativeThermostat.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 53 of file RelativeThermostat.cpp.
double RelativeThermostat::getCurrentContainerTemperature | ( | const std::unique_ptr< ParticleContainer > & | particle_container, |
std::array< double, 3 > | average_velocity | ||
) | const |
Get the current temperature of a particle.
particle_container | The particle container to get the temperature of. |
average_velocity | The average velocity of all particles in the container. |
Definition at line 47 of file RelativeThermostat.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 21 of file RelativeThermostat.cpp.