2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, 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"
50 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwNone_GeomW3W3_VF_c
51 * Electrostatics interaction: CubicSplineTable
52 * VdW interaction: None
53 * Geometry: Water3-Water3
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCSTab_VdwNone_GeomW3W3_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;
81 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
83 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
84 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
85 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
86 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
87 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
88 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
89 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
90 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
91 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
92 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
93 real velec,felec,velecsum,facel,crf,krf,krf2;
96 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
104 jindex = nlist->jindex;
106 shiftidx = nlist->shift;
108 shiftvec = fr->shift_vec[0];
109 fshift = fr->fshift[0];
111 charge = mdatoms->chargeA;
113 vftab = kernel_data->table_elec->data;
114 vftabscale = kernel_data->table_elec->scale;
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];
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 */
179 /* Start inner kernel loop */
180 for(jidx=j_index_start; jidx<j_index_end; jidx++)
182 /* Get j neighbor index, and coordinate index */
184 j_coord_offset = DIM*jnr;
186 /* load j atom coordinates */
187 jx0 = x[j_coord_offset+DIM*0+XX];
188 jy0 = x[j_coord_offset+DIM*0+YY];
189 jz0 = x[j_coord_offset+DIM*0+ZZ];
190 jx1 = x[j_coord_offset+DIM*1+XX];
191 jy1 = x[j_coord_offset+DIM*1+YY];
192 jz1 = x[j_coord_offset+DIM*1+ZZ];
193 jx2 = x[j_coord_offset+DIM*2+XX];
194 jy2 = x[j_coord_offset+DIM*2+YY];
195 jz2 = x[j_coord_offset+DIM*2+ZZ];
197 /* Calculate displacement vector */
226 /* Calculate squared distance and things based on it */
227 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
228 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
229 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
230 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
231 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
232 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
233 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
234 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
235 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
237 rinv00 = gmx_invsqrt(rsq00);
238 rinv01 = gmx_invsqrt(rsq01);
239 rinv02 = gmx_invsqrt(rsq02);
240 rinv10 = gmx_invsqrt(rsq10);
241 rinv11 = gmx_invsqrt(rsq11);
242 rinv12 = gmx_invsqrt(rsq12);
243 rinv20 = gmx_invsqrt(rsq20);
244 rinv21 = gmx_invsqrt(rsq21);
245 rinv22 = gmx_invsqrt(rsq22);
247 /**************************
248 * CALCULATE INTERACTIONS *
249 **************************/
253 /* Calculate table index by multiplying r with table scale and truncate to integer */
259 /* CUBIC SPLINE TABLE ELECTROSTATICS */
262 Geps = vfeps*vftab[vfitab+2];
263 Heps2 = vfeps*vfeps*vftab[vfitab+3];
267 FF = Fp+Geps+2.0*Heps2;
268 felec = -qq00*FF*vftabscale*rinv00;
270 /* 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;
288 /**************************
289 * CALCULATE INTERACTIONS *
290 **************************/
294 /* Calculate table index by multiplying r with table scale and truncate to integer */
300 /* CUBIC SPLINE TABLE ELECTROSTATICS */
303 Geps = vfeps*vftab[vfitab+2];
304 Heps2 = vfeps*vfeps*vftab[vfitab+3];
308 FF = Fp+Geps+2.0*Heps2;
309 felec = -qq01*FF*vftabscale*rinv01;
311 /* Update potential sums from outer loop */
316 /* Calculate temporary vectorial force */
321 /* Update vectorial force */
325 f[j_coord_offset+DIM*1+XX] -= tx;
326 f[j_coord_offset+DIM*1+YY] -= ty;
327 f[j_coord_offset+DIM*1+ZZ] -= tz;
329 /**************************
330 * CALCULATE INTERACTIONS *
331 **************************/
335 /* Calculate table index by multiplying r with table scale and truncate to integer */
341 /* CUBIC SPLINE TABLE ELECTROSTATICS */
344 Geps = vfeps*vftab[vfitab+2];
345 Heps2 = vfeps*vfeps*vftab[vfitab+3];
349 FF = Fp+Geps+2.0*Heps2;
350 felec = -qq02*FF*vftabscale*rinv02;
352 /* Update potential sums from outer loop */
357 /* Calculate temporary vectorial force */
362 /* Update vectorial force */
366 f[j_coord_offset+DIM*2+XX] -= tx;
367 f[j_coord_offset+DIM*2+YY] -= ty;
368 f[j_coord_offset+DIM*2+ZZ] -= tz;
370 /**************************
371 * CALCULATE INTERACTIONS *
372 **************************/
376 /* Calculate table index by multiplying r with table scale and truncate to integer */
382 /* CUBIC SPLINE TABLE ELECTROSTATICS */
385 Geps = vfeps*vftab[vfitab+2];
386 Heps2 = vfeps*vfeps*vftab[vfitab+3];
390 FF = Fp+Geps+2.0*Heps2;
391 felec = -qq10*FF*vftabscale*rinv10;
393 /* Update potential sums from outer loop */
398 /* Calculate temporary vectorial force */
403 /* Update vectorial force */
407 f[j_coord_offset+DIM*0+XX] -= tx;
408 f[j_coord_offset+DIM*0+YY] -= ty;
409 f[j_coord_offset+DIM*0+ZZ] -= tz;
411 /**************************
412 * CALCULATE INTERACTIONS *
413 **************************/
417 /* Calculate table index by multiplying r with table scale and truncate to integer */
423 /* CUBIC SPLINE TABLE ELECTROSTATICS */
426 Geps = vfeps*vftab[vfitab+2];
427 Heps2 = vfeps*vfeps*vftab[vfitab+3];
431 FF = Fp+Geps+2.0*Heps2;
432 felec = -qq11*FF*vftabscale*rinv11;
434 /* Update potential sums from outer loop */
439 /* Calculate temporary vectorial force */
444 /* Update vectorial force */
448 f[j_coord_offset+DIM*1+XX] -= tx;
449 f[j_coord_offset+DIM*1+YY] -= ty;
450 f[j_coord_offset+DIM*1+ZZ] -= tz;
452 /**************************
453 * CALCULATE INTERACTIONS *
454 **************************/
458 /* Calculate table index by multiplying r with table scale and truncate to integer */
464 /* CUBIC SPLINE TABLE ELECTROSTATICS */
467 Geps = vfeps*vftab[vfitab+2];
468 Heps2 = vfeps*vfeps*vftab[vfitab+3];
472 FF = Fp+Geps+2.0*Heps2;
473 felec = -qq12*FF*vftabscale*rinv12;
475 /* Update potential sums from outer loop */
480 /* Calculate temporary vectorial force */
485 /* Update vectorial force */
489 f[j_coord_offset+DIM*2+XX] -= tx;
490 f[j_coord_offset+DIM*2+YY] -= ty;
491 f[j_coord_offset+DIM*2+ZZ] -= tz;
493 /**************************
494 * CALCULATE INTERACTIONS *
495 **************************/
499 /* Calculate table index by multiplying r with table scale and truncate to integer */
505 /* CUBIC SPLINE TABLE ELECTROSTATICS */
508 Geps = vfeps*vftab[vfitab+2];
509 Heps2 = vfeps*vfeps*vftab[vfitab+3];
513 FF = Fp+Geps+2.0*Heps2;
514 felec = -qq20*FF*vftabscale*rinv20;
516 /* Update potential sums from outer loop */
521 /* Calculate temporary vectorial force */
526 /* Update vectorial force */
530 f[j_coord_offset+DIM*0+XX] -= tx;
531 f[j_coord_offset+DIM*0+YY] -= ty;
532 f[j_coord_offset+DIM*0+ZZ] -= tz;
534 /**************************
535 * CALCULATE INTERACTIONS *
536 **************************/
540 /* Calculate table index by multiplying r with table scale and truncate to integer */
546 /* CUBIC SPLINE TABLE ELECTROSTATICS */
549 Geps = vfeps*vftab[vfitab+2];
550 Heps2 = vfeps*vfeps*vftab[vfitab+3];
554 FF = Fp+Geps+2.0*Heps2;
555 felec = -qq21*FF*vftabscale*rinv21;
557 /* Update potential sums from outer loop */
562 /* Calculate temporary vectorial force */
567 /* Update vectorial force */
571 f[j_coord_offset+DIM*1+XX] -= tx;
572 f[j_coord_offset+DIM*1+YY] -= ty;
573 f[j_coord_offset+DIM*1+ZZ] -= tz;
575 /**************************
576 * CALCULATE INTERACTIONS *
577 **************************/
581 /* Calculate table index by multiplying r with table scale and truncate to integer */
587 /* CUBIC SPLINE TABLE ELECTROSTATICS */
590 Geps = vfeps*vftab[vfitab+2];
591 Heps2 = vfeps*vfeps*vftab[vfitab+3];
595 FF = Fp+Geps+2.0*Heps2;
596 felec = -qq22*FF*vftabscale*rinv22;
598 /* Update potential sums from outer loop */
603 /* Calculate temporary vectorial force */
608 /* Update vectorial force */
612 f[j_coord_offset+DIM*2+XX] -= tx;
613 f[j_coord_offset+DIM*2+YY] -= ty;
614 f[j_coord_offset+DIM*2+ZZ] -= tz;
616 /* Inner loop uses 369 flops */
618 /* End of innermost loop */
621 f[i_coord_offset+DIM*0+XX] += fix0;
622 f[i_coord_offset+DIM*0+YY] += fiy0;
623 f[i_coord_offset+DIM*0+ZZ] += fiz0;
627 f[i_coord_offset+DIM*1+XX] += fix1;
628 f[i_coord_offset+DIM*1+YY] += fiy1;
629 f[i_coord_offset+DIM*1+ZZ] += fiz1;
633 f[i_coord_offset+DIM*2+XX] += fix2;
634 f[i_coord_offset+DIM*2+YY] += fiy2;
635 f[i_coord_offset+DIM*2+ZZ] += fiz2;
639 fshift[i_shift_offset+XX] += tx;
640 fshift[i_shift_offset+YY] += ty;
641 fshift[i_shift_offset+ZZ] += tz;
644 /* Update potential energies */
645 kernel_data->energygrp_elec[ggid] += velecsum;
647 /* Increment number of inner iterations */
648 inneriter += j_index_end - j_index_start;
650 /* Outer loop uses 31 flops */
653 /* Increment number of outer iterations */
656 /* Update outer/inner flops */
658 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_VF,outeriter*31 + inneriter*369);
661 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwNone_GeomW3W3_F_c
662 * Electrostatics interaction: CubicSplineTable
663 * VdW interaction: None
664 * Geometry: Water3-Water3
665 * Calculate force/pot: Force
668 nb_kernel_ElecCSTab_VdwNone_GeomW3W3_F_c
669 (t_nblist * gmx_restrict nlist,
670 rvec * gmx_restrict xx,
671 rvec * gmx_restrict ff,
672 t_forcerec * gmx_restrict fr,
673 t_mdatoms * gmx_restrict mdatoms,
674 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
675 t_nrnb * gmx_restrict nrnb)
677 int i_shift_offset,i_coord_offset,j_coord_offset;
678 int j_index_start,j_index_end;
679 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
680 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
681 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
682 real *shiftvec,*fshift,*x,*f;
684 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
686 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
688 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
690 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
692 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
694 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
695 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
696 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
697 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
698 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
699 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
700 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
701 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
702 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
703 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
704 real velec,felec,velecsum,facel,crf,krf,krf2;
707 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
715 jindex = nlist->jindex;
717 shiftidx = nlist->shift;
719 shiftvec = fr->shift_vec[0];
720 fshift = fr->fshift[0];
722 charge = mdatoms->chargeA;
724 vftab = kernel_data->table_elec->data;
725 vftabscale = kernel_data->table_elec->scale;
727 /* Setup water-specific parameters */
728 inr = nlist->iinr[0];
729 iq0 = facel*charge[inr+0];
730 iq1 = facel*charge[inr+1];
731 iq2 = facel*charge[inr+2];
749 /* Start outer loop over neighborlists */
750 for(iidx=0; iidx<nri; iidx++)
752 /* Load shift vector for this list */
753 i_shift_offset = DIM*shiftidx[iidx];
754 shX = shiftvec[i_shift_offset+XX];
755 shY = shiftvec[i_shift_offset+YY];
756 shZ = shiftvec[i_shift_offset+ZZ];
758 /* Load limits for loop over neighbors */
759 j_index_start = jindex[iidx];
760 j_index_end = jindex[iidx+1];
762 /* Get outer coordinate index */
764 i_coord_offset = DIM*inr;
766 /* Load i particle coords and add shift vector */
767 ix0 = shX + x[i_coord_offset+DIM*0+XX];
768 iy0 = shY + x[i_coord_offset+DIM*0+YY];
769 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
770 ix1 = shX + x[i_coord_offset+DIM*1+XX];
771 iy1 = shY + x[i_coord_offset+DIM*1+YY];
772 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
773 ix2 = shX + x[i_coord_offset+DIM*2+XX];
774 iy2 = shY + x[i_coord_offset+DIM*2+YY];
775 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
787 /* Start inner kernel loop */
788 for(jidx=j_index_start; jidx<j_index_end; jidx++)
790 /* Get j neighbor index, and coordinate index */
792 j_coord_offset = DIM*jnr;
794 /* load j atom coordinates */
795 jx0 = x[j_coord_offset+DIM*0+XX];
796 jy0 = x[j_coord_offset+DIM*0+YY];
797 jz0 = x[j_coord_offset+DIM*0+ZZ];
798 jx1 = x[j_coord_offset+DIM*1+XX];
799 jy1 = x[j_coord_offset+DIM*1+YY];
800 jz1 = x[j_coord_offset+DIM*1+ZZ];
801 jx2 = x[j_coord_offset+DIM*2+XX];
802 jy2 = x[j_coord_offset+DIM*2+YY];
803 jz2 = x[j_coord_offset+DIM*2+ZZ];
805 /* Calculate displacement vector */
834 /* Calculate squared distance and things based on it */
835 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
836 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
837 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
838 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
839 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
840 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
841 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
842 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
843 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
845 rinv00 = gmx_invsqrt(rsq00);
846 rinv01 = gmx_invsqrt(rsq01);
847 rinv02 = gmx_invsqrt(rsq02);
848 rinv10 = gmx_invsqrt(rsq10);
849 rinv11 = gmx_invsqrt(rsq11);
850 rinv12 = gmx_invsqrt(rsq12);
851 rinv20 = gmx_invsqrt(rsq20);
852 rinv21 = gmx_invsqrt(rsq21);
853 rinv22 = gmx_invsqrt(rsq22);
855 /**************************
856 * CALCULATE INTERACTIONS *
857 **************************/
861 /* Calculate table index by multiplying r with table scale and truncate to integer */
867 /* CUBIC SPLINE TABLE ELECTROSTATICS */
869 Geps = vfeps*vftab[vfitab+2];
870 Heps2 = vfeps*vfeps*vftab[vfitab+3];
872 FF = Fp+Geps+2.0*Heps2;
873 felec = -qq00*FF*vftabscale*rinv00;
877 /* Calculate temporary vectorial force */
882 /* Update vectorial force */
886 f[j_coord_offset+DIM*0+XX] -= tx;
887 f[j_coord_offset+DIM*0+YY] -= ty;
888 f[j_coord_offset+DIM*0+ZZ] -= tz;
890 /**************************
891 * CALCULATE INTERACTIONS *
892 **************************/
896 /* Calculate table index by multiplying r with table scale and truncate to integer */
902 /* CUBIC SPLINE TABLE ELECTROSTATICS */
904 Geps = vfeps*vftab[vfitab+2];
905 Heps2 = vfeps*vfeps*vftab[vfitab+3];
907 FF = Fp+Geps+2.0*Heps2;
908 felec = -qq01*FF*vftabscale*rinv01;
912 /* Calculate temporary vectorial force */
917 /* Update vectorial force */
921 f[j_coord_offset+DIM*1+XX] -= tx;
922 f[j_coord_offset+DIM*1+YY] -= ty;
923 f[j_coord_offset+DIM*1+ZZ] -= tz;
925 /**************************
926 * CALCULATE INTERACTIONS *
927 **************************/
931 /* Calculate table index by multiplying r with table scale and truncate to integer */
937 /* CUBIC SPLINE TABLE ELECTROSTATICS */
939 Geps = vfeps*vftab[vfitab+2];
940 Heps2 = vfeps*vfeps*vftab[vfitab+3];
942 FF = Fp+Geps+2.0*Heps2;
943 felec = -qq02*FF*vftabscale*rinv02;
947 /* Calculate temporary vectorial force */
952 /* Update vectorial force */
956 f[j_coord_offset+DIM*2+XX] -= tx;
957 f[j_coord_offset+DIM*2+YY] -= ty;
958 f[j_coord_offset+DIM*2+ZZ] -= tz;
960 /**************************
961 * CALCULATE INTERACTIONS *
962 **************************/
966 /* Calculate table index by multiplying r with table scale and truncate to integer */
972 /* CUBIC SPLINE TABLE ELECTROSTATICS */
974 Geps = vfeps*vftab[vfitab+2];
975 Heps2 = vfeps*vfeps*vftab[vfitab+3];
977 FF = Fp+Geps+2.0*Heps2;
978 felec = -qq10*FF*vftabscale*rinv10;
982 /* Calculate temporary vectorial force */
987 /* Update vectorial force */
991 f[j_coord_offset+DIM*0+XX] -= tx;
992 f[j_coord_offset+DIM*0+YY] -= ty;
993 f[j_coord_offset+DIM*0+ZZ] -= tz;
995 /**************************
996 * CALCULATE INTERACTIONS *
997 **************************/
1001 /* Calculate table index by multiplying r with table scale and truncate to integer */
1002 rt = r11*vftabscale;
1005 vfitab = 1*4*vfitab;
1007 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1008 F = vftab[vfitab+1];
1009 Geps = vfeps*vftab[vfitab+2];
1010 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1012 FF = Fp+Geps+2.0*Heps2;
1013 felec = -qq11*FF*vftabscale*rinv11;
1017 /* Calculate temporary vectorial force */
1022 /* Update vectorial force */
1026 f[j_coord_offset+DIM*1+XX] -= tx;
1027 f[j_coord_offset+DIM*1+YY] -= ty;
1028 f[j_coord_offset+DIM*1+ZZ] -= tz;
1030 /**************************
1031 * CALCULATE INTERACTIONS *
1032 **************************/
1036 /* Calculate table index by multiplying r with table scale and truncate to integer */
1037 rt = r12*vftabscale;
1040 vfitab = 1*4*vfitab;
1042 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1043 F = vftab[vfitab+1];
1044 Geps = vfeps*vftab[vfitab+2];
1045 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1047 FF = Fp+Geps+2.0*Heps2;
1048 felec = -qq12*FF*vftabscale*rinv12;
1052 /* Calculate temporary vectorial force */
1057 /* Update vectorial force */
1061 f[j_coord_offset+DIM*2+XX] -= tx;
1062 f[j_coord_offset+DIM*2+YY] -= ty;
1063 f[j_coord_offset+DIM*2+ZZ] -= tz;
1065 /**************************
1066 * CALCULATE INTERACTIONS *
1067 **************************/
1071 /* Calculate table index by multiplying r with table scale and truncate to integer */
1072 rt = r20*vftabscale;
1075 vfitab = 1*4*vfitab;
1077 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1078 F = vftab[vfitab+1];
1079 Geps = vfeps*vftab[vfitab+2];
1080 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1082 FF = Fp+Geps+2.0*Heps2;
1083 felec = -qq20*FF*vftabscale*rinv20;
1087 /* Calculate temporary vectorial force */
1092 /* Update vectorial force */
1096 f[j_coord_offset+DIM*0+XX] -= tx;
1097 f[j_coord_offset+DIM*0+YY] -= ty;
1098 f[j_coord_offset+DIM*0+ZZ] -= tz;
1100 /**************************
1101 * CALCULATE INTERACTIONS *
1102 **************************/
1106 /* Calculate table index by multiplying r with table scale and truncate to integer */
1107 rt = r21*vftabscale;
1110 vfitab = 1*4*vfitab;
1112 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1113 F = vftab[vfitab+1];
1114 Geps = vfeps*vftab[vfitab+2];
1115 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1117 FF = Fp+Geps+2.0*Heps2;
1118 felec = -qq21*FF*vftabscale*rinv21;
1122 /* Calculate temporary vectorial force */
1127 /* Update vectorial force */
1131 f[j_coord_offset+DIM*1+XX] -= tx;
1132 f[j_coord_offset+DIM*1+YY] -= ty;
1133 f[j_coord_offset+DIM*1+ZZ] -= tz;
1135 /**************************
1136 * CALCULATE INTERACTIONS *
1137 **************************/
1141 /* Calculate table index by multiplying r with table scale and truncate to integer */
1142 rt = r22*vftabscale;
1145 vfitab = 1*4*vfitab;
1147 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1148 F = vftab[vfitab+1];
1149 Geps = vfeps*vftab[vfitab+2];
1150 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1152 FF = Fp+Geps+2.0*Heps2;
1153 felec = -qq22*FF*vftabscale*rinv22;
1157 /* Calculate temporary vectorial force */
1162 /* Update vectorial force */
1166 f[j_coord_offset+DIM*2+XX] -= tx;
1167 f[j_coord_offset+DIM*2+YY] -= ty;
1168 f[j_coord_offset+DIM*2+ZZ] -= tz;
1170 /* Inner loop uses 333 flops */
1172 /* End of innermost loop */
1175 f[i_coord_offset+DIM*0+XX] += fix0;
1176 f[i_coord_offset+DIM*0+YY] += fiy0;
1177 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1181 f[i_coord_offset+DIM*1+XX] += fix1;
1182 f[i_coord_offset+DIM*1+YY] += fiy1;
1183 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1187 f[i_coord_offset+DIM*2+XX] += fix2;
1188 f[i_coord_offset+DIM*2+YY] += fiy2;
1189 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1193 fshift[i_shift_offset+XX] += tx;
1194 fshift[i_shift_offset+YY] += ty;
1195 fshift[i_shift_offset+ZZ] += tz;
1197 /* Increment number of inner iterations */
1198 inneriter += j_index_end - j_index_start;
1200 /* Outer loop uses 30 flops */
1203 /* Increment number of outer iterations */
1206 /* Update outer/inner flops */
1208 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_F,outeriter*30 + inneriter*333);