Bug Summary

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