Molecular Dynamics  v0.4
Project for the Practical hosted by the Scientific Computing Chair
Public Member Functions | Protected Attributes | List of all members
Thermostat Class Referenceabstract

Base class for controling the temperature of the simulated system. More...

#include <Thermostat.h>

Inheritance diagram for Thermostat:
Inheritance graph
Collaboration diagram for Thermostat:
Collaboration graph

Public Member Functions

virtual double calculateKineticEnergy ()=0
 Helper method to calculate the current kinetic energy of the system. More...
 
virtual double calculateTemperature ()=0
 Helper method to calculate the current temperature of the system. More...
 
 Thermostat (Model &model, double temperatureInit, double temperatureTarget, double maxTemperatureChange, int dimensions)
 Construct a thermostat for a model. More...
 
void initialiseSystem ()
 Set the temperature of the system to initTemperature before starting the simultion by applying Brownian Motion to all particles. More...
 
virtual void setTemperatureOfTheSystemViaVelocityScaling ()=0
 Set the temperature of the current system to targetTemperature. More...
 
virtual void setTemperatureOfTheSystemViaGradualVelocityScaling ()=0
 Set the temperature of the current system to targetTemperature, if the change in temperature does not exceed maxTemperatureChange. If it does, the temperature will only be adjusted by the value of maxTemperatureChange. More...
 
void setTargetTemperature (double targetTemperature)
 
virtual ~Thermostat ()=default
 

Protected Attributes

Modelmodel
 
double initTemperature
 
double targetTemperature
 
double maxTemperatureChange
 
int dimensions
 

Detailed Description

Base class for controling the temperature of the simulated system.

Constructor & Destructor Documentation

◆ Thermostat()

Thermostat::Thermostat ( Model model,
double  temperatureInit,
double  temperatureTarget,
double  maxTemperatureChange,
int  dimensions 
)

Construct a thermostat for a model.

Parameters
modelModel on which the thermostat is applied.
temperatureInitThe initial temperature of the system.
temperatureTargetTemperature the system should reach and preserve
maxTemperatureChangeThe maximal absolute temperature change that is allowed for one application of the thermostat.
dimensionsNumber of dimensions in which the simulation takes place.

◆ ~Thermostat()

virtual Thermostat::~Thermostat ( )
virtualdefault

Member Function Documentation

◆ calculateKineticEnergy()

virtual double Thermostat::calculateKineticEnergy ( )
pure virtual

Helper method to calculate the current kinetic energy of the system.

Returns
Current kinetic energy of the system.

Implemented in FlowThermostat, and DefaultThermostat.

◆ calculateTemperature()

virtual double Thermostat::calculateTemperature ( )
pure virtual

Helper method to calculate the current temperature of the system.

Returns
Current temperature of the system.

Implemented in FlowThermostat, and DefaultThermostat.

◆ initialiseSystem()

void Thermostat::initialiseSystem ( )

Set the temperature of the system to initTemperature before starting the simultion by applying Brownian Motion to all particles.

Here is the call graph for this function:

◆ setTargetTemperature()

void Thermostat::setTargetTemperature ( double  targetTemperature)
inline

Setter for testing purposes

◆ setTemperatureOfTheSystemViaGradualVelocityScaling()

virtual void Thermostat::setTemperatureOfTheSystemViaGradualVelocityScaling ( )
pure virtual

Set the temperature of the current system to targetTemperature, if the change in temperature does not exceed maxTemperatureChange. If it does, the temperature will only be adjusted by the value of maxTemperatureChange.

Implemented in FlowThermostat, and DefaultThermostat.

◆ setTemperatureOfTheSystemViaVelocityScaling()

virtual void Thermostat::setTemperatureOfTheSystemViaVelocityScaling ( )
pure virtual

Set the temperature of the current system to targetTemperature.

Implemented in FlowThermostat, and DefaultThermostat.

Member Data Documentation

◆ dimensions

int Thermostat::dimensions
protected

◆ initTemperature

double Thermostat::initTemperature
protected

◆ maxTemperatureChange

double Thermostat::maxTemperatureChange
protected

◆ model

Model& Thermostat::model
protected

Paramters used in this thermostat: -model: Model on which this thermostat is applied -initTemperature: The initial temperature of the system -targetTemperature: Temperature the system should reach and preserve -maxTemperatureChange: The maximal absolute temperature change that is allowed for one application of the thermostat -dimensions: Number of dimensions in which the simulation takes place.

◆ targetTemperature

double Thermostat::targetTemperature
protected

The documentation for this class was generated from the following files: