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 | #ifdef HAVE_CONFIG_H1 |
39 | #include <config.h> |
40 | #endif |
41 | |
42 | #include <stdio.h> |
43 | #include <string.h> |
44 | #include "force.h" |
45 | #include "gromacs/utility/smalloc.h" |
46 | #include "types/commrec.h" |
47 | #include "ns.h" |
48 | #include "nrnb.h" |
49 | #include "gromacs/utility/fatalerror.h" |
50 | #include "macros.h" |
51 | #include "gromacs/utility/futil.h" |
52 | #include "names.h" |
53 | #include "domdec.h" |
54 | #include "gromacs/fileio/gmxfio.h" |
55 | |
56 | #define header"Neighborlist:" "Neighborlist:" |
57 | |
58 | static void write_nblist(FILE *out, gmx_domdec_t *dd, t_nblist *nblist, int nDNL) |
59 | { |
60 | int i, nii, ii, j, zi, zj0, zj1, aj, zj, nj; |
61 | int ca1[DD_MAXZONE8], np[DD_MAXZONE8]; |
62 | gmx_domdec_zones_t *dd_zones; |
63 | |
64 | if (nblist->nri > 0) |
| |
65 | { |
66 | fprintf(out, "ielec: %d, ivdw: %d, type: %d, Solvent opt: %s\n", |
67 | nblist->ielec, nblist->ivdw, nblist->type, |
68 | gmx_nblist_geometry_names[nblist->igeometry]); |
69 | fprintf(out, "nri: %d npair: %d\n", nblist->nri, nblist->nrj); |
70 | if (dd) |
| 8 | | Assuming 'dd' is non-null | |
|
| |
71 | { |
72 | dd_zones = domdec_zones(dd); |
73 | |
74 | for (zi = 0; zi < dd_zones->n; zi++) |
| 10 | | Loop condition is false. Execution continues on line 78 | |
|
75 | { |
76 | ca1[zi] = dd->cgindex[dd_zones->cg_range[zi+1]]; |
77 | } |
78 | i = 0; |
79 | for (zi = 0; zi < dd_zones->nizone; zi++) |
| 11 | | Loop condition is true. Entering loop body | |
|
80 | { |
81 | zj0 = dd_zones->izone[zi].j0; |
82 | zj1 = dd_zones->izone[zi].j1; |
83 | for (zj = zj0; zj < zj1; zj++) |
| 12 | | Loop condition is false. Execution continues on line 87 | |
|
84 | { |
85 | np[zj] = 0; |
86 | } |
87 | while (i < nblist->nri && nblist->iinr[i] < ca1[zi]) |
| 13 | | The right operand of '<' is a garbage value |
|
88 | { |
89 | for (j = nblist->jindex[i]; (j < nblist->jindex[i+1]); j++) |
90 | { |
91 | aj = nblist->jjnr[j]; |
92 | zj = zj0; |
93 | while (aj >= ca1[zj]) |
94 | { |
95 | zj++; |
96 | } |
97 | np[zj]++; |
98 | } |
99 | i++; |
100 | } |
101 | fprintf(out, "DD zone %d:", zi); |
102 | for (zj = zj0; zj < zj1; zj++) |
103 | { |
104 | fprintf(out, " %d %d", zj, np[zj]); |
105 | } |
106 | fprintf(out, "\n"); |
107 | } |
108 | } |
109 | if (nDNL >= 2) |
110 | { |
111 | for (i = 0; i < nblist->nri; i++) |
112 | { |
113 | nii = 1; |
114 | if (nDNL >= 3 && nblist->igeometry != GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE) |
115 | { |
116 | nii = 3; |
117 | } |
118 | nj = nblist->jindex[i+1] - nblist->jindex[i]; |
119 | fprintf(out, "i: %d shift: %d gid: %d nj: %d\n", |
120 | ddglatnr(dd, nblist->iinr[i]), |
121 | nblist->shift[i], nblist->gid[i], nj); |
122 | for (ii = 0; ii < nii; ii++) |
123 | { |
124 | for (j = nblist->jindex[i]; (j < nblist->jindex[i+1]); j++) |
125 | { |
126 | fprintf(out, " i: %5d j: %5d\n", |
127 | ddglatnr(dd, nblist->iinr[i]+ii), |
128 | ddglatnr(dd, nblist->jjnr[j])); |
129 | } |
130 | } |
131 | } |
132 | } |
133 | fflush(out); |
134 | } |
135 | } |
136 | |
137 | static void set_mat(FILE *fp, int **mat, int i0, int ni, int j0, int nj, |
138 | gmx_bool bSymm, int shift) |
139 | { |
140 | int i, j; |
141 | |
142 | for (i = i0; (i < i0+ni); i++) |
143 | { |
144 | for (j = j0; (j < j0+nj); j++) |
145 | { |
146 | if (mat[i][j] != 0) |
147 | { |
148 | fprintf(fp, "mat[%d][%d] changing from %d to %d\n", |
149 | i, j, mat[i][j], shift+1); |
150 | } |
151 | mat[i][j] = shift+1; |
152 | if (bSymm) |
153 | { |
154 | mat[j][i] = 27-shift; |
155 | } |
156 | } |
157 | } |
158 | } |
159 | |
160 | |
161 | |
162 | void dump_nblist(FILE *out, t_commrec *cr, t_forcerec *fr, int nDNL) |
163 | { |
164 | #if 0 |
165 | static FILE *fp = NULL((void*)0); |
166 | char buf[STRLEN4096]; |
167 | int n, i; |
168 | |
169 | if (fp == NULL((void*)0)) |
170 | { |
171 | if (PAR(cr)((cr)->nnodes > 1)) |
172 | { |
173 | sprintf(buf, "nlist_n%d.txt", cr->nodeid); |
174 | } |
175 | else |
176 | { |
177 | sprintf(buf, "nlist.txt"); |
178 | } |
179 | fp = gmx_fio_fopen(buf, "w"); |
180 | } |
181 | fprintf(fp, "%s\n", header"Neighborlist:"); |
182 | |
183 | for (n = 0; (n < fr->nnblists); n++) |
184 | { |
185 | for (i = 0; (i < eNL_NR); i++) |
186 | { |
187 | write_nblist(fp, cr->dd, &fr->nblists[n].nlist_sr[i], nDNL); |
188 | } |
189 | } |
190 | #endif |
191 | char buf[STRLEN4096]; |
192 | int n, i; |
193 | |
194 | fprintf(out, "%s\n", header"Neighborlist:"); |
195 | |
196 | for (n = 0; (n < fr->nnblists); n++) |
| 1 | Loop condition is true. Entering loop body | |
|
197 | { |
198 | for (i = 0; (i < eNL_NR); i++) |
| 2 | | Loop condition is true. Entering loop body | |
|
| 3 | | Loop condition is true. Entering loop body | |
|
| 4 | | Loop condition is true. Entering loop body | |
|
| 5 | | Loop condition is true. Entering loop body | |
|
199 | { |
200 | write_nblist(out, cr->dd, &fr->nblists[n].nlist_sr[i], nDNL); |
| |
201 | } |
202 | } |
203 | |
204 | } |