1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * For more info, check our website at http://www.gromacs.org
34 * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
44 static int div_nsteps(int nsteps,int nst)
48 return (1 + nsteps + nst - 1)/nst;
56 double compute_io(t_inputrec *ir,int natoms,gmx_groups_t *groups,
60 int nsteps = ir->nsteps;
62 int nstx,nstv,nstf,nste,nstlog,nstxtc,nfep=0;
65 nstx = div_nsteps(nsteps,ir->nstxout);
66 nstv = div_nsteps(nsteps,ir->nstvout);
67 nstf = div_nsteps(nsteps,ir->nstfout);
68 nstxtc = div_nsteps(nsteps,ir->nstxtcout);
69 if (ir->nstxtcout > 0)
71 for(i=0; i<natoms; i++)
73 if (groups->grpnr[egcXTC] == NULL || groups->grpnr[egcXTC][i] == 0)
79 nstlog = div_nsteps(nsteps,ir->nstlog);
80 /* We add 2 for the header */
81 nste = div_nsteps(2+nsteps,ir->nstenergy);
84 cio += (nstx+nstf+nstv)*sizeof(real)*(3.0*natoms);
85 cio += nstxtc*(14*4 + nxtcatoms*5.0); /* roughly 5 bytes per atom */
86 cio += nstlog*(nrener*16*2.0); /* 16 bytes per energy term plus header */
87 /* t_energy contains doubles, but real is written to edr */
88 cio += (1.0*nste)*nrener*3*sizeof(real);
90 if ((ir->efep != efepNO || ir->bSimTemp) && (ir->fepvals->nstdhdl > 0))
92 int ndh=ir->fepvals->n_lambda;
96 for (i=0;i<efptNR;i++)
98 if (ir->fepvals->separate_dvdl[i])
104 if (ir->fepvals->separate_dhdl_file==esepdhdlfileYES)
106 nchars = 8 + ndhdl*8 + ndh*10; /* time data ~8 chars/entry, dH data ~10 chars/entry */
107 if (ir->expandedvals->elmcmove > elmcmoveNO)
109 nchars += 5; /* alchemical state */
112 if (ir->fepvals->bPrintEnergy)
114 nchars += 12; /* energy for dhdl */
116 cio += div_nsteps(nsteps,ir->fepvals->nstdhdl)*nchars;
120 /* dH output to ener.edr: */
121 if (ir->fepvals->dh_hist_size <= 0)
123 int ndh_tot = ndh+ndhdl;
124 if (ir->expandedvals->elmcmove > elmcmoveNO)
128 if (ir->fepvals->bPrintEnergy)
132 /* as data blocks: 1 real per dH point */
133 cio += div_nsteps(nsteps,ir->fepvals->nstdhdl)*(ndh+ndhdl)*sizeof(real);
137 /* as histograms: dh_hist_size ints per histogram */
138 cio += div_nsteps(nsteps,ir->nstenergy)*
139 sizeof(int)*ir->fepvals->dh_hist_size*ndh;
143 if (ir->pull != NULL)
145 cio += div_nsteps(nsteps,ir->pull->nstxout)*20; /* roughly 20 chars per line */
146 cio += div_nsteps(nsteps,ir->pull->nstfout)*20; /* roughly 20 chars per line */
149 return cio*nrepl/(1024*1024);