Bug Summary

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

Annotated Source Code

1/*
2 * This file is part of the GROMACS molecular simulation package.
3 *
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
8 *
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
13 *
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 *
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
31 *
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
34 */
35/*
36 * Note: this file was generated by the GROMACS c kernel generator.
37 */
38#ifdef HAVE_CONFIG_H1
39#include <config.h>
40#endif
41
42#include <math.h>
43
44#include "../nb_kernel.h"
45#include "types/simple.h"
46#include "gromacs/math/vec.h"
47#include "nrnb.h"
48
49/*
50 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwNone_GeomW3W3_VF_c
51 * Electrostatics interaction: Ewald
52 * VdW interaction: None
53 * Geometry: Water3-Water3
54 * Calculate force/pot: PotentialAndForce
55 */
56void
57nb_kernel_ElecEwSw_VdwNone_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 ewitab;
96 real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace;
97 real *ewtab;
98 real rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
99
100 x = xx[0];
101 f = ff[0];
102
103 nri = nlist->nri;
104 iinr = nlist->iinr;
105 jindex = nlist->jindex;
106 jjnr = nlist->jjnr;
107 shiftidx = nlist->shift;
108 gid = nlist->gid;
109 shiftvec = fr->shift_vec[0];
110 fshift = fr->fshift[0];
111 facel = fr->epsfac;
112 charge = mdatoms->chargeA;
113
114 sh_ewald = fr->ic->sh_ewald;
115 ewtab = fr->ic->tabq_coul_FDV0;
116 ewtabscale = fr->ic->tabq_scale;
117 ewtabhalfspace = 0.5/ewtabscale;
118
119 /* Setup water-specific parameters */
120 inr = nlist->iinr[0];
121 iq0 = facel*charge[inr+0];
122 iq1 = facel*charge[inr+1];
123 iq2 = facel*charge[inr+2];
124
125 jq0 = charge[inr+0];
126 jq1 = charge[inr+1];
127 jq2 = charge[inr+2];
128 qq00 = iq0*jq0;
129 qq01 = iq0*jq1;
130 qq02 = iq0*jq2;
131 qq10 = iq1*jq0;
132 qq11 = iq1*jq1;
133 qq12 = iq1*jq2;
134 qq20 = iq2*jq0;
135 qq21 = iq2*jq1;
136 qq22 = iq2*jq2;
137
138 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
139 rcutoff = fr->rcoulomb;
140 rcutoff2 = rcutoff*rcutoff;
141
142 rswitch = fr->rcoulomb_switch;
143 /* Setup switch parameters */
144 d = rcutoff-rswitch;
145 swV3 = -10.0/(d*d*d);
146 swV4 = 15.0/(d*d*d*d);
147 swV5 = -6.0/(d*d*d*d*d);
148 swF2 = -30.0/(d*d*d);
149 swF3 = 60.0/(d*d*d*d);
150 swF4 = -30.0/(d*d*d*d*d);
151
152 outeriter = 0;
153 inneriter = 0;
154
155 /* Start outer loop over neighborlists */
156 for(iidx=0; iidx<nri; iidx++)
157 {
158 /* Load shift vector for this list */
159 i_shift_offset = DIM3*shiftidx[iidx];
160 shX = shiftvec[i_shift_offset+XX0];
161 shY = shiftvec[i_shift_offset+YY1];
162 shZ = shiftvec[i_shift_offset+ZZ2];
163
164 /* Load limits for loop over neighbors */
165 j_index_start = jindex[iidx];
166 j_index_end = jindex[iidx+1];
167
168 /* Get outer coordinate index */
169 inr = iinr[iidx];
170 i_coord_offset = DIM3*inr;
171
172 /* Load i particle coords and add shift vector */
173 ix0 = shX + x[i_coord_offset+DIM3*0+XX0];
174 iy0 = shY + x[i_coord_offset+DIM3*0+YY1];
175 iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2];
176 ix1 = shX + x[i_coord_offset+DIM3*1+XX0];
177 iy1 = shY + x[i_coord_offset+DIM3*1+YY1];
178 iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2];
179 ix2 = shX + x[i_coord_offset+DIM3*2+XX0];
180 iy2 = shY + x[i_coord_offset+DIM3*2+YY1];
181 iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2];
182
183 fix0 = 0.0;
184 fiy0 = 0.0;
185 fiz0 = 0.0;
186 fix1 = 0.0;
187 fiy1 = 0.0;
188 fiz1 = 0.0;
189 fix2 = 0.0;
190 fiy2 = 0.0;
191 fiz2 = 0.0;
192
193 /* Reset potential sums */
194 velecsum = 0.0;
195
196 /* Start inner kernel loop */
197 for(jidx=j_index_start; jidx<j_index_end; jidx++)
198 {
199 /* Get j neighbor index, and coordinate index */
200 jnr = jjnr[jidx];
201 j_coord_offset = DIM3*jnr;
202
203 /* load j atom coordinates */
204 jx0 = x[j_coord_offset+DIM3*0+XX0];
205 jy0 = x[j_coord_offset+DIM3*0+YY1];
206 jz0 = x[j_coord_offset+DIM3*0+ZZ2];
207 jx1 = x[j_coord_offset+DIM3*1+XX0];
208 jy1 = x[j_coord_offset+DIM3*1+YY1];
209 jz1 = x[j_coord_offset+DIM3*1+ZZ2];
210 jx2 = x[j_coord_offset+DIM3*2+XX0];
211 jy2 = x[j_coord_offset+DIM3*2+YY1];
212 jz2 = x[j_coord_offset+DIM3*2+ZZ2];
213
214 /* Calculate displacement vector */
215 dx00 = ix0 - jx0;
216 dy00 = iy0 - jy0;
217 dz00 = iz0 - jz0;
218 dx01 = ix0 - jx1;
219 dy01 = iy0 - jy1;
220 dz01 = iz0 - jz1;
221 dx02 = ix0 - jx2;
222 dy02 = iy0 - jy2;
223 dz02 = iz0 - jz2;
224 dx10 = ix1 - jx0;
225 dy10 = iy1 - jy0;
226 dz10 = iz1 - jz0;
227 dx11 = ix1 - jx1;
228 dy11 = iy1 - jy1;
229 dz11 = iz1 - jz1;
230 dx12 = ix1 - jx2;
231 dy12 = iy1 - jy2;
232 dz12 = iz1 - jz2;
233 dx20 = ix2 - jx0;
234 dy20 = iy2 - jy0;
235 dz20 = iz2 - jz0;
236 dx21 = ix2 - jx1;
237 dy21 = iy2 - jy1;
238 dz21 = iz2 - jz1;
239 dx22 = ix2 - jx2;
240 dy22 = iy2 - jy2;
241 dz22 = iz2 - jz2;
242
243 /* Calculate squared distance and things based on it */
244 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
245 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
246 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
247 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
248 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
249 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
250 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
251 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
252 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
253
254 rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00);
255 rinv01 = gmx_invsqrt(rsq01)gmx_software_invsqrt(rsq01);
256 rinv02 = gmx_invsqrt(rsq02)gmx_software_invsqrt(rsq02);
257 rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10);
258 rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11);
259 rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12);
260 rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20);
261 rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21);
262 rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22);
263
264 rinvsq00 = rinv00*rinv00;
265 rinvsq01 = rinv01*rinv01;
266 rinvsq02 = rinv02*rinv02;
267 rinvsq10 = rinv10*rinv10;
268 rinvsq11 = rinv11*rinv11;
269 rinvsq12 = rinv12*rinv12;
270 rinvsq20 = rinv20*rinv20;
271 rinvsq21 = rinv21*rinv21;
272 rinvsq22 = rinv22*rinv22;
273
274 /**************************
275 * CALCULATE INTERACTIONS *
276 **************************/
277
278 if (rsq00<rcutoff2)
279 {
280
281 r00 = rsq00*rinv00;
282
283 /* EWALD ELECTROSTATICS */
284
285 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
286 ewrt = r00*ewtabscale;
287 ewitab = ewrt;
288 eweps = ewrt-ewitab;
289 ewitab = 4*ewitab;
290 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
291 velec = qq00*(rinv00-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
292 felec = qq00*rinv00*(rinvsq00-felec);
293
294 d = r00-rswitch;
295 d = (d>0.0) ? d : 0.0;
296 d2 = d*d;
297 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
298
299 dsw = d2*(swF2+d*(swF3+d*swF4));
300
301 /* Evaluate switch function */
302 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
303 felec = felec*sw - rinv00*velec*dsw;
304 velec *= sw;
305
306 /* Update potential sums from outer loop */
307 velecsum += velec;
308
309 fscal = felec;
310
311 /* Calculate temporary vectorial force */
312 tx = fscal*dx00;
313 ty = fscal*dy00;
314 tz = fscal*dz00;
315
316 /* Update vectorial force */
317 fix0 += tx;
318 fiy0 += ty;
319 fiz0 += tz;
320 f[j_coord_offset+DIM3*0+XX0] -= tx;
321 f[j_coord_offset+DIM3*0+YY1] -= ty;
322 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
323
324 }
325
326 /**************************
327 * CALCULATE INTERACTIONS *
328 **************************/
329
330 if (rsq01<rcutoff2)
331 {
332
333 r01 = rsq01*rinv01;
334
335 /* EWALD ELECTROSTATICS */
336
337 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
338 ewrt = r01*ewtabscale;
339 ewitab = ewrt;
340 eweps = ewrt-ewitab;
341 ewitab = 4*ewitab;
342 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
343 velec = qq01*(rinv01-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
344 felec = qq01*rinv01*(rinvsq01-felec);
345
346 d = r01-rswitch;
347 d = (d>0.0) ? d : 0.0;
348 d2 = d*d;
349 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
350
351 dsw = d2*(swF2+d*(swF3+d*swF4));
352
353 /* Evaluate switch function */
354 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
355 felec = felec*sw - rinv01*velec*dsw;
356 velec *= sw;
357
358 /* Update potential sums from outer loop */
359 velecsum += velec;
360
361 fscal = felec;
362
363 /* Calculate temporary vectorial force */
364 tx = fscal*dx01;
365 ty = fscal*dy01;
366 tz = fscal*dz01;
367
368 /* Update vectorial force */
369 fix0 += tx;
370 fiy0 += ty;
371 fiz0 += tz;
372 f[j_coord_offset+DIM3*1+XX0] -= tx;
373 f[j_coord_offset+DIM3*1+YY1] -= ty;
374 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
375
376 }
377
378 /**************************
379 * CALCULATE INTERACTIONS *
380 **************************/
381
382 if (rsq02<rcutoff2)
383 {
384
385 r02 = rsq02*rinv02;
386
387 /* EWALD ELECTROSTATICS */
388
389 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
390 ewrt = r02*ewtabscale;
391 ewitab = ewrt;
392 eweps = ewrt-ewitab;
393 ewitab = 4*ewitab;
394 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
395 velec = qq02*(rinv02-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
396 felec = qq02*rinv02*(rinvsq02-felec);
397
398 d = r02-rswitch;
399 d = (d>0.0) ? d : 0.0;
400 d2 = d*d;
401 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
402
403 dsw = d2*(swF2+d*(swF3+d*swF4));
404
405 /* Evaluate switch function */
406 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
407 felec = felec*sw - rinv02*velec*dsw;
408 velec *= sw;
409
410 /* Update potential sums from outer loop */
411 velecsum += velec;
412
413 fscal = felec;
414
415 /* Calculate temporary vectorial force */
416 tx = fscal*dx02;
417 ty = fscal*dy02;
418 tz = fscal*dz02;
419
420 /* Update vectorial force */
421 fix0 += tx;
422 fiy0 += ty;
423 fiz0 += tz;
424 f[j_coord_offset+DIM3*2+XX0] -= tx;
425 f[j_coord_offset+DIM3*2+YY1] -= ty;
426 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
427
428 }
429
430 /**************************
431 * CALCULATE INTERACTIONS *
432 **************************/
433
434 if (rsq10<rcutoff2)
435 {
436
437 r10 = rsq10*rinv10;
438
439 /* EWALD ELECTROSTATICS */
440
441 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
442 ewrt = r10*ewtabscale;
443 ewitab = ewrt;
444 eweps = ewrt-ewitab;
445 ewitab = 4*ewitab;
446 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
447 velec = qq10*(rinv10-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
448 felec = qq10*rinv10*(rinvsq10-felec);
449
450 d = r10-rswitch;
451 d = (d>0.0) ? d : 0.0;
452 d2 = d*d;
453 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
454
455 dsw = d2*(swF2+d*(swF3+d*swF4));
456
457 /* Evaluate switch function */
458 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
459 felec = felec*sw - rinv10*velec*dsw;
460 velec *= sw;
461
462 /* Update potential sums from outer loop */
463 velecsum += velec;
464
465 fscal = felec;
466
467 /* Calculate temporary vectorial force */
468 tx = fscal*dx10;
469 ty = fscal*dy10;
470 tz = fscal*dz10;
471
472 /* Update vectorial force */
473 fix1 += tx;
474 fiy1 += ty;
475 fiz1 += tz;
476 f[j_coord_offset+DIM3*0+XX0] -= tx;
477 f[j_coord_offset+DIM3*0+YY1] -= ty;
478 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
479
480 }
481
482 /**************************
483 * CALCULATE INTERACTIONS *
484 **************************/
485
486 if (rsq11<rcutoff2)
487 {
488
489 r11 = rsq11*rinv11;
490
491 /* EWALD ELECTROSTATICS */
492
493 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
494 ewrt = r11*ewtabscale;
495 ewitab = ewrt;
496 eweps = ewrt-ewitab;
497 ewitab = 4*ewitab;
498 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
499 velec = qq11*(rinv11-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
500 felec = qq11*rinv11*(rinvsq11-felec);
501
502 d = r11-rswitch;
503 d = (d>0.0) ? d : 0.0;
504 d2 = d*d;
505 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
506
507 dsw = d2*(swF2+d*(swF3+d*swF4));
508
509 /* Evaluate switch function */
510 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
511 felec = felec*sw - rinv11*velec*dsw;
512 velec *= sw;
513
514 /* Update potential sums from outer loop */
515 velecsum += velec;
516
517 fscal = felec;
518
519 /* Calculate temporary vectorial force */
520 tx = fscal*dx11;
521 ty = fscal*dy11;
522 tz = fscal*dz11;
523
524 /* Update vectorial force */
525 fix1 += tx;
526 fiy1 += ty;
527 fiz1 += tz;
528 f[j_coord_offset+DIM3*1+XX0] -= tx;
529 f[j_coord_offset+DIM3*1+YY1] -= ty;
530 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
531
532 }
533
534 /**************************
535 * CALCULATE INTERACTIONS *
536 **************************/
537
538 if (rsq12<rcutoff2)
539 {
540
541 r12 = rsq12*rinv12;
542
543 /* EWALD ELECTROSTATICS */
544
545 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
546 ewrt = r12*ewtabscale;
547 ewitab = ewrt;
548 eweps = ewrt-ewitab;
549 ewitab = 4*ewitab;
550 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
551 velec = qq12*(rinv12-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
552 felec = qq12*rinv12*(rinvsq12-felec);
553
554 d = r12-rswitch;
555 d = (d>0.0) ? d : 0.0;
556 d2 = d*d;
557 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
558
559 dsw = d2*(swF2+d*(swF3+d*swF4));
560
561 /* Evaluate switch function */
562 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
563 felec = felec*sw - rinv12*velec*dsw;
564 velec *= sw;
565
566 /* Update potential sums from outer loop */
567 velecsum += velec;
568
569 fscal = felec;
570
571 /* Calculate temporary vectorial force */
572 tx = fscal*dx12;
573 ty = fscal*dy12;
574 tz = fscal*dz12;
575
576 /* Update vectorial force */
577 fix1 += tx;
578 fiy1 += ty;
579 fiz1 += tz;
580 f[j_coord_offset+DIM3*2+XX0] -= tx;
581 f[j_coord_offset+DIM3*2+YY1] -= ty;
582 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
583
584 }
585
586 /**************************
587 * CALCULATE INTERACTIONS *
588 **************************/
589
590 if (rsq20<rcutoff2)
591 {
592
593 r20 = rsq20*rinv20;
594
595 /* EWALD ELECTROSTATICS */
596
597 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
598 ewrt = r20*ewtabscale;
599 ewitab = ewrt;
600 eweps = ewrt-ewitab;
601 ewitab = 4*ewitab;
602 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
603 velec = qq20*(rinv20-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
604 felec = qq20*rinv20*(rinvsq20-felec);
605
606 d = r20-rswitch;
607 d = (d>0.0) ? d : 0.0;
608 d2 = d*d;
609 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
610
611 dsw = d2*(swF2+d*(swF3+d*swF4));
612
613 /* Evaluate switch function */
614 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
615 felec = felec*sw - rinv20*velec*dsw;
616 velec *= sw;
617
618 /* Update potential sums from outer loop */
619 velecsum += velec;
620
621 fscal = felec;
622
623 /* Calculate temporary vectorial force */
624 tx = fscal*dx20;
625 ty = fscal*dy20;
626 tz = fscal*dz20;
627
628 /* Update vectorial force */
629 fix2 += tx;
630 fiy2 += ty;
631 fiz2 += tz;
632 f[j_coord_offset+DIM3*0+XX0] -= tx;
633 f[j_coord_offset+DIM3*0+YY1] -= ty;
634 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
635
636 }
637
638 /**************************
639 * CALCULATE INTERACTIONS *
640 **************************/
641
642 if (rsq21<rcutoff2)
643 {
644
645 r21 = rsq21*rinv21;
646
647 /* EWALD ELECTROSTATICS */
648
649 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
650 ewrt = r21*ewtabscale;
651 ewitab = ewrt;
652 eweps = ewrt-ewitab;
653 ewitab = 4*ewitab;
654 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
655 velec = qq21*(rinv21-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
656 felec = qq21*rinv21*(rinvsq21-felec);
657
658 d = r21-rswitch;
659 d = (d>0.0) ? d : 0.0;
660 d2 = d*d;
661 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
662
663 dsw = d2*(swF2+d*(swF3+d*swF4));
664
665 /* Evaluate switch function */
666 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
667 felec = felec*sw - rinv21*velec*dsw;
668 velec *= sw;
669
670 /* Update potential sums from outer loop */
671 velecsum += velec;
672
673 fscal = felec;
674
675 /* Calculate temporary vectorial force */
676 tx = fscal*dx21;
677 ty = fscal*dy21;
678 tz = fscal*dz21;
679
680 /* Update vectorial force */
681 fix2 += tx;
682 fiy2 += ty;
683 fiz2 += tz;
684 f[j_coord_offset+DIM3*1+XX0] -= tx;
685 f[j_coord_offset+DIM3*1+YY1] -= ty;
686 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
687
688 }
689
690 /**************************
691 * CALCULATE INTERACTIONS *
692 **************************/
693
694 if (rsq22<rcutoff2)
695 {
696
697 r22 = rsq22*rinv22;
698
699 /* EWALD ELECTROSTATICS */
700
701 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
702 ewrt = r22*ewtabscale;
703 ewitab = ewrt;
704 eweps = ewrt-ewitab;
705 ewitab = 4*ewitab;
706 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
707 velec = qq22*(rinv22-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
708 felec = qq22*rinv22*(rinvsq22-felec);
709
710 d = r22-rswitch;
711 d = (d>0.0) ? d : 0.0;
712 d2 = d*d;
713 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
714
715 dsw = d2*(swF2+d*(swF3+d*swF4));
716
717 /* Evaluate switch function */
718 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
719 felec = felec*sw - rinv22*velec*dsw;
720 velec *= sw;
721
722 /* Update potential sums from outer loop */
723 velecsum += velec;
724
725 fscal = felec;
726
727 /* Calculate temporary vectorial force */
728 tx = fscal*dx22;
729 ty = fscal*dy22;
730 tz = fscal*dz22;
731
732 /* Update vectorial force */
733 fix2 += tx;
734 fiy2 += ty;
735 fiz2 += tz;
736 f[j_coord_offset+DIM3*2+XX0] -= tx;
737 f[j_coord_offset+DIM3*2+YY1] -= ty;
738 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
739
740 }
741
742 /* Inner loop uses 522 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 fshift[i_shift_offset+XX0] += tx;
766 fshift[i_shift_offset+YY1] += ty;
767 fshift[i_shift_offset+ZZ2] += tz;
768
769 ggid = gid[iidx];
770 /* Update potential energies */
771 kernel_data->energygrp_elec[ggid] += velecsum;
772
773 /* Increment number of inner iterations */
774 inneriter += j_index_end - j_index_start;
775
776 /* Outer loop uses 31 flops */
777 }
778
779 /* Increment number of outer iterations */
780 outeriter += nri;
781
782 /* Update outer/inner flops */
783
784 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_VF,outeriter*31 + inneriter*522)(nrnb)->n[eNR_NBKERNEL_ELEC_W3W3_VF] += outeriter*31 + inneriter
*522
;
785}
786/*
787 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwNone_GeomW3W3_F_c
788 * Electrostatics interaction: Ewald
789 * VdW interaction: None
790 * Geometry: Water3-Water3
791 * Calculate force/pot: Force
792 */
793void
794nb_kernel_ElecEwSw_VdwNone_GeomW3W3_F_c
795 (t_nblist * gmx_restrict__restrict nlist,
796 rvec * gmx_restrict__restrict xx,
797 rvec * gmx_restrict__restrict ff,
798 t_forcerec * gmx_restrict__restrict fr,
799 t_mdatoms * gmx_restrict__restrict mdatoms,
800 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict__restrict kernel_data,
801 t_nrnb * gmx_restrict__restrict nrnb)
802{
803 int i_shift_offset,i_coord_offset,j_coord_offset;
804 int j_index_start,j_index_end;
805 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
806 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
807 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
808 real *shiftvec,*fshift,*x,*f;
809 int vdwioffset0;
810 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
811 int vdwioffset1;
812 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
813 int vdwioffset2;
814 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
815 int vdwjidx0;
816 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
817 int vdwjidx1;
818 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
819 int vdwjidx2;
820 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
821 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
822 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
823 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
824 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
825 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
826 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
827 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
828 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
829 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
830 real velec,felec,velecsum,facel,crf,krf,krf2;
831 real *charge;
832 int ewitab;
833 real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace;
834 real *ewtab;
835 real rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
836
837 x = xx[0];
838 f = ff[0];
839
840 nri = nlist->nri;
841 iinr = nlist->iinr;
842 jindex = nlist->jindex;
843 jjnr = nlist->jjnr;
844 shiftidx = nlist->shift;
845 gid = nlist->gid;
Value stored to 'gid' is never read
846 shiftvec = fr->shift_vec[0];
847 fshift = fr->fshift[0];
848 facel = fr->epsfac;
849 charge = mdatoms->chargeA;
850
851 sh_ewald = fr->ic->sh_ewald;
852 ewtab = fr->ic->tabq_coul_FDV0;
853 ewtabscale = fr->ic->tabq_scale;
854 ewtabhalfspace = 0.5/ewtabscale;
855
856 /* Setup water-specific parameters */
857 inr = nlist->iinr[0];
858 iq0 = facel*charge[inr+0];
859 iq1 = facel*charge[inr+1];
860 iq2 = facel*charge[inr+2];
861
862 jq0 = charge[inr+0];
863 jq1 = charge[inr+1];
864 jq2 = charge[inr+2];
865 qq00 = iq0*jq0;
866 qq01 = iq0*jq1;
867 qq02 = iq0*jq2;
868 qq10 = iq1*jq0;
869 qq11 = iq1*jq1;
870 qq12 = iq1*jq2;
871 qq20 = iq2*jq0;
872 qq21 = iq2*jq1;
873 qq22 = iq2*jq2;
874
875 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
876 rcutoff = fr->rcoulomb;
877 rcutoff2 = rcutoff*rcutoff;
878
879 rswitch = fr->rcoulomb_switch;
880 /* Setup switch parameters */
881 d = rcutoff-rswitch;
882 swV3 = -10.0/(d*d*d);
883 swV4 = 15.0/(d*d*d*d);
884 swV5 = -6.0/(d*d*d*d*d);
885 swF2 = -30.0/(d*d*d);
886 swF3 = 60.0/(d*d*d*d);
887 swF4 = -30.0/(d*d*d*d*d);
888
889 outeriter = 0;
890 inneriter = 0;
891
892 /* Start outer loop over neighborlists */
893 for(iidx=0; iidx<nri; iidx++)
894 {
895 /* Load shift vector for this list */
896 i_shift_offset = DIM3*shiftidx[iidx];
897 shX = shiftvec[i_shift_offset+XX0];
898 shY = shiftvec[i_shift_offset+YY1];
899 shZ = shiftvec[i_shift_offset+ZZ2];
900
901 /* Load limits for loop over neighbors */
902 j_index_start = jindex[iidx];
903 j_index_end = jindex[iidx+1];
904
905 /* Get outer coordinate index */
906 inr = iinr[iidx];
907 i_coord_offset = DIM3*inr;
908
909 /* Load i particle coords and add shift vector */
910 ix0 = shX + x[i_coord_offset+DIM3*0+XX0];
911 iy0 = shY + x[i_coord_offset+DIM3*0+YY1];
912 iz0 = shZ + x[i_coord_offset+DIM3*0+ZZ2];
913 ix1 = shX + x[i_coord_offset+DIM3*1+XX0];
914 iy1 = shY + x[i_coord_offset+DIM3*1+YY1];
915 iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2];
916 ix2 = shX + x[i_coord_offset+DIM3*2+XX0];
917 iy2 = shY + x[i_coord_offset+DIM3*2+YY1];
918 iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2];
919
920 fix0 = 0.0;
921 fiy0 = 0.0;
922 fiz0 = 0.0;
923 fix1 = 0.0;
924 fiy1 = 0.0;
925 fiz1 = 0.0;
926 fix2 = 0.0;
927 fiy2 = 0.0;
928 fiz2 = 0.0;
929
930 /* Start inner kernel loop */
931 for(jidx=j_index_start; jidx<j_index_end; jidx++)
932 {
933 /* Get j neighbor index, and coordinate index */
934 jnr = jjnr[jidx];
935 j_coord_offset = DIM3*jnr;
936
937 /* load j atom coordinates */
938 jx0 = x[j_coord_offset+DIM3*0+XX0];
939 jy0 = x[j_coord_offset+DIM3*0+YY1];
940 jz0 = x[j_coord_offset+DIM3*0+ZZ2];
941 jx1 = x[j_coord_offset+DIM3*1+XX0];
942 jy1 = x[j_coord_offset+DIM3*1+YY1];
943 jz1 = x[j_coord_offset+DIM3*1+ZZ2];
944 jx2 = x[j_coord_offset+DIM3*2+XX0];
945 jy2 = x[j_coord_offset+DIM3*2+YY1];
946 jz2 = x[j_coord_offset+DIM3*2+ZZ2];
947
948 /* Calculate displacement vector */
949 dx00 = ix0 - jx0;
950 dy00 = iy0 - jy0;
951 dz00 = iz0 - jz0;
952 dx01 = ix0 - jx1;
953 dy01 = iy0 - jy1;
954 dz01 = iz0 - jz1;
955 dx02 = ix0 - jx2;
956 dy02 = iy0 - jy2;
957 dz02 = iz0 - jz2;
958 dx10 = ix1 - jx0;
959 dy10 = iy1 - jy0;
960 dz10 = iz1 - jz0;
961 dx11 = ix1 - jx1;
962 dy11 = iy1 - jy1;
963 dz11 = iz1 - jz1;
964 dx12 = ix1 - jx2;
965 dy12 = iy1 - jy2;
966 dz12 = iz1 - jz2;
967 dx20 = ix2 - jx0;
968 dy20 = iy2 - jy0;
969 dz20 = iz2 - jz0;
970 dx21 = ix2 - jx1;
971 dy21 = iy2 - jy1;
972 dz21 = iz2 - jz1;
973 dx22 = ix2 - jx2;
974 dy22 = iy2 - jy2;
975 dz22 = iz2 - jz2;
976
977 /* Calculate squared distance and things based on it */
978 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
979 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
980 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
981 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
982 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
983 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
984 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
985 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
986 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
987
988 rinv00 = gmx_invsqrt(rsq00)gmx_software_invsqrt(rsq00);
989 rinv01 = gmx_invsqrt(rsq01)gmx_software_invsqrt(rsq01);
990 rinv02 = gmx_invsqrt(rsq02)gmx_software_invsqrt(rsq02);
991 rinv10 = gmx_invsqrt(rsq10)gmx_software_invsqrt(rsq10);
992 rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11);
993 rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12);
994 rinv20 = gmx_invsqrt(rsq20)gmx_software_invsqrt(rsq20);
995 rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21);
996 rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22);
997
998 rinvsq00 = rinv00*rinv00;
999 rinvsq01 = rinv01*rinv01;
1000 rinvsq02 = rinv02*rinv02;
1001 rinvsq10 = rinv10*rinv10;
1002 rinvsq11 = rinv11*rinv11;
1003 rinvsq12 = rinv12*rinv12;
1004 rinvsq20 = rinv20*rinv20;
1005 rinvsq21 = rinv21*rinv21;
1006 rinvsq22 = rinv22*rinv22;
1007
1008 /**************************
1009 * CALCULATE INTERACTIONS *
1010 **************************/
1011
1012 if (rsq00<rcutoff2)
1013 {
1014
1015 r00 = rsq00*rinv00;
1016
1017 /* EWALD ELECTROSTATICS */
1018
1019 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1020 ewrt = r00*ewtabscale;
1021 ewitab = ewrt;
1022 eweps = ewrt-ewitab;
1023 ewitab = 4*ewitab;
1024 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1025 velec = qq00*(rinv00-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1026 felec = qq00*rinv00*(rinvsq00-felec);
1027
1028 d = r00-rswitch;
1029 d = (d>0.0) ? d : 0.0;
1030 d2 = d*d;
1031 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
1032
1033 dsw = d2*(swF2+d*(swF3+d*swF4));
1034
1035 /* Evaluate switch function */
1036 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1037 felec = felec*sw - rinv00*velec*dsw;
1038
1039 fscal = felec;
1040
1041 /* Calculate temporary vectorial force */
1042 tx = fscal*dx00;
1043 ty = fscal*dy00;
1044 tz = fscal*dz00;
1045
1046 /* Update vectorial force */
1047 fix0 += tx;
1048 fiy0 += ty;
1049 fiz0 += tz;
1050 f[j_coord_offset+DIM3*0+XX0] -= tx;
1051 f[j_coord_offset+DIM3*0+YY1] -= ty;
1052 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
1053
1054 }
1055
1056 /**************************
1057 * CALCULATE INTERACTIONS *
1058 **************************/
1059
1060 if (rsq01<rcutoff2)
1061 {
1062
1063 r01 = rsq01*rinv01;
1064
1065 /* EWALD ELECTROSTATICS */
1066
1067 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1068 ewrt = r01*ewtabscale;
1069 ewitab = ewrt;
1070 eweps = ewrt-ewitab;
1071 ewitab = 4*ewitab;
1072 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1073 velec = qq01*(rinv01-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1074 felec = qq01*rinv01*(rinvsq01-felec);
1075
1076 d = r01-rswitch;
1077 d = (d>0.0) ? d : 0.0;
1078 d2 = d*d;
1079 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
1080
1081 dsw = d2*(swF2+d*(swF3+d*swF4));
1082
1083 /* Evaluate switch function */
1084 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1085 felec = felec*sw - rinv01*velec*dsw;
1086
1087 fscal = felec;
1088
1089 /* Calculate temporary vectorial force */
1090 tx = fscal*dx01;
1091 ty = fscal*dy01;
1092 tz = fscal*dz01;
1093
1094 /* Update vectorial force */
1095 fix0 += tx;
1096 fiy0 += ty;
1097 fiz0 += tz;
1098 f[j_coord_offset+DIM3*1+XX0] -= tx;
1099 f[j_coord_offset+DIM3*1+YY1] -= ty;
1100 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
1101
1102 }
1103
1104 /**************************
1105 * CALCULATE INTERACTIONS *
1106 **************************/
1107
1108 if (rsq02<rcutoff2)
1109 {
1110
1111 r02 = rsq02*rinv02;
1112
1113 /* EWALD ELECTROSTATICS */
1114
1115 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1116 ewrt = r02*ewtabscale;
1117 ewitab = ewrt;
1118 eweps = ewrt-ewitab;
1119 ewitab = 4*ewitab;
1120 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1121 velec = qq02*(rinv02-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1122 felec = qq02*rinv02*(rinvsq02-felec);
1123
1124 d = r02-rswitch;
1125 d = (d>0.0) ? d : 0.0;
1126 d2 = d*d;
1127 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
1128
1129 dsw = d2*(swF2+d*(swF3+d*swF4));
1130
1131 /* Evaluate switch function */
1132 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1133 felec = felec*sw - rinv02*velec*dsw;
1134
1135 fscal = felec;
1136
1137 /* Calculate temporary vectorial force */
1138 tx = fscal*dx02;
1139 ty = fscal*dy02;
1140 tz = fscal*dz02;
1141
1142 /* Update vectorial force */
1143 fix0 += tx;
1144 fiy0 += ty;
1145 fiz0 += tz;
1146 f[j_coord_offset+DIM3*2+XX0] -= tx;
1147 f[j_coord_offset+DIM3*2+YY1] -= ty;
1148 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
1149
1150 }
1151
1152 /**************************
1153 * CALCULATE INTERACTIONS *
1154 **************************/
1155
1156 if (rsq10<rcutoff2)
1157 {
1158
1159 r10 = rsq10*rinv10;
1160
1161 /* EWALD ELECTROSTATICS */
1162
1163 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1164 ewrt = r10*ewtabscale;
1165 ewitab = ewrt;
1166 eweps = ewrt-ewitab;
1167 ewitab = 4*ewitab;
1168 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1169 velec = qq10*(rinv10-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1170 felec = qq10*rinv10*(rinvsq10-felec);
1171
1172 d = r10-rswitch;
1173 d = (d>0.0) ? d : 0.0;
1174 d2 = d*d;
1175 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
1176
1177 dsw = d2*(swF2+d*(swF3+d*swF4));
1178
1179 /* Evaluate switch function */
1180 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1181 felec = felec*sw - rinv10*velec*dsw;
1182
1183 fscal = felec;
1184
1185 /* Calculate temporary vectorial force */
1186 tx = fscal*dx10;
1187 ty = fscal*dy10;
1188 tz = fscal*dz10;
1189
1190 /* Update vectorial force */
1191 fix1 += tx;
1192 fiy1 += ty;
1193 fiz1 += tz;
1194 f[j_coord_offset+DIM3*0+XX0] -= tx;
1195 f[j_coord_offset+DIM3*0+YY1] -= ty;
1196 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
1197
1198 }
1199
1200 /**************************
1201 * CALCULATE INTERACTIONS *
1202 **************************/
1203
1204 if (rsq11<rcutoff2)
1205 {
1206
1207 r11 = rsq11*rinv11;
1208
1209 /* EWALD ELECTROSTATICS */
1210
1211 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1212 ewrt = r11*ewtabscale;
1213 ewitab = ewrt;
1214 eweps = ewrt-ewitab;
1215 ewitab = 4*ewitab;
1216 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1217 velec = qq11*(rinv11-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1218 felec = qq11*rinv11*(rinvsq11-felec);
1219
1220 d = r11-rswitch;
1221 d = (d>0.0) ? d : 0.0;
1222 d2 = d*d;
1223 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
1224
1225 dsw = d2*(swF2+d*(swF3+d*swF4));
1226
1227 /* Evaluate switch function */
1228 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1229 felec = felec*sw - rinv11*velec*dsw;
1230
1231 fscal = felec;
1232
1233 /* Calculate temporary vectorial force */
1234 tx = fscal*dx11;
1235 ty = fscal*dy11;
1236 tz = fscal*dz11;
1237
1238 /* Update vectorial force */
1239 fix1 += tx;
1240 fiy1 += ty;
1241 fiz1 += tz;
1242 f[j_coord_offset+DIM3*1+XX0] -= tx;
1243 f[j_coord_offset+DIM3*1+YY1] -= ty;
1244 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
1245
1246 }
1247
1248 /**************************
1249 * CALCULATE INTERACTIONS *
1250 **************************/
1251
1252 if (rsq12<rcutoff2)
1253 {
1254
1255 r12 = rsq12*rinv12;
1256
1257 /* EWALD ELECTROSTATICS */
1258
1259 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1260 ewrt = r12*ewtabscale;
1261 ewitab = ewrt;
1262 eweps = ewrt-ewitab;
1263 ewitab = 4*ewitab;
1264 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1265 velec = qq12*(rinv12-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1266 felec = qq12*rinv12*(rinvsq12-felec);
1267
1268 d = r12-rswitch;
1269 d = (d>0.0) ? d : 0.0;
1270 d2 = d*d;
1271 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
1272
1273 dsw = d2*(swF2+d*(swF3+d*swF4));
1274
1275 /* Evaluate switch function */
1276 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1277 felec = felec*sw - rinv12*velec*dsw;
1278
1279 fscal = felec;
1280
1281 /* Calculate temporary vectorial force */
1282 tx = fscal*dx12;
1283 ty = fscal*dy12;
1284 tz = fscal*dz12;
1285
1286 /* Update vectorial force */
1287 fix1 += tx;
1288 fiy1 += ty;
1289 fiz1 += tz;
1290 f[j_coord_offset+DIM3*2+XX0] -= tx;
1291 f[j_coord_offset+DIM3*2+YY1] -= ty;
1292 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
1293
1294 }
1295
1296 /**************************
1297 * CALCULATE INTERACTIONS *
1298 **************************/
1299
1300 if (rsq20<rcutoff2)
1301 {
1302
1303 r20 = rsq20*rinv20;
1304
1305 /* EWALD ELECTROSTATICS */
1306
1307 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1308 ewrt = r20*ewtabscale;
1309 ewitab = ewrt;
1310 eweps = ewrt-ewitab;
1311 ewitab = 4*ewitab;
1312 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1313 velec = qq20*(rinv20-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1314 felec = qq20*rinv20*(rinvsq20-felec);
1315
1316 d = r20-rswitch;
1317 d = (d>0.0) ? d : 0.0;
1318 d2 = d*d;
1319 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
1320
1321 dsw = d2*(swF2+d*(swF3+d*swF4));
1322
1323 /* Evaluate switch function */
1324 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1325 felec = felec*sw - rinv20*velec*dsw;
1326
1327 fscal = felec;
1328
1329 /* Calculate temporary vectorial force */
1330 tx = fscal*dx20;
1331 ty = fscal*dy20;
1332 tz = fscal*dz20;
1333
1334 /* Update vectorial force */
1335 fix2 += tx;
1336 fiy2 += ty;
1337 fiz2 += tz;
1338 f[j_coord_offset+DIM3*0+XX0] -= tx;
1339 f[j_coord_offset+DIM3*0+YY1] -= ty;
1340 f[j_coord_offset+DIM3*0+ZZ2] -= tz;
1341
1342 }
1343
1344 /**************************
1345 * CALCULATE INTERACTIONS *
1346 **************************/
1347
1348 if (rsq21<rcutoff2)
1349 {
1350
1351 r21 = rsq21*rinv21;
1352
1353 /* EWALD ELECTROSTATICS */
1354
1355 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1356 ewrt = r21*ewtabscale;
1357 ewitab = ewrt;
1358 eweps = ewrt-ewitab;
1359 ewitab = 4*ewitab;
1360 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1361 velec = qq21*(rinv21-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1362 felec = qq21*rinv21*(rinvsq21-felec);
1363
1364 d = r21-rswitch;
1365 d = (d>0.0) ? d : 0.0;
1366 d2 = d*d;
1367 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
1368
1369 dsw = d2*(swF2+d*(swF3+d*swF4));
1370
1371 /* Evaluate switch function */
1372 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1373 felec = felec*sw - rinv21*velec*dsw;
1374
1375 fscal = felec;
1376
1377 /* Calculate temporary vectorial force */
1378 tx = fscal*dx21;
1379 ty = fscal*dy21;
1380 tz = fscal*dz21;
1381
1382 /* Update vectorial force */
1383 fix2 += tx;
1384 fiy2 += ty;
1385 fiz2 += tz;
1386 f[j_coord_offset+DIM3*1+XX0] -= tx;
1387 f[j_coord_offset+DIM3*1+YY1] -= ty;
1388 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
1389
1390 }
1391
1392 /**************************
1393 * CALCULATE INTERACTIONS *
1394 **************************/
1395
1396 if (rsq22<rcutoff2)
1397 {
1398
1399 r22 = rsq22*rinv22;
1400
1401 /* EWALD ELECTROSTATICS */
1402
1403 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1404 ewrt = r22*ewtabscale;
1405 ewitab = ewrt;
1406 eweps = ewrt-ewitab;
1407 ewitab = 4*ewitab;
1408 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1409 velec = qq22*(rinv22-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1410 felec = qq22*rinv22*(rinvsq22-felec);
1411
1412 d = r22-rswitch;
1413 d = (d>0.0) ? d : 0.0;
1414 d2 = d*d;
1415 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
1416
1417 dsw = d2*(swF2+d*(swF3+d*swF4));
1418
1419 /* Evaluate switch function */
1420 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
1421 felec = felec*sw - rinv22*velec*dsw;
1422
1423 fscal = felec;
1424
1425 /* Calculate temporary vectorial force */
1426 tx = fscal*dx22;
1427 ty = fscal*dy22;
1428 tz = fscal*dz22;
1429
1430 /* Update vectorial force */
1431 fix2 += tx;
1432 fiy2 += ty;
1433 fiz2 += tz;
1434 f[j_coord_offset+DIM3*2+XX0] -= tx;
1435 f[j_coord_offset+DIM3*2+YY1] -= ty;
1436 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
1437
1438 }
1439
1440 /* Inner loop uses 504 flops */
1441 }
1442 /* End of innermost loop */
1443
1444 tx = ty = tz = 0;
1445 f[i_coord_offset+DIM3*0+XX0] += fix0;
1446 f[i_coord_offset+DIM3*0+YY1] += fiy0;
1447 f[i_coord_offset+DIM3*0+ZZ2] += fiz0;
1448 tx += fix0;
1449 ty += fiy0;
1450 tz += fiz0;
1451 f[i_coord_offset+DIM3*1+XX0] += fix1;
1452 f[i_coord_offset+DIM3*1+YY1] += fiy1;
1453 f[i_coord_offset+DIM3*1+ZZ2] += fiz1;
1454 tx += fix1;
1455 ty += fiy1;
1456 tz += fiz1;
1457 f[i_coord_offset+DIM3*2+XX0] += fix2;
1458 f[i_coord_offset+DIM3*2+YY1] += fiy2;
1459 f[i_coord_offset+DIM3*2+ZZ2] += fiz2;
1460 tx += fix2;
1461 ty += fiy2;
1462 tz += fiz2;
1463 fshift[i_shift_offset+XX0] += tx;
1464 fshift[i_shift_offset+YY1] += ty;
1465 fshift[i_shift_offset+ZZ2] += tz;
1466
1467 /* Increment number of inner iterations */
1468 inneriter += j_index_end - j_index_start;
1469
1470 /* Outer loop uses 30 flops */
1471 }
1472
1473 /* Increment number of outer iterations */
1474 outeriter += nri;
1475
1476 /* Update outer/inner flops */
1477
1478 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_F,outeriter*30 + inneriter*504)(nrnb)->n[eNR_NBKERNEL_ELEC_W3W3_F] += outeriter*30 + inneriter
*504
;
1479}