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 | #ifdef HAVE_CONFIG_H1 |
38 | #include <config.h> |
39 | #endif |
40 | |
41 | #include <signal.h> |
42 | #include <stdlib.h> |
43 | #include "typedefs.h" |
44 | |
45 | static int div_nsteps(int nsteps, int nst) |
46 | { |
47 | if (nst > 0) |
48 | { |
49 | return (1 + nsteps + nst - 1)/nst; |
50 | } |
51 | else |
52 | { |
53 | return 0; |
54 | } |
55 | } |
56 | |
57 | double compute_io(t_inputrec *ir, int natoms, gmx_groups_t *groups, |
58 | int nrener, int nrepl) |
59 | { |
60 | |
61 | int nsteps = ir->nsteps; |
62 | int i, nxtcatoms = 0; |
63 | int nstx, nstv, nstf, nste, nstlog, nstxtc, nfep = 0; |
64 | double cio; |
65 | |
66 | nstx = div_nsteps(nsteps, ir->nstxout); |
67 | nstv = div_nsteps(nsteps, ir->nstvout); |
68 | nstf = div_nsteps(nsteps, ir->nstfout); |
69 | nstxtc = div_nsteps(nsteps, ir->nstxout_compressed); |
70 | if (ir->nstxout_compressed > 0) |
71 | { |
72 | for (i = 0; i < natoms; i++) |
73 | { |
74 | if (groups->grpnr[egcCompressedX] == NULL((void*)0) || groups->grpnr[egcCompressedX][i] == 0) |
75 | { |
76 | nxtcatoms++; |
77 | } |
78 | } |
79 | } |
80 | nstlog = div_nsteps(nsteps, ir->nstlog); |
81 | |
82 | nste = div_nsteps(2+nsteps, ir->nstenergy); |
83 | |
84 | cio = 80*natoms; |
85 | cio += (nstx+nstf+nstv)*sizeof(real)*(3.0*natoms); |
86 | cio += nstxtc*(14*4 + nxtcatoms*5.0); |
87 | cio += nstlog*(nrener*16*2.0); |
88 | |
89 | cio += (1.0*nste)*nrener*3*sizeof(real); |
90 | |
91 | if ((ir->efep != efepNO || ir->bSimTemp) && (ir->fepvals->nstdhdl > 0)) |
92 | { |
93 | int ndh = ir->fepvals->n_lambda; |
94 | int ndhdl = 0; |
95 | int nchars = 0; |
96 | |
97 | for (i = 0; i < efptNR; i++) |
98 | { |
99 | if (ir->fepvals->separate_dvdl[i]) |
100 | { |
101 | ndhdl += 1; |
102 | } |
103 | } |
104 | |
105 | if (ir->fepvals->separate_dhdl_file == esepdhdlfileYES) |
106 | { |
107 | nchars = 8 + ndhdl*8 + ndh*10; |
108 | if (ir->expandedvals->elmcmove > elmcmoveNO) |
109 | { |
110 | nchars += 5; |
111 | } |
112 | |
113 | if (ir->fepvals->bPrintEnergy) |
114 | { |
115 | nchars += 12; |
116 | } |
117 | cio += div_nsteps(nsteps, ir->fepvals->nstdhdl)*nchars; |
118 | } |
119 | else |
120 | { |
121 | |
122 | if (ir->fepvals->dh_hist_size <= 0) |
123 | { |
124 | int ndh_tot = ndh+ndhdl; |
125 | if (ir->expandedvals->elmcmove > elmcmoveNO) |
126 | { |
127 | ndh_tot += 1; |
128 | } |
129 | if (ir->fepvals->bPrintEnergy) |
130 | { |
131 | ndh_tot += 1; |
| Value stored to 'ndh_tot' is never read |
132 | } |
133 | |
134 | cio += div_nsteps(nsteps, ir->fepvals->nstdhdl)*(ndh+ndhdl)*sizeof(real); |
135 | } |
136 | else |
137 | { |
138 | |
139 | cio += div_nsteps(nsteps, ir->nstenergy)* |
140 | sizeof(int)*ir->fepvals->dh_hist_size*ndh; |
141 | } |
142 | } |
143 | } |
144 | if (ir->pull != NULL((void*)0)) |
145 | { |
146 | cio += div_nsteps(nsteps, ir->pull->nstxout)*20; |
147 | cio += div_nsteps(nsteps, ir->pull->nstfout)*20; |
148 | } |
149 | |
150 | return cio*nrepl/(1024*1024); |
151 | } |