- Note
- This page is generated from examples/01_IdealGas_NVT/01_IdealGas_NVT.cpp. Build and run it with cmake --build mrmd-build --target 01_IdealGas_NVT followed by ./mrmd-build/examples/01_IdealGas_NVT/01_IdealGas_NVT. Pass --help to see the available command line options.
Minimal ideal gas simulation in the NVT (canonical) ensemble.
#include <CLI/App.hpp>
#include <CLI/Config.hpp>
#include <CLI/Formatter.hpp>
Top-level namespace of MRMD.
Configuration for the ideal gas example simulation in NVT ensemble.
struct Config
{
static constexpr real_t dt = 0.005;
static constexpr real_t temperature =
1.5_r;
static constexpr real_t friction =
0.04_r / dt;
};
int64_t idx_t
Definition datatypes.hpp:91
double real_t
Definition datatypes.hpp:99
Simulation logic goes here
void runIdealGas(const Config& config)
{
auto subdomain =
data::Subdomain({0_r, 0_r, 0_r}, {100_r, 100_r, 100_r}, 1_r);
Kokkos::Timer timer;
for (auto i = 0; i < config.nsteps; ++i)
{
integrator.preForceIntegrate(atoms, config.dt);
integrator.postForceIntegrate(atoms, config.dt);
if (i % 100 == 0)
{
io::dumpCSV(
"atoms_" + std::to_string(i) +
".csv", atoms);
}
}
auto time = timer.seconds();
std::cout << time << std::endl;
}
Integrator that updates the positions and velocities of atoms using the BAOAB Langevin dynamics algor...
Definition VelocityVerletLangevinThermostat.hpp:36
High-level interface for managing ghost atoms at the periodic boundaries.
Definition GhostLayer.hpp:33
void exchangeRealAtoms(data::Atoms &atoms, const data::Subdomain &subdomain)
Definition GhostLayer.hpp:39
void dumpCSV(const std::string &filename, data::Atoms &atoms, bool dumpGhosts)
Definition DumpCSV.cpp:26
data::Atoms fillDomainWithAtoms(const data::Subdomain &subdomain, const idx_t &numAtoms, const real_t &maxVelocity, const real_t &inputMass)
Helper function to provide an initial atoms ensamble.
Definition simulationSetup.cpp:22
Axis-aligned simulation box with a surrounding ghost layer.
Definition Subdomain.hpp:46
Main function for the simulation
int main(int argc, char* argv[])
{
Kokkos::ScopeGuard scope_guard(argc, argv);
std::cout << "execution space: " << typeid(Kokkos::DefaultExecutionSpace).name() << std::endl;
Config config;
CLI::App app{"ideal gas benchmark application"};
app.add_option("-n,--nsteps", config.nsteps, "number of simulation steps");
CLI11_PARSE(app, argc, argv);
runIdealGas(config);
return EXIT_SUCCESS;
}