Bug Summary

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