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_GeomW4W4_VF_c
35 * Electrostatics interaction: CubicSplineTable
36 * VdW interaction: None
37 * Geometry: Water4-Water4
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecCSTab_VdwNone_GeomW4W4_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 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
59 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
61 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
63 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
65 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
67 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
68 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
69 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
70 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
71 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
72 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
73 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
74 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
75 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
76 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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 iq1 = facel*charge[inr+1];
103 iq2 = facel*charge[inr+2];
104 iq3 = facel*charge[inr+3];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
141 iy1 = shY + x[i_coord_offset+DIM*1+YY];
142 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
143 ix2 = shX + x[i_coord_offset+DIM*2+XX];
144 iy2 = shY + x[i_coord_offset+DIM*2+YY];
145 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
146 ix3 = shX + x[i_coord_offset+DIM*3+XX];
147 iy3 = shY + x[i_coord_offset+DIM*3+YY];
148 iz3 = shZ + x[i_coord_offset+DIM*3+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 jx1 = x[j_coord_offset+DIM*1+XX];
172 jy1 = x[j_coord_offset+DIM*1+YY];
173 jz1 = x[j_coord_offset+DIM*1+ZZ];
174 jx2 = x[j_coord_offset+DIM*2+XX];
175 jy2 = x[j_coord_offset+DIM*2+YY];
176 jz2 = x[j_coord_offset+DIM*2+ZZ];
177 jx3 = x[j_coord_offset+DIM*3+XX];
178 jy3 = x[j_coord_offset+DIM*3+YY];
179 jz3 = x[j_coord_offset+DIM*3+ZZ];
181 /* Calculate displacement vector */
210 /* Calculate squared distance and things based on it */
211 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
212 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
213 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
214 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
215 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
216 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
217 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
218 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
219 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
221 rinv11 = gmx_invsqrt(rsq11);
222 rinv12 = gmx_invsqrt(rsq12);
223 rinv13 = gmx_invsqrt(rsq13);
224 rinv21 = gmx_invsqrt(rsq21);
225 rinv22 = gmx_invsqrt(rsq22);
226 rinv23 = gmx_invsqrt(rsq23);
227 rinv31 = gmx_invsqrt(rsq31);
228 rinv32 = gmx_invsqrt(rsq32);
229 rinv33 = gmx_invsqrt(rsq33);
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 = -qq11*FF*vftabscale*rinv11;
254 /* Update potential sums from outer loop */
259 /* Calculate temporary vectorial force */
264 /* Update vectorial force */
268 f[j_coord_offset+DIM*1+XX] -= tx;
269 f[j_coord_offset+DIM*1+YY] -= ty;
270 f[j_coord_offset+DIM*1+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 = -qq12*FF*vftabscale*rinv12;
295 /* Update potential sums from outer loop */
300 /* Calculate temporary vectorial force */
305 /* Update vectorial force */
309 f[j_coord_offset+DIM*2+XX] -= tx;
310 f[j_coord_offset+DIM*2+YY] -= ty;
311 f[j_coord_offset+DIM*2+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 = -qq13*FF*vftabscale*rinv13;
336 /* Update potential sums from outer loop */
341 /* Calculate temporary vectorial force */
346 /* Update vectorial force */
350 f[j_coord_offset+DIM*3+XX] -= tx;
351 f[j_coord_offset+DIM*3+YY] -= ty;
352 f[j_coord_offset+DIM*3+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 = -qq21*FF*vftabscale*rinv21;
377 /* Update potential sums from outer loop */
382 /* Calculate temporary vectorial force */
387 /* Update vectorial force */
391 f[j_coord_offset+DIM*1+XX] -= tx;
392 f[j_coord_offset+DIM*1+YY] -= ty;
393 f[j_coord_offset+DIM*1+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 = -qq22*FF*vftabscale*rinv22;
418 /* Update potential sums from outer loop */
423 /* Calculate temporary vectorial force */
428 /* Update vectorial force */
432 f[j_coord_offset+DIM*2+XX] -= tx;
433 f[j_coord_offset+DIM*2+YY] -= ty;
434 f[j_coord_offset+DIM*2+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 = -qq23*FF*vftabscale*rinv23;
459 /* Update potential sums from outer loop */
464 /* Calculate temporary vectorial force */
469 /* Update vectorial force */
473 f[j_coord_offset+DIM*3+XX] -= tx;
474 f[j_coord_offset+DIM*3+YY] -= ty;
475 f[j_coord_offset+DIM*3+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 = -qq31*FF*vftabscale*rinv31;
500 /* Update potential sums from outer loop */
505 /* Calculate temporary vectorial force */
510 /* Update vectorial force */
514 f[j_coord_offset+DIM*1+XX] -= tx;
515 f[j_coord_offset+DIM*1+YY] -= ty;
516 f[j_coord_offset+DIM*1+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 = -qq32*FF*vftabscale*rinv32;
541 /* Update potential sums from outer loop */
546 /* Calculate temporary vectorial force */
551 /* Update vectorial force */
555 f[j_coord_offset+DIM*2+XX] -= tx;
556 f[j_coord_offset+DIM*2+YY] -= ty;
557 f[j_coord_offset+DIM*2+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 = -qq33*FF*vftabscale*rinv33;
582 /* Update potential sums from outer loop */
587 /* Calculate temporary vectorial force */
592 /* Update vectorial force */
596 f[j_coord_offset+DIM*3+XX] -= tx;
597 f[j_coord_offset+DIM*3+YY] -= ty;
598 f[j_coord_offset+DIM*3+ZZ] -= tz;
600 /* Inner loop uses 369 flops */
602 /* End of innermost loop */
605 f[i_coord_offset+DIM*1+XX] += fix1;
606 f[i_coord_offset+DIM*1+YY] += fiy1;
607 f[i_coord_offset+DIM*1+ZZ] += fiz1;
611 f[i_coord_offset+DIM*2+XX] += fix2;
612 f[i_coord_offset+DIM*2+YY] += fiy2;
613 f[i_coord_offset+DIM*2+ZZ] += fiz2;
617 f[i_coord_offset+DIM*3+XX] += fix3;
618 f[i_coord_offset+DIM*3+YY] += fiy3;
619 f[i_coord_offset+DIM*3+ZZ] += fiz3;
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_W4W4_VF,outeriter*31 + inneriter*369);
645 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwNone_GeomW4W4_F_c
646 * Electrostatics interaction: CubicSplineTable
647 * VdW interaction: None
648 * Geometry: Water4-Water4
649 * Calculate force/pot: Force
652 nb_kernel_ElecCSTab_VdwNone_GeomW4W4_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 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
670 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
672 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
674 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
676 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
678 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
679 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
680 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
681 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
682 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
683 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
684 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
685 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
686 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
687 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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 iq1 = facel*charge[inr+1];
714 iq2 = facel*charge[inr+2];
715 iq3 = facel*charge[inr+3];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
752 iy1 = shY + x[i_coord_offset+DIM*1+YY];
753 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
754 ix2 = shX + x[i_coord_offset+DIM*2+XX];
755 iy2 = shY + x[i_coord_offset+DIM*2+YY];
756 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
757 ix3 = shX + x[i_coord_offset+DIM*3+XX];
758 iy3 = shY + x[i_coord_offset+DIM*3+YY];
759 iz3 = shZ + x[i_coord_offset+DIM*3+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 jx1 = x[j_coord_offset+DIM*1+XX];
780 jy1 = x[j_coord_offset+DIM*1+YY];
781 jz1 = x[j_coord_offset+DIM*1+ZZ];
782 jx2 = x[j_coord_offset+DIM*2+XX];
783 jy2 = x[j_coord_offset+DIM*2+YY];
784 jz2 = x[j_coord_offset+DIM*2+ZZ];
785 jx3 = x[j_coord_offset+DIM*3+XX];
786 jy3 = x[j_coord_offset+DIM*3+YY];
787 jz3 = x[j_coord_offset+DIM*3+ZZ];
789 /* Calculate displacement vector */
818 /* Calculate squared distance and things based on it */
819 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
820 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
821 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
822 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
823 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
824 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
825 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
826 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
827 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
829 rinv11 = gmx_invsqrt(rsq11);
830 rinv12 = gmx_invsqrt(rsq12);
831 rinv13 = gmx_invsqrt(rsq13);
832 rinv21 = gmx_invsqrt(rsq21);
833 rinv22 = gmx_invsqrt(rsq22);
834 rinv23 = gmx_invsqrt(rsq23);
835 rinv31 = gmx_invsqrt(rsq31);
836 rinv32 = gmx_invsqrt(rsq32);
837 rinv33 = gmx_invsqrt(rsq33);
839 /**************************
840 * CALCULATE INTERACTIONS *
841 **************************/
845 /* Calculate table index by multiplying r with table scale and truncate to integer */
851 /* CUBIC SPLINE TABLE ELECTROSTATICS */
854 Geps = vfeps*vftab[vfitab+2];
855 Heps2 = vfeps*vfeps*vftab[vfitab+3];
857 FF = Fp+Geps+2.0*Heps2;
858 felec = -qq11*FF*vftabscale*rinv11;
862 /* Calculate temporary vectorial force */
867 /* Update vectorial force */
871 f[j_coord_offset+DIM*1+XX] -= tx;
872 f[j_coord_offset+DIM*1+YY] -= ty;
873 f[j_coord_offset+DIM*1+ZZ] -= tz;
875 /**************************
876 * CALCULATE INTERACTIONS *
877 **************************/
881 /* Calculate table index by multiplying r with table scale and truncate to integer */
887 /* CUBIC SPLINE TABLE ELECTROSTATICS */
890 Geps = vfeps*vftab[vfitab+2];
891 Heps2 = vfeps*vfeps*vftab[vfitab+3];
893 FF = Fp+Geps+2.0*Heps2;
894 felec = -qq12*FF*vftabscale*rinv12;
898 /* Calculate temporary vectorial force */
903 /* Update vectorial force */
907 f[j_coord_offset+DIM*2+XX] -= tx;
908 f[j_coord_offset+DIM*2+YY] -= ty;
909 f[j_coord_offset+DIM*2+ZZ] -= tz;
911 /**************************
912 * CALCULATE INTERACTIONS *
913 **************************/
917 /* Calculate table index by multiplying r with table scale and truncate to integer */
923 /* CUBIC SPLINE TABLE ELECTROSTATICS */
926 Geps = vfeps*vftab[vfitab+2];
927 Heps2 = vfeps*vfeps*vftab[vfitab+3];
929 FF = Fp+Geps+2.0*Heps2;
930 felec = -qq13*FF*vftabscale*rinv13;
934 /* Calculate temporary vectorial force */
939 /* Update vectorial force */
943 f[j_coord_offset+DIM*3+XX] -= tx;
944 f[j_coord_offset+DIM*3+YY] -= ty;
945 f[j_coord_offset+DIM*3+ZZ] -= tz;
947 /**************************
948 * CALCULATE INTERACTIONS *
949 **************************/
953 /* Calculate table index by multiplying r with table scale and truncate to integer */
959 /* CUBIC SPLINE TABLE ELECTROSTATICS */
962 Geps = vfeps*vftab[vfitab+2];
963 Heps2 = vfeps*vfeps*vftab[vfitab+3];
965 FF = Fp+Geps+2.0*Heps2;
966 felec = -qq21*FF*vftabscale*rinv21;
970 /* Calculate temporary vectorial force */
975 /* Update vectorial force */
979 f[j_coord_offset+DIM*1+XX] -= tx;
980 f[j_coord_offset+DIM*1+YY] -= ty;
981 f[j_coord_offset+DIM*1+ZZ] -= tz;
983 /**************************
984 * CALCULATE INTERACTIONS *
985 **************************/
989 /* Calculate table index by multiplying r with table scale and truncate to integer */
995 /* CUBIC SPLINE TABLE ELECTROSTATICS */
998 Geps = vfeps*vftab[vfitab+2];
999 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1001 FF = Fp+Geps+2.0*Heps2;
1002 felec = -qq22*FF*vftabscale*rinv22;
1006 /* Calculate temporary vectorial force */
1011 /* Update vectorial force */
1015 f[j_coord_offset+DIM*2+XX] -= tx;
1016 f[j_coord_offset+DIM*2+YY] -= ty;
1017 f[j_coord_offset+DIM*2+ZZ] -= tz;
1019 /**************************
1020 * CALCULATE INTERACTIONS *
1021 **************************/
1025 /* Calculate table index by multiplying r with table scale and truncate to integer */
1026 rt = r23*vftabscale;
1029 vfitab = 1*4*vfitab;
1031 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1033 F = vftab[vfitab+1];
1034 Geps = vfeps*vftab[vfitab+2];
1035 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1037 FF = Fp+Geps+2.0*Heps2;
1038 felec = -qq23*FF*vftabscale*rinv23;
1042 /* Calculate temporary vectorial force */
1047 /* Update vectorial force */
1051 f[j_coord_offset+DIM*3+XX] -= tx;
1052 f[j_coord_offset+DIM*3+YY] -= ty;
1053 f[j_coord_offset+DIM*3+ZZ] -= tz;
1055 /**************************
1056 * CALCULATE INTERACTIONS *
1057 **************************/
1061 /* Calculate table index by multiplying r with table scale and truncate to integer */
1062 rt = r31*vftabscale;
1065 vfitab = 1*4*vfitab;
1067 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1069 F = vftab[vfitab+1];
1070 Geps = vfeps*vftab[vfitab+2];
1071 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1073 FF = Fp+Geps+2.0*Heps2;
1074 felec = -qq31*FF*vftabscale*rinv31;
1078 /* Calculate temporary vectorial force */
1083 /* Update vectorial force */
1087 f[j_coord_offset+DIM*1+XX] -= tx;
1088 f[j_coord_offset+DIM*1+YY] -= ty;
1089 f[j_coord_offset+DIM*1+ZZ] -= tz;
1091 /**************************
1092 * CALCULATE INTERACTIONS *
1093 **************************/
1097 /* Calculate table index by multiplying r with table scale and truncate to integer */
1098 rt = r32*vftabscale;
1101 vfitab = 1*4*vfitab;
1103 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1105 F = vftab[vfitab+1];
1106 Geps = vfeps*vftab[vfitab+2];
1107 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1109 FF = Fp+Geps+2.0*Heps2;
1110 felec = -qq32*FF*vftabscale*rinv32;
1114 /* Calculate temporary vectorial force */
1119 /* Update vectorial force */
1123 f[j_coord_offset+DIM*2+XX] -= tx;
1124 f[j_coord_offset+DIM*2+YY] -= ty;
1125 f[j_coord_offset+DIM*2+ZZ] -= tz;
1127 /**************************
1128 * CALCULATE INTERACTIONS *
1129 **************************/
1133 /* Calculate table index by multiplying r with table scale and truncate to integer */
1134 rt = r33*vftabscale;
1137 vfitab = 1*4*vfitab;
1139 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1141 F = vftab[vfitab+1];
1142 Geps = vfeps*vftab[vfitab+2];
1143 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1145 FF = Fp+Geps+2.0*Heps2;
1146 felec = -qq33*FF*vftabscale*rinv33;
1150 /* Calculate temporary vectorial force */
1155 /* Update vectorial force */
1159 f[j_coord_offset+DIM*3+XX] -= tx;
1160 f[j_coord_offset+DIM*3+YY] -= ty;
1161 f[j_coord_offset+DIM*3+ZZ] -= tz;
1163 /* Inner loop uses 333 flops */
1165 /* End of innermost loop */
1168 f[i_coord_offset+DIM*1+XX] += fix1;
1169 f[i_coord_offset+DIM*1+YY] += fiy1;
1170 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1174 f[i_coord_offset+DIM*2+XX] += fix2;
1175 f[i_coord_offset+DIM*2+YY] += fiy2;
1176 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1180 f[i_coord_offset+DIM*3+XX] += fix3;
1181 f[i_coord_offset+DIM*3+YY] += fiy3;
1182 f[i_coord_offset+DIM*3+ZZ] += fiz3;
1186 fshift[i_shift_offset+XX] += tx;
1187 fshift[i_shift_offset+YY] += ty;
1188 fshift[i_shift_offset+ZZ] += tz;
1190 /* Increment number of inner iterations */
1191 inneriter += j_index_end - j_index_start;
1193 /* Outer loop uses 30 flops */
1196 /* Increment number of outer iterations */
1199 /* Update outer/inner flops */
1201 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_F,outeriter*30 + inneriter*333);