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 "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
48 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwNone_GeomW3W3_VF_c
49 * Electrostatics interaction: CubicSplineTable
50 * VdW interaction: None
51 * Geometry: Water3-Water3
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecCSTab_VdwNone_GeomW3W3_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;
79 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
81 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
82 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
83 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
84 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
85 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
86 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
87 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
88 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
89 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
90 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
91 real velec,felec,velecsum,facel,crf,krf,krf2;
94 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
102 jindex = nlist->jindex;
104 shiftidx = nlist->shift;
106 shiftvec = fr->shift_vec[0];
107 fshift = fr->fshift[0];
109 charge = mdatoms->chargeA;
111 vftab = kernel_data->table_elec->data;
112 vftabscale = kernel_data->table_elec->scale;
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];
136 /* Start outer loop over neighborlists */
137 for(iidx=0; iidx<nri; iidx++)
139 /* Load shift vector for this list */
140 i_shift_offset = DIM*shiftidx[iidx];
141 shX = shiftvec[i_shift_offset+XX];
142 shY = shiftvec[i_shift_offset+YY];
143 shZ = shiftvec[i_shift_offset+ZZ];
145 /* Load limits for loop over neighbors */
146 j_index_start = jindex[iidx];
147 j_index_end = jindex[iidx+1];
149 /* Get outer coordinate index */
151 i_coord_offset = DIM*inr;
153 /* Load i particle coords and add shift vector */
154 ix0 = shX + x[i_coord_offset+DIM*0+XX];
155 iy0 = shY + x[i_coord_offset+DIM*0+YY];
156 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
157 ix1 = shX + x[i_coord_offset+DIM*1+XX];
158 iy1 = shY + x[i_coord_offset+DIM*1+YY];
159 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
160 ix2 = shX + x[i_coord_offset+DIM*2+XX];
161 iy2 = shY + x[i_coord_offset+DIM*2+YY];
162 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
174 /* Reset potential sums */
177 /* Start inner kernel loop */
178 for(jidx=j_index_start; jidx<j_index_end; jidx++)
180 /* Get j neighbor index, and coordinate index */
182 j_coord_offset = DIM*jnr;
184 /* load j atom coordinates */
185 jx0 = x[j_coord_offset+DIM*0+XX];
186 jy0 = x[j_coord_offset+DIM*0+YY];
187 jz0 = x[j_coord_offset+DIM*0+ZZ];
188 jx1 = x[j_coord_offset+DIM*1+XX];
189 jy1 = x[j_coord_offset+DIM*1+YY];
190 jz1 = x[j_coord_offset+DIM*1+ZZ];
191 jx2 = x[j_coord_offset+DIM*2+XX];
192 jy2 = x[j_coord_offset+DIM*2+YY];
193 jz2 = x[j_coord_offset+DIM*2+ZZ];
195 /* Calculate displacement vector */
224 /* Calculate squared distance and things based on it */
225 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
226 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
227 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
228 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
229 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
230 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
231 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
232 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
233 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
235 rinv00 = gmx_invsqrt(rsq00);
236 rinv01 = gmx_invsqrt(rsq01);
237 rinv02 = gmx_invsqrt(rsq02);
238 rinv10 = gmx_invsqrt(rsq10);
239 rinv11 = gmx_invsqrt(rsq11);
240 rinv12 = gmx_invsqrt(rsq12);
241 rinv20 = gmx_invsqrt(rsq20);
242 rinv21 = gmx_invsqrt(rsq21);
243 rinv22 = gmx_invsqrt(rsq22);
245 /**************************
246 * CALCULATE INTERACTIONS *
247 **************************/
251 /* Calculate table index by multiplying r with table scale and truncate to integer */
257 /* CUBIC SPLINE TABLE ELECTROSTATICS */
260 Geps = vfeps*vftab[vfitab+2];
261 Heps2 = vfeps*vfeps*vftab[vfitab+3];
265 FF = Fp+Geps+2.0*Heps2;
266 felec = -qq00*FF*vftabscale*rinv00;
268 /* 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;
286 /**************************
287 * CALCULATE INTERACTIONS *
288 **************************/
292 /* Calculate table index by multiplying r with table scale and truncate to integer */
298 /* CUBIC SPLINE TABLE ELECTROSTATICS */
301 Geps = vfeps*vftab[vfitab+2];
302 Heps2 = vfeps*vfeps*vftab[vfitab+3];
306 FF = Fp+Geps+2.0*Heps2;
307 felec = -qq01*FF*vftabscale*rinv01;
309 /* Update potential sums from outer loop */
314 /* Calculate temporary vectorial force */
319 /* Update vectorial force */
323 f[j_coord_offset+DIM*1+XX] -= tx;
324 f[j_coord_offset+DIM*1+YY] -= ty;
325 f[j_coord_offset+DIM*1+ZZ] -= tz;
327 /**************************
328 * CALCULATE INTERACTIONS *
329 **************************/
333 /* Calculate table index by multiplying r with table scale and truncate to integer */
339 /* CUBIC SPLINE TABLE ELECTROSTATICS */
342 Geps = vfeps*vftab[vfitab+2];
343 Heps2 = vfeps*vfeps*vftab[vfitab+3];
347 FF = Fp+Geps+2.0*Heps2;
348 felec = -qq02*FF*vftabscale*rinv02;
350 /* Update potential sums from outer loop */
355 /* Calculate temporary vectorial force */
360 /* Update vectorial force */
364 f[j_coord_offset+DIM*2+XX] -= tx;
365 f[j_coord_offset+DIM*2+YY] -= ty;
366 f[j_coord_offset+DIM*2+ZZ] -= tz;
368 /**************************
369 * CALCULATE INTERACTIONS *
370 **************************/
374 /* Calculate table index by multiplying r with table scale and truncate to integer */
380 /* CUBIC SPLINE TABLE ELECTROSTATICS */
383 Geps = vfeps*vftab[vfitab+2];
384 Heps2 = vfeps*vfeps*vftab[vfitab+3];
388 FF = Fp+Geps+2.0*Heps2;
389 felec = -qq10*FF*vftabscale*rinv10;
391 /* Update potential sums from outer loop */
396 /* Calculate temporary vectorial force */
401 /* Update vectorial force */
405 f[j_coord_offset+DIM*0+XX] -= tx;
406 f[j_coord_offset+DIM*0+YY] -= ty;
407 f[j_coord_offset+DIM*0+ZZ] -= tz;
409 /**************************
410 * CALCULATE INTERACTIONS *
411 **************************/
415 /* Calculate table index by multiplying r with table scale and truncate to integer */
421 /* CUBIC SPLINE TABLE ELECTROSTATICS */
424 Geps = vfeps*vftab[vfitab+2];
425 Heps2 = vfeps*vfeps*vftab[vfitab+3];
429 FF = Fp+Geps+2.0*Heps2;
430 felec = -qq11*FF*vftabscale*rinv11;
432 /* Update potential sums from outer loop */
437 /* Calculate temporary vectorial force */
442 /* Update vectorial force */
446 f[j_coord_offset+DIM*1+XX] -= tx;
447 f[j_coord_offset+DIM*1+YY] -= ty;
448 f[j_coord_offset+DIM*1+ZZ] -= tz;
450 /**************************
451 * CALCULATE INTERACTIONS *
452 **************************/
456 /* Calculate table index by multiplying r with table scale and truncate to integer */
462 /* CUBIC SPLINE TABLE ELECTROSTATICS */
465 Geps = vfeps*vftab[vfitab+2];
466 Heps2 = vfeps*vfeps*vftab[vfitab+3];
470 FF = Fp+Geps+2.0*Heps2;
471 felec = -qq12*FF*vftabscale*rinv12;
473 /* Update potential sums from outer loop */
478 /* Calculate temporary vectorial force */
483 /* Update vectorial force */
487 f[j_coord_offset+DIM*2+XX] -= tx;
488 f[j_coord_offset+DIM*2+YY] -= ty;
489 f[j_coord_offset+DIM*2+ZZ] -= tz;
491 /**************************
492 * CALCULATE INTERACTIONS *
493 **************************/
497 /* Calculate table index by multiplying r with table scale and truncate to integer */
503 /* CUBIC SPLINE TABLE ELECTROSTATICS */
506 Geps = vfeps*vftab[vfitab+2];
507 Heps2 = vfeps*vfeps*vftab[vfitab+3];
511 FF = Fp+Geps+2.0*Heps2;
512 felec = -qq20*FF*vftabscale*rinv20;
514 /* Update potential sums from outer loop */
519 /* Calculate temporary vectorial force */
524 /* Update vectorial force */
528 f[j_coord_offset+DIM*0+XX] -= tx;
529 f[j_coord_offset+DIM*0+YY] -= ty;
530 f[j_coord_offset+DIM*0+ZZ] -= tz;
532 /**************************
533 * CALCULATE INTERACTIONS *
534 **************************/
538 /* Calculate table index by multiplying r with table scale and truncate to integer */
544 /* CUBIC SPLINE TABLE ELECTROSTATICS */
547 Geps = vfeps*vftab[vfitab+2];
548 Heps2 = vfeps*vfeps*vftab[vfitab+3];
552 FF = Fp+Geps+2.0*Heps2;
553 felec = -qq21*FF*vftabscale*rinv21;
555 /* Update potential sums from outer loop */
560 /* Calculate temporary vectorial force */
565 /* Update vectorial force */
569 f[j_coord_offset+DIM*1+XX] -= tx;
570 f[j_coord_offset+DIM*1+YY] -= ty;
571 f[j_coord_offset+DIM*1+ZZ] -= tz;
573 /**************************
574 * CALCULATE INTERACTIONS *
575 **************************/
579 /* Calculate table index by multiplying r with table scale and truncate to integer */
585 /* CUBIC SPLINE TABLE ELECTROSTATICS */
588 Geps = vfeps*vftab[vfitab+2];
589 Heps2 = vfeps*vfeps*vftab[vfitab+3];
593 FF = Fp+Geps+2.0*Heps2;
594 felec = -qq22*FF*vftabscale*rinv22;
596 /* Update potential sums from outer loop */
601 /* Calculate temporary vectorial force */
606 /* Update vectorial force */
610 f[j_coord_offset+DIM*2+XX] -= tx;
611 f[j_coord_offset+DIM*2+YY] -= ty;
612 f[j_coord_offset+DIM*2+ZZ] -= tz;
614 /* Inner loop uses 369 flops */
616 /* End of innermost loop */
619 f[i_coord_offset+DIM*0+XX] += fix0;
620 f[i_coord_offset+DIM*0+YY] += fiy0;
621 f[i_coord_offset+DIM*0+ZZ] += fiz0;
625 f[i_coord_offset+DIM*1+XX] += fix1;
626 f[i_coord_offset+DIM*1+YY] += fiy1;
627 f[i_coord_offset+DIM*1+ZZ] += fiz1;
631 f[i_coord_offset+DIM*2+XX] += fix2;
632 f[i_coord_offset+DIM*2+YY] += fiy2;
633 f[i_coord_offset+DIM*2+ZZ] += fiz2;
637 fshift[i_shift_offset+XX] += tx;
638 fshift[i_shift_offset+YY] += ty;
639 fshift[i_shift_offset+ZZ] += tz;
642 /* Update potential energies */
643 kernel_data->energygrp_elec[ggid] += velecsum;
645 /* Increment number of inner iterations */
646 inneriter += j_index_end - j_index_start;
648 /* Outer loop uses 31 flops */
651 /* Increment number of outer iterations */
654 /* Update outer/inner flops */
656 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_VF,outeriter*31 + inneriter*369);
659 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwNone_GeomW3W3_F_c
660 * Electrostatics interaction: CubicSplineTable
661 * VdW interaction: None
662 * Geometry: Water3-Water3
663 * Calculate force/pot: Force
666 nb_kernel_ElecCSTab_VdwNone_GeomW3W3_F_c
667 (t_nblist * gmx_restrict nlist,
668 rvec * gmx_restrict xx,
669 rvec * gmx_restrict ff,
670 t_forcerec * gmx_restrict fr,
671 t_mdatoms * gmx_restrict mdatoms,
672 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
673 t_nrnb * gmx_restrict nrnb)
675 int i_shift_offset,i_coord_offset,j_coord_offset;
676 int j_index_start,j_index_end;
677 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
678 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
679 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
680 real *shiftvec,*fshift,*x,*f;
682 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
684 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
686 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
688 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
690 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
692 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
693 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
694 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
695 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
696 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
697 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
698 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
699 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
700 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
701 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
702 real velec,felec,velecsum,facel,crf,krf,krf2;
705 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
713 jindex = nlist->jindex;
715 shiftidx = nlist->shift;
717 shiftvec = fr->shift_vec[0];
718 fshift = fr->fshift[0];
720 charge = mdatoms->chargeA;
722 vftab = kernel_data->table_elec->data;
723 vftabscale = kernel_data->table_elec->scale;
725 /* Setup water-specific parameters */
726 inr = nlist->iinr[0];
727 iq0 = facel*charge[inr+0];
728 iq1 = facel*charge[inr+1];
729 iq2 = facel*charge[inr+2];
747 /* Start outer loop over neighborlists */
748 for(iidx=0; iidx<nri; iidx++)
750 /* Load shift vector for this list */
751 i_shift_offset = DIM*shiftidx[iidx];
752 shX = shiftvec[i_shift_offset+XX];
753 shY = shiftvec[i_shift_offset+YY];
754 shZ = shiftvec[i_shift_offset+ZZ];
756 /* Load limits for loop over neighbors */
757 j_index_start = jindex[iidx];
758 j_index_end = jindex[iidx+1];
760 /* Get outer coordinate index */
762 i_coord_offset = DIM*inr;
764 /* Load i particle coords and add shift vector */
765 ix0 = shX + x[i_coord_offset+DIM*0+XX];
766 iy0 = shY + x[i_coord_offset+DIM*0+YY];
767 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
768 ix1 = shX + x[i_coord_offset+DIM*1+XX];
769 iy1 = shY + x[i_coord_offset+DIM*1+YY];
770 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
771 ix2 = shX + x[i_coord_offset+DIM*2+XX];
772 iy2 = shY + x[i_coord_offset+DIM*2+YY];
773 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
785 /* Start inner kernel loop */
786 for(jidx=j_index_start; jidx<j_index_end; jidx++)
788 /* Get j neighbor index, and coordinate index */
790 j_coord_offset = DIM*jnr;
792 /* load j atom coordinates */
793 jx0 = x[j_coord_offset+DIM*0+XX];
794 jy0 = x[j_coord_offset+DIM*0+YY];
795 jz0 = x[j_coord_offset+DIM*0+ZZ];
796 jx1 = x[j_coord_offset+DIM*1+XX];
797 jy1 = x[j_coord_offset+DIM*1+YY];
798 jz1 = x[j_coord_offset+DIM*1+ZZ];
799 jx2 = x[j_coord_offset+DIM*2+XX];
800 jy2 = x[j_coord_offset+DIM*2+YY];
801 jz2 = x[j_coord_offset+DIM*2+ZZ];
803 /* Calculate displacement vector */
832 /* Calculate squared distance and things based on it */
833 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
834 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
835 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
836 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
837 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
838 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
839 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
840 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
841 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
843 rinv00 = gmx_invsqrt(rsq00);
844 rinv01 = gmx_invsqrt(rsq01);
845 rinv02 = gmx_invsqrt(rsq02);
846 rinv10 = gmx_invsqrt(rsq10);
847 rinv11 = gmx_invsqrt(rsq11);
848 rinv12 = gmx_invsqrt(rsq12);
849 rinv20 = gmx_invsqrt(rsq20);
850 rinv21 = gmx_invsqrt(rsq21);
851 rinv22 = gmx_invsqrt(rsq22);
853 /**************************
854 * CALCULATE INTERACTIONS *
855 **************************/
859 /* Calculate table index by multiplying r with table scale and truncate to integer */
865 /* CUBIC SPLINE TABLE ELECTROSTATICS */
867 Geps = vfeps*vftab[vfitab+2];
868 Heps2 = vfeps*vfeps*vftab[vfitab+3];
870 FF = Fp+Geps+2.0*Heps2;
871 felec = -qq00*FF*vftabscale*rinv00;
875 /* Calculate temporary vectorial force */
880 /* Update vectorial force */
884 f[j_coord_offset+DIM*0+XX] -= tx;
885 f[j_coord_offset+DIM*0+YY] -= ty;
886 f[j_coord_offset+DIM*0+ZZ] -= tz;
888 /**************************
889 * CALCULATE INTERACTIONS *
890 **************************/
894 /* Calculate table index by multiplying r with table scale and truncate to integer */
900 /* CUBIC SPLINE TABLE ELECTROSTATICS */
902 Geps = vfeps*vftab[vfitab+2];
903 Heps2 = vfeps*vfeps*vftab[vfitab+3];
905 FF = Fp+Geps+2.0*Heps2;
906 felec = -qq01*FF*vftabscale*rinv01;
910 /* Calculate temporary vectorial force */
915 /* Update vectorial force */
919 f[j_coord_offset+DIM*1+XX] -= tx;
920 f[j_coord_offset+DIM*1+YY] -= ty;
921 f[j_coord_offset+DIM*1+ZZ] -= tz;
923 /**************************
924 * CALCULATE INTERACTIONS *
925 **************************/
929 /* Calculate table index by multiplying r with table scale and truncate to integer */
935 /* CUBIC SPLINE TABLE ELECTROSTATICS */
937 Geps = vfeps*vftab[vfitab+2];
938 Heps2 = vfeps*vfeps*vftab[vfitab+3];
940 FF = Fp+Geps+2.0*Heps2;
941 felec = -qq02*FF*vftabscale*rinv02;
945 /* Calculate temporary vectorial force */
950 /* Update vectorial force */
954 f[j_coord_offset+DIM*2+XX] -= tx;
955 f[j_coord_offset+DIM*2+YY] -= ty;
956 f[j_coord_offset+DIM*2+ZZ] -= tz;
958 /**************************
959 * CALCULATE INTERACTIONS *
960 **************************/
964 /* Calculate table index by multiplying r with table scale and truncate to integer */
970 /* CUBIC SPLINE TABLE ELECTROSTATICS */
972 Geps = vfeps*vftab[vfitab+2];
973 Heps2 = vfeps*vfeps*vftab[vfitab+3];
975 FF = Fp+Geps+2.0*Heps2;
976 felec = -qq10*FF*vftabscale*rinv10;
980 /* Calculate temporary vectorial force */
985 /* Update vectorial force */
989 f[j_coord_offset+DIM*0+XX] -= tx;
990 f[j_coord_offset+DIM*0+YY] -= ty;
991 f[j_coord_offset+DIM*0+ZZ] -= tz;
993 /**************************
994 * CALCULATE INTERACTIONS *
995 **************************/
999 /* Calculate table index by multiplying r with table scale and truncate to integer */
1000 rt = r11*vftabscale;
1003 vfitab = 1*4*vfitab;
1005 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1006 F = vftab[vfitab+1];
1007 Geps = vfeps*vftab[vfitab+2];
1008 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1010 FF = Fp+Geps+2.0*Heps2;
1011 felec = -qq11*FF*vftabscale*rinv11;
1015 /* Calculate temporary vectorial force */
1020 /* Update vectorial force */
1024 f[j_coord_offset+DIM*1+XX] -= tx;
1025 f[j_coord_offset+DIM*1+YY] -= ty;
1026 f[j_coord_offset+DIM*1+ZZ] -= tz;
1028 /**************************
1029 * CALCULATE INTERACTIONS *
1030 **************************/
1034 /* Calculate table index by multiplying r with table scale and truncate to integer */
1035 rt = r12*vftabscale;
1038 vfitab = 1*4*vfitab;
1040 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1041 F = vftab[vfitab+1];
1042 Geps = vfeps*vftab[vfitab+2];
1043 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1045 FF = Fp+Geps+2.0*Heps2;
1046 felec = -qq12*FF*vftabscale*rinv12;
1050 /* Calculate temporary vectorial force */
1055 /* Update vectorial force */
1059 f[j_coord_offset+DIM*2+XX] -= tx;
1060 f[j_coord_offset+DIM*2+YY] -= ty;
1061 f[j_coord_offset+DIM*2+ZZ] -= tz;
1063 /**************************
1064 * CALCULATE INTERACTIONS *
1065 **************************/
1069 /* Calculate table index by multiplying r with table scale and truncate to integer */
1070 rt = r20*vftabscale;
1073 vfitab = 1*4*vfitab;
1075 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1076 F = vftab[vfitab+1];
1077 Geps = vfeps*vftab[vfitab+2];
1078 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1080 FF = Fp+Geps+2.0*Heps2;
1081 felec = -qq20*FF*vftabscale*rinv20;
1085 /* Calculate temporary vectorial force */
1090 /* Update vectorial force */
1094 f[j_coord_offset+DIM*0+XX] -= tx;
1095 f[j_coord_offset+DIM*0+YY] -= ty;
1096 f[j_coord_offset+DIM*0+ZZ] -= tz;
1098 /**************************
1099 * CALCULATE INTERACTIONS *
1100 **************************/
1104 /* Calculate table index by multiplying r with table scale and truncate to integer */
1105 rt = r21*vftabscale;
1108 vfitab = 1*4*vfitab;
1110 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1111 F = vftab[vfitab+1];
1112 Geps = vfeps*vftab[vfitab+2];
1113 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1115 FF = Fp+Geps+2.0*Heps2;
1116 felec = -qq21*FF*vftabscale*rinv21;
1120 /* Calculate temporary vectorial force */
1125 /* Update vectorial force */
1129 f[j_coord_offset+DIM*1+XX] -= tx;
1130 f[j_coord_offset+DIM*1+YY] -= ty;
1131 f[j_coord_offset+DIM*1+ZZ] -= tz;
1133 /**************************
1134 * CALCULATE INTERACTIONS *
1135 **************************/
1139 /* Calculate table index by multiplying r with table scale and truncate to integer */
1140 rt = r22*vftabscale;
1143 vfitab = 1*4*vfitab;
1145 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1146 F = vftab[vfitab+1];
1147 Geps = vfeps*vftab[vfitab+2];
1148 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1150 FF = Fp+Geps+2.0*Heps2;
1151 felec = -qq22*FF*vftabscale*rinv22;
1155 /* Calculate temporary vectorial force */
1160 /* Update vectorial force */
1164 f[j_coord_offset+DIM*2+XX] -= tx;
1165 f[j_coord_offset+DIM*2+YY] -= ty;
1166 f[j_coord_offset+DIM*2+ZZ] -= tz;
1168 /* Inner loop uses 333 flops */
1170 /* End of innermost loop */
1173 f[i_coord_offset+DIM*0+XX] += fix0;
1174 f[i_coord_offset+DIM*0+YY] += fiy0;
1175 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1179 f[i_coord_offset+DIM*1+XX] += fix1;
1180 f[i_coord_offset+DIM*1+YY] += fiy1;
1181 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1185 f[i_coord_offset+DIM*2+XX] += fix2;
1186 f[i_coord_offset+DIM*2+YY] += fiy2;
1187 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1191 fshift[i_shift_offset+XX] += tx;
1192 fshift[i_shift_offset+YY] += ty;
1193 fshift[i_shift_offset+ZZ] += tz;
1195 /* Increment number of inner iterations */
1196 inneriter += j_index_end - j_index_start;
1198 /* Outer loop uses 30 flops */
1201 /* Increment number of outer iterations */
1204 /* Update outer/inner flops */
1206 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_F,outeriter*30 + inneriter*333);