/usr/include/gromacs/fileio/enxio.h is in libgromacs-dev 2016.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | /*
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* GROMACS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* GROMACS 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GROMACS; if not, see
* http://www.gnu.org/licenses, or write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* If you want to redistribute modifications to GROMACS, please
* consider that scientific software is very special. Version
* control is crucial - bugs must be traceable. We will be happy to
* consider code for inclusion in the official distribution, but
* derived work must not be called official GROMACS. Details are found
* in the README & COPYING files - if they are missing, get the
* official version at http://www.gromacs.org.
*
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
#ifndef GMX_FILEIO_ENXIO_H
#define GMX_FILEIO_ENXIO_H
#include "gromacs/fileio/xdr_datatype.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/trajectory/energy.h"
#ifdef __cplusplus
extern "C" {
#endif
struct gmx_groups_t;
struct t_fileio;
struct t_inputrec;
/**************************************************************
* These are the base datatypes + functions for reading and
* writing energy files (.edr). They are either called directly
* (as in the processing tools), or indirectly through mdebin.c
* during mdrun.
*
* The routines in the corresponding c-file enxio.c
* are based on the lower level routines in gmxfio.c.
* The file pointer returned from open_enx
* can also be used with the routines in gmxfio.h
*
**************************************************************/
typedef struct {
char *name;
char *unit;
} gmx_enxnm_t;
/*
* Index for the IDs of additional blocks in the energy file.
* Blocks can be added without sacrificing backward and forward
* compatibility of the energy files.
*
* For backward compatibility, the order of these should not be changed.
*/
enum {
enxOR, /* Time and ensemble averaged data for orientation restraints */
enxORI, /* Instantaneous data for orientation restraints */
enxORT, /* Order tensor(s) for orientation restraints */
enxDISRE, /* Distance restraint blocks */
enxDHCOLL, /* Data about the free energy blocks in this frame. */
enxDHHIST, /* BAR histogram */
enxDH, /* BAR raw delta H data */
enxNR /* Total number of extra blocks in the current code,
* note that the enxio code can read files written by
* future code which contain more blocks.
*/
};
/* names for the above enum */
extern const char *enx_block_id_name[];
/* the subblocks that are contained in energy file blocks. Each of these
has a number of values of a single data type in a .edr file. */
typedef struct
{
int nr; /* number of items in subblock */
xdr_datatype type; /* the block type */
/* the values: pointers for each type */
float* fval;
double* dval;
int* ival;
gmx_int64_t* lval;
unsigned char* cval;
char** sval;
/* the allocated sizes, defined separately.
(nonzero sizes can be free()d later): */
int fval_alloc;
int dval_alloc;
int ival_alloc;
int lval_alloc;
int cval_alloc;
int sval_alloc;
} t_enxsubblock;
/* the energy file blocks. Each block contains a number of sub-blocks
of a single type that contain the actual data. */
typedef struct t_enxblock{
int id; /* block id, from the enx enums above */
int nsub; /* number of subblocks */
t_enxsubblock *sub; /* the subblocks */
int nsub_alloc; /* number of allocated subblocks */
} t_enxblock;
/* The frames that are read/written */
typedef struct {
double t; /* Timestamp of this frame */
gmx_int64_t step; /* MD step */
gmx_int64_t nsteps; /* The number of steps between frames */
double dt; /* The MD time step */
int nsum; /* The number of terms for the sums in ener */
int nre; /* Number of energies */
int e_size; /* Size (in bytes) of energies */
int e_alloc; /* Allocated size (in elements) of ener */
t_energy *ener; /* The energies */
int nblock; /* Number of following energy blocks */
t_enxblock *block; /* The blocks */
int nblock_alloc; /* The number of blocks allocated */
} t_enxframe;
/* file handle */
typedef struct ener_file *ener_file_t;
/*
* An energy file is read like this:
*
* ener_file_t fp;
* t_enxframe *fr;
*
* fp = open_enx(...);
* do_enxnms(fp,...);
* snew(fr,1);
* while (do_enx(fp,fr)) {
* ...
* }
* free_enxframe(fr);
* sfree(fr);
*/
/* New energy reading and writing interface */
/* initialize a pre-allocated frame */
void init_enxframe(t_enxframe *ef);
/* delete a frame's memory (except the ef itself) */
void free_enxframe(t_enxframe *ef);
ener_file_t open_enx(const char *fn, const char *mode);
struct t_fileio *enx_file_pointer(const ener_file_t ef);
/* Free the contents of ef */
void close_enx(ener_file_t ef);
/* Free the contents of ef, and ef itself */
void done_ener_file(ener_file_t ef);
void do_enxnms(ener_file_t ef, int *nre, gmx_enxnm_t **enms);
void free_enxnms(int n, gmx_enxnm_t *nms);
/* Frees nms and all strings in it */
gmx_bool do_enx(ener_file_t ef, t_enxframe *fr);
/* Reads enx_frames, memory in fr is (re)allocated if necessary */
void get_enx_state(const char *fn, real t,
const gmx_groups_t *groups, t_inputrec *ir,
t_state *state);
/*
* Reads state variables from enx file fn at time t.
* atoms and ir are required for determining which things must be read.
* Currently pcoupl and tcoupl state are read from enx.
*/
/* block funtions */
/* allocate n blocks to a frame (if neccesary). Don't touch existing blocks */
void add_blocks_enxframe(t_enxframe *ef, int n);
/* find a block by id number; if prev!=NULL, it searches from
that block's next block.
Returns NULL if no block is found with the given id. */
t_enxblock *find_block_id_enxframe(t_enxframe *ef, int id, t_enxblock *prev);
/* allocate n subblocks to a block (if neccesary). Don't touch existing
subbblocks. */
void add_subblocks_enxblock(t_enxblock *eb, int n);
#ifdef __cplusplus
}
#endif
#endif
|