Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEwSh_VdwBhamSh_GeomW3W3_c.c
Location:line 755, 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_ElecEwSh_VdwBhamSh_GeomW3W3_VF_c
51 * Electrostatics interaction: Ewald
52 * VdW interaction: Buckingham
53 * Geometry: Water3-Water3
54 * Calculate force/pot: PotentialAndForce
55 */
56void
57nb_kernel_ElecEwSh_VdwBhamSh_GeomW3W3_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 int vdwjidx1;
81 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
82 int vdwjidx2;
83 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
84 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
85 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
86 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
87 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
88 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
89 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
90 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
91 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
92 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
93 real velec,felec,velecsum,facel,crf,krf,krf2;
94 real *charge;
95 int nvdwtype;
96 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
97 int *vdwtype;
98 real *vdwparam;
99 int ewitab;
100 real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace;
101 real *ewtab;
102
103 x = xx[0];
104 f = ff[0];
105
106 nri = nlist->nri;
107 iinr = nlist->iinr;
108 jindex = nlist->jindex;
109 jjnr = nlist->jjnr;
110 shiftidx = nlist->shift;
111 gid = nlist->gid;
112 shiftvec = fr->shift_vec[0];
113 fshift = fr->fshift[0];
114 facel = fr->epsfac;
115 charge = mdatoms->chargeA;
116 nvdwtype = fr->ntype;
117 vdwparam = fr->nbfp;
118 vdwtype = mdatoms->typeA;
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 = 3*nvdwtype*vdwtype[inr+0];
131
132 jq0 = charge[inr+0];
133 jq1 = charge[inr+1];
134 jq2 = charge[inr+2];
135 vdwjidx0 = 3*vdwtype[inr+0];
136 qq00 = iq0*jq0;
137 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
138 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
139 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
140 qq01 = iq0*jq1;
141 qq02 = iq0*jq2;
142 qq10 = iq1*jq0;
143 qq11 = iq1*jq1;
144 qq12 = iq1*jq2;
145 qq20 = iq2*jq0;
146 qq21 = iq2*jq1;
147 qq22 = iq2*jq2;
148
149 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
150 rcutoff = fr->rcoulomb;
151 rcutoff2 = rcutoff*rcutoff;
152
153 sh_vdw_invrcut6 = fr->ic->sh_invrc6;
154 rvdw = fr->rvdw;
155
156 outeriter = 0;
157 inneriter = 0;
158
159 /* Start outer loop over neighborlists */
160 for(iidx=0; iidx<nri; iidx++)
161 {
162 /* Load shift vector for this list */
163 i_shift_offset = DIM3*shiftidx[iidx];
164 shX = shiftvec[i_shift_offset+XX0];
165 shY = shiftvec[i_shift_offset+YY1];
166 shZ = shiftvec[i_shift_offset+ZZ2];
167
168 /* Load limits for loop over neighbors */
169 j_index_start = jindex[iidx];
170 j_index_end = jindex[iidx+1];
171
172 /* Get outer coordinate index */
173 inr = iinr[iidx];
174 i_coord_offset = DIM3*inr;
175
176 /* Load i particle coords and add shift vector */
177 ix0 = shX + x[i_coord_offset+DIM3*0+XX0];
178 iy0 = shY + x[i_coord_offset+DIM3*0+YY1];
179 iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2];
180 ix1 = shX + x[i_coord_offset+DIM3*1+XX0];
181 iy1 = shY + x[i_coord_offset+DIM3*1+YY1];
182 iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2];
183 ix2 = shX + x[i_coord_offset+DIM3*2+XX0];
184 iy2 = shY + x[i_coord_offset+DIM3*2+YY1];
185 iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2];
186
187 fix0 = 0.0;
188 fiy0 = 0.0;
189 fiz0 = 0.0;
190 fix1 = 0.0;
191 fiy1 = 0.0;
192 fiz1 = 0.0;
193 fix2 = 0.0;
194 fiy2 = 0.0;
195 fiz2 = 0.0;
196
197 /* Reset potential sums */
198 velecsum = 0.0;
199 vvdwsum = 0.0;
200
201 /* Start inner kernel loop */
202 for(jidx=j_index_start; jidx<j_index_end; jidx++)
203 {
204 /* Get j neighbor index, and coordinate index */
205 jnr = jjnr[jidx];
206 j_coord_offset = DIM3*jnr;
207
208 /* load j atom coordinates */
209 jx0 = x[j_coord_offset+DIM3*0+XX0];
210 jy0 = x[j_coord_offset+DIM3*0+YY1];
211 jz0 = x[j_coord_offset+DIM3*0+ZZ2];
212 jx1 = x[j_coord_offset+DIM3*1+XX0];
213 jy1 = x[j_coord_offset+DIM3*1+YY1];
214 jz1 = x[j_coord_offset+DIM3*1+ZZ2];
215 jx2 = x[j_coord_offset+DIM3*2+XX0];
216 jy2 = x[j_coord_offset+DIM3*2+YY1];
217 jz2 = x[j_coord_offset+DIM3*2+ZZ2];
218
219 /* Calculate displacement vector */
220 dx00 = ix0 - jx0;
221 dy00 = iy0 - jy0;
222 dz00 = iz0 - jz0;
223 dx01 = ix0 - jx1;
224 dy01 = iy0 - jy1;
225 dz01 = iz0 - jz1;
226 dx02 = ix0 - jx2;
227 dy02 = iy0 - jy2;
228 dz02 = iz0 - jz2;
229 dx10 = ix1 - jx0;
230 dy10 = iy1 - jy0;
231 dz10 = iz1 - jz0;
232 dx11 = ix1 - jx1;
233 dy11 = iy1 - jy1;
234 dz11 = iz1 - jz1;
235 dx12 = ix1 - jx2;
236 dy12 = iy1 - jy2;
237 dz12 = iz1 - jz2;
238 dx20 = ix2 - jx0;
239 dy20 = iy2 - jy0;
240 dz20 = iz2 - jz0;
241 dx21 = ix2 - jx1;
242 dy21 = iy2 - jy1;
243 dz21 = iz2 - jz1;
244 dx22 = ix2 - jx2;
245 dy22 = iy2 - jy2;
246 dz22 = iz2 - jz2;
247
248 /* Calculate squared distance and things based on it */
249 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
250 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
251 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
252 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
253 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
254 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
255 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
256 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
257 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
258
259 rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00);
260 rinv01 = gmx_invsqrt(rsq01)gmx_software_invsqrt(rsq01);
261 rinv02 = gmx_invsqrt(rsq02)gmx_software_invsqrt(rsq02);
262 rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10);
263 rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11);
264 rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12);
265 rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20);
266 rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21);
267 rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22);
268
269 rinvsq00 = rinv00*rinv00;
270 rinvsq01 = rinv01*rinv01;
271 rinvsq02 = rinv02*rinv02;
272 rinvsq10 = rinv10*rinv10;
273 rinvsq11 = rinv11*rinv11;
274 rinvsq12 = rinv12*rinv12;
275 rinvsq20 = rinv20*rinv20;
276 rinvsq21 = rinv21*rinv21;
277 rinvsq22 = rinv22*rinv22;
278
279 /**************************
280 * CALCULATE INTERACTIONS *
281 **************************/
282
283 if (rsq00<rcutoff2)
284 {
285
286 r00 = rsq00*rinv00;
287
288 /* EWALD ELECTROSTATICS */
289
290 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
291 ewrt = r00*ewtabscale;
292 ewitab = ewrt;
293 eweps = ewrt-ewitab;
294 ewitab = 4*ewitab;
295 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
296 velec = qq00*((rinv00-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
297 felec = qq00*rinv00*(rinvsq00-felec);
298
299 /* BUCKINGHAM DISPERSION/REPULSION */
300 rinvsix = rinvsq00*rinvsq00*rinvsq00;
301 vvdw6 = c6_00*rinvsix;
302 br = cexp2_00*r00;
303 vvdwexp = cexp1_00*exp(-br);
304 vvdw = (vvdwexp-cexp1_00*exp(-cexp2_00*rvdw)) - (vvdw6 - c6_00*sh_vdw_invrcut6)*(1.0/6.0);
305 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
306
307 /* Update potential sums from outer loop */
308 velecsum += velec;
309 vvdwsum += vvdw;
310
311 fscal = felec+fvdw;
312
313 /* Calculate temporary vectorial force */
314 tx = fscal*dx00;
315 ty = fscal*dy00;
316 tz = fscal*dz00;
317
318 /* Update vectorial force */
319 fix0 += tx;
320 fiy0 += ty;
321 fiz0 += tz;
322 f[j_coord_offset+DIM3*0+XX0] -= tx;
323 f[j_coord_offset+DIM3*0+YY1] -= ty;
324 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
325
326 }
327
328 /**************************
329 * CALCULATE INTERACTIONS *
330 **************************/
331
332 if (rsq01<rcutoff2)
333 {
334
335 r01 = rsq01*rinv01;
336
337 /* EWALD ELECTROSTATICS */
338
339 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
340 ewrt = r01*ewtabscale;
341 ewitab = ewrt;
342 eweps = ewrt-ewitab;
343 ewitab = 4*ewitab;
344 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
345 velec = qq01*((rinv01-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
346 felec = qq01*rinv01*(rinvsq01-felec);
347
348 /* Update potential sums from outer loop */
349 velecsum += velec;
350
351 fscal = felec;
352
353 /* Calculate temporary vectorial force */
354 tx = fscal*dx01;
355 ty = fscal*dy01;
356 tz = fscal*dz01;
357
358 /* Update vectorial force */
359 fix0 += tx;
360 fiy0 += ty;
361 fiz0 += tz;
362 f[j_coord_offset+DIM3*1+XX0] -= tx;
363 f[j_coord_offset+DIM3*1+YY1] -= ty;
364 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
365
366 }
367
368 /**************************
369 * CALCULATE INTERACTIONS *
370 **************************/
371
372 if (rsq02<rcutoff2)
373 {
374
375 r02 = rsq02*rinv02;
376
377 /* EWALD ELECTROSTATICS */
378
379 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
380 ewrt = r02*ewtabscale;
381 ewitab = ewrt;
382 eweps = ewrt-ewitab;
383 ewitab = 4*ewitab;
384 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
385 velec = qq02*((rinv02-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
386 felec = qq02*rinv02*(rinvsq02-felec);
387
388 /* Update potential sums from outer loop */
389 velecsum += velec;
390
391 fscal = felec;
392
393 /* Calculate temporary vectorial force */
394 tx = fscal*dx02;
395 ty = fscal*dy02;
396 tz = fscal*dz02;
397
398 /* Update vectorial force */
399 fix0 += tx;
400 fiy0 += ty;
401 fiz0 += tz;
402 f[j_coord_offset+DIM3*2+XX0] -= tx;
403 f[j_coord_offset+DIM3*2+YY1] -= ty;
404 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
405
406 }
407
408 /**************************
409 * CALCULATE INTERACTIONS *
410 **************************/
411
412 if (rsq10<rcutoff2)
413 {
414
415 r10 = rsq10*rinv10;
416
417 /* EWALD ELECTROSTATICS */
418
419 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
420 ewrt = r10*ewtabscale;
421 ewitab = ewrt;
422 eweps = ewrt-ewitab;
423 ewitab = 4*ewitab;
424 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
425 velec = qq10*((rinv10-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
426 felec = qq10*rinv10*(rinvsq10-felec);
427
428 /* Update potential sums from outer loop */
429 velecsum += velec;
430
431 fscal = felec;
432
433 /* Calculate temporary vectorial force */
434 tx = fscal*dx10;
435 ty = fscal*dy10;
436 tz = fscal*dz10;
437
438 /* Update vectorial force */
439 fix1 += tx;
440 fiy1 += ty;
441 fiz1 += tz;
442 f[j_coord_offset+DIM3*0+XX0] -= tx;
443 f[j_coord_offset+DIM3*0+YY1] -= ty;
444 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
445
446 }
447
448 /**************************
449 * CALCULATE INTERACTIONS *
450 **************************/
451
452 if (rsq11<rcutoff2)
453 {
454
455 r11 = rsq11*rinv11;
456
457 /* EWALD ELECTROSTATICS */
458
459 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
460 ewrt = r11*ewtabscale;
461 ewitab = ewrt;
462 eweps = ewrt-ewitab;
463 ewitab = 4*ewitab;
464 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
465 velec = qq11*((rinv11-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
466 felec = qq11*rinv11*(rinvsq11-felec);
467
468 /* Update potential sums from outer loop */
469 velecsum += velec;
470
471 fscal = felec;
472
473 /* Calculate temporary vectorial force */
474 tx = fscal*dx11;
475 ty = fscal*dy11;
476 tz = fscal*dz11;
477
478 /* Update vectorial force */
479 fix1 += tx;
480 fiy1 += ty;
481 fiz1 += tz;
482 f[j_coord_offset+DIM3*1+XX0] -= tx;
483 f[j_coord_offset+DIM3*1+YY1] -= ty;
484 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
485
486 }
487
488 /**************************
489 * CALCULATE INTERACTIONS *
490 **************************/
491
492 if (rsq12<rcutoff2)
493 {
494
495 r12 = rsq12*rinv12;
496
497 /* EWALD ELECTROSTATICS */
498
499 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
500 ewrt = r12*ewtabscale;
501 ewitab = ewrt;
502 eweps = ewrt-ewitab;
503 ewitab = 4*ewitab;
504 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
505 velec = qq12*((rinv12-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
506 felec = qq12*rinv12*(rinvsq12-felec);
507
508 /* Update potential sums from outer loop */
509 velecsum += velec;
510
511 fscal = felec;
512
513 /* Calculate temporary vectorial force */
514 tx = fscal*dx12;
515 ty = fscal*dy12;
516 tz = fscal*dz12;
517
518 /* Update vectorial force */
519 fix1 += tx;
520 fiy1 += ty;
521 fiz1 += tz;
522 f[j_coord_offset+DIM3*2+XX0] -= tx;
523 f[j_coord_offset+DIM3*2+YY1] -= ty;
524 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
525
526 }
527
528 /**************************
529 * CALCULATE INTERACTIONS *
530 **************************/
531
532 if (rsq20<rcutoff2)
533 {
534
535 r20 = rsq20*rinv20;
536
537 /* EWALD ELECTROSTATICS */
538
539 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
540 ewrt = r20*ewtabscale;
541 ewitab = ewrt;
542 eweps = ewrt-ewitab;
543 ewitab = 4*ewitab;
544 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
545 velec = qq20*((rinv20-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
546 felec = qq20*rinv20*(rinvsq20-felec);
547
548 /* Update potential sums from outer loop */
549 velecsum += velec;
550
551 fscal = felec;
552
553 /* Calculate temporary vectorial force */
554 tx = fscal*dx20;
555 ty = fscal*dy20;
556 tz = fscal*dz20;
557
558 /* Update vectorial force */
559 fix2 += tx;
560 fiy2 += ty;
561 fiz2 += tz;
562 f[j_coord_offset+DIM3*0+XX0] -= tx;
563 f[j_coord_offset+DIM3*0+YY1] -= ty;
564 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
565
566 }
567
568 /**************************
569 * CALCULATE INTERACTIONS *
570 **************************/
571
572 if (rsq21<rcutoff2)
573 {
574
575 r21 = rsq21*rinv21;
576
577 /* EWALD ELECTROSTATICS */
578
579 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
580 ewrt = r21*ewtabscale;
581 ewitab = ewrt;
582 eweps = ewrt-ewitab;
583 ewitab = 4*ewitab;
584 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
585 velec = qq21*((rinv21-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
586 felec = qq21*rinv21*(rinvsq21-felec);
587
588 /* Update potential sums from outer loop */
589 velecsum += velec;
590
591 fscal = felec;
592
593 /* Calculate temporary vectorial force */
594 tx = fscal*dx21;
595 ty = fscal*dy21;
596 tz = fscal*dz21;
597
598 /* Update vectorial force */
599 fix2 += tx;
600 fiy2 += ty;
601 fiz2 += tz;
602 f[j_coord_offset+DIM3*1+XX0] -= tx;
603 f[j_coord_offset+DIM3*1+YY1] -= ty;
604 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
605
606 }
607
608 /**************************
609 * CALCULATE INTERACTIONS *
610 **************************/
611
612 if (rsq22<rcutoff2)
613 {
614
615 r22 = rsq22*rinv22;
616
617 /* EWALD ELECTROSTATICS */
618
619 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
620 ewrt = r22*ewtabscale;
621 ewitab = ewrt;
622 eweps = ewrt-ewitab;
623 ewitab = 4*ewitab;
624 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
625 velec = qq22*((rinv22-sh_ewald)-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
626 felec = qq22*rinv22*(rinvsq22-felec);
627
628 /* Update potential sums from outer loop */
629 velecsum += velec;
630
631 fscal = felec;
632
633 /* Calculate temporary vectorial force */
634 tx = fscal*dx22;
635 ty = fscal*dy22;
636 tz = fscal*dz22;
637
638 /* Update vectorial force */
639 fix2 += tx;
640 fiy2 += ty;
641 fiz2 += tz;
642 f[j_coord_offset+DIM3*2+XX0] -= tx;
643 f[j_coord_offset+DIM3*2+YY1] -= ty;
644 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
645
646 }
647
648 /* Inner loop uses 438 flops */
649 }
650 /* End of innermost loop */
651
652 tx = ty = tz = 0;
653 f[i_coord_offset+DIM3*0+XX0] += fix0;
654 f[i_coord_offset+DIM3*0+YY1] += fiy0;
655 f[i_coord_offset+DIM3*0+ZZ2] += fiz0;
656 tx += fix0;
657 ty += fiy0;
658 tz += fiz0;
659 f[i_coord_offset+DIM3*1+XX0] += fix1;
660 f[i_coord_offset+DIM3*1+YY1] += fiy1;
661 f[i_coord_offset+DIM3*1+ZZ2] += fiz1;
662 tx += fix1;
663 ty += fiy1;
664 tz += fiz1;
665 f[i_coord_offset+DIM3*2+XX0] += fix2;
666 f[i_coord_offset+DIM3*2+YY1] += fiy2;
667 f[i_coord_offset+DIM3*2+ZZ2] += fiz2;
668 tx += fix2;
669 ty += fiy2;
670 tz += fiz2;
671 fshift[i_shift_offset+XX0] += tx;
672 fshift[i_shift_offset+YY1] += ty;
673 fshift[i_shift_offset+ZZ2] += tz;
674
675 ggid = gid[iidx];
676 /* Update potential energies */
677 kernel_data->energygrp_elec[ggid] += velecsum;
678 kernel_data->energygrp_vdw[ggid] += vvdwsum;
679
680 /* Increment number of inner iterations */
681 inneriter += j_index_end - j_index_start;
682
683 /* Outer loop uses 32 flops */
684 }
685
686 /* Increment number of outer iterations */
687 outeriter += nri;
688
689 /* Update outer/inner flops */
690
691 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*438)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3W3_VF] += outeriter*32 +
inneriter*438
;
692}
693/*
694 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwBhamSh_GeomW3W3_F_c
695 * Electrostatics interaction: Ewald
696 * VdW interaction: Buckingham
697 * Geometry: Water3-Water3
698 * Calculate force/pot: Force
699 */
700void
701nb_kernel_ElecEwSh_VdwBhamSh_GeomW3W3_F_c
702 (t_nblist * gmx_restrict__restrict nlist,
703 rvec * gmx_restrict__restrict xx,
704 rvec * gmx_restrict__restrict ff,
705 t_forcerec * gmx_restrict__restrict fr,
706 t_mdatoms * gmx_restrict__restrict mdatoms,
707 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data,
708 t_nrnb * gmx_restrict__restrict nrnb)
709{
710 int i_shift_offset,i_coord_offset,j_coord_offset;
711 int j_index_start,j_index_end;
712 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
713 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
714 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
715 real *shiftvec,*fshift,*x,*f;
716 int vdwioffset0;
717 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
718 int vdwioffset1;
719 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
720 int vdwioffset2;
721 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
722 int vdwjidx0;
723 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
724 int vdwjidx1;
725 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
726 int vdwjidx2;
727 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
728 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
729 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
730 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
731 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
732 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
733 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
734 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
735 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
736 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
737 real velec,felec,velecsum,facel,crf,krf,krf2;
738 real *charge;
739 int nvdwtype;
740 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
741 int *vdwtype;
742 real *vdwparam;
743 int ewitab;
744 real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace;
745 real *ewtab;
746
747 x = xx[0];
748 f = ff[0];
749
750 nri = nlist->nri;
751 iinr = nlist->iinr;
752 jindex = nlist->jindex;
753 jjnr = nlist->jjnr;
754 shiftidx = nlist->shift;
755 gid = nlist->gid;
Value stored to 'gid' is never read
756 shiftvec = fr->shift_vec[0];
757 fshift = fr->fshift[0];
758 facel = fr->epsfac;
759 charge = mdatoms->chargeA;
760 nvdwtype = fr->ntype;
761 vdwparam = fr->nbfp;
762 vdwtype = mdatoms->typeA;
763
764 sh_ewald = fr->ic->sh_ewald;
765 ewtab = fr->ic->tabq_coul_F;
766 ewtabscale = fr->ic->tabq_scale;
767 ewtabhalfspace = 0.5/ewtabscale;
768
769 /* Setup water-specific parameters */
770 inr = nlist->iinr[0];
771 iq0 = facel*charge[inr+0];
772 iq1 = facel*charge[inr+1];
773 iq2 = facel*charge[inr+2];
774 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
775
776 jq0 = charge[inr+0];
777 jq1 = charge[inr+1];
778 jq2 = charge[inr+2];
779 vdwjidx0 = 3*vdwtype[inr+0];
780 qq00 = iq0*jq0;
781 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
782 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
783 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
784 qq01 = iq0*jq1;
785 qq02 = iq0*jq2;
786 qq10 = iq1*jq0;
787 qq11 = iq1*jq1;
788 qq12 = iq1*jq2;
789 qq20 = iq2*jq0;
790 qq21 = iq2*jq1;
791 qq22 = iq2*jq2;
792
793 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
794 rcutoff = fr->rcoulomb;
795 rcutoff2 = rcutoff*rcutoff;
796
797 sh_vdw_invrcut6 = fr->ic->sh_invrc6;
798 rvdw = fr->rvdw;
799
800 outeriter = 0;
801 inneriter = 0;
802
803 /* Start outer loop over neighborlists */
804 for(iidx=0; iidx<nri; iidx++)
805 {
806 /* Load shift vector for this list */
807 i_shift_offset = DIM3*shiftidx[iidx];
808 shX = shiftvec[i_shift_offset+XX0];
809 shY = shiftvec[i_shift_offset+YY1];
810 shZ = shiftvec[i_shift_offset+ZZ2];
811
812 /* Load limits for loop over neighbors */
813 j_index_start = jindex[iidx];
814 j_index_end = jindex[iidx+1];
815
816 /* Get outer coordinate index */
817 inr = iinr[iidx];
818 i_coord_offset = DIM3*inr;
819
820 /* Load i particle coords and add shift vector */
821 ix0 = shX + x[i_coord_offset+DIM3*0+XX0];
822 iy0 = shY + x[i_coord_offset+DIM3*0+YY1];
823 iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2];
824 ix1 = shX + x[i_coord_offset+DIM3*1+XX0];
825 iy1 = shY + x[i_coord_offset+DIM3*1+YY1];
826 iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2];
827 ix2 = shX + x[i_coord_offset+DIM3*2+XX0];
828 iy2 = shY + x[i_coord_offset+DIM3*2+YY1];
829 iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2];
830
831 fix0 = 0.0;
832 fiy0 = 0.0;
833 fiz0 = 0.0;
834 fix1 = 0.0;
835 fiy1 = 0.0;
836 fiz1 = 0.0;
837 fix2 = 0.0;
838 fiy2 = 0.0;
839 fiz2 = 0.0;
840
841 /* Start inner kernel loop */
842 for(jidx=j_index_start; jidx<j_index_end; jidx++)
843 {
844 /* Get j neighbor index, and coordinate index */
845 jnr = jjnr[jidx];
846 j_coord_offset = DIM3*jnr;
847
848 /* load j atom coordinates */
849 jx0 = x[j_coord_offset+DIM3*0+XX0];
850 jy0 = x[j_coord_offset+DIM3*0+YY1];
851 jz0 = x[j_coord_offset+DIM3*0+ZZ2];
852 jx1 = x[j_coord_offset+DIM3*1+XX0];
853 jy1 = x[j_coord_offset+DIM3*1+YY1];
854 jz1 = x[j_coord_offset+DIM3*1+ZZ2];
855 jx2 = x[j_coord_offset+DIM3*2+XX0];
856 jy2 = x[j_coord_offset+DIM3*2+YY1];
857 jz2 = x[j_coord_offset+DIM3*2+ZZ2];
858
859 /* Calculate displacement vector */
860 dx00 = ix0 - jx0;
861 dy00 = iy0 - jy0;
862 dz00 = iz0 - jz0;
863 dx01 = ix0 - jx1;
864 dy01 = iy0 - jy1;
865 dz01 = iz0 - jz1;
866 dx02 = ix0 - jx2;
867 dy02 = iy0 - jy2;
868 dz02 = iz0 - jz2;
869 dx10 = ix1 - jx0;
870 dy10 = iy1 - jy0;
871 dz10 = iz1 - jz0;
872 dx11 = ix1 - jx1;
873 dy11 = iy1 - jy1;
874 dz11 = iz1 - jz1;
875 dx12 = ix1 - jx2;
876 dy12 = iy1 - jy2;
877 dz12 = iz1 - jz2;
878 dx20 = ix2 - jx0;
879 dy20 = iy2 - jy0;
880 dz20 = iz2 - jz0;
881 dx21 = ix2 - jx1;
882 dy21 = iy2 - jy1;
883 dz21 = iz2 - jz1;
884 dx22 = ix2 - jx2;
885 dy22 = iy2 - jy2;
886 dz22 = iz2 - jz2;
887
888 /* Calculate squared distance and things based on it */
889 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
890 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
891 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
892 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
893 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
894 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
895 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
896 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
897 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
898
899 rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00);
900 rinv01 = gmx_invsqrt(rsq01)gmx_software_invsqrt(rsq01);
901 rinv02 = gmx_invsqrt(rsq02)gmx_software_invsqrt(rsq02);
902 rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10);
903 rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11);
904 rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12);
905 rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20);
906 rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21);
907 rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22);
908
909 rinvsq00 = rinv00*rinv00;
910 rinvsq01 = rinv01*rinv01;
911 rinvsq02 = rinv02*rinv02;
912 rinvsq10 = rinv10*rinv10;
913 rinvsq11 = rinv11*rinv11;
914 rinvsq12 = rinv12*rinv12;
915 rinvsq20 = rinv20*rinv20;
916 rinvsq21 = rinv21*rinv21;
917 rinvsq22 = rinv22*rinv22;
918
919 /**************************
920 * CALCULATE INTERACTIONS *
921 **************************/
922
923 if (rsq00<rcutoff2)
924 {
925
926 r00 = rsq00*rinv00;
927
928 /* EWALD ELECTROSTATICS */
929
930 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
931 ewrt = r00*ewtabscale;
932 ewitab = ewrt;
933 eweps = ewrt-ewitab;
934 felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1];
935 felec = qq00*rinv00*(rinvsq00-felec);
936
937 /* BUCKINGHAM DISPERSION/REPULSION */
938 rinvsix = rinvsq00*rinvsq00*rinvsq00;
939 vvdw6 = c6_00*rinvsix;
940 br = cexp2_00*r00;
941 vvdwexp = cexp1_00*exp(-br);
942 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
943
944 fscal = felec+fvdw;
945
946 /* Calculate temporary vectorial force */
947 tx = fscal*dx00;
948 ty = fscal*dy00;
949 tz = fscal*dz00;
950
951 /* Update vectorial force */
952 fix0 += tx;
953 fiy0 += ty;
954 fiz0 += tz;
955 f[j_coord_offset+DIM3*0+XX0] -= tx;
956 f[j_coord_offset+DIM3*0+YY1] -= ty;
957 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
958
959 }
960
961 /**************************
962 * CALCULATE INTERACTIONS *
963 **************************/
964
965 if (rsq01<rcutoff2)
966 {
967
968 r01 = rsq01*rinv01;
969
970 /* EWALD ELECTROSTATICS */
971
972 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
973 ewrt = r01*ewtabscale;
974 ewitab = ewrt;
975 eweps = ewrt-ewitab;
976 felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1];
977 felec = qq01*rinv01*(rinvsq01-felec);
978
979 fscal = felec;
980
981 /* Calculate temporary vectorial force */
982 tx = fscal*dx01;
983 ty = fscal*dy01;
984 tz = fscal*dz01;
985
986 /* Update vectorial force */
987 fix0 += tx;
988 fiy0 += ty;
989 fiz0 += tz;
990 f[j_coord_offset+DIM3*1+XX0] -= tx;
991 f[j_coord_offset+DIM3*1+YY1] -= ty;
992 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
993
994 }
995
996 /**************************
997 * CALCULATE INTERACTIONS *
998 **************************/
999
1000 if (rsq02<rcutoff2)
1001 {
1002
1003 r02 = rsq02*rinv02;
1004
1005 /* EWALD ELECTROSTATICS */
1006
1007 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1008 ewrt = r02*ewtabscale;
1009 ewitab = ewrt;
1010 eweps = ewrt-ewitab;
1011 felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1];
1012 felec = qq02*rinv02*(rinvsq02-felec);
1013
1014 fscal = felec;
1015
1016 /* Calculate temporary vectorial force */
1017 tx = fscal*dx02;
1018 ty = fscal*dy02;
1019 tz = fscal*dz02;
1020
1021 /* Update vectorial force */
1022 fix0 += tx;
1023 fiy0 += ty;
1024 fiz0 += tz;
1025 f[j_coord_offset+DIM3*2+XX0] -= tx;
1026 f[j_coord_offset+DIM3*2+YY1] -= ty;
1027 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
1028
1029 }
1030
1031 /**************************
1032 * CALCULATE INTERACTIONS *
1033 **************************/
1034
1035 if (rsq10<rcutoff2)
1036 {
1037
1038 r10 = rsq10*rinv10;
1039
1040 /* EWALD ELECTROSTATICS */
1041
1042 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1043 ewrt = r10*ewtabscale;
1044 ewitab = ewrt;
1045 eweps = ewrt-ewitab;
1046 felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1];
1047 felec = qq10*rinv10*(rinvsq10-felec);
1048
1049 fscal = felec;
1050
1051 /* Calculate temporary vectorial force */
1052 tx = fscal*dx10;
1053 ty = fscal*dy10;
1054 tz = fscal*dz10;
1055
1056 /* Update vectorial force */
1057 fix1 += tx;
1058 fiy1 += ty;
1059 fiz1 += tz;
1060 f[j_coord_offset+DIM3*0+XX0] -= tx;
1061 f[j_coord_offset+DIM3*0+YY1] -= ty;
1062 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
1063
1064 }
1065
1066 /**************************
1067 * CALCULATE INTERACTIONS *
1068 **************************/
1069
1070 if (rsq11<rcutoff2)
1071 {
1072
1073 r11 = rsq11*rinv11;
1074
1075 /* EWALD ELECTROSTATICS */
1076
1077 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1078 ewrt = r11*ewtabscale;
1079 ewitab = ewrt;
1080 eweps = ewrt-ewitab;
1081 felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1];
1082 felec = qq11*rinv11*(rinvsq11-felec);
1083
1084 fscal = felec;
1085
1086 /* Calculate temporary vectorial force */
1087 tx = fscal*dx11;
1088 ty = fscal*dy11;
1089 tz = fscal*dz11;
1090
1091 /* Update vectorial force */
1092 fix1 += tx;
1093 fiy1 += ty;
1094 fiz1 += tz;
1095 f[j_coord_offset+DIM3*1+XX0] -= tx;
1096 f[j_coord_offset+DIM3*1+YY1] -= ty;
1097 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
1098
1099 }
1100
1101 /**************************
1102 * CALCULATE INTERACTIONS *
1103 **************************/
1104
1105 if (rsq12<rcutoff2)
1106 {
1107
1108 r12 = rsq12*rinv12;
1109
1110 /* EWALD ELECTROSTATICS */
1111
1112 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1113 ewrt = r12*ewtabscale;
1114 ewitab = ewrt;
1115 eweps = ewrt-ewitab;
1116 felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1];
1117 felec = qq12*rinv12*(rinvsq12-felec);
1118
1119 fscal = felec;
1120
1121 /* Calculate temporary vectorial force */
1122 tx = fscal*dx12;
1123 ty = fscal*dy12;
1124 tz = fscal*dz12;
1125
1126 /* Update vectorial force */
1127 fix1 += tx;
1128 fiy1 += ty;
1129 fiz1 += tz;
1130 f[j_coord_offset+DIM3*2+XX0] -= tx;
1131 f[j_coord_offset+DIM3*2+YY1] -= ty;
1132 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
1133
1134 }
1135
1136 /**************************
1137 * CALCULATE INTERACTIONS *
1138 **************************/
1139
1140 if (rsq20<rcutoff2)
1141 {
1142
1143 r20 = rsq20*rinv20;
1144
1145 /* EWALD ELECTROSTATICS */
1146
1147 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1148 ewrt = r20*ewtabscale;
1149 ewitab = ewrt;
1150 eweps = ewrt-ewitab;
1151 felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1];
1152 felec = qq20*rinv20*(rinvsq20-felec);
1153
1154 fscal = felec;
1155
1156 /* Calculate temporary vectorial force */
1157 tx = fscal*dx20;
1158 ty = fscal*dy20;
1159 tz = fscal*dz20;
1160
1161 /* Update vectorial force */
1162 fix2 += tx;
1163 fiy2 += ty;
1164 fiz2 += tz;
1165 f[j_coord_offset+DIM3*0+XX0] -= tx;
1166 f[j_coord_offset+DIM3*0+YY1] -= ty;
1167 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
1168
1169 }
1170
1171 /**************************
1172 * CALCULATE INTERACTIONS *
1173 **************************/
1174
1175 if (rsq21<rcutoff2)
1176 {
1177
1178 r21 = rsq21*rinv21;
1179
1180 /* EWALD ELECTROSTATICS */
1181
1182 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1183 ewrt = r21*ewtabscale;
1184 ewitab = ewrt;
1185 eweps = ewrt-ewitab;
1186 felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1];
1187 felec = qq21*rinv21*(rinvsq21-felec);
1188
1189 fscal = felec;
1190
1191 /* Calculate temporary vectorial force */
1192 tx = fscal*dx21;
1193 ty = fscal*dy21;
1194 tz = fscal*dz21;
1195
1196 /* Update vectorial force */
1197 fix2 += tx;
1198 fiy2 += ty;
1199 fiz2 += tz;
1200 f[j_coord_offset+DIM3*1+XX0] -= tx;
1201 f[j_coord_offset+DIM3*1+YY1] -= ty;
1202 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
1203
1204 }
1205
1206 /**************************
1207 * CALCULATE INTERACTIONS *
1208 **************************/
1209
1210 if (rsq22<rcutoff2)
1211 {
1212
1213 r22 = rsq22*rinv22;
1214
1215 /* EWALD ELECTROSTATICS */
1216
1217 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1218 ewrt = r22*ewtabscale;
1219 ewitab = ewrt;
1220 eweps = ewrt-ewitab;
1221 felec = (1.0-eweps)*ewtab[ewitab]+eweps*ewtab[ewitab+1];
1222 felec = qq22*rinv22*(rinvsq22-felec);
1223
1224 fscal = felec;
1225
1226 /* Calculate temporary vectorial force */
1227 tx = fscal*dx22;
1228 ty = fscal*dy22;
1229 tz = fscal*dz22;
1230
1231 /* Update vectorial force */
1232 fix2 += tx;
1233 fiy2 += ty;
1234 fiz2 += tz;
1235 f[j_coord_offset+DIM3*2+XX0] -= tx;
1236 f[j_coord_offset+DIM3*2+YY1] -= ty;
1237 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
1238
1239 }
1240
1241 /* Inner loop uses 332 flops */
1242 }
1243 /* End of innermost loop */
1244
1245 tx = ty = tz = 0;
1246 f[i_coord_offset+DIM3*0+XX0] += fix0;
1247 f[i_coord_offset+DIM3*0+YY1] += fiy0;
1248 f[i_coord_offset+DIM3*0+ZZ2] += fiz0;
1249 tx += fix0;
1250 ty += fiy0;
1251 tz += fiz0;
1252 f[i_coord_offset+DIM3*1+XX0] += fix1;
1253 f[i_coord_offset+DIM3*1+YY1] += fiy1;
1254 f[i_coord_offset+DIM3*1+ZZ2] += fiz1;
1255 tx += fix1;
1256 ty += fiy1;
1257 tz += fiz1;
1258 f[i_coord_offset+DIM3*2+XX0] += fix2;
1259 f[i_coord_offset+DIM3*2+YY1] += fiy2;
1260 f[i_coord_offset+DIM3*2+ZZ2] += fiz2;
1261 tx += fix2;
1262 ty += fiy2;
1263 tz += fiz2;
1264 fshift[i_shift_offset+XX0] += tx;
1265 fshift[i_shift_offset+YY1] += ty;
1266 fshift[i_shift_offset+ZZ2] += tz;
1267
1268 /* Increment number of inner iterations */
1269 inneriter += j_index_end - j_index_start;
1270
1271 /* Outer loop uses 30 flops */
1272 }
1273
1274 /* Increment number of outer iterations */
1275 outeriter += nri;
1276
1277 /* Update outer/inner flops */
1278
1279 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*332)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3W3_F] += outeriter*30 + inneriter
*332
;
1280}