Multi Resolution Molecular Dynamics 0.4.0
Multi Resolution Molecular Dynamics
Loading...
Searching...
No Matches
DumpH5MD.hpp
Go to the documentation of this file.
1// Copyright 2024 Sebastian Eibl
2// Copyright 2026 Julian Friedrich Hille
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// https://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#pragma once
17
18#include <string>
19
20#include "data/Atoms.hpp"
21#include "data/Subdomain.hpp"
22
23namespace mrmd::io
24{
25namespace impl
26{
32class DumpH5MDImpl;
33} // namespace impl
34
41{
42public:
43 DumpH5MD(const std::string& authorArg, const std::string& particleGroupNameArg = "atoms");
44
45 DumpH5MD(const DumpH5MD&) = delete;
46 DumpH5MD& operator=(const DumpH5MD&) = delete;
47 DumpH5MD(DumpH5MD&&) = delete;
49
50 void open(const std::string& filename,
51 const data::Subdomain& subdomain,
52 const data::Atoms& atoms);
53
54 void dumpStep(const data::Subdomain& subdomain,
55 const data::Atoms& atoms,
56 const idx_t step,
57 const real_t dt);
58
59 void close();
60
61 void dump(const std::string& filename,
62 const data::Subdomain& subdomain,
63 const data::Atoms& atoms);
64
65 bool dumpPos = true;
66 bool dumpVel = true;
67 bool dumpForce = true;
68 bool dumpType = true;
69 bool dumpMass = true;
70 bool dumpCharge = true;
71 bool dumpRelativeMass = true;
72
73 std::string posDataset = "position";
74 std::string velDataset = "velocity";
75 std::string forceDataset = "force";
76 std::string typeDataset = "type";
77 std::string massDataset = "mass";
78 std::string chargeDataset = "charge";
79 std::string relativeMassDataset = "relativeMass";
80
81 std::string author = "xxx";
82 std::string particleGroupName = "atoms";
83
84private:
85 friend class impl::DumpH5MDImpl;
86
87 struct ElementHandles
88 {
89 int64_t group = -1;
90 int64_t step = -1;
91 int64_t time = -1;
92 int64_t value = -1;
93 };
94
95 struct State
96 {
97 int64_t fileId = -1;
98 int64_t particleGroupId = -1;
99 int64_t particleSubGroupId = -1;
100 int64_t boxGroupId = -1;
101 ElementHandles edges;
102 ElementHandles charges;
103 ElementHandles force;
104 ElementHandles mass;
105 ElementHandles pos;
106 ElementHandles relativeMass;
107 ElementHandles type;
108 ElementHandles vel;
109 uint64_t saveCount = 0;
110 };
111
112 State state_;
113};
114
115} // namespace mrmd::io
std::string chargeDataset
Definition DumpH5MD.hpp:78
DumpH5MD(const DumpH5MD &)=delete
DumpH5MD(DumpH5MD &&)=delete
void dumpStep(const data::Subdomain &subdomain, const data::Atoms &atoms, const idx_t step, const real_t dt)
Definition DumpH5MD.cpp:776
bool dumpPos
Definition DumpH5MD.hpp:65
std::string typeDataset
Definition DumpH5MD.hpp:76
void dump(const std::string &filename, const data::Subdomain &subdomain, const data::Atoms &atoms)
Definition DumpH5MD.cpp:791
void open(const std::string &filename, const data::Subdomain &subdomain, const data::Atoms &atoms)
Definition DumpH5MD.cpp:768
bool dumpForce
Definition DumpH5MD.hpp:67
bool dumpCharge
Definition DumpH5MD.hpp:70
std::string forceDataset
Definition DumpH5MD.hpp:75
friend class impl::DumpH5MDImpl
Definition DumpH5MD.hpp:85
DumpH5MD & operator=(DumpH5MD &&)=delete
std::string relativeMassDataset
Definition DumpH5MD.hpp:79
std::string massDataset
Definition DumpH5MD.hpp:77
bool dumpRelativeMass
Definition DumpH5MD.hpp:71
bool dumpType
Definition DumpH5MD.hpp:68
std::string particleGroupName
Definition DumpH5MD.hpp:82
std::string velDataset
Definition DumpH5MD.hpp:74
bool dumpMass
Definition DumpH5MD.hpp:69
void close()
Definition DumpH5MD.cpp:785
DumpH5MD & operator=(const DumpH5MD &)=delete
bool dumpVel
Definition DumpH5MD.hpp:66
std::string author
Definition DumpH5MD.hpp:81
DumpH5MD(const std::string &authorArg, const std::string &particleGroupNameArg="atoms")
Definition DumpH5MD.cpp:30
std::string posDataset
Definition DumpH5MD.hpp:73
DeviceAtoms Atoms
Definition Atoms.hpp:177
Save and load simulation data.
int64_t idx_t
Definition datatypes.hpp:91
double real_t
Definition datatypes.hpp:99
Axis-aligned simulation box with a surrounding ghost layer.
Definition Subdomain.hpp:46