Bug Summary

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