-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdump_nc.h
More file actions
141 lines (105 loc) · 4.36 KB
/
dump_nc.h
File metadata and controls
141 lines (105 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* ======================================================================
LAMMPS NetCDF dump style
https://github.com/pastewka/lammps-netcdf
Lars Pastewka, lars.pastewka@kit.edu
Copyright (2011-2013) Fraunhofer IWM
Copyright (2014) Karlsruhe Institute of Technology
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
====================================================================== */
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef DUMP_CLASS
DumpStyle(nc,DumpNC)
#else
#ifndef LMP_DUMP_NC_H
#define LMP_DUMP_NC_H
#include "dump_custom.h"
namespace LAMMPS_NS {
const int NC_FIELD_NAME_MAX = 100;
const int DUMP_NC_MAX_DIMS = 100;
class DumpNC : public DumpCustom {
public:
DumpNC(class LAMMPS *, int, char **);
virtual ~DumpNC();
virtual void write();
private:
// per-atoms quantities (positions, velocities, etc.)
struct nc_perat_t {
int dims; // number of dimensions
int field[DUMP_NC_MAX_DIMS]; // field indices corresponding to the dim.
char name[NC_FIELD_NAME_MAX]; // field name
int var; // NetCDF variable
bool constant; // is this property per file (not per frame)
int ndumped; // number of enties written for this prop.
};
typedef void (DumpNC::*funcptr_t)(void *);
// per-frame quantities (variables, fixes or computes)
struct nc_perframe_t {
char name[NC_FIELD_NAME_MAX]; // field name
int var; // NetCDF variable
int type; // variable, fix, compute or callback
int index; // index in fix/compute list
funcptr_t compute; // compute function
int dim; // dimension
char id[NC_FIELD_NAME_MAX]; // variable id
bigint bigint_data; // actual data
double double_data; // actual data
};
int framei; // current frame index
int blocki; // current block index
int ndata; // number of data blocks to expect
bigint ntotalgr; // # of atoms
int n_perat; // # of netcdf per-atom properties
nc_perat_t *perat; // per-atom properties
int n_perframe; // # of global netcdf (not per-atom) fix props
nc_perframe_t *perframe; // global properties
bool double_precision; // write everything as double precision
bigint n_buffer; // size of buffer
int *int_buffer; // buffer for passing data to netcdf
double *double_buffer; // buffer for passing data to netcdf
int ncid;
int frame_dim;
int spatial_dim;
int Voigt_dim;
int atom_dim;
int cell_spatial_dim;
int cell_angular_dim;
int label_dim;
int spatial_var;
int cell_spatial_var;
int cell_angular_var;
int time_var;
int cell_origin_var;
int cell_lengths_var;
int cell_angles_var;
virtual void openfile();
void closefile();
virtual void write_header(bigint);
virtual void write_data(int, double *);
void write_prmtop();
virtual int modify_param(int, char **);
void ncerr(int, const char *, int);
void compute_step(void *);
void compute_elapsed(void *);
void compute_elapsed_long(void *);
};
}
#endif
#endif