Bug Summary

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