MRMD 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{
27class DumpH5MDImpl;
28}
29
31{
32public:
33 DumpH5MD(const std::string& authorArg, const std::string& particleGroupNameArg = "atoms");
34
35 DumpH5MD(const DumpH5MD&) = delete;
36 DumpH5MD& operator=(const DumpH5MD&) = delete;
37 DumpH5MD(DumpH5MD&&) = delete;
39
40 void open(const std::string& filename,
41 const data::Subdomain& subdomain,
42 const data::Atoms& atoms);
43
44 void dumpStep(const data::Subdomain& subdomain,
45 const data::Atoms& atoms,
46 const idx_t step,
47 const real_t dt);
48
49 void close();
50
51 void dump(const std::string& filename,
52 const data::Subdomain& subdomain,
53 const data::Atoms& atoms);
54
55 bool dumpPos = true;
56 bool dumpVel = true;
57 bool dumpForce = true;
58 bool dumpType = true;
59 bool dumpMass = true;
60 bool dumpCharge = true;
61 bool dumpRelativeMass = true;
62
63 std::string posDataset = "position";
64 std::string velDataset = "velocity";
65 std::string forceDataset = "force";
66 std::string typeDataset = "type";
67 std::string massDataset = "mass";
68 std::string chargeDataset = "charge";
69 std::string relativeMassDataset = "relativeMass";
70
71 std::string author = "xxx";
72 std::string particleGroupName = "atoms";
73
74private:
75 friend class impl::DumpH5MDImpl;
76
77 struct ElementHandles
78 {
79 int64_t group = -1;
80 int64_t step = -1;
81 int64_t time = -1;
82 int64_t value = -1;
83 };
84
85 struct State
86 {
87 int64_t fileId = -1;
88 int64_t particleGroupId = -1;
89 int64_t particleSubGroupId = -1;
90 int64_t boxGroupId = -1;
91 ElementHandles edges;
92 ElementHandles charges;
93 ElementHandles force;
94 ElementHandles mass;
95 ElementHandles pos;
96 ElementHandles relativeMass;
97 ElementHandles type;
98 ElementHandles vel;
99 uint64_t saveCount = 0;
100 };
101
102 State state_;
103};
104
105} // namespace mrmd::io
Data structure for storing information about atoms on the host and the device.
Definition Atoms.hpp:35
Definition DumpH5MD.hpp:31
std::string chargeDataset
Definition DumpH5MD.hpp:68
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:780
bool dumpPos
Definition DumpH5MD.hpp:55
std::string typeDataset
Definition DumpH5MD.hpp:66
void dump(const std::string &filename, const data::Subdomain &subdomain, const data::Atoms &atoms)
Definition DumpH5MD.cpp:795
void open(const std::string &filename, const data::Subdomain &subdomain, const data::Atoms &atoms)
Definition DumpH5MD.cpp:772
bool dumpForce
Definition DumpH5MD.hpp:57
bool dumpCharge
Definition DumpH5MD.hpp:60
std::string forceDataset
Definition DumpH5MD.hpp:65
friend class impl::DumpH5MDImpl
Definition DumpH5MD.hpp:75
DumpH5MD & operator=(DumpH5MD &&)=delete
std::string relativeMassDataset
Definition DumpH5MD.hpp:69
std::string massDataset
Definition DumpH5MD.hpp:67
bool dumpRelativeMass
Definition DumpH5MD.hpp:61
bool dumpType
Definition DumpH5MD.hpp:58
std::string particleGroupName
Definition DumpH5MD.hpp:72
std::string velDataset
Definition DumpH5MD.hpp:64
bool dumpMass
Definition DumpH5MD.hpp:59
void close()
Definition DumpH5MD.cpp:789
DumpH5MD & operator=(const DumpH5MD &)=delete
bool dumpVel
Definition DumpH5MD.hpp:56
std::string author
Definition DumpH5MD.hpp:71
std::string posDataset
Definition DumpH5MD.hpp:63
Definition DumpCSV.cpp:25
int64_t idx_t
Definition datatypes.hpp:91
double real_t
Definition datatypes.hpp:99
|X|O|OOOOOOOOOO |X|O|OOOOOOOOOO |X|O+-------— <– minInnerCorner |X|OOOOOOOOOOOO |X+---------— <– minC...
Definition Subdomain.hpp:38