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

This class implements the simulation of the particle system. More...

#include <Simulator.h>

Collaboration diagram for Simulator:
Collaboration graph

Public Member Functions

 Simulator ()=delete
 
 Simulator (SimulationSettings &simulationSettings, FileHandler::outputFormat outputFormat)
 Constructor to contruct a new simulation evironment. More...
 
 Simulator (DirectSumSimulationParameters &parameters, std::string &inputFilePath, FileHandler::outputFormat outputFormat, int outputFrequency, std::string &outputFileBaseName)
 Legacy constructor to construct a new simulation environment using the direct sum algorithm. More...
 
void run (bool benchmark)
 Run the simulation. More...
 
void loadState (std::string &pathToMolecules)
 Load the state of all molecules from a previous simulation back into this simulation. More...
 
void saveState ()
 Export the current state of all molecules to a txt file for using them in a new simulation. More...
 
ParticleContainergetParticles ()
 Get the Particle container of this simulator. More...
 
unsigned long long getTotalMoleculeUpdates () const
 

Private Attributes

bool computeProfiles
 
std::unique_ptr< Statisticsstatistics
 
std::array< double, 3 > domainSize {}
 
std::unique_ptr< Thermostatthermostat
 
int nThermostat
 
bool useThermostat
 
bool initialiseSystemWithBrownianMotion
 
bool applyScalingGradually
 
std::unique_ptr< Forceforce
 
std::unique_ptr< Modelmodel
 
double deltaT
 
double endT
 
int outputFrequency
 
std::string outputFileBaseName
 
unsigned long long totalMoleculeUpdates
 

Detailed Description

This class implements the simulation of the particle system.

Using Newton's axioms and the Störmer-Verlet equations force, velocity and position of all particles are computed in fixed discrete time steps. Results are written to files.

Constructor & Destructor Documentation

◆ Simulator() [1/3]

Simulator::Simulator ( )
delete

◆ Simulator() [2/3]

Simulator::Simulator ( SimulationSettings simulationSettings,
FileHandler::outputFormat  outputFormat 
)

Constructor to contruct a new simulation evironment.

Parameters
simulationSettingsSpecify all parameters of the simulation environment.
outputFormatFormat of the output files.

◆ Simulator() [3/3]

Simulator::Simulator ( DirectSumSimulationParameters parameters,
std::string &  inputFilePath,
FileHandler::outputFormat  outputFormat,
int  outputFrequency,
std::string &  outputFileBaseName 
)

Legacy constructor to construct a new simulation environment using the direct sum algorithm.

Parameters
parametersSimulation parameters for the direct sum model.
inputFilePathPath to the input file which comprises the particles going to be simulated.
outputFormatFormat of the output file. Supported formats are vtk and xyz.
outputFrequencySpecifies after how much time steps an output file is written. For example an output frequency of 10 means that after each 10 iterations an output file is written.
outputFileBaseNameBase name of the output files.

To create a new simulation environment you have to provide an input file containing the particles you want to simulate.

Member Function Documentation

◆ getParticles()

ParticleContainer & Simulator::getParticles ( )

Get the Particle container of this simulator.

Returns
Particle container of this simulator

◆ getTotalMoleculeUpdates()

unsigned long long Simulator::getTotalMoleculeUpdates ( ) const
Here is the caller graph for this function:

◆ loadState()

void Simulator::loadState ( std::string &  pathToMolecules)

Load the state of all molecules from a previous simulation back into this simulation.

Parameters
pathToMoleculesPath pointing to the txt file which stores the state of the molecules.

◆ run()

void Simulator::run ( bool  benchmark)

Run the simulation.

After configuration of the parameters the simulation can be run calling this method. When no configuration is done before, the default parameters will be used.

Parameters
benchmarkActivate or deactivate time measurement
Here is the caller graph for this function:

◆ saveState()

void Simulator::saveState ( )

Export the current state of all molecules to a txt file for using them in a new simulation.

Member Data Documentation

◆ applyScalingGradually

bool Simulator::applyScalingGradually
private

◆ computeProfiles

bool Simulator::computeProfiles
private

◆ deltaT

double Simulator::deltaT
private

◆ domainSize

std::array<double, 3> Simulator::domainSize {}
private

◆ endT

double Simulator::endT
private

◆ force

std::unique_ptr<Force> Simulator::force
private

◆ initialiseSystemWithBrownianMotion

bool Simulator::initialiseSystemWithBrownianMotion
private

◆ model

std::unique_ptr<Model> Simulator::model
private

◆ nThermostat

int Simulator::nThermostat
private

◆ outputFileBaseName

std::string Simulator::outputFileBaseName
private

◆ outputFrequency

int Simulator::outputFrequency
private

◆ statistics

std::unique_ptr<Statistics> Simulator::statistics
private

◆ thermostat

std::unique_ptr<Thermostat> Simulator::thermostat
private

◆ totalMoleculeUpdates

unsigned long long Simulator::totalMoleculeUpdates
private

◆ useThermostat

bool Simulator::useThermostat
private

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