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 */
903 Geps = vfeps*vftab[vfitab+2];
904 Heps2 = vfeps*vfeps*vftab[vfitab+3];
906 FF = Fp+Geps+2.0*Heps2;
907 felec = -qq00*FF*vftabscale*rinv00;
909 /* CUBIC SPLINE TABLE DISPERSION */
912 Geps = vfeps*vftab[vfitab+2];
913 Heps2 = vfeps*vfeps*vftab[vfitab+3];
915 FF = Fp+Geps+2.0*Heps2;
918 /* CUBIC SPLINE TABLE REPULSION */
920 Geps = vfeps*vftab[vfitab+6];
921 Heps2 = vfeps*vfeps*vftab[vfitab+7];
923 FF = Fp+Geps+2.0*Heps2;
925 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
929 /* Calculate temporary vectorial force */
934 /* Update vectorial force */
938 f[j_coord_offset+DIM*0+XX] -= tx;
939 f[j_coord_offset+DIM*0+YY] -= ty;
940 f[j_coord_offset+DIM*0+ZZ] -= tz;
942 /**************************
943 * CALCULATE INTERACTIONS *
944 **************************/
948 /* Calculate table index by multiplying r with table scale and truncate to integer */
954 /* CUBIC SPLINE TABLE ELECTROSTATICS */
956 Geps = vfeps*vftab[vfitab+2];
957 Heps2 = vfeps*vfeps*vftab[vfitab+3];
959 FF = Fp+Geps+2.0*Heps2;
960 felec = -qq01*FF*vftabscale*rinv01;
964 /* Calculate temporary vectorial force */
969 /* Update vectorial force */
973 f[j_coord_offset+DIM*1+XX] -= tx;
974 f[j_coord_offset+DIM*1+YY] -= ty;
975 f[j_coord_offset+DIM*1+ZZ] -= tz;
977 /**************************
978 * CALCULATE INTERACTIONS *
979 **************************/
983 /* Calculate table index by multiplying r with table scale and truncate to integer */
989 /* CUBIC SPLINE TABLE ELECTROSTATICS */
991 Geps = vfeps*vftab[vfitab+2];
992 Heps2 = vfeps*vfeps*vftab[vfitab+3];
994 FF = Fp+Geps+2.0*Heps2;
995 felec = -qq02*FF*vftabscale*rinv02;
999 /* Calculate temporary vectorial force */
1004 /* Update vectorial force */
1008 f[j_coord_offset+DIM*2+XX] -= tx;
1009 f[j_coord_offset+DIM*2+YY] -= ty;
1010 f[j_coord_offset+DIM*2+ZZ] -= tz;
1012 /**************************
1013 * CALCULATE INTERACTIONS *
1014 **************************/
1018 /* Calculate table index by multiplying r with table scale and truncate to integer */
1019 rt = r10*vftabscale;
1022 vfitab = 3*4*vfitab;
1024 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1025 F = vftab[vfitab+1];
1026 Geps = vfeps*vftab[vfitab+2];
1027 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1029 FF = Fp+Geps+2.0*Heps2;
1030 felec = -qq10*FF*vftabscale*rinv10;
1034 /* Calculate temporary vectorial force */
1039 /* Update vectorial force */
1043 f[j_coord_offset+DIM*0+XX] -= tx;
1044 f[j_coord_offset+DIM*0+YY] -= ty;
1045 f[j_coord_offset+DIM*0+ZZ] -= tz;
1047 /**************************
1048 * CALCULATE INTERACTIONS *
1049 **************************/
1053 /* Calculate table index by multiplying r with table scale and truncate to integer */
1054 rt = r11*vftabscale;
1057 vfitab = 3*4*vfitab;
1059 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1060 F = vftab[vfitab+1];
1061 Geps = vfeps*vftab[vfitab+2];
1062 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1064 FF = Fp+Geps+2.0*Heps2;
1065 felec = -qq11*FF*vftabscale*rinv11;
1069 /* Calculate temporary vectorial force */
1074 /* Update vectorial force */
1078 f[j_coord_offset+DIM*1+XX] -= tx;
1079 f[j_coord_offset+DIM*1+YY] -= ty;
1080 f[j_coord_offset+DIM*1+ZZ] -= tz;
1082 /**************************
1083 * CALCULATE INTERACTIONS *
1084 **************************/
1088 /* Calculate table index by multiplying r with table scale and truncate to integer */
1089 rt = r12*vftabscale;
1092 vfitab = 3*4*vfitab;
1094 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1095 F = vftab[vfitab+1];
1096 Geps = vfeps*vftab[vfitab+2];
1097 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1099 FF = Fp+Geps+2.0*Heps2;
1100 felec = -qq12*FF*vftabscale*rinv12;
1104 /* Calculate temporary vectorial force */
1109 /* Update vectorial force */
1113 f[j_coord_offset+DIM*2+XX] -= tx;
1114 f[j_coord_offset+DIM*2+YY] -= ty;
1115 f[j_coord_offset+DIM*2+ZZ] -= tz;
1117 /**************************
1118 * CALCULATE INTERACTIONS *
1119 **************************/
1123 /* Calculate table index by multiplying r with table scale and truncate to integer */
1124 rt = r20*vftabscale;
1127 vfitab = 3*4*vfitab;
1129 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1130 F = vftab[vfitab+1];
1131 Geps = vfeps*vftab[vfitab+2];
1132 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1134 FF = Fp+Geps+2.0*Heps2;
1135 felec = -qq20*FF*vftabscale*rinv20;
1139 /* Calculate temporary vectorial force */
1144 /* Update vectorial force */
1148 f[j_coord_offset+DIM*0+XX] -= tx;
1149 f[j_coord_offset+DIM*0+YY] -= ty;
1150 f[j_coord_offset+DIM*0+ZZ] -= tz;
1152 /**************************
1153 * CALCULATE INTERACTIONS *
1154 **************************/
1158 /* Calculate table index by multiplying r with table scale and truncate to integer */
1159 rt = r21*vftabscale;
1162 vfitab = 3*4*vfitab;
1164 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1165 F = vftab[vfitab+1];
1166 Geps = vfeps*vftab[vfitab+2];
1167 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1169 FF = Fp+Geps+2.0*Heps2;
1170 felec = -qq21*FF*vftabscale*rinv21;
1174 /* Calculate temporary vectorial force */
1179 /* Update vectorial force */
1183 f[j_coord_offset+DIM*1+XX] -= tx;
1184 f[j_coord_offset+DIM*1+YY] -= ty;
1185 f[j_coord_offset+DIM*1+ZZ] -= tz;
1187 /**************************
1188 * CALCULATE INTERACTIONS *
1189 **************************/
1193 /* Calculate table index by multiplying r with table scale and truncate to integer */
1194 rt = r22*vftabscale;
1197 vfitab = 3*4*vfitab;
1199 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1200 F = vftab[vfitab+1];
1201 Geps = vfeps*vftab[vfitab+2];
1202 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1204 FF = Fp+Geps+2.0*Heps2;
1205 felec = -qq22*FF*vftabscale*rinv22;
1209 /* Calculate temporary vectorial force */
1214 /* Update vectorial force */
1218 f[j_coord_offset+DIM*2+XX] -= tx;
1219 f[j_coord_offset+DIM*2+YY] -= ty;
1220 f[j_coord_offset+DIM*2+ZZ] -= tz;
1222 /* Inner loop uses 356 flops */
1224 /* End of innermost loop */
1227 f[i_coord_offset+DIM*0+XX] += fix0;
1228 f[i_coord_offset+DIM*0+YY] += fiy0;
1229 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1233 f[i_coord_offset+DIM*1+XX] += fix1;
1234 f[i_coord_offset+DIM*1+YY] += fiy1;
1235 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1239 f[i_coord_offset+DIM*2+XX] += fix2;
1240 f[i_coord_offset+DIM*2+YY] += fiy2;
1241 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1245 fshift[i_shift_offset+XX] += tx;
1246 fshift[i_shift_offset+YY] += ty;
1247 fshift[i_shift_offset+ZZ] += tz;
1249 /* Increment number of inner iterations */
1250 inneriter += j_index_end - j_index_start;
1252 /* Outer loop uses 30 flops */
1255 /* Increment number of outer iterations */
1258 /* Update outer/inner flops */
1260 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*356);