3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * Gromacs Runs On Most of All Computer Systems
48 /**************************************************************
50 * The routines in the corresponding c-file enxio.c
51 * are based on the lower level routines in gmxfio.c
52 * The integer file pointer returned from open_enx
53 * can also be used with the routines in gmxfio.h
55 **************************************************************/
67 * Index for the additional blocks in the energy file.
68 * Blocks can be added without sacrificing backward and forward
69 * compatibility of the energy files.
72 enxOR
, /* Time and ensemble averaged data for orientation restraints */
73 enxORI
, /* Instantaneous data for orientation restraints */
74 enxORT
, /* Order tensor(s) for orientation restraints */
75 enxNR
/* Total number of extra blocks in the current code,
76 * note that the enxio code can read files written by
77 * future code which contain more blocks.
82 double t
; /* Timestamp of this frame */
83 gmx_step_t step
; /* MD step */
84 gmx_step_t nsteps
; /* The number of steps between frames */
85 gmx_step_t nsum
; /* The number of terms for the sums in ener */
86 int nre
; /* Number of energies */
87 int ndisre
; /* Number of distance restraints */
88 int nblock
; /* Number of following energy blocks */
89 int *nr
; /* Number of things in additional blocks (nblock) */
90 int e_size
; /* Size (in bytes) of energies */
91 int d_size
; /* Size (in bytes) of disre blocks */
92 int nr_alloc
; /* Allocated size of nr and block */
93 int e_alloc
; /* Allocated size (in elements) of ener */
94 int d_alloc
; /* Allocated size (in elements) of rav and rt */
95 int *b_alloc
; /* Allocated size (in elements) of each block */
96 t_energy
*ener
; /* The energies */
97 real
*disre_rm3tav
; /* Time averaged data for distance restraints */
98 real
*disre_rt
; /* Instantaneous data for distance restraints */
99 real
**block
; /* Additional energy blocks (nblock x b_alloc[b]) */
103 typedef struct ener_file
*ener_file_t
;
106 * An energy file is read like this:
111 * fp = open_enx(...);
114 * while (do_enx(fp,fr)) {
121 /* New energy reading and writing interface */
122 extern void free_enxframe(t_enxframe
*fr
);
123 /* Frees all allocated memory in fr */
125 extern ener_file_t
open_enx(const char *fn
,const char *mode
);
127 extern void close_enx(ener_file_t ef
);
129 extern void do_enxnms(ener_file_t ef
,int *nre
,gmx_enxnm_t
**enms
);
131 extern void free_enxnms(int n
,gmx_enxnm_t
*nms
);
132 /* Frees nms and all strings in it */
134 extern bool do_enx(ener_file_t ef
,t_enxframe
*fr
);
135 /* Reads enx_frames, memory in fr is (re)allocated if necessary */
137 extern void get_enx_state(const char *fn
, real t
,
138 gmx_groups_t
*groups
, t_inputrec
*ir
,
141 * Reads state variables from enx file fn at time t.
142 * atoms and ir are required for determining which things must be read.
143 * Currently pcoupl and tcoupl state are read from enx.
150 #endif /* _enerio_h */