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 "types/simple.h"
44 #include "gromacs/math/vec.h"
48 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwNone_GeomW4W4_VF_c
49 * Electrostatics interaction: CubicSplineTable
50 * VdW interaction: None
51 * Geometry: Water4-Water4
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecCSTab_VdwNone_GeomW4W4_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 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
73 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
75 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
77 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
79 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
81 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
82 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
83 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
84 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
85 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
86 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
87 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
88 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
89 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
90 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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 iq1 = facel*charge[inr+1];
117 iq2 = facel*charge[inr+2];
118 iq3 = facel*charge[inr+3];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
155 iy1 = shY + x[i_coord_offset+DIM*1+YY];
156 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
157 ix2 = shX + x[i_coord_offset+DIM*2+XX];
158 iy2 = shY + x[i_coord_offset+DIM*2+YY];
159 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
160 ix3 = shX + x[i_coord_offset+DIM*3+XX];
161 iy3 = shY + x[i_coord_offset+DIM*3+YY];
162 iz3 = shZ + x[i_coord_offset+DIM*3+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 jx1 = x[j_coord_offset+DIM*1+XX];
186 jy1 = x[j_coord_offset+DIM*1+YY];
187 jz1 = x[j_coord_offset+DIM*1+ZZ];
188 jx2 = x[j_coord_offset+DIM*2+XX];
189 jy2 = x[j_coord_offset+DIM*2+YY];
190 jz2 = x[j_coord_offset+DIM*2+ZZ];
191 jx3 = x[j_coord_offset+DIM*3+XX];
192 jy3 = x[j_coord_offset+DIM*3+YY];
193 jz3 = x[j_coord_offset+DIM*3+ZZ];
195 /* Calculate displacement vector */
224 /* Calculate squared distance and things based on it */
225 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
226 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
227 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
228 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
229 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
230 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
231 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
232 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
233 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
235 rinv11 = gmx_invsqrt(rsq11);
236 rinv12 = gmx_invsqrt(rsq12);
237 rinv13 = gmx_invsqrt(rsq13);
238 rinv21 = gmx_invsqrt(rsq21);
239 rinv22 = gmx_invsqrt(rsq22);
240 rinv23 = gmx_invsqrt(rsq23);
241 rinv31 = gmx_invsqrt(rsq31);
242 rinv32 = gmx_invsqrt(rsq32);
243 rinv33 = gmx_invsqrt(rsq33);
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 = -qq11*FF*vftabscale*rinv11;
268 /* Update potential sums from outer loop */
273 /* Calculate temporary vectorial force */
278 /* Update vectorial force */
282 f[j_coord_offset+DIM*1+XX] -= tx;
283 f[j_coord_offset+DIM*1+YY] -= ty;
284 f[j_coord_offset+DIM*1+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 = -qq12*FF*vftabscale*rinv12;
309 /* Update potential sums from outer loop */
314 /* Calculate temporary vectorial force */
319 /* Update vectorial force */
323 f[j_coord_offset+DIM*2+XX] -= tx;
324 f[j_coord_offset+DIM*2+YY] -= ty;
325 f[j_coord_offset+DIM*2+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 = -qq13*FF*vftabscale*rinv13;
350 /* Update potential sums from outer loop */
355 /* Calculate temporary vectorial force */
360 /* Update vectorial force */
364 f[j_coord_offset+DIM*3+XX] -= tx;
365 f[j_coord_offset+DIM*3+YY] -= ty;
366 f[j_coord_offset+DIM*3+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 = -qq21*FF*vftabscale*rinv21;
391 /* Update potential sums from outer loop */
396 /* Calculate temporary vectorial force */
401 /* Update vectorial force */
405 f[j_coord_offset+DIM*1+XX] -= tx;
406 f[j_coord_offset+DIM*1+YY] -= ty;
407 f[j_coord_offset+DIM*1+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 = -qq22*FF*vftabscale*rinv22;
432 /* Update potential sums from outer loop */
437 /* Calculate temporary vectorial force */
442 /* Update vectorial force */
446 f[j_coord_offset+DIM*2+XX] -= tx;
447 f[j_coord_offset+DIM*2+YY] -= ty;
448 f[j_coord_offset+DIM*2+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 = -qq23*FF*vftabscale*rinv23;
473 /* Update potential sums from outer loop */
478 /* Calculate temporary vectorial force */
483 /* Update vectorial force */
487 f[j_coord_offset+DIM*3+XX] -= tx;
488 f[j_coord_offset+DIM*3+YY] -= ty;
489 f[j_coord_offset+DIM*3+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 = -qq31*FF*vftabscale*rinv31;
514 /* Update potential sums from outer loop */
519 /* Calculate temporary vectorial force */
524 /* Update vectorial force */
528 f[j_coord_offset+DIM*1+XX] -= tx;
529 f[j_coord_offset+DIM*1+YY] -= ty;
530 f[j_coord_offset+DIM*1+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 = -qq32*FF*vftabscale*rinv32;
555 /* Update potential sums from outer loop */
560 /* Calculate temporary vectorial force */
565 /* Update vectorial force */
569 f[j_coord_offset+DIM*2+XX] -= tx;
570 f[j_coord_offset+DIM*2+YY] -= ty;
571 f[j_coord_offset+DIM*2+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 = -qq33*FF*vftabscale*rinv33;
596 /* Update potential sums from outer loop */
601 /* Calculate temporary vectorial force */
606 /* Update vectorial force */
610 f[j_coord_offset+DIM*3+XX] -= tx;
611 f[j_coord_offset+DIM*3+YY] -= ty;
612 f[j_coord_offset+DIM*3+ZZ] -= tz;
614 /* Inner loop uses 369 flops */
616 /* End of innermost loop */
619 f[i_coord_offset+DIM*1+XX] += fix1;
620 f[i_coord_offset+DIM*1+YY] += fiy1;
621 f[i_coord_offset+DIM*1+ZZ] += fiz1;
625 f[i_coord_offset+DIM*2+XX] += fix2;
626 f[i_coord_offset+DIM*2+YY] += fiy2;
627 f[i_coord_offset+DIM*2+ZZ] += fiz2;
631 f[i_coord_offset+DIM*3+XX] += fix3;
632 f[i_coord_offset+DIM*3+YY] += fiy3;
633 f[i_coord_offset+DIM*3+ZZ] += fiz3;
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_W4W4_VF,outeriter*31 + inneriter*369);
659 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwNone_GeomW4W4_F_c
660 * Electrostatics interaction: CubicSplineTable
661 * VdW interaction: None
662 * Geometry: Water4-Water4
663 * Calculate force/pot: Force
666 nb_kernel_ElecCSTab_VdwNone_GeomW4W4_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 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
684 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
686 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
688 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
690 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
692 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
693 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
694 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
695 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
696 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
697 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
698 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
699 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
700 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
701 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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 iq1 = facel*charge[inr+1];
728 iq2 = facel*charge[inr+2];
729 iq3 = facel*charge[inr+3];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
766 iy1 = shY + x[i_coord_offset+DIM*1+YY];
767 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
768 ix2 = shX + x[i_coord_offset+DIM*2+XX];
769 iy2 = shY + x[i_coord_offset+DIM*2+YY];
770 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
771 ix3 = shX + x[i_coord_offset+DIM*3+XX];
772 iy3 = shY + x[i_coord_offset+DIM*3+YY];
773 iz3 = shZ + x[i_coord_offset+DIM*3+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 jx1 = x[j_coord_offset+DIM*1+XX];
794 jy1 = x[j_coord_offset+DIM*1+YY];
795 jz1 = x[j_coord_offset+DIM*1+ZZ];
796 jx2 = x[j_coord_offset+DIM*2+XX];
797 jy2 = x[j_coord_offset+DIM*2+YY];
798 jz2 = x[j_coord_offset+DIM*2+ZZ];
799 jx3 = x[j_coord_offset+DIM*3+XX];
800 jy3 = x[j_coord_offset+DIM*3+YY];
801 jz3 = x[j_coord_offset+DIM*3+ZZ];
803 /* Calculate displacement vector */
832 /* Calculate squared distance and things based on it */
833 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
834 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
835 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
836 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
837 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
838 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
839 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
840 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
841 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
843 rinv11 = gmx_invsqrt(rsq11);
844 rinv12 = gmx_invsqrt(rsq12);
845 rinv13 = gmx_invsqrt(rsq13);
846 rinv21 = gmx_invsqrt(rsq21);
847 rinv22 = gmx_invsqrt(rsq22);
848 rinv23 = gmx_invsqrt(rsq23);
849 rinv31 = gmx_invsqrt(rsq31);
850 rinv32 = gmx_invsqrt(rsq32);
851 rinv33 = gmx_invsqrt(rsq33);
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 = -qq11*FF*vftabscale*rinv11;
875 /* Calculate temporary vectorial force */
880 /* Update vectorial force */
884 f[j_coord_offset+DIM*1+XX] -= tx;
885 f[j_coord_offset+DIM*1+YY] -= ty;
886 f[j_coord_offset+DIM*1+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 = -qq12*FF*vftabscale*rinv12;
910 /* Calculate temporary vectorial force */
915 /* Update vectorial force */
919 f[j_coord_offset+DIM*2+XX] -= tx;
920 f[j_coord_offset+DIM*2+YY] -= ty;
921 f[j_coord_offset+DIM*2+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 = -qq13*FF*vftabscale*rinv13;
945 /* Calculate temporary vectorial force */
950 /* Update vectorial force */
954 f[j_coord_offset+DIM*3+XX] -= tx;
955 f[j_coord_offset+DIM*3+YY] -= ty;
956 f[j_coord_offset+DIM*3+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 = -qq21*FF*vftabscale*rinv21;
980 /* Calculate temporary vectorial force */
985 /* Update vectorial force */
989 f[j_coord_offset+DIM*1+XX] -= tx;
990 f[j_coord_offset+DIM*1+YY] -= ty;
991 f[j_coord_offset+DIM*1+ZZ] -= tz;
993 /**************************
994 * CALCULATE INTERACTIONS *
995 **************************/
999 /* Calculate table index by multiplying r with table scale and truncate to integer */
1000 rt = r22*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 = -qq22*FF*vftabscale*rinv22;
1015 /* Calculate temporary vectorial force */
1020 /* Update vectorial force */
1024 f[j_coord_offset+DIM*2+XX] -= tx;
1025 f[j_coord_offset+DIM*2+YY] -= ty;
1026 f[j_coord_offset+DIM*2+ZZ] -= tz;
1028 /**************************
1029 * CALCULATE INTERACTIONS *
1030 **************************/
1034 /* Calculate table index by multiplying r with table scale and truncate to integer */
1035 rt = r23*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 = -qq23*FF*vftabscale*rinv23;
1050 /* Calculate temporary vectorial force */
1055 /* Update vectorial force */
1059 f[j_coord_offset+DIM*3+XX] -= tx;
1060 f[j_coord_offset+DIM*3+YY] -= ty;
1061 f[j_coord_offset+DIM*3+ZZ] -= tz;
1063 /**************************
1064 * CALCULATE INTERACTIONS *
1065 **************************/
1069 /* Calculate table index by multiplying r with table scale and truncate to integer */
1070 rt = r31*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 = -qq31*FF*vftabscale*rinv31;
1085 /* Calculate temporary vectorial force */
1090 /* Update vectorial force */
1094 f[j_coord_offset+DIM*1+XX] -= tx;
1095 f[j_coord_offset+DIM*1+YY] -= ty;
1096 f[j_coord_offset+DIM*1+ZZ] -= tz;
1098 /**************************
1099 * CALCULATE INTERACTIONS *
1100 **************************/
1104 /* Calculate table index by multiplying r with table scale and truncate to integer */
1105 rt = r32*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 = -qq32*FF*vftabscale*rinv32;
1120 /* Calculate temporary vectorial force */
1125 /* Update vectorial force */
1129 f[j_coord_offset+DIM*2+XX] -= tx;
1130 f[j_coord_offset+DIM*2+YY] -= ty;
1131 f[j_coord_offset+DIM*2+ZZ] -= tz;
1133 /**************************
1134 * CALCULATE INTERACTIONS *
1135 **************************/
1139 /* Calculate table index by multiplying r with table scale and truncate to integer */
1140 rt = r33*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 = -qq33*FF*vftabscale*rinv33;
1155 /* Calculate temporary vectorial force */
1160 /* Update vectorial force */
1164 f[j_coord_offset+DIM*3+XX] -= tx;
1165 f[j_coord_offset+DIM*3+YY] -= ty;
1166 f[j_coord_offset+DIM*3+ZZ] -= tz;
1168 /* Inner loop uses 333 flops */
1170 /* End of innermost loop */
1173 f[i_coord_offset+DIM*1+XX] += fix1;
1174 f[i_coord_offset+DIM*1+YY] += fiy1;
1175 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1179 f[i_coord_offset+DIM*2+XX] += fix2;
1180 f[i_coord_offset+DIM*2+YY] += fiy2;
1181 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1185 f[i_coord_offset+DIM*3+XX] += fix3;
1186 f[i_coord_offset+DIM*3+YY] += fiy3;
1187 f[i_coord_offset+DIM*3+ZZ] += fiz3;
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_W4W4_F,outeriter*30 + inneriter*333);