Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEwSw_VdwBhamSw_GeomP1P1_c.c
Location:line 337, column 5
Description:Value stored to 'gid' is never read

Annotated Source Code

1/*
2 * This file is part of the GROMACS molecular simulation package.
3 *
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
8 *
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
13 *
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 *
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
31 *
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
34 */
35/*
36 * Note: this file was generated by the GROMACS c kernel generator.
37 */
38#ifdef HAVE_CONFIG_H1
39#include <config.h>
40#endif
41
42#include <math.h>
43
44#include "../nb_kernel.h"
45#include "types/simple.h"
46#include "gromacs/math/vec.h"
47#include "nrnb.h"
48
49/*
50 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwBhamSw_GeomP1P1_VF_c
51 * Electrostatics interaction: Ewald
52 * VdW interaction: Buckingham
53 * Geometry: Particle-Particle
54 * Calculate force/pot: PotentialAndForce
55 */
56void
57nb_kernel_ElecEwSw_VdwBhamSw_GeomP1P1_VF_c
58 (t_nblist * gmx_restrict__restrict nlist,
59 rvec * gmx_restrict__restrict xx,
60 rvec * gmx_restrict__restrict ff,
61 t_forcerec * gmx_restrict__restrict fr,
62 t_mdatoms * gmx_restrict__restrict mdatoms,
63 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data,
64 t_nrnb * gmx_restrict__restrict nrnb)
65{
66 int i_shift_offset,i_coord_offset,j_coord_offset;
67 int j_index_start,j_index_end;
68 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
69 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
70 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
71 real *shiftvec,*fshift,*x,*f;
72 int vdwioffset0;
73 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
74 int vdwjidx0;
75 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
76 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
77 real velec,felec,velecsum,facel,crf,krf,krf2;
78 real *charge;
79 int nvdwtype;
80 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
81 int *vdwtype;
82 real *vdwparam;
83 int ewitab;
84 real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace;
85 real *ewtab;
86 real rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
87
88 x = xx[0];
89 f = ff[0];
90
91 nri = nlist->nri;
92 iinr = nlist->iinr;
93 jindex = nlist->jindex;
94 jjnr = nlist->jjnr;
95 shiftidx = nlist->shift;
96 gid = nlist->gid;
97 shiftvec = fr->shift_vec[0];
98 fshift = fr->fshift[0];
99 facel = fr->epsfac;
100 charge = mdatoms->chargeA;
101 nvdwtype = fr->ntype;
102 vdwparam = fr->nbfp;
103 vdwtype = mdatoms->typeA;
104
105 sh_ewald = fr->ic->sh_ewald;
106 ewtab = fr->ic->tabq_coul_FDV0;
107 ewtabscale = fr->ic->tabq_scale;
108 ewtabhalfspace = 0.5/ewtabscale;
109
110 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
111 rcutoff = fr->rcoulomb;
112 rcutoff2 = rcutoff*rcutoff;
113
114 rswitch = fr->rcoulomb_switch;
115 /* Setup switch parameters */
116 d = rcutoff-rswitch;
117 swV3 = -10.0/(d*d*d);
118 swV4 = 15.0/(d*d*d*d);
119 swV5 = -6.0/(d*d*d*d*d);
120 swF2 = -30.0/(d*d*d);
121 swF3 = 60.0/(d*d*d*d);
122 swF4 = -30.0/(d*d*d*d*d);
123
124 outeriter = 0;
125 inneriter = 0;
126
127 /* Start outer loop over neighborlists */
128 for(iidx=0; iidx<nri; iidx++)
129 {
130 /* Load shift vector for this list */
131 i_shift_offset = DIM3*shiftidx[iidx];
132 shX = shiftvec[i_shift_offset+XX0];
133 shY = shiftvec[i_shift_offset+YY1];
134 shZ = shiftvec[i_shift_offset+ZZ2];
135
136 /* Load limits for loop over neighbors */
137 j_index_start = jindex[iidx];
138 j_index_end = jindex[iidx+1];
139
140 /* Get outer coordinate index */
141 inr = iinr[iidx];
142 i_coord_offset = DIM3*inr;
143
144 /* Load i particle coords and add shift vector */
145 ix0 = shX + x[i_coord_offset+DIM3*0+XX0];
146 iy0 = shY + x[i_coord_offset+DIM3*0+YY1];
147 iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2];
148
149 fix0 = 0.0;
150 fiy0 = 0.0;
151 fiz0 = 0.0;
152
153 /* Load parameters for i particles */
154 iq0 = facel*charge[inr+0];
155 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
156
157 /* Reset potential sums */
158 velecsum = 0.0;
159 vvdwsum = 0.0;
160
161 /* Start inner kernel loop */
162 for(jidx=j_index_start; jidx<j_index_end; jidx++)
163 {
164 /* Get j neighbor index, and coordinate index */
165 jnr = jjnr[jidx];
166 j_coord_offset = DIM3*jnr;
167
168 /* load j atom coordinates */
169 jx0 = x[j_coord_offset+DIM3*0+XX0];
170 jy0 = x[j_coord_offset+DIM3*0+YY1];
171 jz0 = x[j_coord_offset+DIM3*0+ZZ2];
172
173 /* Calculate displacement vector */
174 dx00 = ix0 - jx0;
175 dy00 = iy0 - jy0;
176 dz00 = iz0 - jz0;
177
178 /* Calculate squared distance and things based on it */
179 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
180
181 rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00);
182
183 rinvsq00 = rinv00*rinv00;
184
185 /* Load parameters for j particles */
186 jq0 = charge[jnr+0];
187 vdwjidx0 = 3*vdwtype[jnr+0];
188
189 /**************************
190 * CALCULATE INTERACTIONS *
191 **************************/
192
193 if (rsq00<rcutoff2)
194 {
195
196 r00 = rsq00*rinv00;
197
198 qq00 = iq0*jq0;
199 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
200 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
201 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
202
203 /* EWALD ELECTROSTATICS */
204
205 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
206 ewrt = r00*ewtabscale;
207 ewitab = ewrt;
208 eweps = ewrt-ewitab;
209 ewitab = 4*ewitab;
210 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
211 velec = qq00*(rinv00-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
212 felec = qq00*rinv00*(rinvsq00-felec);
213
214 /* BUCKINGHAM DISPERSION/REPULSION */
215 rinvsix = rinvsq00*rinvsq00*rinvsq00;
216 vvdw6 = c6_00*rinvsix;
217 br = cexp2_00*r00;
218 vvdwexp = cexp1_00*exp(-br);
219 vvdw = vvdwexp - vvdw6*(1.0/6.0);
220 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
221
222 d = r00-rswitch;
223 d = (d>0.0) ? d : 0.0;
224 d2 = d*d;
225 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
226
227 dsw = d2*(swF2+d*(swF3+d*swF4));
228
229 /* Evaluate switch function */
230 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
231 felec = felec*sw - rinv00*velec*dsw;
232 fvdw = fvdw*sw - rinv00*vvdw*dsw;
233 velec *= sw;
234 vvdw *= sw;
235
236 /* Update potential sums from outer loop */
237 velecsum += velec;
238 vvdwsum += vvdw;
239
240 fscal = felec+fvdw;
241
242 /* Calculate temporary vectorial force */
243 tx = fscal*dx00;
244 ty = fscal*dy00;
245 tz = fscal*dz00;
246
247 /* Update vectorial force */
248 fix0 += tx;
249 fiy0 += ty;
250 fiz0 += tz;
251 f[j_coord_offset+DIM3*0+XX0] -= tx;
252 f[j_coord_offset+DIM3*0+YY1] -= ty;
253 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
254
255 }
256
257 /* Inner loop uses 101 flops */
258 }
259 /* End of innermost loop */
260
261 tx = ty = tz = 0;
262 f[i_coord_offset+DIM3*0+XX0] += fix0;
263 f[i_coord_offset+DIM3*0+YY1] += fiy0;
264 f[i_coord_offset+DIM3*0+ZZ2] += fiz0;
265 tx += fix0;
266 ty += fiy0;
267 tz += fiz0;
268 fshift[i_shift_offset+XX0] += tx;
269 fshift[i_shift_offset+YY1] += ty;
270 fshift[i_shift_offset+ZZ2] += tz;
271
272 ggid = gid[iidx];
273 /* Update potential energies */
274 kernel_data->energygrp_elec[ggid] += velecsum;
275 kernel_data->energygrp_vdw[ggid] += vvdwsum;
276
277 /* Increment number of inner iterations */
278 inneriter += j_index_end - j_index_start;
279
280 /* Outer loop uses 15 flops */
281 }
282
283 /* Increment number of outer iterations */
284 outeriter += nri;
285
286 /* Update outer/inner flops */
287
288 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*15 + inneriter*101)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_VF] += outeriter*15 + inneriter
*101
;
289}
290/*
291 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwBhamSw_GeomP1P1_F_c
292 * Electrostatics interaction: Ewald
293 * VdW interaction: Buckingham
294 * Geometry: Particle-Particle
295 * Calculate force/pot: Force
296 */
297void
298nb_kernel_ElecEwSw_VdwBhamSw_GeomP1P1_F_c
299 (t_nblist * gmx_restrict__restrict nlist,
300 rvec * gmx_restrict__restrict xx,
301 rvec * gmx_restrict__restrict ff,
302 t_forcerec * gmx_restrict__restrict fr,
303 t_mdatoms * gmx_restrict__restrict mdatoms,
304 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data,
305 t_nrnb * gmx_restrict__restrict nrnb)
306{
307 int i_shift_offset,i_coord_offset,j_coord_offset;
308 int j_index_start,j_index_end;
309 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
310 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
311 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
312 real *shiftvec,*fshift,*x,*f;
313 int vdwioffset0;
314 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
315 int vdwjidx0;
316 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
317 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
318 real velec,felec,velecsum,facel,crf,krf,krf2;
319 real *charge;
320 int nvdwtype;
321 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
322 int *vdwtype;
323 real *vdwparam;
324 int ewitab;
325 real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace;
326 real *ewtab;
327 real rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
328
329 x = xx[0];
330 f = ff[0];
331
332 nri = nlist->nri;
333 iinr = nlist->iinr;
334 jindex = nlist->jindex;
335 jjnr = nlist->jjnr;
336 shiftidx = nlist->shift;
337 gid = nlist->gid;
Value stored to 'gid' is never read
338 shiftvec = fr->shift_vec[0];
339 fshift = fr->fshift[0];
340 facel = fr->epsfac;
341 charge = mdatoms->chargeA;
342 nvdwtype = fr->ntype;
343 vdwparam = fr->nbfp;
344 vdwtype = mdatoms->typeA;
345
346 sh_ewald = fr->ic->sh_ewald;
347 ewtab = fr->ic->tabq_coul_FDV0;
348 ewtabscale = fr->ic->tabq_scale;
349 ewtabhalfspace = 0.5/ewtabscale;
350
351 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
352 rcutoff = fr->rcoulomb;
353 rcutoff2 = rcutoff*rcutoff;
354
355 rswitch = fr->rcoulomb_switch;
356 /* Setup switch parameters */
357 d = rcutoff-rswitch;
358 swV3 = -10.0/(d*d*d);
359 swV4 = 15.0/(d*d*d*d);
360 swV5 = -6.0/(d*d*d*d*d);
361 swF2 = -30.0/(d*d*d);
362 swF3 = 60.0/(d*d*d*d);
363 swF4 = -30.0/(d*d*d*d*d);
364
365 outeriter = 0;
366 inneriter = 0;
367
368 /* Start outer loop over neighborlists */
369 for(iidx=0; iidx<nri; iidx++)
370 {
371 /* Load shift vector for this list */
372 i_shift_offset = DIM3*shiftidx[iidx];
373 shX = shiftvec[i_shift_offset+XX0];
374 shY = shiftvec[i_shift_offset+YY1];
375 shZ = shiftvec[i_shift_offset+ZZ2];
376
377 /* Load limits for loop over neighbors */
378 j_index_start = jindex[iidx];
379 j_index_end = jindex[iidx+1];
380
381 /* Get outer coordinate index */
382 inr = iinr[iidx];
383 i_coord_offset = DIM3*inr;
384
385 /* Load i particle coords and add shift vector */
386 ix0 = shX + x[i_coord_offset+DIM3*0+XX0];
387 iy0 = shY + x[i_coord_offset+DIM3*0+YY1];
388 iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2];
389
390 fix0 = 0.0;
391 fiy0 = 0.0;
392 fiz0 = 0.0;
393
394 /* Load parameters for i particles */
395 iq0 = facel*charge[inr+0];
396 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
397
398 /* Start inner kernel loop */
399 for(jidx=j_index_start; jidx<j_index_end; jidx++)
400 {
401 /* Get j neighbor index, and coordinate index */
402 jnr = jjnr[jidx];
403 j_coord_offset = DIM3*jnr;
404
405 /* load j atom coordinates */
406 jx0 = x[j_coord_offset+DIM3*0+XX0];
407 jy0 = x[j_coord_offset+DIM3*0+YY1];
408 jz0 = x[j_coord_offset+DIM3*0+ZZ2];
409
410 /* Calculate displacement vector */
411 dx00 = ix0 - jx0;
412 dy00 = iy0 - jy0;
413 dz00 = iz0 - jz0;
414
415 /* Calculate squared distance and things based on it */
416 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
417
418 rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00);
419
420 rinvsq00 = rinv00*rinv00;
421
422 /* Load parameters for j particles */
423 jq0 = charge[jnr+0];
424 vdwjidx0 = 3*vdwtype[jnr+0];
425
426 /**************************
427 * CALCULATE INTERACTIONS *
428 **************************/
429
430 if (rsq00<rcutoff2)
431 {
432
433 r00 = rsq00*rinv00;
434
435 qq00 = iq0*jq0;
436 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
437 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
438 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
439
440 /* EWALD ELECTROSTATICS */
441
442 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
443 ewrt = r00*ewtabscale;
444 ewitab = ewrt;
445 eweps = ewrt-ewitab;
446 ewitab = 4*ewitab;
447 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
448 velec = qq00*(rinv00-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
449 felec = qq00*rinv00*(rinvsq00-felec);
450
451 /* BUCKINGHAM DISPERSION/REPULSION */
452 rinvsix = rinvsq00*rinvsq00*rinvsq00;
453 vvdw6 = c6_00*rinvsix;
454 br = cexp2_00*r00;
455 vvdwexp = cexp1_00*exp(-br);
456 vvdw = vvdwexp - vvdw6*(1.0/6.0);
457 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
458
459 d = r00-rswitch;
460 d = (d>0.0) ? d : 0.0;
461 d2 = d*d;
462 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
463
464 dsw = d2*(swF2+d*(swF3+d*swF4));
465
466 /* Evaluate switch function */
467 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
468 felec = felec*sw - rinv00*velec*dsw;
469 fvdw = fvdw*sw - rinv00*vvdw*dsw;
470
471 fscal = felec+fvdw;
472
473 /* Calculate temporary vectorial force */
474 tx = fscal*dx00;
475 ty = fscal*dy00;
476 tz = fscal*dz00;
477
478 /* Update vectorial force */
479 fix0 += tx;
480 fiy0 += ty;
481 fiz0 += tz;
482 f[j_coord_offset+DIM3*0+XX0] -= tx;
483 f[j_coord_offset+DIM3*0+YY1] -= ty;
484 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
485
486 }
487
488 /* Inner loop uses 97 flops */
489 }
490 /* End of innermost loop */
491
492 tx = ty = tz = 0;
493 f[i_coord_offset+DIM3*0+XX0] += fix0;
494 f[i_coord_offset+DIM3*0+YY1] += fiy0;
495 f[i_coord_offset+DIM3*0+ZZ2] += fiz0;
496 tx += fix0;
497 ty += fiy0;
498 tz += fiz0;
499 fshift[i_shift_offset+XX0] += tx;
500 fshift[i_shift_offset+YY1] += ty;
501 fshift[i_shift_offset+ZZ2] += tz;
502
503 /* Increment number of inner iterations */
504 inneriter += j_index_end - j_index_start;
505
506 /* Outer loop uses 13 flops */
507 }
508
509 /* Increment number of outer iterations */
510 outeriter += nri;
511
512 /* Update outer/inner flops */
513
514 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*13 + inneriter*97)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_F] += outeriter*13 + inneriter
*97
;
515}