2 * Note: this file was generated by the Gromacs c kernel generator.
4 * This source code is part of
8 * Copyright (c) 2001-2012, The GROMACS Development Team
10 * Gromacs is a library for molecular simulation and trajectory analysis,
11 * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
12 * a full list of developers and information, check out http://www.gromacs.org
14 * This program is free software; you can redistribute it and/or modify it under
15 * the terms of the GNU Lesser General Public License as published by the Free
16 * Software Foundation; either version 2 of the License, or (at your option) any
19 * To help fund GROMACS development, we humbly ask that you cite
20 * the papers people have written on it - you can find them on the website.
28 #include "../nb_kernel.h"
29 #include "types/simple.h"
34 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwNone_GeomW3W3_VF_c
35 * Electrostatics interaction: CubicSplineTable
36 * VdW interaction: None
37 * Geometry: Water3-Water3
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecCSTab_VdwNone_GeomW3W3_VF_c
42 (t_nblist * gmx_restrict nlist,
43 rvec * gmx_restrict xx,
44 rvec * gmx_restrict ff,
45 t_forcerec * gmx_restrict fr,
46 t_mdatoms * gmx_restrict mdatoms,
47 nb_kernel_data_t * gmx_restrict kernel_data,
48 t_nrnb * gmx_restrict nrnb)
50 int i_shift_offset,i_coord_offset,j_coord_offset;
51 int j_index_start,j_index_end;
52 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
53 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
54 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
55 real *shiftvec,*fshift,*x,*f;
57 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
59 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
61 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
63 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
65 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
67 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
68 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
69 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
70 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
71 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
72 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
73 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
74 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
75 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
76 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
77 real velec,felec,velecsum,facel,crf,krf,krf2;
80 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
88 jindex = nlist->jindex;
90 shiftidx = nlist->shift;
92 shiftvec = fr->shift_vec[0];
93 fshift = fr->fshift[0];
95 charge = mdatoms->chargeA;
97 vftab = kernel_data->table_elec->data;
98 vftabscale = kernel_data->table_elec->scale;
100 /* Setup water-specific parameters */
101 inr = nlist->iinr[0];
102 iq0 = facel*charge[inr+0];
103 iq1 = facel*charge[inr+1];
104 iq2 = facel*charge[inr+2];
122 /* Start outer loop over neighborlists */
123 for(iidx=0; iidx<nri; iidx++)
125 /* Load shift vector for this list */
126 i_shift_offset = DIM*shiftidx[iidx];
127 shX = shiftvec[i_shift_offset+XX];
128 shY = shiftvec[i_shift_offset+YY];
129 shZ = shiftvec[i_shift_offset+ZZ];
131 /* Load limits for loop over neighbors */
132 j_index_start = jindex[iidx];
133 j_index_end = jindex[iidx+1];
135 /* Get outer coordinate index */
137 i_coord_offset = DIM*inr;
139 /* Load i particle coords and add shift vector */
140 ix0 = shX + x[i_coord_offset+DIM*0+XX];
141 iy0 = shY + x[i_coord_offset+DIM*0+YY];
142 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
143 ix1 = shX + x[i_coord_offset+DIM*1+XX];
144 iy1 = shY + x[i_coord_offset+DIM*1+YY];
145 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
146 ix2 = shX + x[i_coord_offset+DIM*2+XX];
147 iy2 = shY + x[i_coord_offset+DIM*2+YY];
148 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
160 /* Reset potential sums */
163 /* Start inner kernel loop */
164 for(jidx=j_index_start; jidx<j_index_end; jidx++)
166 /* Get j neighbor index, and coordinate index */
168 j_coord_offset = DIM*jnr;
170 /* load j atom coordinates */
171 jx0 = x[j_coord_offset+DIM*0+XX];
172 jy0 = x[j_coord_offset+DIM*0+YY];
173 jz0 = x[j_coord_offset+DIM*0+ZZ];
174 jx1 = x[j_coord_offset+DIM*1+XX];
175 jy1 = x[j_coord_offset+DIM*1+YY];
176 jz1 = x[j_coord_offset+DIM*1+ZZ];
177 jx2 = x[j_coord_offset+DIM*2+XX];
178 jy2 = x[j_coord_offset+DIM*2+YY];
179 jz2 = x[j_coord_offset+DIM*2+ZZ];
181 /* Calculate displacement vector */
210 /* Calculate squared distance and things based on it */
211 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
212 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
213 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
214 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
215 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
216 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
217 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
218 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
219 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
221 rinv00 = gmx_invsqrt(rsq00);
222 rinv01 = gmx_invsqrt(rsq01);
223 rinv02 = gmx_invsqrt(rsq02);
224 rinv10 = gmx_invsqrt(rsq10);
225 rinv11 = gmx_invsqrt(rsq11);
226 rinv12 = gmx_invsqrt(rsq12);
227 rinv20 = gmx_invsqrt(rsq20);
228 rinv21 = gmx_invsqrt(rsq21);
229 rinv22 = gmx_invsqrt(rsq22);
231 /**************************
232 * CALCULATE INTERACTIONS *
233 **************************/
237 /* Calculate table index by multiplying r with table scale and truncate to integer */
243 /* CUBIC SPLINE TABLE ELECTROSTATICS */
246 Geps = vfeps*vftab[vfitab+2];
247 Heps2 = vfeps*vfeps*vftab[vfitab+3];
251 FF = Fp+Geps+2.0*Heps2;
252 felec = -qq00*FF*vftabscale*rinv00;
254 /* Update potential sums from outer loop */
259 /* Calculate temporary vectorial force */
264 /* Update vectorial force */
268 f[j_coord_offset+DIM*0+XX] -= tx;
269 f[j_coord_offset+DIM*0+YY] -= ty;
270 f[j_coord_offset+DIM*0+ZZ] -= tz;
272 /**************************
273 * CALCULATE INTERACTIONS *
274 **************************/
278 /* Calculate table index by multiplying r with table scale and truncate to integer */
284 /* CUBIC SPLINE TABLE ELECTROSTATICS */
287 Geps = vfeps*vftab[vfitab+2];
288 Heps2 = vfeps*vfeps*vftab[vfitab+3];
292 FF = Fp+Geps+2.0*Heps2;
293 felec = -qq01*FF*vftabscale*rinv01;
295 /* Update potential sums from outer loop */
300 /* Calculate temporary vectorial force */
305 /* Update vectorial force */
309 f[j_coord_offset+DIM*1+XX] -= tx;
310 f[j_coord_offset+DIM*1+YY] -= ty;
311 f[j_coord_offset+DIM*1+ZZ] -= tz;
313 /**************************
314 * CALCULATE INTERACTIONS *
315 **************************/
319 /* Calculate table index by multiplying r with table scale and truncate to integer */
325 /* CUBIC SPLINE TABLE ELECTROSTATICS */
328 Geps = vfeps*vftab[vfitab+2];
329 Heps2 = vfeps*vfeps*vftab[vfitab+3];
333 FF = Fp+Geps+2.0*Heps2;
334 felec = -qq02*FF*vftabscale*rinv02;
336 /* Update potential sums from outer loop */
341 /* Calculate temporary vectorial force */
346 /* Update vectorial force */
350 f[j_coord_offset+DIM*2+XX] -= tx;
351 f[j_coord_offset+DIM*2+YY] -= ty;
352 f[j_coord_offset+DIM*2+ZZ] -= tz;
354 /**************************
355 * CALCULATE INTERACTIONS *
356 **************************/
360 /* Calculate table index by multiplying r with table scale and truncate to integer */
366 /* CUBIC SPLINE TABLE ELECTROSTATICS */
369 Geps = vfeps*vftab[vfitab+2];
370 Heps2 = vfeps*vfeps*vftab[vfitab+3];
374 FF = Fp+Geps+2.0*Heps2;
375 felec = -qq10*FF*vftabscale*rinv10;
377 /* Update potential sums from outer loop */
382 /* Calculate temporary vectorial force */
387 /* Update vectorial force */
391 f[j_coord_offset+DIM*0+XX] -= tx;
392 f[j_coord_offset+DIM*0+YY] -= ty;
393 f[j_coord_offset+DIM*0+ZZ] -= tz;
395 /**************************
396 * CALCULATE INTERACTIONS *
397 **************************/
401 /* Calculate table index by multiplying r with table scale and truncate to integer */
407 /* CUBIC SPLINE TABLE ELECTROSTATICS */
410 Geps = vfeps*vftab[vfitab+2];
411 Heps2 = vfeps*vfeps*vftab[vfitab+3];
415 FF = Fp+Geps+2.0*Heps2;
416 felec = -qq11*FF*vftabscale*rinv11;
418 /* Update potential sums from outer loop */
423 /* Calculate temporary vectorial force */
428 /* Update vectorial force */
432 f[j_coord_offset+DIM*1+XX] -= tx;
433 f[j_coord_offset+DIM*1+YY] -= ty;
434 f[j_coord_offset+DIM*1+ZZ] -= tz;
436 /**************************
437 * CALCULATE INTERACTIONS *
438 **************************/
442 /* Calculate table index by multiplying r with table scale and truncate to integer */
448 /* CUBIC SPLINE TABLE ELECTROSTATICS */
451 Geps = vfeps*vftab[vfitab+2];
452 Heps2 = vfeps*vfeps*vftab[vfitab+3];
456 FF = Fp+Geps+2.0*Heps2;
457 felec = -qq12*FF*vftabscale*rinv12;
459 /* Update potential sums from outer loop */
464 /* Calculate temporary vectorial force */
469 /* Update vectorial force */
473 f[j_coord_offset+DIM*2+XX] -= tx;
474 f[j_coord_offset+DIM*2+YY] -= ty;
475 f[j_coord_offset+DIM*2+ZZ] -= tz;
477 /**************************
478 * CALCULATE INTERACTIONS *
479 **************************/
483 /* Calculate table index by multiplying r with table scale and truncate to integer */
489 /* CUBIC SPLINE TABLE ELECTROSTATICS */
492 Geps = vfeps*vftab[vfitab+2];
493 Heps2 = vfeps*vfeps*vftab[vfitab+3];
497 FF = Fp+Geps+2.0*Heps2;
498 felec = -qq20*FF*vftabscale*rinv20;
500 /* Update potential sums from outer loop */
505 /* Calculate temporary vectorial force */
510 /* Update vectorial force */
514 f[j_coord_offset+DIM*0+XX] -= tx;
515 f[j_coord_offset+DIM*0+YY] -= ty;
516 f[j_coord_offset+DIM*0+ZZ] -= tz;
518 /**************************
519 * CALCULATE INTERACTIONS *
520 **************************/
524 /* Calculate table index by multiplying r with table scale and truncate to integer */
530 /* CUBIC SPLINE TABLE ELECTROSTATICS */
533 Geps = vfeps*vftab[vfitab+2];
534 Heps2 = vfeps*vfeps*vftab[vfitab+3];
538 FF = Fp+Geps+2.0*Heps2;
539 felec = -qq21*FF*vftabscale*rinv21;
541 /* Update potential sums from outer loop */
546 /* Calculate temporary vectorial force */
551 /* Update vectorial force */
555 f[j_coord_offset+DIM*1+XX] -= tx;
556 f[j_coord_offset+DIM*1+YY] -= ty;
557 f[j_coord_offset+DIM*1+ZZ] -= tz;
559 /**************************
560 * CALCULATE INTERACTIONS *
561 **************************/
565 /* Calculate table index by multiplying r with table scale and truncate to integer */
571 /* CUBIC SPLINE TABLE ELECTROSTATICS */
574 Geps = vfeps*vftab[vfitab+2];
575 Heps2 = vfeps*vfeps*vftab[vfitab+3];
579 FF = Fp+Geps+2.0*Heps2;
580 felec = -qq22*FF*vftabscale*rinv22;
582 /* Update potential sums from outer loop */
587 /* Calculate temporary vectorial force */
592 /* Update vectorial force */
596 f[j_coord_offset+DIM*2+XX] -= tx;
597 f[j_coord_offset+DIM*2+YY] -= ty;
598 f[j_coord_offset+DIM*2+ZZ] -= tz;
600 /* Inner loop uses 369 flops */
602 /* End of innermost loop */
605 f[i_coord_offset+DIM*0+XX] += fix0;
606 f[i_coord_offset+DIM*0+YY] += fiy0;
607 f[i_coord_offset+DIM*0+ZZ] += fiz0;
611 f[i_coord_offset+DIM*1+XX] += fix1;
612 f[i_coord_offset+DIM*1+YY] += fiy1;
613 f[i_coord_offset+DIM*1+ZZ] += fiz1;
617 f[i_coord_offset+DIM*2+XX] += fix2;
618 f[i_coord_offset+DIM*2+YY] += fiy2;
619 f[i_coord_offset+DIM*2+ZZ] += fiz2;
623 fshift[i_shift_offset+XX] += tx;
624 fshift[i_shift_offset+YY] += ty;
625 fshift[i_shift_offset+ZZ] += tz;
628 /* Update potential energies */
629 kernel_data->energygrp_elec[ggid] += velecsum;
631 /* Increment number of inner iterations */
632 inneriter += j_index_end - j_index_start;
634 /* Outer loop uses 31 flops */
637 /* Increment number of outer iterations */
640 /* Update outer/inner flops */
642 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_VF,outeriter*31 + inneriter*369);
645 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwNone_GeomW3W3_F_c
646 * Electrostatics interaction: CubicSplineTable
647 * VdW interaction: None
648 * Geometry: Water3-Water3
649 * Calculate force/pot: Force
652 nb_kernel_ElecCSTab_VdwNone_GeomW3W3_F_c
653 (t_nblist * gmx_restrict nlist,
654 rvec * gmx_restrict xx,
655 rvec * gmx_restrict ff,
656 t_forcerec * gmx_restrict fr,
657 t_mdatoms * gmx_restrict mdatoms,
658 nb_kernel_data_t * gmx_restrict kernel_data,
659 t_nrnb * gmx_restrict nrnb)
661 int i_shift_offset,i_coord_offset,j_coord_offset;
662 int j_index_start,j_index_end;
663 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
664 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
665 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
666 real *shiftvec,*fshift,*x,*f;
668 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
670 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
672 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
674 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
676 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
678 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
679 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
680 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
681 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
682 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
683 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
684 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
685 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
686 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
687 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
688 real velec,felec,velecsum,facel,crf,krf,krf2;
691 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
699 jindex = nlist->jindex;
701 shiftidx = nlist->shift;
703 shiftvec = fr->shift_vec[0];
704 fshift = fr->fshift[0];
706 charge = mdatoms->chargeA;
708 vftab = kernel_data->table_elec->data;
709 vftabscale = kernel_data->table_elec->scale;
711 /* Setup water-specific parameters */
712 inr = nlist->iinr[0];
713 iq0 = facel*charge[inr+0];
714 iq1 = facel*charge[inr+1];
715 iq2 = facel*charge[inr+2];
733 /* Start outer loop over neighborlists */
734 for(iidx=0; iidx<nri; iidx++)
736 /* Load shift vector for this list */
737 i_shift_offset = DIM*shiftidx[iidx];
738 shX = shiftvec[i_shift_offset+XX];
739 shY = shiftvec[i_shift_offset+YY];
740 shZ = shiftvec[i_shift_offset+ZZ];
742 /* Load limits for loop over neighbors */
743 j_index_start = jindex[iidx];
744 j_index_end = jindex[iidx+1];
746 /* Get outer coordinate index */
748 i_coord_offset = DIM*inr;
750 /* Load i particle coords and add shift vector */
751 ix0 = shX + x[i_coord_offset+DIM*0+XX];
752 iy0 = shY + x[i_coord_offset+DIM*0+YY];
753 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
754 ix1 = shX + x[i_coord_offset+DIM*1+XX];
755 iy1 = shY + x[i_coord_offset+DIM*1+YY];
756 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
757 ix2 = shX + x[i_coord_offset+DIM*2+XX];
758 iy2 = shY + x[i_coord_offset+DIM*2+YY];
759 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
771 /* Start inner kernel loop */
772 for(jidx=j_index_start; jidx<j_index_end; jidx++)
774 /* Get j neighbor index, and coordinate index */
776 j_coord_offset = DIM*jnr;
778 /* load j atom coordinates */
779 jx0 = x[j_coord_offset+DIM*0+XX];
780 jy0 = x[j_coord_offset+DIM*0+YY];
781 jz0 = x[j_coord_offset+DIM*0+ZZ];
782 jx1 = x[j_coord_offset+DIM*1+XX];
783 jy1 = x[j_coord_offset+DIM*1+YY];
784 jz1 = x[j_coord_offset+DIM*1+ZZ];
785 jx2 = x[j_coord_offset+DIM*2+XX];
786 jy2 = x[j_coord_offset+DIM*2+YY];
787 jz2 = x[j_coord_offset+DIM*2+ZZ];
789 /* Calculate displacement vector */
818 /* Calculate squared distance and things based on it */
819 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
820 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
821 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
822 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
823 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
824 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
825 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
826 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
827 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
829 rinv00 = gmx_invsqrt(rsq00);
830 rinv01 = gmx_invsqrt(rsq01);
831 rinv02 = gmx_invsqrt(rsq02);
832 rinv10 = gmx_invsqrt(rsq10);
833 rinv11 = gmx_invsqrt(rsq11);
834 rinv12 = gmx_invsqrt(rsq12);
835 rinv20 = gmx_invsqrt(rsq20);
836 rinv21 = gmx_invsqrt(rsq21);
837 rinv22 = gmx_invsqrt(rsq22);
839 /**************************
840 * CALCULATE INTERACTIONS *
841 **************************/
845 /* Calculate table index by multiplying r with table scale and truncate to integer */
851 /* CUBIC SPLINE TABLE ELECTROSTATICS */
853 Geps = vfeps*vftab[vfitab+2];
854 Heps2 = vfeps*vfeps*vftab[vfitab+3];
856 FF = Fp+Geps+2.0*Heps2;
857 felec = -qq00*FF*vftabscale*rinv00;
861 /* Calculate temporary vectorial force */
866 /* Update vectorial force */
870 f[j_coord_offset+DIM*0+XX] -= tx;
871 f[j_coord_offset+DIM*0+YY] -= ty;
872 f[j_coord_offset+DIM*0+ZZ] -= tz;
874 /**************************
875 * CALCULATE INTERACTIONS *
876 **************************/
880 /* Calculate table index by multiplying r with table scale and truncate to integer */
886 /* CUBIC SPLINE TABLE ELECTROSTATICS */
888 Geps = vfeps*vftab[vfitab+2];
889 Heps2 = vfeps*vfeps*vftab[vfitab+3];
891 FF = Fp+Geps+2.0*Heps2;
892 felec = -qq01*FF*vftabscale*rinv01;
896 /* Calculate temporary vectorial force */
901 /* Update vectorial force */
905 f[j_coord_offset+DIM*1+XX] -= tx;
906 f[j_coord_offset+DIM*1+YY] -= ty;
907 f[j_coord_offset+DIM*1+ZZ] -= tz;
909 /**************************
910 * CALCULATE INTERACTIONS *
911 **************************/
915 /* Calculate table index by multiplying r with table scale and truncate to integer */
921 /* CUBIC SPLINE TABLE ELECTROSTATICS */
923 Geps = vfeps*vftab[vfitab+2];
924 Heps2 = vfeps*vfeps*vftab[vfitab+3];
926 FF = Fp+Geps+2.0*Heps2;
927 felec = -qq02*FF*vftabscale*rinv02;
931 /* Calculate temporary vectorial force */
936 /* Update vectorial force */
940 f[j_coord_offset+DIM*2+XX] -= tx;
941 f[j_coord_offset+DIM*2+YY] -= ty;
942 f[j_coord_offset+DIM*2+ZZ] -= tz;
944 /**************************
945 * CALCULATE INTERACTIONS *
946 **************************/
950 /* Calculate table index by multiplying r with table scale and truncate to integer */
956 /* CUBIC SPLINE TABLE ELECTROSTATICS */
958 Geps = vfeps*vftab[vfitab+2];
959 Heps2 = vfeps*vfeps*vftab[vfitab+3];
961 FF = Fp+Geps+2.0*Heps2;
962 felec = -qq10*FF*vftabscale*rinv10;
966 /* Calculate temporary vectorial force */
971 /* Update vectorial force */
975 f[j_coord_offset+DIM*0+XX] -= tx;
976 f[j_coord_offset+DIM*0+YY] -= ty;
977 f[j_coord_offset+DIM*0+ZZ] -= tz;
979 /**************************
980 * CALCULATE INTERACTIONS *
981 **************************/
985 /* Calculate table index by multiplying r with table scale and truncate to integer */
991 /* CUBIC SPLINE TABLE ELECTROSTATICS */
993 Geps = vfeps*vftab[vfitab+2];
994 Heps2 = vfeps*vfeps*vftab[vfitab+3];
996 FF = Fp+Geps+2.0*Heps2;
997 felec = -qq11*FF*vftabscale*rinv11;
1001 /* Calculate temporary vectorial force */
1006 /* Update vectorial force */
1010 f[j_coord_offset+DIM*1+XX] -= tx;
1011 f[j_coord_offset+DIM*1+YY] -= ty;
1012 f[j_coord_offset+DIM*1+ZZ] -= tz;
1014 /**************************
1015 * CALCULATE INTERACTIONS *
1016 **************************/
1020 /* Calculate table index by multiplying r with table scale and truncate to integer */
1021 rt = r12*vftabscale;
1024 vfitab = 1*4*vfitab;
1026 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1027 F = vftab[vfitab+1];
1028 Geps = vfeps*vftab[vfitab+2];
1029 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1031 FF = Fp+Geps+2.0*Heps2;
1032 felec = -qq12*FF*vftabscale*rinv12;
1036 /* Calculate temporary vectorial force */
1041 /* Update vectorial force */
1045 f[j_coord_offset+DIM*2+XX] -= tx;
1046 f[j_coord_offset+DIM*2+YY] -= ty;
1047 f[j_coord_offset+DIM*2+ZZ] -= tz;
1049 /**************************
1050 * CALCULATE INTERACTIONS *
1051 **************************/
1055 /* Calculate table index by multiplying r with table scale and truncate to integer */
1056 rt = r20*vftabscale;
1059 vfitab = 1*4*vfitab;
1061 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1062 F = vftab[vfitab+1];
1063 Geps = vfeps*vftab[vfitab+2];
1064 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1066 FF = Fp+Geps+2.0*Heps2;
1067 felec = -qq20*FF*vftabscale*rinv20;
1071 /* Calculate temporary vectorial force */
1076 /* Update vectorial force */
1080 f[j_coord_offset+DIM*0+XX] -= tx;
1081 f[j_coord_offset+DIM*0+YY] -= ty;
1082 f[j_coord_offset+DIM*0+ZZ] -= tz;
1084 /**************************
1085 * CALCULATE INTERACTIONS *
1086 **************************/
1090 /* Calculate table index by multiplying r with table scale and truncate to integer */
1091 rt = r21*vftabscale;
1094 vfitab = 1*4*vfitab;
1096 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1097 F = vftab[vfitab+1];
1098 Geps = vfeps*vftab[vfitab+2];
1099 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1101 FF = Fp+Geps+2.0*Heps2;
1102 felec = -qq21*FF*vftabscale*rinv21;
1106 /* Calculate temporary vectorial force */
1111 /* Update vectorial force */
1115 f[j_coord_offset+DIM*1+XX] -= tx;
1116 f[j_coord_offset+DIM*1+YY] -= ty;
1117 f[j_coord_offset+DIM*1+ZZ] -= tz;
1119 /**************************
1120 * CALCULATE INTERACTIONS *
1121 **************************/
1125 /* Calculate table index by multiplying r with table scale and truncate to integer */
1126 rt = r22*vftabscale;
1129 vfitab = 1*4*vfitab;
1131 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1132 F = vftab[vfitab+1];
1133 Geps = vfeps*vftab[vfitab+2];
1134 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1136 FF = Fp+Geps+2.0*Heps2;
1137 felec = -qq22*FF*vftabscale*rinv22;
1141 /* Calculate temporary vectorial force */
1146 /* Update vectorial force */
1150 f[j_coord_offset+DIM*2+XX] -= tx;
1151 f[j_coord_offset+DIM*2+YY] -= ty;
1152 f[j_coord_offset+DIM*2+ZZ] -= tz;
1154 /* Inner loop uses 333 flops */
1156 /* End of innermost loop */
1159 f[i_coord_offset+DIM*0+XX] += fix0;
1160 f[i_coord_offset+DIM*0+YY] += fiy0;
1161 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1165 f[i_coord_offset+DIM*1+XX] += fix1;
1166 f[i_coord_offset+DIM*1+YY] += fiy1;
1167 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1171 f[i_coord_offset+DIM*2+XX] += fix2;
1172 f[i_coord_offset+DIM*2+YY] += fiy2;
1173 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1177 fshift[i_shift_offset+XX] += tx;
1178 fshift[i_shift_offset+YY] += ty;
1179 fshift[i_shift_offset+ZZ] += tz;
1181 /* Increment number of inner iterations */
1182 inneriter += j_index_end - j_index_start;
1184 /* Outer loop uses 30 flops */
1187 /* Increment number of outer iterations */
1190 /* Update outer/inner flops */
1192 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_F,outeriter*30 + inneriter*333);