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
51 /**************************************************************
53 * The routines in the corresponding c-file enxio.c
54 * are based on the lower level routines in gmxfio.c
55 * The integer file pointer returned from open_enx
56 * can also be used with the routines in gmxfio.h
58 **************************************************************/
66 * Index for the additional blocks in the energy file.
67 * Blocks can be added without sacrificing backward and forward
68 * compatibility of the energy files.
71 enxOR
, /* Time and ensemble averaged data for orientation restraints */
72 enxORI
, /* Instantaneous data for orientation restraints */
73 enxORT
, /* Order tensor(s) for orientation restraints */
74 enxNR
/* Total number of extra blocks in the current code,
75 * note that the enxio code can read files written by
76 * future code which contain more blocks.
81 double t
; /* Timestamp of this frame */
82 gmx_large_int_t step
; /* MD step */
83 gmx_large_int_t nsteps
; /* The number of steps between frames */
84 gmx_large_int_t nsum
; /* The number of terms for the sums in ener */
85 int nre
; /* Number of energies */
86 int ndisre
; /* Number of distance restraints */
87 int nblock
; /* Number of following energy blocks */
88 int *nr
; /* Number of things in additional blocks (nblock) */
89 int e_size
; /* Size (in bytes) of energies */
90 int d_size
; /* Size (in bytes) of disre blocks */
91 int nr_alloc
; /* Allocated size of nr and block */
92 int e_alloc
; /* Allocated size (in elements) of ener */
93 int d_alloc
; /* Allocated size (in elements) of rav and rt */
94 int *b_alloc
; /* Allocated size (in elements) of each block */
95 t_energy
*ener
; /* The energies */
96 real
*disre_rm3tav
; /* Time averaged data for distance restraints */
97 real
*disre_rt
; /* Instantaneous data for distance restraints */
98 real
**block
; /* Additional energy blocks (nblock x b_alloc[b]) */
102 typedef struct ener_file
*ener_file_t
;
105 * An energy file is read like this:
110 * fp = open_enx(...);
113 * while (do_enx(fp,fr)) {
120 /* New energy reading and writing interface */
121 extern void free_enxframe(t_enxframe
*fr
);
122 /* Frees all allocated memory in fr */
124 extern ener_file_t
open_enx(const char *fn
,const char *mode
);
126 extern int enx_file_pointer(const ener_file_t ef
);
128 extern void close_enx(ener_file_t ef
);
130 extern void do_enxnms(ener_file_t ef
,int *nre
,gmx_enxnm_t
**enms
);
132 extern void free_enxnms(int n
,gmx_enxnm_t
*nms
);
133 /* Frees nms and all strings in it */
135 extern bool do_enx(ener_file_t ef
,t_enxframe
*fr
);
136 /* Reads enx_frames, memory in fr is (re)allocated if necessary */
138 extern void get_enx_state(const char *fn
, real t
,
139 gmx_groups_t
*groups
, t_inputrec
*ir
,
142 * Reads state variables from enx file fn at time t.
143 * atoms and ir are required for determining which things must be read.
144 * Currently pcoupl and tcoupl state are read from enx.
151 #endif /* _enerio_h */