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.
44 #include "../nb_kernel.h"
45 #include "types/simple.h"
46 #include "gromacs/math/vec.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwBhamSw_GeomW3P1_VF_c
51 * Electrostatics interaction: Ewald
52 * VdW interaction: Buckingham
53 * Geometry: Water3-Particle
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecEwSw_VdwBhamSw_GeomW3P1_VF_c
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
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;
73 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
75 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
77 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
79 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
80 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
81 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
82 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
83 real velec,felec,velecsum,facel,crf,krf,krf2;
86 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
90 real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace;
92 real rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
99 jindex = nlist->jindex;
101 shiftidx = nlist->shift;
103 shiftvec = fr->shift_vec[0];
104 fshift = fr->fshift[0];
106 charge = mdatoms->chargeA;
107 nvdwtype = fr->ntype;
109 vdwtype = mdatoms->typeA;
111 sh_ewald = fr->ic->sh_ewald;
112 ewtab = fr->ic->tabq_coul_FDV0;
113 ewtabscale = fr->ic->tabq_scale;
114 ewtabhalfspace = 0.5/ewtabscale;
116 /* Setup water-specific parameters */
117 inr = nlist->iinr[0];
118 iq0 = facel*charge[inr+0];
119 iq1 = facel*charge[inr+1];
120 iq2 = facel*charge[inr+2];
121 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
123 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
124 rcutoff = fr->rcoulomb;
125 rcutoff2 = rcutoff*rcutoff;
127 rswitch = fr->rcoulomb_switch;
128 /* Setup switch parameters */
130 swV3 = -10.0/(d*d*d);
131 swV4 = 15.0/(d*d*d*d);
132 swV5 = -6.0/(d*d*d*d*d);
133 swF2 = -30.0/(d*d*d);
134 swF3 = 60.0/(d*d*d*d);
135 swF4 = -30.0/(d*d*d*d*d);
140 /* Start outer loop over neighborlists */
141 for(iidx=0; iidx<nri; iidx++)
143 /* Load shift vector for this list */
144 i_shift_offset = DIM*shiftidx[iidx];
145 shX = shiftvec[i_shift_offset+XX];
146 shY = shiftvec[i_shift_offset+YY];
147 shZ = shiftvec[i_shift_offset+ZZ];
149 /* Load limits for loop over neighbors */
150 j_index_start = jindex[iidx];
151 j_index_end = jindex[iidx+1];
153 /* Get outer coordinate index */
155 i_coord_offset = DIM*inr;
157 /* Load i particle coords and add shift vector */
158 ix0 = shX + x[i_coord_offset+DIM*0+XX];
159 iy0 = shY + x[i_coord_offset+DIM*0+YY];
160 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
161 ix1 = shX + x[i_coord_offset+DIM*1+XX];
162 iy1 = shY + x[i_coord_offset+DIM*1+YY];
163 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
164 ix2 = shX + x[i_coord_offset+DIM*2+XX];
165 iy2 = shY + x[i_coord_offset+DIM*2+YY];
166 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
178 /* Reset potential sums */
182 /* Start inner kernel loop */
183 for(jidx=j_index_start; jidx<j_index_end; jidx++)
185 /* Get j neighbor index, and coordinate index */
187 j_coord_offset = DIM*jnr;
189 /* load j atom coordinates */
190 jx0 = x[j_coord_offset+DIM*0+XX];
191 jy0 = x[j_coord_offset+DIM*0+YY];
192 jz0 = x[j_coord_offset+DIM*0+ZZ];
194 /* Calculate displacement vector */
205 /* Calculate squared distance and things based on it */
206 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
207 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
208 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
210 rinv00 = gmx_invsqrt(rsq00);
211 rinv10 = gmx_invsqrt(rsq10);
212 rinv20 = gmx_invsqrt(rsq20);
214 rinvsq00 = rinv00*rinv00;
215 rinvsq10 = rinv10*rinv10;
216 rinvsq20 = rinv20*rinv20;
218 /* Load parameters for j particles */
220 vdwjidx0 = 3*vdwtype[jnr+0];
222 /**************************
223 * CALCULATE INTERACTIONS *
224 **************************/
232 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
233 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
234 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
236 /* EWALD ELECTROSTATICS */
238 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
239 ewrt = r00*ewtabscale;
243 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
244 velec = qq00*(rinv00-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
245 felec = qq00*rinv00*(rinvsq00-felec);
247 /* BUCKINGHAM DISPERSION/REPULSION */
248 rinvsix = rinvsq00*rinvsq00*rinvsq00;
249 vvdw6 = c6_00*rinvsix;
251 vvdwexp = cexp1_00*exp(-br);
252 vvdw = vvdwexp - vvdw6*(1.0/6.0);
253 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
256 d = (d>0.0) ? d : 0.0;
258 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
260 dsw = d2*(swF2+d*(swF3+d*swF4));
262 /* Evaluate switch function */
263 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
264 felec = felec*sw - rinv00*velec*dsw;
265 fvdw = fvdw*sw - rinv00*vvdw*dsw;
269 /* Update potential sums from outer loop */
275 /* Calculate temporary vectorial force */
280 /* Update vectorial force */
284 f[j_coord_offset+DIM*0+XX] -= tx;
285 f[j_coord_offset+DIM*0+YY] -= ty;
286 f[j_coord_offset+DIM*0+ZZ] -= tz;
290 /**************************
291 * CALCULATE INTERACTIONS *
292 **************************/
301 /* EWALD ELECTROSTATICS */
303 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
304 ewrt = r10*ewtabscale;
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);
313 d = (d>0.0) ? d : 0.0;
315 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
317 dsw = d2*(swF2+d*(swF3+d*swF4));
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;
324 /* Update potential sums from outer loop */
329 /* Calculate temporary vectorial force */
334 /* Update vectorial force */
338 f[j_coord_offset+DIM*0+XX] -= tx;
339 f[j_coord_offset+DIM*0+YY] -= ty;
340 f[j_coord_offset+DIM*0+ZZ] -= tz;
344 /**************************
345 * CALCULATE INTERACTIONS *
346 **************************/
355 /* EWALD ELECTROSTATICS */
357 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
358 ewrt = r20*ewtabscale;
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);
367 d = (d>0.0) ? d : 0.0;
369 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
371 dsw = d2*(swF2+d*(swF3+d*swF4));
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;
378 /* Update potential sums from outer loop */
383 /* Calculate temporary vectorial force */
388 /* Update vectorial force */
392 f[j_coord_offset+DIM*0+XX] -= tx;
393 f[j_coord_offset+DIM*0+YY] -= ty;
394 f[j_coord_offset+DIM*0+ZZ] -= tz;
398 /* Inner loop uses 219 flops */
400 /* End of innermost loop */
403 f[i_coord_offset+DIM*0+XX] += fix0;
404 f[i_coord_offset+DIM*0+YY] += fiy0;
405 f[i_coord_offset+DIM*0+ZZ] += fiz0;
409 f[i_coord_offset+DIM*1+XX] += fix1;
410 f[i_coord_offset+DIM*1+YY] += fiy1;
411 f[i_coord_offset+DIM*1+ZZ] += fiz1;
415 f[i_coord_offset+DIM*2+XX] += fix2;
416 f[i_coord_offset+DIM*2+YY] += fiy2;
417 f[i_coord_offset+DIM*2+ZZ] += fiz2;
421 fshift[i_shift_offset+XX] += tx;
422 fshift[i_shift_offset+YY] += ty;
423 fshift[i_shift_offset+ZZ] += tz;
426 /* Update potential energies */
427 kernel_data->energygrp_elec[ggid] += velecsum;
428 kernel_data->energygrp_vdw[ggid] += vvdwsum;
430 /* Increment number of inner iterations */
431 inneriter += j_index_end - j_index_start;
433 /* Outer loop uses 32 flops */
436 /* Increment number of outer iterations */
439 /* Update outer/inner flops */
441 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*32 + inneriter*219);
444 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwBhamSw_GeomW3P1_F_c
445 * Electrostatics interaction: Ewald
446 * VdW interaction: Buckingham
447 * Geometry: Water3-Particle
448 * Calculate force/pot: Force
451 nb_kernel_ElecEwSw_VdwBhamSw_GeomW3P1_F_c
452 (t_nblist * gmx_restrict nlist,
453 rvec * gmx_restrict xx,
454 rvec * gmx_restrict ff,
455 t_forcerec * gmx_restrict fr,
456 t_mdatoms * gmx_restrict mdatoms,
457 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
458 t_nrnb * gmx_restrict nrnb)
460 int i_shift_offset,i_coord_offset,j_coord_offset;
461 int j_index_start,j_index_end;
462 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
463 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
464 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
465 real *shiftvec,*fshift,*x,*f;
467 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
469 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
471 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
473 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
474 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
475 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
476 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
477 real velec,felec,velecsum,facel,crf,krf,krf2;
480 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
484 real ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace;
486 real rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
493 jindex = nlist->jindex;
495 shiftidx = nlist->shift;
497 shiftvec = fr->shift_vec[0];
498 fshift = fr->fshift[0];
500 charge = mdatoms->chargeA;
501 nvdwtype = fr->ntype;
503 vdwtype = mdatoms->typeA;
505 sh_ewald = fr->ic->sh_ewald;
506 ewtab = fr->ic->tabq_coul_FDV0;
507 ewtabscale = fr->ic->tabq_scale;
508 ewtabhalfspace = 0.5/ewtabscale;
510 /* Setup water-specific parameters */
511 inr = nlist->iinr[0];
512 iq0 = facel*charge[inr+0];
513 iq1 = facel*charge[inr+1];
514 iq2 = facel*charge[inr+2];
515 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
517 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
518 rcutoff = fr->rcoulomb;
519 rcutoff2 = rcutoff*rcutoff;
521 rswitch = fr->rcoulomb_switch;
522 /* Setup switch parameters */
524 swV3 = -10.0/(d*d*d);
525 swV4 = 15.0/(d*d*d*d);
526 swV5 = -6.0/(d*d*d*d*d);
527 swF2 = -30.0/(d*d*d);
528 swF3 = 60.0/(d*d*d*d);
529 swF4 = -30.0/(d*d*d*d*d);
534 /* Start outer loop over neighborlists */
535 for(iidx=0; iidx<nri; iidx++)
537 /* Load shift vector for this list */
538 i_shift_offset = DIM*shiftidx[iidx];
539 shX = shiftvec[i_shift_offset+XX];
540 shY = shiftvec[i_shift_offset+YY];
541 shZ = shiftvec[i_shift_offset+ZZ];
543 /* Load limits for loop over neighbors */
544 j_index_start = jindex[iidx];
545 j_index_end = jindex[iidx+1];
547 /* Get outer coordinate index */
549 i_coord_offset = DIM*inr;
551 /* Load i particle coords and add shift vector */
552 ix0 = shX + x[i_coord_offset+DIM*0+XX];
553 iy0 = shY + x[i_coord_offset+DIM*0+YY];
554 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
555 ix1 = shX + x[i_coord_offset+DIM*1+XX];
556 iy1 = shY + x[i_coord_offset+DIM*1+YY];
557 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
558 ix2 = shX + x[i_coord_offset+DIM*2+XX];
559 iy2 = shY + x[i_coord_offset+DIM*2+YY];
560 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
572 /* Start inner kernel loop */
573 for(jidx=j_index_start; jidx<j_index_end; jidx++)
575 /* Get j neighbor index, and coordinate index */
577 j_coord_offset = DIM*jnr;
579 /* load j atom coordinates */
580 jx0 = x[j_coord_offset+DIM*0+XX];
581 jy0 = x[j_coord_offset+DIM*0+YY];
582 jz0 = x[j_coord_offset+DIM*0+ZZ];
584 /* Calculate displacement vector */
595 /* Calculate squared distance and things based on it */
596 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
597 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
598 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
600 rinv00 = gmx_invsqrt(rsq00);
601 rinv10 = gmx_invsqrt(rsq10);
602 rinv20 = gmx_invsqrt(rsq20);
604 rinvsq00 = rinv00*rinv00;
605 rinvsq10 = rinv10*rinv10;
606 rinvsq20 = rinv20*rinv20;
608 /* Load parameters for j particles */
610 vdwjidx0 = 3*vdwtype[jnr+0];
612 /**************************
613 * CALCULATE INTERACTIONS *
614 **************************/
622 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
623 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
624 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
626 /* EWALD ELECTROSTATICS */
628 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
629 ewrt = r00*ewtabscale;
633 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
634 velec = qq00*(rinv00-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
635 felec = qq00*rinv00*(rinvsq00-felec);
637 /* BUCKINGHAM DISPERSION/REPULSION */
638 rinvsix = rinvsq00*rinvsq00*rinvsq00;
639 vvdw6 = c6_00*rinvsix;
641 vvdwexp = cexp1_00*exp(-br);
642 vvdw = vvdwexp - vvdw6*(1.0/6.0);
643 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
646 d = (d>0.0) ? d : 0.0;
648 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
650 dsw = d2*(swF2+d*(swF3+d*swF4));
652 /* Evaluate switch function */
653 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
654 felec = felec*sw - rinv00*velec*dsw;
655 fvdw = fvdw*sw - rinv00*vvdw*dsw;
659 /* Calculate temporary vectorial force */
664 /* Update vectorial force */
668 f[j_coord_offset+DIM*0+XX] -= tx;
669 f[j_coord_offset+DIM*0+YY] -= ty;
670 f[j_coord_offset+DIM*0+ZZ] -= tz;
674 /**************************
675 * CALCULATE INTERACTIONS *
676 **************************/
685 /* EWALD ELECTROSTATICS */
687 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
688 ewrt = r10*ewtabscale;
692 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
693 velec = qq10*(rinv10-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
694 felec = qq10*rinv10*(rinvsq10-felec);
697 d = (d>0.0) ? d : 0.0;
699 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
701 dsw = d2*(swF2+d*(swF3+d*swF4));
703 /* Evaluate switch function */
704 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
705 felec = felec*sw - rinv10*velec*dsw;
709 /* Calculate temporary vectorial force */
714 /* Update vectorial force */
718 f[j_coord_offset+DIM*0+XX] -= tx;
719 f[j_coord_offset+DIM*0+YY] -= ty;
720 f[j_coord_offset+DIM*0+ZZ] -= tz;
724 /**************************
725 * CALCULATE INTERACTIONS *
726 **************************/
735 /* EWALD ELECTROSTATICS */
737 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
738 ewrt = r20*ewtabscale;
742 felec = ewtab[ewitab]+eweps*ewtab[ewitab+1];
743 velec = qq20*(rinv20-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+felec)));
744 felec = qq20*rinv20*(rinvsq20-felec);
747 d = (d>0.0) ? d : 0.0;
749 sw = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
751 dsw = d2*(swF2+d*(swF3+d*swF4));
753 /* Evaluate switch function */
754 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
755 felec = felec*sw - rinv20*velec*dsw;
759 /* Calculate temporary vectorial force */
764 /* Update vectorial force */
768 f[j_coord_offset+DIM*0+XX] -= tx;
769 f[j_coord_offset+DIM*0+YY] -= ty;
770 f[j_coord_offset+DIM*0+ZZ] -= tz;
774 /* Inner loop uses 211 flops */
776 /* End of innermost loop */
779 f[i_coord_offset+DIM*0+XX] += fix0;
780 f[i_coord_offset+DIM*0+YY] += fiy0;
781 f[i_coord_offset+DIM*0+ZZ] += fiz0;
785 f[i_coord_offset+DIM*1+XX] += fix1;
786 f[i_coord_offset+DIM*1+YY] += fiy1;
787 f[i_coord_offset+DIM*1+ZZ] += fiz1;
791 f[i_coord_offset+DIM*2+XX] += fix2;
792 f[i_coord_offset+DIM*2+YY] += fiy2;
793 f[i_coord_offset+DIM*2+ZZ] += fiz2;
797 fshift[i_shift_offset+XX] += tx;
798 fshift[i_shift_offset+YY] += ty;
799 fshift[i_shift_offset+ZZ] += tz;
801 /* Increment number of inner iterations */
802 inneriter += j_index_end - j_index_start;
804 /* Outer loop uses 30 flops */
807 /* Increment number of outer iterations */
810 /* Update outer/inner flops */
812 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*30 + inneriter*211);