Page MenuHomec4science

simulation_box.hpp
No OneTemporary

File Metadata

Created
Wed, Jun 26, 23:06

simulation_box.hpp

/*-------------------------------------------------------
- Module : specmicp
- File : simulation_box.hpp
- Author : Fabien Georget
Copyright (c) 2014, Fabien Georget, Princeton University
---------------------------------------------------------*/
#ifndef SPECMICP_SPECMICP_SIMULATIONBOX_HPP
#define SPECMICP_SPECMICP_SIMULATIONBOX_HPP
//! \file simulation_box.hpp The simulation box, contains information about the simulation
#include "physics/units.hpp"
namespace specmicp {
//! \brief Store information about the simulation
class SimulationBox
{
public:
static constexpr double not_fixed = 0;
SimulationBox():
m_temperature(units::celsius(25)),
m_volume(not_fixed)
{}
// Temperature
// -----------
//! \brief Return true if the temperature of the simulation box is fixed
double is_fixed_temperature() const {return (m_temperature != not_fixed);}
//! \brief Return the temperature of the simulation box (K)
double get_temperature() const {return m_temperature;}
//! \brief set the temperature
void set_temperature(double temperature_kelvin) {m_temperature = temperature_kelvin;}
//! \brief set the temperature (in celsius)
void set_temperature_celsius(double temperature_celsius) {m_temperature = units::celsius(temperature_celsius);}
//! \brief set the temperature to be non fixed
void set_notfixed_temperature() {m_temperature = not_fixed;}
// Volume
// ------
//! \brief Return true if the volume is run in a fixed volume
bool is_fixed_volume() const {return (m_volume != not_fixed);}
//! \brief Return the volume of the simulation box
double get_volume() const {return m_volume;}
//! \brief Return the volume of the simulation box (in L)
double get_volume_liter() const {return units::to_liter(m_volume);}
//! \brief Set the volume of the simulation box (in m^3)
void set_volume(double volume) {m_volume = volume;}
//! \brief Get the volume of the simulation box (in L)
void set_volume_liter(double volume) {m_volume = units::liter(volume);}
//! \brief Set the volume to non-fixed
void set_notfixed_volume() {m_volume = not_fixed;}
private:
double m_temperature; // Temperature of the simulation // in Kelvin
double m_volume; // internal storage of the volume // in m3
};
} // end namespace specmicp
#endif // SPECMICP_SPECMICP_SIMULATIONBOX_HPP

Event Timeline