Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F68167918
simulation_box.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jun 26, 04:25
Size
3 KB
Mime Type
text/x-c++
Expires
Fri, Jun 28, 04:25 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18511117
Attached To
rSPECMICP SpecMiCP / ReactMiCP
simulation_box.hpp
View Options
/*-------------------------------------------------------
- Module : specmicp
- File : simulation_box.hpp
- Author : Fabien Georget
Copyright (c) 2014, Fabien Georget <fabieng@princeton.edu>, Princeton University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Princeton University nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------*/
#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.0
)),
m_volume
(
not_fixed
)
{}
SimulationBox
(
double
volume
)
:
m_temperature
(
units
::
celsius
(
25.0
)),
m_volume
(
volume
)
{}
// 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
Log In to Comment