Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_c/nb_kernel_ElecEwSw_VdwNone_GeomW4W4_c.c
Location:line 114, column 5
Description:Value stored to 'sh_ewald' 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_GeomW4W4_VF_c
51 * Electrostatics interaction: Ewald
52 * VdW interaction: None
53 * Geometry: Water4-Water4
54 * Calculate force/pot: PotentialAndForce
55 */
56void
57nb_kernel_ElecEwSw_VdwNone_GeomW4W4_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 vdwioffset1;
73 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
74 int vdwioffset2;
75 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
76 int vdwioffset3;
77 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
78 int vdwjidx1;
79 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
80 int vdwjidx2;
81 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
82 int vdwjidx3;
83 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
84 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
85 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
86 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
87 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
88 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
89 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
90 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
91 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
92 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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;
Value stored to 'sh_ewald' is never read
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 iq1 = facel*charge[inr+1];
122 iq2 = facel*charge[inr+2];
123 iq3 = facel*charge[inr+3];
124
125 jq1 = charge[inr+1];
126 jq2 = charge[inr+2];
127 jq3 = charge[inr+3];
128 qq11 = iq1*jq1;
129 qq12 = iq1*jq2;
130 qq13 = iq1*jq3;
131 qq21 = iq2*jq1;
132 qq22 = iq2*jq2;
133 qq23 = iq2*jq3;
134 qq31 = iq3*jq1;
135 qq32 = iq3*jq2;
136 qq33 = iq3*jq3;
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 ix1 = shX + x[i_coord_offset+DIM3*1+XX0];
174 iy1 = shY + x[i_coord_offset+DIM3*1+YY1];
175 iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2];
176 ix2 = shX + x[i_coord_offset+DIM3*2+XX0];
177 iy2 = shY + x[i_coord_offset+DIM3*2+YY1];
178 iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2];
179 ix3 = shX + x[i_coord_offset+DIM3*3+XX0];
180 iy3 = shY + x[i_coord_offset+DIM3*3+YY1];
181 iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2];
182
183 fix1 = 0.0;
184 fiy1 = 0.0;
185 fiz1 = 0.0;
186 fix2 = 0.0;
187 fiy2 = 0.0;
188 fiz2 = 0.0;
189 fix3 = 0.0;
190 fiy3 = 0.0;
191 fiz3 = 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 jx1 = x[j_coord_offset+DIM3*1+XX0];
205 jy1 = x[j_coord_offset+DIM3*1+YY1];
206 jz1 = x[j_coord_offset+DIM3*1+ZZ2];
207 jx2 = x[j_coord_offset+DIM3*2+XX0];
208 jy2 = x[j_coord_offset+DIM3*2+YY1];
209 jz2 = x[j_coord_offset+DIM3*2+ZZ2];
210 jx3 = x[j_coord_offset+DIM3*3+XX0];
211 jy3 = x[j_coord_offset+DIM3*3+YY1];
212 jz3 = x[j_coord_offset+DIM3*3+ZZ2];
213
214 /* Calculate displacement vector */
215 dx11 = ix1 - jx1;
216 dy11 = iy1 - jy1;
217 dz11 = iz1 - jz1;
218 dx12 = ix1 - jx2;
219 dy12 = iy1 - jy2;
220 dz12 = iz1 - jz2;
221 dx13 = ix1 - jx3;
222 dy13 = iy1 - jy3;
223 dz13 = iz1 - jz3;
224 dx21 = ix2 - jx1;
225 dy21 = iy2 - jy1;
226 dz21 = iz2 - jz1;
227 dx22 = ix2 - jx2;
228 dy22 = iy2 - jy2;
229 dz22 = iz2 - jz2;
230 dx23 = ix2 - jx3;
231 dy23 = iy2 - jy3;
232 dz23 = iz2 - jz3;
233 dx31 = ix3 - jx1;
234 dy31 = iy3 - jy1;
235 dz31 = iz3 - jz1;
236 dx32 = ix3 - jx2;
237 dy32 = iy3 - jy2;
238 dz32 = iz3 - jz2;
239 dx33 = ix3 - jx3;
240 dy33 = iy3 - jy3;
241 dz33 = iz3 - jz3;
242
243 /* Calculate squared distance and things based on it */
244 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
245 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
246 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
247 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
248 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
249 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
250 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
251 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
252 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
253
254 rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11);
255 rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12);
256 rinv13 = gmx_invsqrt(rsq13)gmx_software_invsqrt(rsq13);
257 rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21);
258 rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22);
259 rinv23 = gmx_invsqrt(rsq23)gmx_software_invsqrt(rsq23);
260 rinv31 = gmx_invsqrt(rsq31)gmx_software_invsqrt(rsq31);
261 rinv32 = gmx_invsqrt(rsq32)gmx_software_invsqrt(rsq32);
262 rinv33 = gmx_invsqrt(rsq33)gmx_software_invsqrt(rsq33);
263
264 rinvsq11 = rinv11*rinv11;
265 rinvsq12 = rinv12*rinv12;
266 rinvsq13 = rinv13*rinv13;
267 rinvsq21 = rinv21*rinv21;
268 rinvsq22 = rinv22*rinv22;
269 rinvsq23 = rinv23*rinv23;
270 rinvsq31 = rinv31*rinv31;
271 rinvsq32 = rinv32*rinv32;
272 rinvsq33 = rinv33*rinv33;
273
274 /**************************
275 * CALCULATE INTERACTIONS *
276 **************************/
277
278 if (rsq11<rcutoff2)
279 {
280
281 r11 = rsq11*rinv11;
282
283 /* EWALD ELECTROSTATICS */
284
285 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
286 ewrt = r11*ewtabscale;
287 ewitab = ewrt;
288 eweps = ewrt-ewitab;
289 ewitab = 4*ewitab;
290 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
291 velec = qq11*(rinv11-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
292 felec = qq11*rinv11*(rinvsq11-felec);
293
294 d = r11-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 - rinv11*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*dx11;
313 ty = fscal*dy11;
314 tz = fscal*dz11;
315
316 /* Update vectorial force */
317 fix1 += tx;
318 fiy1 += ty;
319 fiz1 += tz;
320 f[j_coord_offset+DIM3*1+XX0] -= tx;
321 f[j_coord_offset+DIM3*1+YY1] -= ty;
322 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
323
324 }
325
326 /**************************
327 * CALCULATE INTERACTIONS *
328 **************************/
329
330 if (rsq12<rcutoff2)
331 {
332
333 r12 = rsq12*rinv12;
334
335 /* EWALD ELECTROSTATICS */
336
337 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
338 ewrt = r12*ewtabscale;
339 ewitab = ewrt;
340 eweps = ewrt-ewitab;
341 ewitab = 4*ewitab;
342 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
343 velec = qq12*(rinv12-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
344 felec = qq12*rinv12*(rinvsq12-felec);
345
346 d = r12-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 - rinv12*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*dx12;
365 ty = fscal*dy12;
366 tz = fscal*dz12;
367
368 /* Update vectorial force */
369 fix1 += tx;
370 fiy1 += ty;
371 fiz1 += tz;
372 f[j_coord_offset+DIM3*2+XX0] -= tx;
373 f[j_coord_offset+DIM3*2+YY1] -= ty;
374 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
375
376 }
377
378 /**************************
379 * CALCULATE INTERACTIONS *
380 **************************/
381
382 if (rsq13<rcutoff2)
383 {
384
385 r13 = rsq13*rinv13;
386
387 /* EWALD ELECTROSTATICS */
388
389 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
390 ewrt = r13*ewtabscale;
391 ewitab = ewrt;
392 eweps = ewrt-ewitab;
393 ewitab = 4*ewitab;
394 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
395 velec = qq13*(rinv13-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
396 felec = qq13*rinv13*(rinvsq13-felec);
397
398 d = r13-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 - rinv13*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*dx13;
417 ty = fscal*dy13;
418 tz = fscal*dz13;
419
420 /* Update vectorial force */
421 fix1 += tx;
422 fiy1 += ty;
423 fiz1 += tz;
424 f[j_coord_offset+DIM3*3+XX0] -= tx;
425 f[j_coord_offset+DIM3*3+YY1] -= ty;
426 f[j_coord_offset+DIM3*3+ZZ2] -= tz;
427
428 }
429
430 /**************************
431 * CALCULATE INTERACTIONS *
432 **************************/
433
434 if (rsq21<rcutoff2)
435 {
436
437 r21 = rsq21*rinv21;
438
439 /* EWALD ELECTROSTATICS */
440
441 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
442 ewrt = r21*ewtabscale;
443 ewitab = ewrt;
444 eweps = ewrt-ewitab;
445 ewitab = 4*ewitab;
446 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
447 velec = qq21*(rinv21-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
448 felec = qq21*rinv21*(rinvsq21-felec);
449
450 d = r21-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 - rinv21*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*dx21;
469 ty = fscal*dy21;
470 tz = fscal*dz21;
471
472 /* Update vectorial force */
473 fix2 += tx;
474 fiy2 += ty;
475 fiz2 += tz;
476 f[j_coord_offset+DIM3*1+XX0] -= tx;
477 f[j_coord_offset+DIM3*1+YY1] -= ty;
478 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
479
480 }
481
482 /**************************
483 * CALCULATE INTERACTIONS *
484 **************************/
485
486 if (rsq22<rcutoff2)
487 {
488
489 r22 = rsq22*rinv22;
490
491 /* EWALD ELECTROSTATICS */
492
493 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
494 ewrt = r22*ewtabscale;
495 ewitab = ewrt;
496 eweps = ewrt-ewitab;
497 ewitab = 4*ewitab;
498 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
499 velec = qq22*(rinv22-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
500 felec = qq22*rinv22*(rinvsq22-felec);
501
502 d = r22-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 - rinv22*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*dx22;
521 ty = fscal*dy22;
522 tz = fscal*dz22;
523
524 /* Update vectorial force */
525 fix2 += tx;
526 fiy2 += ty;
527 fiz2 += tz;
528 f[j_coord_offset+DIM3*2+XX0] -= tx;
529 f[j_coord_offset+DIM3*2+YY1] -= ty;
530 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
531
532 }
533
534 /**************************
535 * CALCULATE INTERACTIONS *
536 **************************/
537
538 if (rsq23<rcutoff2)
539 {
540
541 r23 = rsq23*rinv23;
542
543 /* EWALD ELECTROSTATICS */
544
545 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
546 ewrt = r23*ewtabscale;
547 ewitab = ewrt;
548 eweps = ewrt-ewitab;
549 ewitab = 4*ewitab;
550 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
551 velec = qq23*(rinv23-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
552 felec = qq23*rinv23*(rinvsq23-felec);
553
554 d = r23-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 - rinv23*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*dx23;
573 ty = fscal*dy23;
574 tz = fscal*dz23;
575
576 /* Update vectorial force */
577 fix2 += tx;
578 fiy2 += ty;
579 fiz2 += tz;
580 f[j_coord_offset+DIM3*3+XX0] -= tx;
581 f[j_coord_offset+DIM3*3+YY1] -= ty;
582 f[j_coord_offset+DIM3*3+ZZ2] -= tz;
583
584 }
585
586 /**************************
587 * CALCULATE INTERACTIONS *
588 **************************/
589
590 if (rsq31<rcutoff2)
591 {
592
593 r31 = rsq31*rinv31;
594
595 /* EWALD ELECTROSTATICS */
596
597 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
598 ewrt = r31*ewtabscale;
599 ewitab = ewrt;
600 eweps = ewrt-ewitab;
601 ewitab = 4*ewitab;
602 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
603 velec = qq31*(rinv31-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
604 felec = qq31*rinv31*(rinvsq31-felec);
605
606 d = r31-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 - rinv31*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*dx31;
625 ty = fscal*dy31;
626 tz = fscal*dz31;
627
628 /* Update vectorial force */
629 fix3 += tx;
630 fiy3 += ty;
631 fiz3 += tz;
632 f[j_coord_offset+DIM3*1+XX0] -= tx;
633 f[j_coord_offset+DIM3*1+YY1] -= ty;
634 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
635
636 }
637
638 /**************************
639 * CALCULATE INTERACTIONS *
640 **************************/
641
642 if (rsq32<rcutoff2)
643 {
644
645 r32 = rsq32*rinv32;
646
647 /* EWALD ELECTROSTATICS */
648
649 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
650 ewrt = r32*ewtabscale;
651 ewitab = ewrt;
652 eweps = ewrt-ewitab;
653 ewitab = 4*ewitab;
654 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
655 velec = qq32*(rinv32-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
656 felec = qq32*rinv32*(rinvsq32-felec);
657
658 d = r32-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 - rinv32*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*dx32;
677 ty = fscal*dy32;
678 tz = fscal*dz32;
679
680 /* Update vectorial force */
681 fix3 += tx;
682 fiy3 += ty;
683 fiz3 += tz;
684 f[j_coord_offset+DIM3*2+XX0] -= tx;
685 f[j_coord_offset+DIM3*2+YY1] -= ty;
686 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
687
688 }
689
690 /**************************
691 * CALCULATE INTERACTIONS *
692 **************************/
693
694 if (rsq33<rcutoff2)
695 {
696
697 r33 = rsq33*rinv33;
698
699 /* EWALD ELECTROSTATICS */
700
701 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
702 ewrt = r33*ewtabscale;
703 ewitab = ewrt;
704 eweps = ewrt-ewitab;
705 ewitab = 4*ewitab;
706 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
707 velec = qq33*(rinv33-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
708 felec = qq33*rinv33*(rinvsq33-felec);
709
710 d = r33-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 - rinv33*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*dx33;
729 ty = fscal*dy33;
730 tz = fscal*dz33;
731
732 /* Update vectorial force */
733 fix3 += tx;
734 fiy3 += ty;
735 fiz3 += tz;
736 f[j_coord_offset+DIM3*3+XX0] -= tx;
737 f[j_coord_offset+DIM3*3+YY1] -= ty;
738 f[j_coord_offset+DIM3*3+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*1+XX0] += fix1;
748 f[i_coord_offset+DIM3*1+YY1] += fiy1;
749 f[i_coord_offset+DIM3*1+ZZ2] += fiz1;
750 tx += fix1;
751 ty += fiy1;
752 tz += fiz1;
753 f[i_coord_offset+DIM3*2+XX0] += fix2;
754 f[i_coord_offset+DIM3*2+YY1] += fiy2;
755 f[i_coord_offset+DIM3*2+ZZ2] += fiz2;
756 tx += fix2;
757 ty += fiy2;
758 tz += fiz2;
759 f[i_coord_offset+DIM3*3+XX0] += fix3;
760 f[i_coord_offset+DIM3*3+YY1] += fiy3;
761 f[i_coord_offset+DIM3*3+ZZ2] += fiz3;
762 tx += fix3;
763 ty += fiy3;
764 tz += fiz3;
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_W4W4_VF,outeriter*31 + inneriter*522)(nrnb)->n[eNR_NBKERNEL_ELEC_W4W4_VF] += outeriter*31 + inneriter
*522
;
785}
786/*
787 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwNone_GeomW4W4_F_c
788 * Electrostatics interaction: Ewald
789 * VdW interaction: None
790 * Geometry: Water4-Water4
791 * Calculate force/pot: Force
792 */
793void
794nb_kernel_ElecEwSw_VdwNone_GeomW4W4_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 vdwioffset1;
810 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
811 int vdwioffset2;
812 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
813 int vdwioffset3;
814 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
815 int vdwjidx1;
816 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
817 int vdwjidx2;
818 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
819 int vdwjidx3;
820 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
821 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
822 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
823 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
824 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
825 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
826 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
827 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
828 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
829 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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;
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 iq1 = facel*charge[inr+1];
859 iq2 = facel*charge[inr+2];
860 iq3 = facel*charge[inr+3];
861
862 jq1 = charge[inr+1];
863 jq2 = charge[inr+2];
864 jq3 = charge[inr+3];
865 qq11 = iq1*jq1;
866 qq12 = iq1*jq2;
867 qq13 = iq1*jq3;
868 qq21 = iq2*jq1;
869 qq22 = iq2*jq2;
870 qq23 = iq2*jq3;
871 qq31 = iq3*jq1;
872 qq32 = iq3*jq2;
873 qq33 = iq3*jq3;
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 ix1 = shX + x[i_coord_offset+DIM3*1+XX0];
911 iy1 = shY + x[i_coord_offset+DIM3*1+YY1];
912 iz1 = shZ + x[i_coord_offset+DIM3*1+ZZ2];
913 ix2 = shX + x[i_coord_offset+DIM3*2+XX0];
914 iy2 = shY + x[i_coord_offset+DIM3*2+YY1];
915 iz2 = shZ + x[i_coord_offset+DIM3*2+ZZ2];
916 ix3 = shX + x[i_coord_offset+DIM3*3+XX0];
917 iy3 = shY + x[i_coord_offset+DIM3*3+YY1];
918 iz3 = shZ + x[i_coord_offset+DIM3*3+ZZ2];
919
920 fix1 = 0.0;
921 fiy1 = 0.0;
922 fiz1 = 0.0;
923 fix2 = 0.0;
924 fiy2 = 0.0;
925 fiz2 = 0.0;
926 fix3 = 0.0;
927 fiy3 = 0.0;
928 fiz3 = 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 jx1 = x[j_coord_offset+DIM3*1+XX0];
939 jy1 = x[j_coord_offset+DIM3*1+YY1];
940 jz1 = x[j_coord_offset+DIM3*1+ZZ2];
941 jx2 = x[j_coord_offset+DIM3*2+XX0];
942 jy2 = x[j_coord_offset+DIM3*2+YY1];
943 jz2 = x[j_coord_offset+DIM3*2+ZZ2];
944 jx3 = x[j_coord_offset+DIM3*3+XX0];
945 jy3 = x[j_coord_offset+DIM3*3+YY1];
946 jz3 = x[j_coord_offset+DIM3*3+ZZ2];
947
948 /* Calculate displacement vector */
949 dx11 = ix1 - jx1;
950 dy11 = iy1 - jy1;
951 dz11 = iz1 - jz1;
952 dx12 = ix1 - jx2;
953 dy12 = iy1 - jy2;
954 dz12 = iz1 - jz2;
955 dx13 = ix1 - jx3;
956 dy13 = iy1 - jy3;
957 dz13 = iz1 - jz3;
958 dx21 = ix2 - jx1;
959 dy21 = iy2 - jy1;
960 dz21 = iz2 - jz1;
961 dx22 = ix2 - jx2;
962 dy22 = iy2 - jy2;
963 dz22 = iz2 - jz2;
964 dx23 = ix2 - jx3;
965 dy23 = iy2 - jy3;
966 dz23 = iz2 - jz3;
967 dx31 = ix3 - jx1;
968 dy31 = iy3 - jy1;
969 dz31 = iz3 - jz1;
970 dx32 = ix3 - jx2;
971 dy32 = iy3 - jy2;
972 dz32 = iz3 - jz2;
973 dx33 = ix3 - jx3;
974 dy33 = iy3 - jy3;
975 dz33 = iz3 - jz3;
976
977 /* Calculate squared distance and things based on it */
978 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
979 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
980 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
981 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
982 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
983 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
984 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
985 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
986 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
987
988 rinv11 = gmx_invsqrt(rsq11)gmx_software_invsqrt(rsq11);
989 rinv12 = gmx_invsqrt(rsq12)gmx_software_invsqrt(rsq12);
990 rinv13 = gmx_invsqrt(rsq13)gmx_software_invsqrt(rsq13);
991 rinv21 = gmx_invsqrt(rsq21)gmx_software_invsqrt(rsq21);
992 rinv22 = gmx_invsqrt(rsq22)gmx_software_invsqrt(rsq22);
993 rinv23 = gmx_invsqrt(rsq23)gmx_software_invsqrt(rsq23);
994 rinv31 = gmx_invsqrt(rsq31)gmx_software_invsqrt(rsq31);
995 rinv32 = gmx_invsqrt(rsq32)gmx_software_invsqrt(rsq32);
996 rinv33 = gmx_invsqrt(rsq33)gmx_software_invsqrt(rsq33);
997
998 rinvsq11 = rinv11*rinv11;
999 rinvsq12 = rinv12*rinv12;
1000 rinvsq13 = rinv13*rinv13;
1001 rinvsq21 = rinv21*rinv21;
1002 rinvsq22 = rinv22*rinv22;
1003 rinvsq23 = rinv23*rinv23;
1004 rinvsq31 = rinv31*rinv31;
1005 rinvsq32 = rinv32*rinv32;
1006 rinvsq33 = rinv33*rinv33;
1007
1008 /**************************
1009 * CALCULATE INTERACTIONS *
1010 **************************/
1011
1012 if (rsq11<rcutoff2)
1013 {
1014
1015 r11 = rsq11*rinv11;
1016
1017 /* EWALD ELECTROSTATICS */
1018
1019 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1020 ewrt = r11*ewtabscale;
1021 ewitab = ewrt;
1022 eweps = ewrt-ewitab;
1023 ewitab = 4*ewitab;
1024 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1025 velec = qq11*(rinv11-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1026 felec = qq11*rinv11*(rinvsq11-felec);
1027
1028 d = r11-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 - rinv11*velec*dsw;
1038
1039 fscal = felec;
1040
1041 /* Calculate temporary vectorial force */
1042 tx = fscal*dx11;
1043 ty = fscal*dy11;
1044 tz = fscal*dz11;
1045
1046 /* Update vectorial force */
1047 fix1 += tx;
1048 fiy1 += ty;
1049 fiz1 += tz;
1050 f[j_coord_offset+DIM3*1+XX0] -= tx;
1051 f[j_coord_offset+DIM3*1+YY1] -= ty;
1052 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
1053
1054 }
1055
1056 /**************************
1057 * CALCULATE INTERACTIONS *
1058 **************************/
1059
1060 if (rsq12<rcutoff2)
1061 {
1062
1063 r12 = rsq12*rinv12;
1064
1065 /* EWALD ELECTROSTATICS */
1066
1067 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1068 ewrt = r12*ewtabscale;
1069 ewitab = ewrt;
1070 eweps = ewrt-ewitab;
1071 ewitab = 4*ewitab;
1072 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1073 velec = qq12*(rinv12-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1074 felec = qq12*rinv12*(rinvsq12-felec);
1075
1076 d = r12-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 - rinv12*velec*dsw;
1086
1087 fscal = felec;
1088
1089 /* Calculate temporary vectorial force */
1090 tx = fscal*dx12;
1091 ty = fscal*dy12;
1092 tz = fscal*dz12;
1093
1094 /* Update vectorial force */
1095 fix1 += tx;
1096 fiy1 += ty;
1097 fiz1 += tz;
1098 f[j_coord_offset+DIM3*2+XX0] -= tx;
1099 f[j_coord_offset+DIM3*2+YY1] -= ty;
1100 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
1101
1102 }
1103
1104 /**************************
1105 * CALCULATE INTERACTIONS *
1106 **************************/
1107
1108 if (rsq13<rcutoff2)
1109 {
1110
1111 r13 = rsq13*rinv13;
1112
1113 /* EWALD ELECTROSTATICS */
1114
1115 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1116 ewrt = r13*ewtabscale;
1117 ewitab = ewrt;
1118 eweps = ewrt-ewitab;
1119 ewitab = 4*ewitab;
1120 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1121 velec = qq13*(rinv13-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1122 felec = qq13*rinv13*(rinvsq13-felec);
1123
1124 d = r13-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 - rinv13*velec*dsw;
1134
1135 fscal = felec;
1136
1137 /* Calculate temporary vectorial force */
1138 tx = fscal*dx13;
1139 ty = fscal*dy13;
1140 tz = fscal*dz13;
1141
1142 /* Update vectorial force */
1143 fix1 += tx;
1144 fiy1 += ty;
1145 fiz1 += tz;
1146 f[j_coord_offset+DIM3*3+XX0] -= tx;
1147 f[j_coord_offset+DIM3*3+YY1] -= ty;
1148 f[j_coord_offset+DIM3*3+ZZ2] -= tz;
1149
1150 }
1151
1152 /**************************
1153 * CALCULATE INTERACTIONS *
1154 **************************/
1155
1156 if (rsq21<rcutoff2)
1157 {
1158
1159 r21 = rsq21*rinv21;
1160
1161 /* EWALD ELECTROSTATICS */
1162
1163 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1164 ewrt = r21*ewtabscale;
1165 ewitab = ewrt;
1166 eweps = ewrt-ewitab;
1167 ewitab = 4*ewitab;
1168 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1169 velec = qq21*(rinv21-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1170 felec = qq21*rinv21*(rinvsq21-felec);
1171
1172 d = r21-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 - rinv21*velec*dsw;
1182
1183 fscal = felec;
1184
1185 /* Calculate temporary vectorial force */
1186 tx = fscal*dx21;
1187 ty = fscal*dy21;
1188 tz = fscal*dz21;
1189
1190 /* Update vectorial force */
1191 fix2 += tx;
1192 fiy2 += ty;
1193 fiz2 += tz;
1194 f[j_coord_offset+DIM3*1+XX0] -= tx;
1195 f[j_coord_offset+DIM3*1+YY1] -= ty;
1196 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
1197
1198 }
1199
1200 /**************************
1201 * CALCULATE INTERACTIONS *
1202 **************************/
1203
1204 if (rsq22<rcutoff2)
1205 {
1206
1207 r22 = rsq22*rinv22;
1208
1209 /* EWALD ELECTROSTATICS */
1210
1211 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1212 ewrt = r22*ewtabscale;
1213 ewitab = ewrt;
1214 eweps = ewrt-ewitab;
1215 ewitab = 4*ewitab;
1216 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1217 velec = qq22*(rinv22-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1218 felec = qq22*rinv22*(rinvsq22-felec);
1219
1220 d = r22-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 - rinv22*velec*dsw;
1230
1231 fscal = felec;
1232
1233 /* Calculate temporary vectorial force */
1234 tx = fscal*dx22;
1235 ty = fscal*dy22;
1236 tz = fscal*dz22;
1237
1238 /* Update vectorial force */
1239 fix2 += tx;
1240 fiy2 += ty;
1241 fiz2 += tz;
1242 f[j_coord_offset+DIM3*2+XX0] -= tx;
1243 f[j_coord_offset+DIM3*2+YY1] -= ty;
1244 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
1245
1246 }
1247
1248 /**************************
1249 * CALCULATE INTERACTIONS *
1250 **************************/
1251
1252 if (rsq23<rcutoff2)
1253 {
1254
1255 r23 = rsq23*rinv23;
1256
1257 /* EWALD ELECTROSTATICS */
1258
1259 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1260 ewrt = r23*ewtabscale;
1261 ewitab = ewrt;
1262 eweps = ewrt-ewitab;
1263 ewitab = 4*ewitab;
1264 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1265 velec = qq23*(rinv23-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1266 felec = qq23*rinv23*(rinvsq23-felec);
1267
1268 d = r23-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 - rinv23*velec*dsw;
1278
1279 fscal = felec;
1280
1281 /* Calculate temporary vectorial force */
1282 tx = fscal*dx23;
1283 ty = fscal*dy23;
1284 tz = fscal*dz23;
1285
1286 /* Update vectorial force */
1287 fix2 += tx;
1288 fiy2 += ty;
1289 fiz2 += tz;
1290 f[j_coord_offset+DIM3*3+XX0] -= tx;
1291 f[j_coord_offset+DIM3*3+YY1] -= ty;
1292 f[j_coord_offset+DIM3*3+ZZ2] -= tz;
1293
1294 }
1295
1296 /**************************
1297 * CALCULATE INTERACTIONS *
1298 **************************/
1299
1300 if (rsq31<rcutoff2)
1301 {
1302
1303 r31 = rsq31*rinv31;
1304
1305 /* EWALD ELECTROSTATICS */
1306
1307 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1308 ewrt = r31*ewtabscale;
1309 ewitab = ewrt;
1310 eweps = ewrt-ewitab;
1311 ewitab = 4*ewitab;
1312 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1313 velec = qq31*(rinv31-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1314 felec = qq31*rinv31*(rinvsq31-felec);
1315
1316 d = r31-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 - rinv31*velec*dsw;
1326
1327 fscal = felec;
1328
1329 /* Calculate temporary vectorial force */
1330 tx = fscal*dx31;
1331 ty = fscal*dy31;
1332 tz = fscal*dz31;
1333
1334 /* Update vectorial force */
1335 fix3 += tx;
1336 fiy3 += ty;
1337 fiz3 += tz;
1338 f[j_coord_offset+DIM3*1+XX0] -= tx;
1339 f[j_coord_offset+DIM3*1+YY1] -= ty;
1340 f[j_coord_offset+DIM3*1+ZZ2] -= tz;
1341
1342 }
1343
1344 /**************************
1345 * CALCULATE INTERACTIONS *
1346 **************************/
1347
1348 if (rsq32<rcutoff2)
1349 {
1350
1351 r32 = rsq32*rinv32;
1352
1353 /* EWALD ELECTROSTATICS */
1354
1355 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1356 ewrt = r32*ewtabscale;
1357 ewitab = ewrt;
1358 eweps = ewrt-ewitab;
1359 ewitab = 4*ewitab;
1360 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1361 velec = qq32*(rinv32-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1362 felec = qq32*rinv32*(rinvsq32-felec);
1363
1364 d = r32-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 - rinv32*velec*dsw;
1374
1375 fscal = felec;
1376
1377 /* Calculate temporary vectorial force */
1378 tx = fscal*dx32;
1379 ty = fscal*dy32;
1380 tz = fscal*dz32;
1381
1382 /* Update vectorial force */
1383 fix3 += tx;
1384 fiy3 += ty;
1385 fiz3 += tz;
1386 f[j_coord_offset+DIM3*2+XX0] -= tx;
1387 f[j_coord_offset+DIM3*2+YY1] -= ty;
1388 f[j_coord_offset+DIM3*2+ZZ2] -= tz;
1389
1390 }
1391
1392 /**************************
1393 * CALCULATE INTERACTIONS *
1394 **************************/
1395
1396 if (rsq33<rcutoff2)
1397 {
1398
1399 r33 = rsq33*rinv33;
1400
1401 /* EWALD ELECTROSTATICS */
1402
1403 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
1404 ewrt = r33*ewtabscale;
1405 ewitab = ewrt;
1406 eweps = ewrt-ewitab;
1407 ewitab = 4*ewitab;
1408 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
1409 velec = qq33*(rinv33-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
1410 felec = qq33*rinv33*(rinvsq33-felec);
1411
1412 d = r33-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 - rinv33*velec*dsw;
1422
1423 fscal = felec;
1424
1425 /* Calculate temporary vectorial force */
1426 tx = fscal*dx33;
1427 ty = fscal*dy33;
1428 tz = fscal*dz33;
1429
1430 /* Update vectorial force */
1431 fix3 += tx;
1432 fiy3 += ty;
1433 fiz3 += tz;
1434 f[j_coord_offset+DIM3*3+XX0] -= tx;
1435 f[j_coord_offset+DIM3*3+YY1] -= ty;
1436 f[j_coord_offset+DIM3*3+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*1+XX0] += fix1;
1446 f[i_coord_offset+DIM3*1+YY1] += fiy1;
1447 f[i_coord_offset+DIM3*1+ZZ2] += fiz1;
1448 tx += fix1;
1449 ty += fiy1;
1450 tz += fiz1;
1451 f[i_coord_offset+DIM3*2+XX0] += fix2;
1452 f[i_coord_offset+DIM3*2+YY1] += fiy2;
1453 f[i_coord_offset+DIM3*2+ZZ2] += fiz2;
1454 tx += fix2;
1455 ty += fiy2;
1456 tz += fiz2;
1457 f[i_coord_offset+DIM3*3+XX0] += fix3;
1458 f[i_coord_offset+DIM3*3+YY1] += fiy3;
1459 f[i_coord_offset+DIM3*3+ZZ2] += fiz3;
1460 tx += fix3;
1461 ty += fiy3;
1462 tz += fiz3;
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_W4W4_F,outeriter*30 + inneriter*504)(nrnb)->n[eNR_NBKERNEL_ELEC_W4W4_F] += outeriter*30 + inneriter
*504
;
1479}