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_VdwCSTab_GeomW3W3_VF_c
35 * Electrostatics interaction: CubicSplineTable
36 * VdW interaction: CubicSplineTable
37 * Geometry: Water3-Water3
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecCSTab_VdwCSTab_GeomW3W3_VF_c
42 (t_nblist * gmx_restrict nlist,
43 rvec * gmx_restrict xx,
44 rvec * gmx_restrict ff,
45 t_forcerec * gmx_restrict fr,
46 t_mdatoms * gmx_restrict mdatoms,
47 nb_kernel_data_t * gmx_restrict kernel_data,
48 t_nrnb * gmx_restrict nrnb)
50 int i_shift_offset,i_coord_offset,j_coord_offset;
51 int j_index_start,j_index_end;
52 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
53 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
54 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
55 real *shiftvec,*fshift,*x,*f;
57 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
59 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
61 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
63 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
65 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
67 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
68 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
69 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
70 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
71 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
72 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
73 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
74 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
75 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
76 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
77 real velec,felec,velecsum,facel,crf,krf,krf2;
80 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
84 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
92 jindex = nlist->jindex;
94 shiftidx = nlist->shift;
96 shiftvec = fr->shift_vec[0];
97 fshift = fr->fshift[0];
99 charge = mdatoms->chargeA;
100 nvdwtype = fr->ntype;
102 vdwtype = mdatoms->typeA;
104 vftab = kernel_data->table_elec_vdw->data;
105 vftabscale = kernel_data->table_elec_vdw->scale;
107 /* Setup water-specific parameters */
108 inr = nlist->iinr[0];
109 iq0 = facel*charge[inr+0];
110 iq1 = facel*charge[inr+1];
111 iq2 = facel*charge[inr+2];
112 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
117 vdwjidx0 = 2*vdwtype[inr+0];
119 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
120 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
133 /* Start outer loop over neighborlists */
134 for(iidx=0; iidx<nri; iidx++)
136 /* Load shift vector for this list */
137 i_shift_offset = DIM*shiftidx[iidx];
138 shX = shiftvec[i_shift_offset+XX];
139 shY = shiftvec[i_shift_offset+YY];
140 shZ = shiftvec[i_shift_offset+ZZ];
142 /* Load limits for loop over neighbors */
143 j_index_start = jindex[iidx];
144 j_index_end = jindex[iidx+1];
146 /* Get outer coordinate index */
148 i_coord_offset = DIM*inr;
150 /* Load i particle coords and add shift vector */
151 ix0 = shX + x[i_coord_offset+DIM*0+XX];
152 iy0 = shY + x[i_coord_offset+DIM*0+YY];
153 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
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];
171 /* Reset potential sums */
175 /* Start inner kernel loop */
176 for(jidx=j_index_start; jidx<j_index_end; jidx++)
178 /* Get j neighbor index, and coordinate index */
180 j_coord_offset = DIM*jnr;
182 /* load j atom coordinates */
183 jx0 = x[j_coord_offset+DIM*0+XX];
184 jy0 = x[j_coord_offset+DIM*0+YY];
185 jz0 = x[j_coord_offset+DIM*0+ZZ];
186 jx1 = x[j_coord_offset+DIM*1+XX];
187 jy1 = x[j_coord_offset+DIM*1+YY];
188 jz1 = x[j_coord_offset+DIM*1+ZZ];
189 jx2 = x[j_coord_offset+DIM*2+XX];
190 jy2 = x[j_coord_offset+DIM*2+YY];
191 jz2 = x[j_coord_offset+DIM*2+ZZ];
193 /* Calculate displacement vector */
222 /* Calculate squared distance and things based on it */
223 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
224 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
225 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
226 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
227 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
228 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
229 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
230 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
231 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
233 rinv00 = gmx_invsqrt(rsq00);
234 rinv01 = gmx_invsqrt(rsq01);
235 rinv02 = gmx_invsqrt(rsq02);
236 rinv10 = gmx_invsqrt(rsq10);
237 rinv11 = gmx_invsqrt(rsq11);
238 rinv12 = gmx_invsqrt(rsq12);
239 rinv20 = gmx_invsqrt(rsq20);
240 rinv21 = gmx_invsqrt(rsq21);
241 rinv22 = gmx_invsqrt(rsq22);
243 /**************************
244 * CALCULATE INTERACTIONS *
245 **************************/
249 /* Calculate table index by multiplying r with table scale and truncate to integer */
255 /* CUBIC SPLINE TABLE ELECTROSTATICS */
258 Geps = vfeps*vftab[vfitab+2];
259 Heps2 = vfeps*vfeps*vftab[vfitab+3];
263 FF = Fp+Geps+2.0*Heps2;
264 felec = -qq00*FF*vftabscale*rinv00;
266 /* CUBIC SPLINE TABLE DISPERSION */
270 Geps = vfeps*vftab[vfitab+2];
271 Heps2 = vfeps*vfeps*vftab[vfitab+3];
275 FF = Fp+Geps+2.0*Heps2;
278 /* CUBIC SPLINE TABLE REPULSION */
281 Geps = vfeps*vftab[vfitab+6];
282 Heps2 = vfeps*vfeps*vftab[vfitab+7];
286 FF = Fp+Geps+2.0*Heps2;
289 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
291 /* Update potential sums from outer loop */
297 /* Calculate temporary vectorial force */
302 /* Update vectorial force */
306 f[j_coord_offset+DIM*0+XX] -= tx;
307 f[j_coord_offset+DIM*0+YY] -= ty;
308 f[j_coord_offset+DIM*0+ZZ] -= tz;
310 /**************************
311 * CALCULATE INTERACTIONS *
312 **************************/
316 /* Calculate table index by multiplying r with table scale and truncate to integer */
322 /* CUBIC SPLINE TABLE ELECTROSTATICS */
325 Geps = vfeps*vftab[vfitab+2];
326 Heps2 = vfeps*vfeps*vftab[vfitab+3];
330 FF = Fp+Geps+2.0*Heps2;
331 felec = -qq01*FF*vftabscale*rinv01;
333 /* Update potential sums from outer loop */
338 /* Calculate temporary vectorial force */
343 /* Update vectorial force */
347 f[j_coord_offset+DIM*1+XX] -= tx;
348 f[j_coord_offset+DIM*1+YY] -= ty;
349 f[j_coord_offset+DIM*1+ZZ] -= tz;
351 /**************************
352 * CALCULATE INTERACTIONS *
353 **************************/
357 /* Calculate table index by multiplying r with table scale and truncate to integer */
363 /* CUBIC SPLINE TABLE ELECTROSTATICS */
366 Geps = vfeps*vftab[vfitab+2];
367 Heps2 = vfeps*vfeps*vftab[vfitab+3];
371 FF = Fp+Geps+2.0*Heps2;
372 felec = -qq02*FF*vftabscale*rinv02;
374 /* Update potential sums from outer loop */
379 /* Calculate temporary vectorial force */
384 /* Update vectorial force */
388 f[j_coord_offset+DIM*2+XX] -= tx;
389 f[j_coord_offset+DIM*2+YY] -= ty;
390 f[j_coord_offset+DIM*2+ZZ] -= tz;
392 /**************************
393 * CALCULATE INTERACTIONS *
394 **************************/
398 /* Calculate table index by multiplying r with table scale and truncate to integer */
404 /* CUBIC SPLINE TABLE ELECTROSTATICS */
407 Geps = vfeps*vftab[vfitab+2];
408 Heps2 = vfeps*vfeps*vftab[vfitab+3];
412 FF = Fp+Geps+2.0*Heps2;
413 felec = -qq10*FF*vftabscale*rinv10;
415 /* Update potential sums from outer loop */
420 /* Calculate temporary vectorial force */
425 /* Update vectorial force */
429 f[j_coord_offset+DIM*0+XX] -= tx;
430 f[j_coord_offset+DIM*0+YY] -= ty;
431 f[j_coord_offset+DIM*0+ZZ] -= tz;
433 /**************************
434 * CALCULATE INTERACTIONS *
435 **************************/
439 /* Calculate table index by multiplying r with table scale and truncate to integer */
445 /* CUBIC SPLINE TABLE ELECTROSTATICS */
448 Geps = vfeps*vftab[vfitab+2];
449 Heps2 = vfeps*vfeps*vftab[vfitab+3];
453 FF = Fp+Geps+2.0*Heps2;
454 felec = -qq11*FF*vftabscale*rinv11;
456 /* Update potential sums from outer loop */
461 /* Calculate temporary vectorial force */
466 /* Update vectorial force */
470 f[j_coord_offset+DIM*1+XX] -= tx;
471 f[j_coord_offset+DIM*1+YY] -= ty;
472 f[j_coord_offset+DIM*1+ZZ] -= tz;
474 /**************************
475 * CALCULATE INTERACTIONS *
476 **************************/
480 /* Calculate table index by multiplying r with table scale and truncate to integer */
486 /* CUBIC SPLINE TABLE ELECTROSTATICS */
489 Geps = vfeps*vftab[vfitab+2];
490 Heps2 = vfeps*vfeps*vftab[vfitab+3];
494 FF = Fp+Geps+2.0*Heps2;
495 felec = -qq12*FF*vftabscale*rinv12;
497 /* Update potential sums from outer loop */
502 /* Calculate temporary vectorial force */
507 /* Update vectorial force */
511 f[j_coord_offset+DIM*2+XX] -= tx;
512 f[j_coord_offset+DIM*2+YY] -= ty;
513 f[j_coord_offset+DIM*2+ZZ] -= tz;
515 /**************************
516 * CALCULATE INTERACTIONS *
517 **************************/
521 /* Calculate table index by multiplying r with table scale and truncate to integer */
527 /* CUBIC SPLINE TABLE ELECTROSTATICS */
530 Geps = vfeps*vftab[vfitab+2];
531 Heps2 = vfeps*vfeps*vftab[vfitab+3];
535 FF = Fp+Geps+2.0*Heps2;
536 felec = -qq20*FF*vftabscale*rinv20;
538 /* Update potential sums from outer loop */
543 /* Calculate temporary vectorial force */
548 /* Update vectorial force */
552 f[j_coord_offset+DIM*0+XX] -= tx;
553 f[j_coord_offset+DIM*0+YY] -= ty;
554 f[j_coord_offset+DIM*0+ZZ] -= tz;
556 /**************************
557 * CALCULATE INTERACTIONS *
558 **************************/
562 /* Calculate table index by multiplying r with table scale and truncate to integer */
568 /* CUBIC SPLINE TABLE ELECTROSTATICS */
571 Geps = vfeps*vftab[vfitab+2];
572 Heps2 = vfeps*vfeps*vftab[vfitab+3];
576 FF = Fp+Geps+2.0*Heps2;
577 felec = -qq21*FF*vftabscale*rinv21;
579 /* Update potential sums from outer loop */
584 /* Calculate temporary vectorial force */
589 /* Update vectorial force */
593 f[j_coord_offset+DIM*1+XX] -= tx;
594 f[j_coord_offset+DIM*1+YY] -= ty;
595 f[j_coord_offset+DIM*1+ZZ] -= tz;
597 /**************************
598 * CALCULATE INTERACTIONS *
599 **************************/
603 /* Calculate table index by multiplying r with table scale and truncate to integer */
609 /* CUBIC SPLINE TABLE ELECTROSTATICS */
612 Geps = vfeps*vftab[vfitab+2];
613 Heps2 = vfeps*vfeps*vftab[vfitab+3];
617 FF = Fp+Geps+2.0*Heps2;
618 felec = -qq22*FF*vftabscale*rinv22;
620 /* Update potential sums from outer loop */
625 /* Calculate temporary vectorial force */
630 /* Update vectorial force */
634 f[j_coord_offset+DIM*2+XX] -= tx;
635 f[j_coord_offset+DIM*2+YY] -= ty;
636 f[j_coord_offset+DIM*2+ZZ] -= tz;
638 /* Inner loop uses 400 flops */
640 /* End of innermost loop */
643 f[i_coord_offset+DIM*0+XX] += fix0;
644 f[i_coord_offset+DIM*0+YY] += fiy0;
645 f[i_coord_offset+DIM*0+ZZ] += fiz0;
649 f[i_coord_offset+DIM*1+XX] += fix1;
650 f[i_coord_offset+DIM*1+YY] += fiy1;
651 f[i_coord_offset+DIM*1+ZZ] += fiz1;
655 f[i_coord_offset+DIM*2+XX] += fix2;
656 f[i_coord_offset+DIM*2+YY] += fiy2;
657 f[i_coord_offset+DIM*2+ZZ] += fiz2;
661 fshift[i_shift_offset+XX] += tx;
662 fshift[i_shift_offset+YY] += ty;
663 fshift[i_shift_offset+ZZ] += tz;
666 /* Update potential energies */
667 kernel_data->energygrp_elec[ggid] += velecsum;
668 kernel_data->energygrp_vdw[ggid] += vvdwsum;
670 /* Increment number of inner iterations */
671 inneriter += j_index_end - j_index_start;
673 /* Outer loop uses 32 flops */
676 /* Increment number of outer iterations */
679 /* Update outer/inner flops */
681 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*400);
684 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomW3W3_F_c
685 * Electrostatics interaction: CubicSplineTable
686 * VdW interaction: CubicSplineTable
687 * Geometry: Water3-Water3
688 * Calculate force/pot: Force
691 nb_kernel_ElecCSTab_VdwCSTab_GeomW3W3_F_c
692 (t_nblist * gmx_restrict nlist,
693 rvec * gmx_restrict xx,
694 rvec * gmx_restrict ff,
695 t_forcerec * gmx_restrict fr,
696 t_mdatoms * gmx_restrict mdatoms,
697 nb_kernel_data_t * gmx_restrict kernel_data,
698 t_nrnb * gmx_restrict nrnb)
700 int i_shift_offset,i_coord_offset,j_coord_offset;
701 int j_index_start,j_index_end;
702 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
703 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
704 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
705 real *shiftvec,*fshift,*x,*f;
707 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
709 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
711 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
713 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
715 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
717 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
718 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
719 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
720 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
721 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
722 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
723 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
724 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
725 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
726 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
727 real velec,felec,velecsum,facel,crf,krf,krf2;
730 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
734 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
742 jindex = nlist->jindex;
744 shiftidx = nlist->shift;
746 shiftvec = fr->shift_vec[0];
747 fshift = fr->fshift[0];
749 charge = mdatoms->chargeA;
750 nvdwtype = fr->ntype;
752 vdwtype = mdatoms->typeA;
754 vftab = kernel_data->table_elec_vdw->data;
755 vftabscale = kernel_data->table_elec_vdw->scale;
757 /* Setup water-specific parameters */
758 inr = nlist->iinr[0];
759 iq0 = facel*charge[inr+0];
760 iq1 = facel*charge[inr+1];
761 iq2 = facel*charge[inr+2];
762 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
767 vdwjidx0 = 2*vdwtype[inr+0];
769 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
770 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
783 /* Start outer loop over neighborlists */
784 for(iidx=0; iidx<nri; iidx++)
786 /* Load shift vector for this list */
787 i_shift_offset = DIM*shiftidx[iidx];
788 shX = shiftvec[i_shift_offset+XX];
789 shY = shiftvec[i_shift_offset+YY];
790 shZ = shiftvec[i_shift_offset+ZZ];
792 /* Load limits for loop over neighbors */
793 j_index_start = jindex[iidx];
794 j_index_end = jindex[iidx+1];
796 /* Get outer coordinate index */
798 i_coord_offset = DIM*inr;
800 /* Load i particle coords and add shift vector */
801 ix0 = shX + x[i_coord_offset+DIM*0+XX];
802 iy0 = shY + x[i_coord_offset+DIM*0+YY];
803 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
804 ix1 = shX + x[i_coord_offset+DIM*1+XX];
805 iy1 = shY + x[i_coord_offset+DIM*1+YY];
806 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
807 ix2 = shX + x[i_coord_offset+DIM*2+XX];
808 iy2 = shY + x[i_coord_offset+DIM*2+YY];
809 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
821 /* Start inner kernel loop */
822 for(jidx=j_index_start; jidx<j_index_end; jidx++)
824 /* Get j neighbor index, and coordinate index */
826 j_coord_offset = DIM*jnr;
828 /* load j atom coordinates */
829 jx0 = x[j_coord_offset+DIM*0+XX];
830 jy0 = x[j_coord_offset+DIM*0+YY];
831 jz0 = x[j_coord_offset+DIM*0+ZZ];
832 jx1 = x[j_coord_offset+DIM*1+XX];
833 jy1 = x[j_coord_offset+DIM*1+YY];
834 jz1 = x[j_coord_offset+DIM*1+ZZ];
835 jx2 = x[j_coord_offset+DIM*2+XX];
836 jy2 = x[j_coord_offset+DIM*2+YY];
837 jz2 = x[j_coord_offset+DIM*2+ZZ];
839 /* Calculate displacement vector */
868 /* Calculate squared distance and things based on it */
869 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
870 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
871 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
872 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
873 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
874 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
875 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
876 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
877 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
879 rinv00 = gmx_invsqrt(rsq00);
880 rinv01 = gmx_invsqrt(rsq01);
881 rinv02 = gmx_invsqrt(rsq02);
882 rinv10 = gmx_invsqrt(rsq10);
883 rinv11 = gmx_invsqrt(rsq11);
884 rinv12 = gmx_invsqrt(rsq12);
885 rinv20 = gmx_invsqrt(rsq20);
886 rinv21 = gmx_invsqrt(rsq21);
887 rinv22 = gmx_invsqrt(rsq22);
889 /**************************
890 * CALCULATE INTERACTIONS *
891 **************************/
895 /* Calculate table index by multiplying r with table scale and truncate to integer */
901 /* 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 = -qq00*FF*vftabscale*rinv00;
910 /* CUBIC SPLINE TABLE DISPERSION */
914 Geps = vfeps*vftab[vfitab+2];
915 Heps2 = vfeps*vfeps*vftab[vfitab+3];
917 FF = Fp+Geps+2.0*Heps2;
920 /* CUBIC SPLINE TABLE REPULSION */
923 Geps = vfeps*vftab[vfitab+6];
924 Heps2 = vfeps*vfeps*vftab[vfitab+7];
926 FF = Fp+Geps+2.0*Heps2;
928 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
932 /* Calculate temporary vectorial force */
937 /* Update vectorial force */
941 f[j_coord_offset+DIM*0+XX] -= tx;
942 f[j_coord_offset+DIM*0+YY] -= ty;
943 f[j_coord_offset+DIM*0+ZZ] -= tz;
945 /**************************
946 * CALCULATE INTERACTIONS *
947 **************************/
951 /* Calculate table index by multiplying r with table scale and truncate to integer */
957 /* CUBIC SPLINE TABLE ELECTROSTATICS */
960 Geps = vfeps*vftab[vfitab+2];
961 Heps2 = vfeps*vfeps*vftab[vfitab+3];
963 FF = Fp+Geps+2.0*Heps2;
964 felec = -qq01*FF*vftabscale*rinv01;
968 /* Calculate temporary vectorial force */
973 /* Update vectorial force */
977 f[j_coord_offset+DIM*1+XX] -= tx;
978 f[j_coord_offset+DIM*1+YY] -= ty;
979 f[j_coord_offset+DIM*1+ZZ] -= tz;
981 /**************************
982 * CALCULATE INTERACTIONS *
983 **************************/
987 /* Calculate table index by multiplying r with table scale and truncate to integer */
993 /* CUBIC SPLINE TABLE ELECTROSTATICS */
996 Geps = vfeps*vftab[vfitab+2];
997 Heps2 = vfeps*vfeps*vftab[vfitab+3];
999 FF = Fp+Geps+2.0*Heps2;
1000 felec = -qq02*FF*vftabscale*rinv02;
1004 /* Calculate temporary vectorial force */
1009 /* Update vectorial force */
1013 f[j_coord_offset+DIM*2+XX] -= tx;
1014 f[j_coord_offset+DIM*2+YY] -= ty;
1015 f[j_coord_offset+DIM*2+ZZ] -= tz;
1017 /**************************
1018 * CALCULATE INTERACTIONS *
1019 **************************/
1023 /* Calculate table index by multiplying r with table scale and truncate to integer */
1024 rt = r10*vftabscale;
1027 vfitab = 3*4*vfitab;
1029 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1031 F = vftab[vfitab+1];
1032 Geps = vfeps*vftab[vfitab+2];
1033 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1035 FF = Fp+Geps+2.0*Heps2;
1036 felec = -qq10*FF*vftabscale*rinv10;
1040 /* Calculate temporary vectorial force */
1045 /* Update vectorial force */
1049 f[j_coord_offset+DIM*0+XX] -= tx;
1050 f[j_coord_offset+DIM*0+YY] -= ty;
1051 f[j_coord_offset+DIM*0+ZZ] -= tz;
1053 /**************************
1054 * CALCULATE INTERACTIONS *
1055 **************************/
1059 /* Calculate table index by multiplying r with table scale and truncate to integer */
1060 rt = r11*vftabscale;
1063 vfitab = 3*4*vfitab;
1065 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1067 F = vftab[vfitab+1];
1068 Geps = vfeps*vftab[vfitab+2];
1069 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1071 FF = Fp+Geps+2.0*Heps2;
1072 felec = -qq11*FF*vftabscale*rinv11;
1076 /* Calculate temporary vectorial force */
1081 /* Update vectorial force */
1085 f[j_coord_offset+DIM*1+XX] -= tx;
1086 f[j_coord_offset+DIM*1+YY] -= ty;
1087 f[j_coord_offset+DIM*1+ZZ] -= tz;
1089 /**************************
1090 * CALCULATE INTERACTIONS *
1091 **************************/
1095 /* Calculate table index by multiplying r with table scale and truncate to integer */
1096 rt = r12*vftabscale;
1099 vfitab = 3*4*vfitab;
1101 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1103 F = vftab[vfitab+1];
1104 Geps = vfeps*vftab[vfitab+2];
1105 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1107 FF = Fp+Geps+2.0*Heps2;
1108 felec = -qq12*FF*vftabscale*rinv12;
1112 /* Calculate temporary vectorial force */
1117 /* Update vectorial force */
1121 f[j_coord_offset+DIM*2+XX] -= tx;
1122 f[j_coord_offset+DIM*2+YY] -= ty;
1123 f[j_coord_offset+DIM*2+ZZ] -= tz;
1125 /**************************
1126 * CALCULATE INTERACTIONS *
1127 **************************/
1131 /* Calculate table index by multiplying r with table scale and truncate to integer */
1132 rt = r20*vftabscale;
1135 vfitab = 3*4*vfitab;
1137 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1139 F = vftab[vfitab+1];
1140 Geps = vfeps*vftab[vfitab+2];
1141 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1143 FF = Fp+Geps+2.0*Heps2;
1144 felec = -qq20*FF*vftabscale*rinv20;
1148 /* Calculate temporary vectorial force */
1153 /* Update vectorial force */
1157 f[j_coord_offset+DIM*0+XX] -= tx;
1158 f[j_coord_offset+DIM*0+YY] -= ty;
1159 f[j_coord_offset+DIM*0+ZZ] -= tz;
1161 /**************************
1162 * CALCULATE INTERACTIONS *
1163 **************************/
1167 /* Calculate table index by multiplying r with table scale and truncate to integer */
1168 rt = r21*vftabscale;
1171 vfitab = 3*4*vfitab;
1173 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1175 F = vftab[vfitab+1];
1176 Geps = vfeps*vftab[vfitab+2];
1177 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1179 FF = Fp+Geps+2.0*Heps2;
1180 felec = -qq21*FF*vftabscale*rinv21;
1184 /* Calculate temporary vectorial force */
1189 /* Update vectorial force */
1193 f[j_coord_offset+DIM*1+XX] -= tx;
1194 f[j_coord_offset+DIM*1+YY] -= ty;
1195 f[j_coord_offset+DIM*1+ZZ] -= tz;
1197 /**************************
1198 * CALCULATE INTERACTIONS *
1199 **************************/
1203 /* Calculate table index by multiplying r with table scale and truncate to integer */
1204 rt = r22*vftabscale;
1207 vfitab = 3*4*vfitab;
1209 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1211 F = vftab[vfitab+1];
1212 Geps = vfeps*vftab[vfitab+2];
1213 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1215 FF = Fp+Geps+2.0*Heps2;
1216 felec = -qq22*FF*vftabscale*rinv22;
1220 /* Calculate temporary vectorial force */
1225 /* Update vectorial force */
1229 f[j_coord_offset+DIM*2+XX] -= tx;
1230 f[j_coord_offset+DIM*2+YY] -= ty;
1231 f[j_coord_offset+DIM*2+ZZ] -= tz;
1233 /* Inner loop uses 356 flops */
1235 /* End of innermost loop */
1238 f[i_coord_offset+DIM*0+XX] += fix0;
1239 f[i_coord_offset+DIM*0+YY] += fiy0;
1240 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1244 f[i_coord_offset+DIM*1+XX] += fix1;
1245 f[i_coord_offset+DIM*1+YY] += fiy1;
1246 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1250 f[i_coord_offset+DIM*2+XX] += fix2;
1251 f[i_coord_offset+DIM*2+YY] += fiy2;
1252 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1256 fshift[i_shift_offset+XX] += tx;
1257 fshift[i_shift_offset+YY] += ty;
1258 fshift[i_shift_offset+ZZ] += tz;
1260 /* Increment number of inner iterations */
1261 inneriter += j_index_end - j_index_start;
1263 /* Outer loop uses 30 flops */
1266 /* Increment number of outer iterations */
1269 /* Update outer/inner flops */
1271 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*356);