2 * This file is part of the GROMACS molecular simulation package.
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.
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.
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.
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.
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.
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.
36 * Note: this file was generated by the GROMACS c kernel generator.
42 #include "../nb_kernel.h"
43 #include "types/simple.h"
44 #include "gromacs/math/vec.h"
48 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwBhamSw_GeomW3P1_VF_c
49 * Electrostatics interaction: Ewald
50 * VdW interaction: Buckingham
51 * Geometry: Water3-Particle
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecEwSw_VdwBhamSw_GeomW3P1_VF_c
56 (t_nblist * gmx_restrict nlist,
57 rvec * gmx_restrict xx,
58 rvec * gmx_restrict ff,
59 t_forcerec * gmx_restrict fr,
60 t_mdatoms * gmx_restrict mdatoms,
61 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
62 t_nrnb * gmx_restrict nrnb)
64 int i_shift_offset,i_coord_offset,j_coord_offset;
65 int j_index_start,j_index_end;
66 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
67 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
68 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
69 real *shiftvec,*fshift,*x,*f;
71 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
73 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
75 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
77 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
78 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
79 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
80 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
81 real velec,felec,velecsum,facel,crf,krf,krf2;
84 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
88 real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace;
90 real rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
97 jindex = nlist->jindex;
99 shiftidx = nlist->shift;
101 shiftvec = fr->shift_vec[0];
102 fshift = fr->fshift[0];
104 charge = mdatoms->chargeA;
105 nvdwtype = fr->ntype;
107 vdwtype = mdatoms->typeA;
109 sh_ewald = fr->ic->sh_ewald;
110 ewtab = fr->ic->tabq_coul_FDV0;
111 ewtabscale = fr->ic->tabq_scale;
112 ewtabhalfspace = 0.5/ewtabscale;
114 /* Setup water-specific parameters */
115 inr = nlist->iinr[0];
116 iq0 = facel*charge[inr+0];
117 iq1 = facel*charge[inr+1];
118 iq2 = facel*charge[inr+2];
119 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
121 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
122 rcutoff = fr->rcoulomb;
123 rcutoff2 = rcutoff*rcutoff;
125 rswitch = fr->rcoulomb_switch;
126 /* Setup switch parameters */
128 swV3 = -10.0/(d*d*d);
129 swV4 = 15.0/(d*d*d*d);
130 swV5 = -6.0/(d*d*d*d*d);
131 swF2 = -30.0/(d*d*d);
132 swF3 = 60.0/(d*d*d*d);
133 swF4 = -30.0/(d*d*d*d*d);
138 /* Start outer loop over neighborlists */
139 for(iidx=0; iidx<nri; iidx++)
141 /* Load shift vector for this list */
142 i_shift_offset = DIM*shiftidx[iidx];
143 shX = shiftvec[i_shift_offset+XX];
144 shY = shiftvec[i_shift_offset+YY];
145 shZ = shiftvec[i_shift_offset+ZZ];
147 /* Load limits for loop over neighbors */
148 j_index_start = jindex[iidx];
149 j_index_end = jindex[iidx+1];
151 /* Get outer coordinate index */
153 i_coord_offset = DIM*inr;
155 /* Load i particle coords and add shift vector */
156 ix0 = shX + x[i_coord_offset+DIM*0+XX];
157 iy0 = shY + x[i_coord_offset+DIM*0+YY];
158 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
159 ix1 = shX + x[i_coord_offset+DIM*1+XX];
160 iy1 = shY + x[i_coord_offset+DIM*1+YY];
161 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
162 ix2 = shX + x[i_coord_offset+DIM*2+XX];
163 iy2 = shY + x[i_coord_offset+DIM*2+YY];
164 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
176 /* Reset potential sums */
180 /* Start inner kernel loop */
181 for(jidx=j_index_start; jidx<j_index_end; jidx++)
183 /* Get j neighbor index, and coordinate index */
185 j_coord_offset = DIM*jnr;
187 /* load j atom coordinates */
188 jx0 = x[j_coord_offset+DIM*0+XX];
189 jy0 = x[j_coord_offset+DIM*0+YY];
190 jz0 = x[j_coord_offset+DIM*0+ZZ];
192 /* Calculate displacement vector */
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;
208 rinv00 = gmx_invsqrt(rsq00);
209 rinv10 = gmx_invsqrt(rsq10);
210 rinv20 = gmx_invsqrt(rsq20);
212 rinvsq00 = rinv00*rinv00;
213 rinvsq10 = rinv10*rinv10;
214 rinvsq20 = rinv20*rinv20;
216 /* Load parameters for j particles */
218 vdwjidx0 = 3*vdwtype[jnr+0];
220 /**************************
221 * CALCULATE INTERACTIONS *
222 **************************/
230 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
231 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
232 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
234 /* EWALD ELECTROSTATICS */
236 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
237 ewrt = r00*ewtabscale;
241 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
242 velec = qq00*(rinv00-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
243 felec = qq00*rinv00*(rinvsq00-felec);
245 /* BUCKINGHAM DISPERSION/REPULSION */
246 rinvsix = rinvsq00*rinvsq00*rinvsq00;
247 vvdw6 = c6_00*rinvsix;
249 vvdwexp = cexp1_00*exp(-br);
250 vvdw = vvdwexp - vvdw6*(1.0/6.0);
251 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
254 d = (d>0.0) ? d : 0.0;
256 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
258 dsw = d2*(swF2+d*(swF3+d*swF4));
260 /* Evaluate switch function */
261 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
262 felec = felec*sw - rinv00*velec*dsw;
263 fvdw = fvdw*sw - rinv00*vvdw*dsw;
267 /* Update potential sums from outer loop */
273 /* Calculate temporary vectorial force */
278 /* Update vectorial force */
282 f[j_coord_offset+DIM*0+XX] -= tx;
283 f[j_coord_offset+DIM*0+YY] -= ty;
284 f[j_coord_offset+DIM*0+ZZ] -= tz;
288 /**************************
289 * CALCULATE INTERACTIONS *
290 **************************/
299 /* EWALD ELECTROSTATICS */
301 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
302 ewrt = r10*ewtabscale;
306 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
307 velec = qq10*(rinv10-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
308 felec = qq10*rinv10*(rinvsq10-felec);
311 d = (d>0.0) ? d : 0.0;
313 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
315 dsw = d2*(swF2+d*(swF3+d*swF4));
317 /* Evaluate switch function */
318 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
319 felec = felec*sw - rinv10*velec*dsw;
322 /* Update potential sums from outer loop */
327 /* Calculate temporary vectorial force */
332 /* Update vectorial force */
336 f[j_coord_offset+DIM*0+XX] -= tx;
337 f[j_coord_offset+DIM*0+YY] -= ty;
338 f[j_coord_offset+DIM*0+ZZ] -= tz;
342 /**************************
343 * CALCULATE INTERACTIONS *
344 **************************/
353 /* EWALD ELECTROSTATICS */
355 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
356 ewrt = r20*ewtabscale;
360 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
361 velec = qq20*(rinv20-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
362 felec = qq20*rinv20*(rinvsq20-felec);
365 d = (d>0.0) ? d : 0.0;
367 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
369 dsw = d2*(swF2+d*(swF3+d*swF4));
371 /* Evaluate switch function */
372 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
373 felec = felec*sw - rinv20*velec*dsw;
376 /* Update potential sums from outer loop */
381 /* Calculate temporary vectorial force */
386 /* Update vectorial force */
390 f[j_coord_offset+DIM*0+XX] -= tx;
391 f[j_coord_offset+DIM*0+YY] -= ty;
392 f[j_coord_offset+DIM*0+ZZ] -= tz;
396 /* Inner loop uses 219 flops */
398 /* End of innermost loop */
401 f[i_coord_offset+DIM*0+XX] += fix0;
402 f[i_coord_offset+DIM*0+YY] += fiy0;
403 f[i_coord_offset+DIM*0+ZZ] += fiz0;
407 f[i_coord_offset+DIM*1+XX] += fix1;
408 f[i_coord_offset+DIM*1+YY] += fiy1;
409 f[i_coord_offset+DIM*1+ZZ] += fiz1;
413 f[i_coord_offset+DIM*2+XX] += fix2;
414 f[i_coord_offset+DIM*2+YY] += fiy2;
415 f[i_coord_offset+DIM*2+ZZ] += fiz2;
419 fshift[i_shift_offset+XX] += tx;
420 fshift[i_shift_offset+YY] += ty;
421 fshift[i_shift_offset+ZZ] += tz;
424 /* Update potential energies */
425 kernel_data->energygrp_elec[ggid] += velecsum;
426 kernel_data->energygrp_vdw[ggid] += vvdwsum;
428 /* Increment number of inner iterations */
429 inneriter += j_index_end - j_index_start;
431 /* Outer loop uses 32 flops */
434 /* Increment number of outer iterations */
437 /* Update outer/inner flops */
439 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*32 + inneriter*219);
442 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwBhamSw_GeomW3P1_F_c
443 * Electrostatics interaction: Ewald
444 * VdW interaction: Buckingham
445 * Geometry: Water3-Particle
446 * Calculate force/pot: Force
449 nb_kernel_ElecEwSw_VdwBhamSw_GeomW3P1_F_c
450 (t_nblist * gmx_restrict nlist,
451 rvec * gmx_restrict xx,
452 rvec * gmx_restrict ff,
453 t_forcerec * gmx_restrict fr,
454 t_mdatoms * gmx_restrict mdatoms,
455 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
456 t_nrnb * gmx_restrict nrnb)
458 int i_shift_offset,i_coord_offset,j_coord_offset;
459 int j_index_start,j_index_end;
460 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
461 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
462 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
463 real *shiftvec,*fshift,*x,*f;
465 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
467 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
469 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
471 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
472 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
473 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
474 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
475 real velec,felec,velecsum,facel,crf,krf,krf2;
478 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
482 real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace;
484 real rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
491 jindex = nlist->jindex;
493 shiftidx = nlist->shift;
495 shiftvec = fr->shift_vec[0];
496 fshift = fr->fshift[0];
498 charge = mdatoms->chargeA;
499 nvdwtype = fr->ntype;
501 vdwtype = mdatoms->typeA;
503 sh_ewald = fr->ic->sh_ewald;
504 ewtab = fr->ic->tabq_coul_FDV0;
505 ewtabscale = fr->ic->tabq_scale;
506 ewtabhalfspace = 0.5/ewtabscale;
508 /* Setup water-specific parameters */
509 inr = nlist->iinr[0];
510 iq0 = facel*charge[inr+0];
511 iq1 = facel*charge[inr+1];
512 iq2 = facel*charge[inr+2];
513 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
515 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
516 rcutoff = fr->rcoulomb;
517 rcutoff2 = rcutoff*rcutoff;
519 rswitch = fr->rcoulomb_switch;
520 /* Setup switch parameters */
522 swV3 = -10.0/(d*d*d);
523 swV4 = 15.0/(d*d*d*d);
524 swV5 = -6.0/(d*d*d*d*d);
525 swF2 = -30.0/(d*d*d);
526 swF3 = 60.0/(d*d*d*d);
527 swF4 = -30.0/(d*d*d*d*d);
532 /* Start outer loop over neighborlists */
533 for(iidx=0; iidx<nri; iidx++)
535 /* Load shift vector for this list */
536 i_shift_offset = DIM*shiftidx[iidx];
537 shX = shiftvec[i_shift_offset+XX];
538 shY = shiftvec[i_shift_offset+YY];
539 shZ = shiftvec[i_shift_offset+ZZ];
541 /* Load limits for loop over neighbors */
542 j_index_start = jindex[iidx];
543 j_index_end = jindex[iidx+1];
545 /* Get outer coordinate index */
547 i_coord_offset = DIM*inr;
549 /* Load i particle coords and add shift vector */
550 ix0 = shX + x[i_coord_offset+DIM*0+XX];
551 iy0 = shY + x[i_coord_offset+DIM*0+YY];
552 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
553 ix1 = shX + x[i_coord_offset+DIM*1+XX];
554 iy1 = shY + x[i_coord_offset+DIM*1+YY];
555 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
556 ix2 = shX + x[i_coord_offset+DIM*2+XX];
557 iy2 = shY + x[i_coord_offset+DIM*2+YY];
558 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
570 /* Start inner kernel loop */
571 for(jidx=j_index_start; jidx<j_index_end; jidx++)
573 /* Get j neighbor index, and coordinate index */
575 j_coord_offset = DIM*jnr;
577 /* load j atom coordinates */
578 jx0 = x[j_coord_offset+DIM*0+XX];
579 jy0 = x[j_coord_offset+DIM*0+YY];
580 jz0 = x[j_coord_offset+DIM*0+ZZ];
582 /* Calculate displacement vector */
593 /* Calculate squared distance and things based on it */
594 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
595 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
596 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
598 rinv00 = gmx_invsqrt(rsq00);
599 rinv10 = gmx_invsqrt(rsq10);
600 rinv20 = gmx_invsqrt(rsq20);
602 rinvsq00 = rinv00*rinv00;
603 rinvsq10 = rinv10*rinv10;
604 rinvsq20 = rinv20*rinv20;
606 /* Load parameters for j particles */
608 vdwjidx0 = 3*vdwtype[jnr+0];
610 /**************************
611 * CALCULATE INTERACTIONS *
612 **************************/
620 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
621 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
622 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
624 /* EWALD ELECTROSTATICS */
626 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
627 ewrt = r00*ewtabscale;
631 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
632 velec = qq00*(rinv00-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
633 felec = qq00*rinv00*(rinvsq00-felec);
635 /* BUCKINGHAM DISPERSION/REPULSION */
636 rinvsix = rinvsq00*rinvsq00*rinvsq00;
637 vvdw6 = c6_00*rinvsix;
639 vvdwexp = cexp1_00*exp(-br);
640 vvdw = vvdwexp - vvdw6*(1.0/6.0);
641 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
644 d = (d>0.0) ? d : 0.0;
646 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
648 dsw = d2*(swF2+d*(swF3+d*swF4));
650 /* Evaluate switch function */
651 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
652 felec = felec*sw - rinv00*velec*dsw;
653 fvdw = fvdw*sw - rinv00*vvdw*dsw;
657 /* Calculate temporary vectorial force */
662 /* Update vectorial force */
666 f[j_coord_offset+DIM*0+XX] -= tx;
667 f[j_coord_offset+DIM*0+YY] -= ty;
668 f[j_coord_offset+DIM*0+ZZ] -= tz;
672 /**************************
673 * CALCULATE INTERACTIONS *
674 **************************/
683 /* EWALD ELECTROSTATICS */
685 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
686 ewrt = r10*ewtabscale;
690 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
691 velec = qq10*(rinv10-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
692 felec = qq10*rinv10*(rinvsq10-felec);
695 d = (d>0.0) ? d : 0.0;
697 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
699 dsw = d2*(swF2+d*(swF3+d*swF4));
701 /* Evaluate switch function */
702 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
703 felec = felec*sw - rinv10*velec*dsw;
707 /* Calculate temporary vectorial force */
712 /* Update vectorial force */
716 f[j_coord_offset+DIM*0+XX] -= tx;
717 f[j_coord_offset+DIM*0+YY] -= ty;
718 f[j_coord_offset+DIM*0+ZZ] -= tz;
722 /**************************
723 * CALCULATE INTERACTIONS *
724 **************************/
733 /* EWALD ELECTROSTATICS */
735 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
736 ewrt = r20*ewtabscale;
740 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
741 velec = qq20*(rinv20-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
742 felec = qq20*rinv20*(rinvsq20-felec);
745 d = (d>0.0) ? d : 0.0;
747 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
749 dsw = d2*(swF2+d*(swF3+d*swF4));
751 /* Evaluate switch function */
752 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
753 felec = felec*sw - rinv20*velec*dsw;
757 /* Calculate temporary vectorial force */
762 /* Update vectorial force */
766 f[j_coord_offset+DIM*0+XX] -= tx;
767 f[j_coord_offset+DIM*0+YY] -= ty;
768 f[j_coord_offset+DIM*0+ZZ] -= tz;
772 /* Inner loop uses 211 flops */
774 /* End of innermost loop */
777 f[i_coord_offset+DIM*0+XX] += fix0;
778 f[i_coord_offset+DIM*0+YY] += fiy0;
779 f[i_coord_offset+DIM*0+ZZ] += fiz0;
783 f[i_coord_offset+DIM*1+XX] += fix1;
784 f[i_coord_offset+DIM*1+YY] += fiy1;
785 f[i_coord_offset+DIM*1+ZZ] += fiz1;
789 f[i_coord_offset+DIM*2+XX] += fix2;
790 f[i_coord_offset+DIM*2+YY] += fiy2;
791 f[i_coord_offset+DIM*2+ZZ] += fiz2;
795 fshift[i_shift_offset+XX] += tx;
796 fshift[i_shift_offset+YY] += ty;
797 fshift[i_shift_offset+ZZ] += tz;
799 /* Increment number of inner iterations */
800 inneriter += j_index_end - j_index_start;
802 /* Outer loop uses 30 flops */
805 /* Increment number of outer iterations */
808 /* Update outer/inner flops */
810 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*30 + inneriter*211);