Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_c.c
Location:line 489, 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_ElecRFCut_VdwCSTab_GeomW4P1_VF_c
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: CubicSplineTable
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
55 */
56void
57nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_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 vdwioffset1;
75 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
76 int vdwioffset2;
77 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
78 int vdwioffset3;
79 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
80 int vdwjidx0;
81 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
82 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
83 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
84 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
85 real dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30,cexp1_30,cexp2_30;
86 real velec,felec,velecsum,facel,crf,krf,krf2;
87 real *charge;
88 int nvdwtype;
89 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
90 int *vdwtype;
91 real *vdwparam;
92 int vfitab;
93 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
94 real *vftab;
95
96 x = xx[0];
97 f = ff[0];
98
99 nri = nlist->nri;
100 iinr = nlist->iinr;
101 jindex = nlist->jindex;
102 jjnr = nlist->jjnr;
103 shiftidx = nlist->shift;
104 gid = nlist->gid;
105 shiftvec = fr->shift_vec[0];
106 fshift = fr->fshift[0];
107 facel = fr->epsfac;
108 charge = mdatoms->chargeA;
109 krf = fr->ic->k_rf;
110 krf2 = krf*2.0;
111 crf = fr->ic->c_rf;
112 nvdwtype = fr->ntype;
113 vdwparam = fr->nbfp;
114 vdwtype = mdatoms->typeA;
115
116 vftab = kernel_data->table_vdw->data;
117 vftabscale = kernel_data->table_vdw->scale;
118
119 /* Setup water-specific parameters */
120 inr = nlist->iinr[0];
121 iq1 = facel*charge[inr+1];
122 iq2 = facel*charge[inr+2];
123 iq3 = facel*charge[inr+3];
124 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
125
126 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
127 rcutoff = fr->rcoulomb;
128 rcutoff2 = rcutoff*rcutoff;
129
130 outeriter = 0;
131 inneriter = 0;
132
133 /* Start outer loop over neighborlists */
134 for(iidx=0; iidx<nri; iidx++)
135 {
136 /* Load shift vector for this list */
137 i_shift_offset = DIM3*shiftidx[iidx];
138 shX = shiftvec[i_shift_offset+XX0];
139 shY = shiftvec[i_shift_offset+YY1];
140 shZ = shiftvec[i_shift_offset+ZZ2];
141
142 /* Load limits for loop over neighbors */
143 j_index_start = jindex[iidx];
144 j_index_end = jindex[iidx+1];
145
146 /* Get outer coordinate index */
147 inr = iinr[iidx];
148 i_coord_offset = DIM3*inr;
149
150 /* Load i particle coords and add shift vector */
151 ix0 = shX + x[i_coord_offset+DIM3*0+XX0];
152 iy0 = shY + x[i_coord_offset+DIM3*0+YY1];
153 iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2];
154 ix1 = shX + x[i_coord_offset+DIM3*1+XX0];
155 iy1 = shY + x[i_coord_offset+DIM3*1+YY1];
156 iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2];
157 ix2 = shX + x[i_coord_offset+DIM3*2+XX0];
158 iy2 = shY + x[i_coord_offset+DIM3*2+YY1];
159 iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2];
160 ix3 = shX + x[i_coord_offset+DIM3*3+XX0];
161 iy3 = shY + x[i_coord_offset+DIM3*3+YY1];
162 iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2];
163
164 fix0 = 0.0;
165 fiy0 = 0.0;
166 fiz0 = 0.0;
167 fix1 = 0.0;
168 fiy1 = 0.0;
169 fiz1 = 0.0;
170 fix2 = 0.0;
171 fiy2 = 0.0;
172 fiz2 = 0.0;
173 fix3 = 0.0;
174 fiy3 = 0.0;
175 fiz3 = 0.0;
176
177 /* Reset potential sums */
178 velecsum = 0.0;
179 vvdwsum = 0.0;
180
181 /* Start inner kernel loop */
182 for(jidx=j_index_start; jidx<j_index_end; jidx++)
183 {
184 /* Get j neighbor index, and coordinate index */
185 jnr = jjnr[jidx];
186 j_coord_offset = DIM3*jnr;
187
188 /* load j atom coordinates */
189 jx0 = x[j_coord_offset+DIM3*0+XX0];
190 jy0 = x[j_coord_offset+DIM3*0+YY1];
191 jz0 = x[j_coord_offset+DIM3*0+ZZ2];
192
193 /* Calculate displacement vector */
194 dx00 = ix0 - jx0;
195 dy00 = iy0 - jy0;
196 dz00 = iz0 - jz0;
197 dx10 = ix1 - jx0;
198 dy10 = iy1 - jy0;
199 dz10 = iz1 - jz0;
200 dx20 = ix2 - jx0;
201 dy20 = iy2 - jy0;
202 dz20 = iz2 - jz0;
203 dx30 = ix3 - jx0;
204 dy30 = iy3 - jy0;
205 dz30 = iz3 - jz0;
206
207 /* Calculate squared distance and things based on it */
208 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
209 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
210 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
211 rsq30 = dx30*dx30+dy30*dy30+dz30*dz30;
212
213 rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00);
214 rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10);
215 rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20);
216 rinv30 = gmx_invsqrt(rsq30)gmx_software_invsqrt(rsq30);
217
218 rinvsq10 = rinv10*rinv10;
219 rinvsq20 = rinv20*rinv20;
220 rinvsq30 = rinv30*rinv30;
221
222 /* Load parameters for j particles */
223 jq0 = charge[jnr+0];
224 vdwjidx0 = 2*vdwtype[jnr+0];
225
226 /**************************
227 * CALCULATE INTERACTIONS *
228 **************************/
229
230 r00 = rsq00*rinv00;
231
232 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
233 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
234
235 /* Calculate table index by multiplying r with table scale and truncate to integer */
236 rt = r00*vftabscale;
237 vfitab = rt;
238 vfeps = rt-vfitab;
239 vfitab = 2*4*vfitab;
240
241 /* CUBIC SPLINE TABLE DISPERSION */
242 vfitab += 0;
243 Y = vftab[vfitab];
244 F = vftab[vfitab+1];
245 Geps = vfeps*vftab[vfitab+2];
246 Heps2 = vfeps*vfeps*vftab[vfitab+3];
247 Fp = F+Geps+Heps2;
248 VV = Y+vfeps*Fp;
249 vvdw6 = c6_00*VV;
250 FF = Fp+Geps+2.0*Heps2;
251 fvdw6 = c6_00*FF;
252
253 /* CUBIC SPLINE TABLE REPULSION */
254 Y = vftab[vfitab+4];
255 F = vftab[vfitab+5];
256 Geps = vfeps*vftab[vfitab+6];
257 Heps2 = vfeps*vfeps*vftab[vfitab+7];
258 Fp = F+Geps+Heps2;
259 VV = Y+vfeps*Fp;
260 vvdw12 = c12_00*VV;
261 FF = Fp+Geps+2.0*Heps2;
262 fvdw12 = c12_00*FF;
263 vvdw = vvdw12+vvdw6;
264 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
265
266 /* Update potential sums from outer loop */
267 vvdwsum += vvdw;
268
269 fscal = fvdw;
270
271 /* Calculate temporary vectorial force */
272 tx = fscal*dx00;
273 ty = fscal*dy00;
274 tz = fscal*dz00;
275
276 /* Update vectorial force */
277 fix0 += tx;
278 fiy0 += ty;
279 fiz0 += tz;
280 f[j_coord_offset+DIM3*0+XX0] -= tx;
281 f[j_coord_offset+DIM3*0+YY1] -= ty;
282 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
283
284 /**************************
285 * CALCULATE INTERACTIONS *
286 **************************/
287
288 if (rsq10<rcutoff2)
289 {
290
291 qq10 = iq1*jq0;
292
293 /* REACTION-FIELD ELECTROSTATICS */
294 velec = qq10*(rinv10+krf*rsq10-crf);
295 felec = qq10*(rinv10*rinvsq10-krf2);
296
297 /* Update potential sums from outer loop */
298 velecsum += velec;
299
300 fscal = felec;
301
302 /* Calculate temporary vectorial force */
303 tx = fscal*dx10;
304 ty = fscal*dy10;
305 tz = fscal*dz10;
306
307 /* Update vectorial force */
308 fix1 += tx;
309 fiy1 += ty;
310 fiz1 += tz;
311 f[j_coord_offset+DIM3*0+XX0] -= tx;
312 f[j_coord_offset+DIM3*0+YY1] -= ty;
313 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
314
315 }
316
317 /**************************
318 * CALCULATE INTERACTIONS *
319 **************************/
320
321 if (rsq20<rcutoff2)
322 {
323
324 qq20 = iq2*jq0;
325
326 /* REACTION-FIELD ELECTROSTATICS */
327 velec = qq20*(rinv20+krf*rsq20-crf);
328 felec = qq20*(rinv20*rinvsq20-krf2);
329
330 /* Update potential sums from outer loop */
331 velecsum += velec;
332
333 fscal = felec;
334
335 /* Calculate temporary vectorial force */
336 tx = fscal*dx20;
337 ty = fscal*dy20;
338 tz = fscal*dz20;
339
340 /* Update vectorial force */
341 fix2 += tx;
342 fiy2 += ty;
343 fiz2 += tz;
344 f[j_coord_offset+DIM3*0+XX0] -= tx;
345 f[j_coord_offset+DIM3*0+YY1] -= ty;
346 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
347
348 }
349
350 /**************************
351 * CALCULATE INTERACTIONS *
352 **************************/
353
354 if (rsq30<rcutoff2)
355 {
356
357 qq30 = iq3*jq0;
358
359 /* REACTION-FIELD ELECTROSTATICS */
360 velec = qq30*(rinv30+krf*rsq30-crf);
361 felec = qq30*(rinv30*rinvsq30-krf2);
362
363 /* Update potential sums from outer loop */
364 velecsum += velec;
365
366 fscal = felec;
367
368 /* Calculate temporary vectorial force */
369 tx = fscal*dx30;
370 ty = fscal*dy30;
371 tz = fscal*dz30;
372
373 /* Update vectorial force */
374 fix3 += tx;
375 fiy3 += ty;
376 fiz3 += tz;
377 f[j_coord_offset+DIM3*0+XX0] -= tx;
378 f[j_coord_offset+DIM3*0+YY1] -= ty;
379 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
380
381 }
382
383 /* Inner loop uses 151 flops */
384 }
385 /* End of innermost loop */
386
387 tx = ty = tz = 0;
388 f[i_coord_offset+DIM3*0+XX0] += fix0;
389 f[i_coord_offset+DIM3*0+YY1] += fiy0;
390 f[i_coord_offset+DIM3*0+ZZ2] += fiz0;
391 tx += fix0;
392 ty += fiy0;
393 tz += fiz0;
394 f[i_coord_offset+DIM3*1+XX0] += fix1;
395 f[i_coord_offset+DIM3*1+YY1] += fiy1;
396 f[i_coord_offset+DIM3*1+ZZ2] += fiz1;
397 tx += fix1;
398 ty += fiy1;
399 tz += fiz1;
400 f[i_coord_offset+DIM3*2+XX0] += fix2;
401 f[i_coord_offset+DIM3*2+YY1] += fiy2;
402 f[i_coord_offset+DIM3*2+ZZ2] += fiz2;
403 tx += fix2;
404 ty += fiy2;
405 tz += fiz2;
406 f[i_coord_offset+DIM3*3+XX0] += fix3;
407 f[i_coord_offset+DIM3*3+YY1] += fiy3;
408 f[i_coord_offset+DIM3*3+ZZ2] += fiz3;
409 tx += fix3;
410 ty += fiy3;
411 tz += fiz3;
412 fshift[i_shift_offset+XX0] += tx;
413 fshift[i_shift_offset+YY1] += ty;
414 fshift[i_shift_offset+ZZ2] += tz;
415
416 ggid = gid[iidx];
417 /* Update potential energies */
418 kernel_data->energygrp_elec[ggid] += velecsum;
419 kernel_data->energygrp_vdw[ggid] += vvdwsum;
420
421 /* Increment number of inner iterations */
422 inneriter += j_index_end - j_index_start;
423
424 /* Outer loop uses 41 flops */
425 }
426
427 /* Increment number of outer iterations */
428 outeriter += nri;
429
430 /* Update outer/inner flops */
431
432 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*41 + inneriter*151)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4_VF] += outeriter*41 + inneriter
*151
;
433}
434/*
435 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_c
436 * Electrostatics interaction: ReactionField
437 * VdW interaction: CubicSplineTable
438 * Geometry: Water4-Particle
439 * Calculate force/pot: Force
440 */
441void
442nb_kernel_ElecRFCut_VdwCSTab_GeomW4P1_F_c
443 (t_nblist * gmx_restrict__restrict nlist,
444 rvec * gmx_restrict__restrict xx,
445 rvec * gmx_restrict__restrict ff,
446 t_forcerec * gmx_restrict__restrict fr,
447 t_mdatoms * gmx_restrict__restrict mdatoms,
448 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data,
449 t_nrnb * gmx_restrict__restrict nrnb)
450{
451 int i_shift_offset,i_coord_offset,j_coord_offset;
452 int j_index_start,j_index_end;
453 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
454 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
455 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
456 real *shiftvec,*fshift,*x,*f;
457 int vdwioffset0;
458 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
459 int vdwioffset1;
460 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
461 int vdwioffset2;
462 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
463 int vdwioffset3;
464 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
465 int vdwjidx0;
466 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
467 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
468 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
469 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
470 real dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30,cexp1_30,cexp2_30;
471 real velec,felec,velecsum,facel,crf,krf,krf2;
472 real *charge;
473 int nvdwtype;
474 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
475 int *vdwtype;
476 real *vdwparam;
477 int vfitab;
478 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
479 real *vftab;
480
481 x = xx[0];
482 f = ff[0];
483
484 nri = nlist->nri;
485 iinr = nlist->iinr;
486 jindex = nlist->jindex;
487 jjnr = nlist->jjnr;
488 shiftidx = nlist->shift;
489 gid = nlist->gid;
Value stored to 'gid' is never read
490 shiftvec = fr->shift_vec[0];
491 fshift = fr->fshift[0];
492 facel = fr->epsfac;
493 charge = mdatoms->chargeA;
494 krf = fr->ic->k_rf;
495 krf2 = krf*2.0;
496 crf = fr->ic->c_rf;
497 nvdwtype = fr->ntype;
498 vdwparam = fr->nbfp;
499 vdwtype = mdatoms->typeA;
500
501 vftab = kernel_data->table_vdw->data;
502 vftabscale = kernel_data->table_vdw->scale;
503
504 /* Setup water-specific parameters */
505 inr = nlist->iinr[0];
506 iq1 = facel*charge[inr+1];
507 iq2 = facel*charge[inr+2];
508 iq3 = facel*charge[inr+3];
509 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
510
511 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
512 rcutoff = fr->rcoulomb;
513 rcutoff2 = rcutoff*rcutoff;
514
515 outeriter = 0;
516 inneriter = 0;
517
518 /* Start outer loop over neighborlists */
519 for(iidx=0; iidx<nri; iidx++)
520 {
521 /* Load shift vector for this list */
522 i_shift_offset = DIM3*shiftidx[iidx];
523 shX = shiftvec[i_shift_offset+XX0];
524 shY = shiftvec[i_shift_offset+YY1];
525 shZ = shiftvec[i_shift_offset+ZZ2];
526
527 /* Load limits for loop over neighbors */
528 j_index_start = jindex[iidx];
529 j_index_end = jindex[iidx+1];
530
531 /* Get outer coordinate index */
532 inr = iinr[iidx];
533 i_coord_offset = DIM3*inr;
534
535 /* Load i particle coords and add shift vector */
536 ix0 = shX + x[i_coord_offset+DIM3*0+XX0];
537 iy0 = shY + x[i_coord_offset+DIM3*0+YY1];
538 iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2];
539 ix1 = shX + x[i_coord_offset+DIM3*1+XX0];
540 iy1 = shY + x[i_coord_offset+DIM3*1+YY1];
541 iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2];
542 ix2 = shX + x[i_coord_offset+DIM3*2+XX0];
543 iy2 = shY + x[i_coord_offset+DIM3*2+YY1];
544 iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2];
545 ix3 = shX + x[i_coord_offset+DIM3*3+XX0];
546 iy3 = shY + x[i_coord_offset+DIM3*3+YY1];
547 iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2];
548
549 fix0 = 0.0;
550 fiy0 = 0.0;
551 fiz0 = 0.0;
552 fix1 = 0.0;
553 fiy1 = 0.0;
554 fiz1 = 0.0;
555 fix2 = 0.0;
556 fiy2 = 0.0;
557 fiz2 = 0.0;
558 fix3 = 0.0;
559 fiy3 = 0.0;
560 fiz3 = 0.0;
561
562 /* Start inner kernel loop */
563 for(jidx=j_index_start; jidx<j_index_end; jidx++)
564 {
565 /* Get j neighbor index, and coordinate index */
566 jnr = jjnr[jidx];
567 j_coord_offset = DIM3*jnr;
568
569 /* load j atom coordinates */
570 jx0 = x[j_coord_offset+DIM3*0+XX0];
571 jy0 = x[j_coord_offset+DIM3*0+YY1];
572 jz0 = x[j_coord_offset+DIM3*0+ZZ2];
573
574 /* Calculate displacement vector */
575 dx00 = ix0 - jx0;
576 dy00 = iy0 - jy0;
577 dz00 = iz0 - jz0;
578 dx10 = ix1 - jx0;
579 dy10 = iy1 - jy0;
580 dz10 = iz1 - jz0;
581 dx20 = ix2 - jx0;
582 dy20 = iy2 - jy0;
583 dz20 = iz2 - jz0;
584 dx30 = ix3 - jx0;
585 dy30 = iy3 - jy0;
586 dz30 = iz3 - jz0;
587
588 /* Calculate squared distance and things based on it */
589 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
590 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
591 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
592 rsq30 = dx30*dx30+dy30*dy30+dz30*dz30;
593
594 rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00);
595 rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10);
596 rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20);
597 rinv30 = gmx_invsqrt(rsq30)gmx_software_invsqrt(rsq30);
598
599 rinvsq10 = rinv10*rinv10;
600 rinvsq20 = rinv20*rinv20;
601 rinvsq30 = rinv30*rinv30;
602
603 /* Load parameters for j particles */
604 jq0 = charge[jnr+0];
605 vdwjidx0 = 2*vdwtype[jnr+0];
606
607 /**************************
608 * CALCULATE INTERACTIONS *
609 **************************/
610
611 r00 = rsq00*rinv00;
612
613 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
614 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
615
616 /* Calculate table index by multiplying r with table scale and truncate to integer */
617 rt = r00*vftabscale;
618 vfitab = rt;
619 vfeps = rt-vfitab;
620 vfitab = 2*4*vfitab;
621
622 /* CUBIC SPLINE TABLE DISPERSION */
623 vfitab += 0;
624 F = vftab[vfitab+1];
625 Geps = vfeps*vftab[vfitab+2];
626 Heps2 = vfeps*vfeps*vftab[vfitab+3];
627 Fp = F+Geps+Heps2;
628 FF = Fp+Geps+2.0*Heps2;
629 fvdw6 = c6_00*FF;
630
631 /* CUBIC SPLINE TABLE REPULSION */
632 F = vftab[vfitab+5];
633 Geps = vfeps*vftab[vfitab+6];
634 Heps2 = vfeps*vfeps*vftab[vfitab+7];
635 Fp = F+Geps+Heps2;
636 FF = Fp+Geps+2.0*Heps2;
637 fvdw12 = c12_00*FF;
638 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
639
640 fscal = fvdw;
641
642 /* Calculate temporary vectorial force */
643 tx = fscal*dx00;
644 ty = fscal*dy00;
645 tz = fscal*dz00;
646
647 /* Update vectorial force */
648 fix0 += tx;
649 fiy0 += ty;
650 fiz0 += tz;
651 f[j_coord_offset+DIM3*0+XX0] -= tx;
652 f[j_coord_offset+DIM3*0+YY1] -= ty;
653 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
654
655 /**************************
656 * CALCULATE INTERACTIONS *
657 **************************/
658
659 if (rsq10<rcutoff2)
660 {
661
662 qq10 = iq1*jq0;
663
664 /* REACTION-FIELD ELECTROSTATICS */
665 felec = qq10*(rinv10*rinvsq10-krf2);
666
667 fscal = felec;
668
669 /* Calculate temporary vectorial force */
670 tx = fscal*dx10;
671 ty = fscal*dy10;
672 tz = fscal*dz10;
673
674 /* Update vectorial force */
675 fix1 += tx;
676 fiy1 += ty;
677 fiz1 += tz;
678 f[j_coord_offset+DIM3*0+XX0] -= tx;
679 f[j_coord_offset+DIM3*0+YY1] -= ty;
680 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
681
682 }
683
684 /**************************
685 * CALCULATE INTERACTIONS *
686 **************************/
687
688 if (rsq20<rcutoff2)
689 {
690
691 qq20 = iq2*jq0;
692
693 /* REACTION-FIELD ELECTROSTATICS */
694 felec = qq20*(rinv20*rinvsq20-krf2);
695
696 fscal = felec;
697
698 /* Calculate temporary vectorial force */
699 tx = fscal*dx20;
700 ty = fscal*dy20;
701 tz = fscal*dz20;
702
703 /* Update vectorial force */
704 fix2 += tx;
705 fiy2 += ty;
706 fiz2 += tz;
707 f[j_coord_offset+DIM3*0+XX0] -= tx;
708 f[j_coord_offset+DIM3*0+YY1] -= ty;
709 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
710
711 }
712
713 /**************************
714 * CALCULATE INTERACTIONS *
715 **************************/
716
717 if (rsq30<rcutoff2)
718 {
719
720 qq30 = iq3*jq0;
721
722 /* REACTION-FIELD ELECTROSTATICS */
723 felec = qq30*(rinv30*rinvsq30-krf2);
724
725 fscal = felec;
726
727 /* Calculate temporary vectorial force */
728 tx = fscal*dx30;
729 ty = fscal*dy30;
730 tz = fscal*dz30;
731
732 /* Update vectorial force */
733 fix3 += tx;
734 fiy3 += ty;
735 fiz3 += tz;
736 f[j_coord_offset+DIM3*0+XX0] -= tx;
737 f[j_coord_offset+DIM3*0+YY1] -= ty;
738 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
739
740 }
741
742 /* Inner loop uses 128 flops */
743 }
744 /* End of innermost loop */
745
746 tx = ty = tz = 0;
747 f[i_coord_offset+DIM3*0+XX0] += fix0;
748 f[i_coord_offset+DIM3*0+YY1] += fiy0;
749 f[i_coord_offset+DIM3*0+ZZ2] += fiz0;
750 tx += fix0;
751 ty += fiy0;
752 tz += fiz0;
753 f[i_coord_offset+DIM3*1+XX0] += fix1;
754 f[i_coord_offset+DIM3*1+YY1] += fiy1;
755 f[i_coord_offset+DIM3*1+ZZ2] += fiz1;
756 tx += fix1;
757 ty += fiy1;
758 tz += fiz1;
759 f[i_coord_offset+DIM3*2+XX0] += fix2;
760 f[i_coord_offset+DIM3*2+YY1] += fiy2;
761 f[i_coord_offset+DIM3*2+ZZ2] += fiz2;
762 tx += fix2;
763 ty += fiy2;
764 tz += fiz2;
765 f[i_coord_offset+DIM3*3+XX0] += fix3;
766 f[i_coord_offset+DIM3*3+YY1] += fiy3;
767 f[i_coord_offset+DIM3*3+ZZ2] += fiz3;
768 tx += fix3;
769 ty += fiy3;
770 tz += fiz3;
771 fshift[i_shift_offset+XX0] += tx;
772 fshift[i_shift_offset+YY1] += ty;
773 fshift[i_shift_offset+ZZ2] += tz;
774
775 /* Increment number of inner iterations */
776 inneriter += j_index_end - j_index_start;
777
778 /* Outer loop uses 39 flops */
779 }
780
781 /* Increment number of outer iterations */
782 outeriter += nri;
783
784 /* Update outer/inner flops */
785
786 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*39 + inneriter*128)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4_F] += outeriter*39 + inneriter
*128
;
787}