ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
h5md_specification.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
4 * Max-Planck-Institute for Polymer Research, Theory Group
5 *
6 * This file is part of ESPResSo.
7 *
8 * ESPResSo is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * ESPResSo is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
23#include "h5md_core.hpp"
24#include "hdf5.h"
25
26#include <utility>
27
28namespace Writer {
29namespace H5md {
30
32 auto const add_time_series = [this](Dataset &&dataset, bool link = true) {
33 auto const group = dataset.group;
34 m_datasets.push_back(std::move(dataset));
35 m_datasets.push_back({group, "step", 1, H5T_NATIVE_INT, 1, link});
36 m_datasets.push_back({group, "time", 1, H5T_NATIVE_DOUBLE, 1, link});
37 };
38
39 if (fields & H5MD_OUT_BOX_L) {
40 add_time_series(
41 {"particles/atoms/box/edges", "value", 2, H5T_NATIVE_DOUBLE, 3, false});
42 }
43 if (fields & H5MD_OUT_LE_OFF) {
44 add_time_series({"particles/atoms/lees_edwards/offset", "value", 2,
45 H5T_NATIVE_DOUBLE, 1, false});
46 }
47 if (fields & H5MD_OUT_LE_DIR) {
48 add_time_series({"particles/atoms/lees_edwards/direction", "value", 2,
49 H5T_NATIVE_INT, 1, false});
50 }
51 if (fields & H5MD_OUT_LE_NORMAL) {
52 add_time_series({"particles/atoms/lees_edwards/normal", "value", 2,
53 H5T_NATIVE_INT, 1, false});
54 }
55 if (fields & H5MD_OUT_MASS) {
56 add_time_series(
57 {"particles/atoms/mass", "value", 2, H5T_NATIVE_DOUBLE, 1, false});
58 }
59 if (fields & H5MD_OUT_CHARGE) {
60 add_time_series(
61 {"particles/atoms/charge", "value", 2, H5T_NATIVE_DOUBLE, 1, false});
62 }
63 add_time_series({"particles/atoms/id", "value", 2, H5T_NATIVE_INT, 1, false},
64 false);
65 if (fields & H5MD_OUT_TYPE) {
66 add_time_series(
67 {"particles/atoms/species", "value", 2, H5T_NATIVE_INT, 1, false});
68 }
69 if (fields & H5MD_OUT_POS) {
70 add_time_series(
71 {"particles/atoms/position", "value", 3, H5T_NATIVE_DOUBLE, 3, false});
72 }
73 if (fields & H5MD_OUT_VEL) {
74 add_time_series(
75 {"particles/atoms/velocity", "value", 3, H5T_NATIVE_DOUBLE, 3, false});
76 }
77 if (fields & H5MD_OUT_FORCE) {
78 add_time_series(
79 {"particles/atoms/force", "value", 3, H5T_NATIVE_DOUBLE, 3, false});
80 }
81 if (fields & H5MD_OUT_IMG) {
82 add_time_series(
83 {"particles/atoms/image", "value", 3, H5T_NATIVE_INT, 3, false});
84 }
85 if (fields & H5MD_OUT_BONDS) {
86 add_time_series(
87 {"connectivity/atoms", "value", 3, H5T_NATIVE_INT, 2, false});
88 }
89}
90
91} // namespace H5md
92} // namespace Writer