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.
44 #include "../nb_kernel.h"
45 #include "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwCSTab_GeomW3W3_VF_c
51 * Electrostatics interaction: Coulomb
52 * VdW interaction: CubicSplineTable
53 * Geometry: Water3-Water3
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCoul_VdwCSTab_GeomW3W3_VF_c
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 int i_shift_offset,i_coord_offset,j_coord_offset;
67 int j_index_start,j_index_end;
68 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
69 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
70 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
71 real *shiftvec,*fshift,*x,*f;
73 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
75 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
77 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
79 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
81 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
83 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
84 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
85 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
86 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
87 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
88 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
89 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
90 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
91 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
92 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
93 real velec,felec,velecsum,facel,crf,krf,krf2;
96 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
100 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
108 jindex = nlist->jindex;
110 shiftidx = nlist->shift;
112 shiftvec = fr->shift_vec[0];
113 fshift = fr->fshift[0];
115 charge = mdatoms->chargeA;
116 nvdwtype = fr->ntype;
118 vdwtype = mdatoms->typeA;
120 vftab = kernel_data->table_vdw->data;
121 vftabscale = kernel_data->table_vdw->scale;
123 /* Setup water-specific parameters */
124 inr = nlist->iinr[0];
125 iq0 = facel*charge[inr+0];
126 iq1 = facel*charge[inr+1];
127 iq2 = facel*charge[inr+2];
128 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
133 vdwjidx0 = 2*vdwtype[inr+0];
135 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
136 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
149 /* Start outer loop over neighborlists */
150 for(iidx=0; iidx<nri; iidx++)
152 /* Load shift vector for this list */
153 i_shift_offset = DIM*shiftidx[iidx];
154 shX = shiftvec[i_shift_offset+XX];
155 shY = shiftvec[i_shift_offset+YY];
156 shZ = shiftvec[i_shift_offset+ZZ];
158 /* Load limits for loop over neighbors */
159 j_index_start = jindex[iidx];
160 j_index_end = jindex[iidx+1];
162 /* Get outer coordinate index */
164 i_coord_offset = DIM*inr;
166 /* Load i particle coords and add shift vector */
167 ix0 = shX + x[i_coord_offset+DIM*0+XX];
168 iy0 = shY + x[i_coord_offset+DIM*0+YY];
169 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
170 ix1 = shX + x[i_coord_offset+DIM*1+XX];
171 iy1 = shY + x[i_coord_offset+DIM*1+YY];
172 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
173 ix2 = shX + x[i_coord_offset+DIM*2+XX];
174 iy2 = shY + x[i_coord_offset+DIM*2+YY];
175 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
187 /* Reset potential sums */
191 /* Start inner kernel loop */
192 for(jidx=j_index_start; jidx<j_index_end; jidx++)
194 /* Get j neighbor index, and coordinate index */
196 j_coord_offset = DIM*jnr;
198 /* load j atom coordinates */
199 jx0 = x[j_coord_offset+DIM*0+XX];
200 jy0 = x[j_coord_offset+DIM*0+YY];
201 jz0 = x[j_coord_offset+DIM*0+ZZ];
202 jx1 = x[j_coord_offset+DIM*1+XX];
203 jy1 = x[j_coord_offset+DIM*1+YY];
204 jz1 = x[j_coord_offset+DIM*1+ZZ];
205 jx2 = x[j_coord_offset+DIM*2+XX];
206 jy2 = x[j_coord_offset+DIM*2+YY];
207 jz2 = x[j_coord_offset+DIM*2+ZZ];
209 /* Calculate displacement vector */
238 /* Calculate squared distance and things based on it */
239 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
240 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
241 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
242 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
243 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
244 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
245 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
246 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
247 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
249 rinv00 = gmx_invsqrt(rsq00);
250 rinv01 = gmx_invsqrt(rsq01);
251 rinv02 = gmx_invsqrt(rsq02);
252 rinv10 = gmx_invsqrt(rsq10);
253 rinv11 = gmx_invsqrt(rsq11);
254 rinv12 = gmx_invsqrt(rsq12);
255 rinv20 = gmx_invsqrt(rsq20);
256 rinv21 = gmx_invsqrt(rsq21);
257 rinv22 = gmx_invsqrt(rsq22);
259 rinvsq00 = rinv00*rinv00;
260 rinvsq01 = rinv01*rinv01;
261 rinvsq02 = rinv02*rinv02;
262 rinvsq10 = rinv10*rinv10;
263 rinvsq11 = rinv11*rinv11;
264 rinvsq12 = rinv12*rinv12;
265 rinvsq20 = rinv20*rinv20;
266 rinvsq21 = rinv21*rinv21;
267 rinvsq22 = rinv22*rinv22;
269 /**************************
270 * CALCULATE INTERACTIONS *
271 **************************/
275 /* Calculate table index by multiplying r with table scale and truncate to integer */
281 /* COULOMB ELECTROSTATICS */
283 felec = velec*rinvsq00;
285 /* CUBIC SPLINE TABLE DISPERSION */
289 Geps = vfeps*vftab[vfitab+2];
290 Heps2 = vfeps*vfeps*vftab[vfitab+3];
294 FF = Fp+Geps+2.0*Heps2;
297 /* CUBIC SPLINE TABLE REPULSION */
300 Geps = vfeps*vftab[vfitab+6];
301 Heps2 = vfeps*vfeps*vftab[vfitab+7];
305 FF = Fp+Geps+2.0*Heps2;
308 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
310 /* Update potential sums from outer loop */
316 /* Calculate temporary vectorial force */
321 /* Update vectorial force */
325 f[j_coord_offset+DIM*0+XX] -= tx;
326 f[j_coord_offset+DIM*0+YY] -= ty;
327 f[j_coord_offset+DIM*0+ZZ] -= tz;
329 /**************************
330 * CALCULATE INTERACTIONS *
331 **************************/
333 /* COULOMB ELECTROSTATICS */
335 felec = velec*rinvsq01;
337 /* Update potential sums from outer loop */
342 /* Calculate temporary vectorial force */
347 /* Update vectorial force */
351 f[j_coord_offset+DIM*1+XX] -= tx;
352 f[j_coord_offset+DIM*1+YY] -= ty;
353 f[j_coord_offset+DIM*1+ZZ] -= tz;
355 /**************************
356 * CALCULATE INTERACTIONS *
357 **************************/
359 /* COULOMB ELECTROSTATICS */
361 felec = velec*rinvsq02;
363 /* Update potential sums from outer loop */
368 /* Calculate temporary vectorial force */
373 /* Update vectorial force */
377 f[j_coord_offset+DIM*2+XX] -= tx;
378 f[j_coord_offset+DIM*2+YY] -= ty;
379 f[j_coord_offset+DIM*2+ZZ] -= tz;
381 /**************************
382 * CALCULATE INTERACTIONS *
383 **************************/
385 /* COULOMB ELECTROSTATICS */
387 felec = velec*rinvsq10;
389 /* Update potential sums from outer loop */
394 /* Calculate temporary vectorial force */
399 /* Update vectorial force */
403 f[j_coord_offset+DIM*0+XX] -= tx;
404 f[j_coord_offset+DIM*0+YY] -= ty;
405 f[j_coord_offset+DIM*0+ZZ] -= tz;
407 /**************************
408 * CALCULATE INTERACTIONS *
409 **************************/
411 /* COULOMB ELECTROSTATICS */
413 felec = velec*rinvsq11;
415 /* Update potential sums from outer loop */
420 /* Calculate temporary vectorial force */
425 /* Update vectorial force */
429 f[j_coord_offset+DIM*1+XX] -= tx;
430 f[j_coord_offset+DIM*1+YY] -= ty;
431 f[j_coord_offset+DIM*1+ZZ] -= tz;
433 /**************************
434 * CALCULATE INTERACTIONS *
435 **************************/
437 /* COULOMB ELECTROSTATICS */
439 felec = velec*rinvsq12;
441 /* Update potential sums from outer loop */
446 /* Calculate temporary vectorial force */
451 /* Update vectorial force */
455 f[j_coord_offset+DIM*2+XX] -= tx;
456 f[j_coord_offset+DIM*2+YY] -= ty;
457 f[j_coord_offset+DIM*2+ZZ] -= tz;
459 /**************************
460 * CALCULATE INTERACTIONS *
461 **************************/
463 /* COULOMB ELECTROSTATICS */
465 felec = velec*rinvsq20;
467 /* Update potential sums from outer loop */
472 /* Calculate temporary vectorial force */
477 /* Update vectorial force */
481 f[j_coord_offset+DIM*0+XX] -= tx;
482 f[j_coord_offset+DIM*0+YY] -= ty;
483 f[j_coord_offset+DIM*0+ZZ] -= tz;
485 /**************************
486 * CALCULATE INTERACTIONS *
487 **************************/
489 /* COULOMB ELECTROSTATICS */
491 felec = velec*rinvsq21;
493 /* Update potential sums from outer loop */
498 /* Calculate temporary vectorial force */
503 /* Update vectorial force */
507 f[j_coord_offset+DIM*1+XX] -= tx;
508 f[j_coord_offset+DIM*1+YY] -= ty;
509 f[j_coord_offset+DIM*1+ZZ] -= tz;
511 /**************************
512 * CALCULATE INTERACTIONS *
513 **************************/
515 /* COULOMB ELECTROSTATICS */
517 felec = velec*rinvsq22;
519 /* Update potential sums from outer loop */
524 /* Calculate temporary vectorial force */
529 /* Update vectorial force */
533 f[j_coord_offset+DIM*2+XX] -= tx;
534 f[j_coord_offset+DIM*2+YY] -= ty;
535 f[j_coord_offset+DIM*2+ZZ] -= tz;
537 /* Inner loop uses 277 flops */
539 /* End of innermost loop */
542 f[i_coord_offset+DIM*0+XX] += fix0;
543 f[i_coord_offset+DIM*0+YY] += fiy0;
544 f[i_coord_offset+DIM*0+ZZ] += fiz0;
548 f[i_coord_offset+DIM*1+XX] += fix1;
549 f[i_coord_offset+DIM*1+YY] += fiy1;
550 f[i_coord_offset+DIM*1+ZZ] += fiz1;
554 f[i_coord_offset+DIM*2+XX] += fix2;
555 f[i_coord_offset+DIM*2+YY] += fiy2;
556 f[i_coord_offset+DIM*2+ZZ] += fiz2;
560 fshift[i_shift_offset+XX] += tx;
561 fshift[i_shift_offset+YY] += ty;
562 fshift[i_shift_offset+ZZ] += tz;
565 /* Update potential energies */
566 kernel_data->energygrp_elec[ggid] += velecsum;
567 kernel_data->energygrp_vdw[ggid] += vvdwsum;
569 /* Increment number of inner iterations */
570 inneriter += j_index_end - j_index_start;
572 /* Outer loop uses 32 flops */
575 /* Increment number of outer iterations */
578 /* Update outer/inner flops */
580 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*277);
583 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwCSTab_GeomW3W3_F_c
584 * Electrostatics interaction: Coulomb
585 * VdW interaction: CubicSplineTable
586 * Geometry: Water3-Water3
587 * Calculate force/pot: Force
590 nb_kernel_ElecCoul_VdwCSTab_GeomW3W3_F_c
591 (t_nblist * gmx_restrict nlist,
592 rvec * gmx_restrict xx,
593 rvec * gmx_restrict ff,
594 t_forcerec * gmx_restrict fr,
595 t_mdatoms * gmx_restrict mdatoms,
596 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
597 t_nrnb * gmx_restrict nrnb)
599 int i_shift_offset,i_coord_offset,j_coord_offset;
600 int j_index_start,j_index_end;
601 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
602 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
603 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
604 real *shiftvec,*fshift,*x,*f;
606 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
608 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
610 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
612 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
614 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
616 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
617 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
618 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
619 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
620 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
621 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
622 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
623 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
624 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
625 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
626 real velec,felec,velecsum,facel,crf,krf,krf2;
629 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
633 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
641 jindex = nlist->jindex;
643 shiftidx = nlist->shift;
645 shiftvec = fr->shift_vec[0];
646 fshift = fr->fshift[0];
648 charge = mdatoms->chargeA;
649 nvdwtype = fr->ntype;
651 vdwtype = mdatoms->typeA;
653 vftab = kernel_data->table_vdw->data;
654 vftabscale = kernel_data->table_vdw->scale;
656 /* Setup water-specific parameters */
657 inr = nlist->iinr[0];
658 iq0 = facel*charge[inr+0];
659 iq1 = facel*charge[inr+1];
660 iq2 = facel*charge[inr+2];
661 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
666 vdwjidx0 = 2*vdwtype[inr+0];
668 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
669 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
682 /* Start outer loop over neighborlists */
683 for(iidx=0; iidx<nri; iidx++)
685 /* Load shift vector for this list */
686 i_shift_offset = DIM*shiftidx[iidx];
687 shX = shiftvec[i_shift_offset+XX];
688 shY = shiftvec[i_shift_offset+YY];
689 shZ = shiftvec[i_shift_offset+ZZ];
691 /* Load limits for loop over neighbors */
692 j_index_start = jindex[iidx];
693 j_index_end = jindex[iidx+1];
695 /* Get outer coordinate index */
697 i_coord_offset = DIM*inr;
699 /* Load i particle coords and add shift vector */
700 ix0 = shX + x[i_coord_offset+DIM*0+XX];
701 iy0 = shY + x[i_coord_offset+DIM*0+YY];
702 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
703 ix1 = shX + x[i_coord_offset+DIM*1+XX];
704 iy1 = shY + x[i_coord_offset+DIM*1+YY];
705 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
706 ix2 = shX + x[i_coord_offset+DIM*2+XX];
707 iy2 = shY + x[i_coord_offset+DIM*2+YY];
708 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
720 /* Start inner kernel loop */
721 for(jidx=j_index_start; jidx<j_index_end; jidx++)
723 /* Get j neighbor index, and coordinate index */
725 j_coord_offset = DIM*jnr;
727 /* load j atom coordinates */
728 jx0 = x[j_coord_offset+DIM*0+XX];
729 jy0 = x[j_coord_offset+DIM*0+YY];
730 jz0 = x[j_coord_offset+DIM*0+ZZ];
731 jx1 = x[j_coord_offset+DIM*1+XX];
732 jy1 = x[j_coord_offset+DIM*1+YY];
733 jz1 = x[j_coord_offset+DIM*1+ZZ];
734 jx2 = x[j_coord_offset+DIM*2+XX];
735 jy2 = x[j_coord_offset+DIM*2+YY];
736 jz2 = x[j_coord_offset+DIM*2+ZZ];
738 /* Calculate displacement vector */
767 /* Calculate squared distance and things based on it */
768 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
769 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
770 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
771 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
772 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
773 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
774 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
775 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
776 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
778 rinv00 = gmx_invsqrt(rsq00);
779 rinv01 = gmx_invsqrt(rsq01);
780 rinv02 = gmx_invsqrt(rsq02);
781 rinv10 = gmx_invsqrt(rsq10);
782 rinv11 = gmx_invsqrt(rsq11);
783 rinv12 = gmx_invsqrt(rsq12);
784 rinv20 = gmx_invsqrt(rsq20);
785 rinv21 = gmx_invsqrt(rsq21);
786 rinv22 = gmx_invsqrt(rsq22);
788 rinvsq00 = rinv00*rinv00;
789 rinvsq01 = rinv01*rinv01;
790 rinvsq02 = rinv02*rinv02;
791 rinvsq10 = rinv10*rinv10;
792 rinvsq11 = rinv11*rinv11;
793 rinvsq12 = rinv12*rinv12;
794 rinvsq20 = rinv20*rinv20;
795 rinvsq21 = rinv21*rinv21;
796 rinvsq22 = rinv22*rinv22;
798 /**************************
799 * CALCULATE INTERACTIONS *
800 **************************/
804 /* Calculate table index by multiplying r with table scale and truncate to integer */
810 /* COULOMB ELECTROSTATICS */
812 felec = velec*rinvsq00;
814 /* CUBIC SPLINE TABLE DISPERSION */
817 Geps = vfeps*vftab[vfitab+2];
818 Heps2 = vfeps*vfeps*vftab[vfitab+3];
820 FF = Fp+Geps+2.0*Heps2;
823 /* CUBIC SPLINE TABLE REPULSION */
825 Geps = vfeps*vftab[vfitab+6];
826 Heps2 = vfeps*vfeps*vftab[vfitab+7];
828 FF = Fp+Geps+2.0*Heps2;
830 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
834 /* Calculate temporary vectorial force */
839 /* Update vectorial force */
843 f[j_coord_offset+DIM*0+XX] -= tx;
844 f[j_coord_offset+DIM*0+YY] -= ty;
845 f[j_coord_offset+DIM*0+ZZ] -= tz;
847 /**************************
848 * CALCULATE INTERACTIONS *
849 **************************/
851 /* COULOMB ELECTROSTATICS */
853 felec = velec*rinvsq01;
857 /* Calculate temporary vectorial force */
862 /* Update vectorial force */
866 f[j_coord_offset+DIM*1+XX] -= tx;
867 f[j_coord_offset+DIM*1+YY] -= ty;
868 f[j_coord_offset+DIM*1+ZZ] -= tz;
870 /**************************
871 * CALCULATE INTERACTIONS *
872 **************************/
874 /* COULOMB ELECTROSTATICS */
876 felec = velec*rinvsq02;
880 /* Calculate temporary vectorial force */
885 /* Update vectorial force */
889 f[j_coord_offset+DIM*2+XX] -= tx;
890 f[j_coord_offset+DIM*2+YY] -= ty;
891 f[j_coord_offset+DIM*2+ZZ] -= tz;
893 /**************************
894 * CALCULATE INTERACTIONS *
895 **************************/
897 /* COULOMB ELECTROSTATICS */
899 felec = velec*rinvsq10;
903 /* Calculate temporary vectorial force */
908 /* Update vectorial force */
912 f[j_coord_offset+DIM*0+XX] -= tx;
913 f[j_coord_offset+DIM*0+YY] -= ty;
914 f[j_coord_offset+DIM*0+ZZ] -= tz;
916 /**************************
917 * CALCULATE INTERACTIONS *
918 **************************/
920 /* COULOMB ELECTROSTATICS */
922 felec = velec*rinvsq11;
926 /* Calculate temporary vectorial force */
931 /* Update vectorial force */
935 f[j_coord_offset+DIM*1+XX] -= tx;
936 f[j_coord_offset+DIM*1+YY] -= ty;
937 f[j_coord_offset+DIM*1+ZZ] -= tz;
939 /**************************
940 * CALCULATE INTERACTIONS *
941 **************************/
943 /* COULOMB ELECTROSTATICS */
945 felec = velec*rinvsq12;
949 /* Calculate temporary vectorial force */
954 /* Update vectorial force */
958 f[j_coord_offset+DIM*2+XX] -= tx;
959 f[j_coord_offset+DIM*2+YY] -= ty;
960 f[j_coord_offset+DIM*2+ZZ] -= tz;
962 /**************************
963 * CALCULATE INTERACTIONS *
964 **************************/
966 /* COULOMB ELECTROSTATICS */
968 felec = velec*rinvsq20;
972 /* Calculate temporary vectorial force */
977 /* Update vectorial force */
981 f[j_coord_offset+DIM*0+XX] -= tx;
982 f[j_coord_offset+DIM*0+YY] -= ty;
983 f[j_coord_offset+DIM*0+ZZ] -= tz;
985 /**************************
986 * CALCULATE INTERACTIONS *
987 **************************/
989 /* COULOMB ELECTROSTATICS */
991 felec = velec*rinvsq21;
995 /* Calculate temporary vectorial force */
1000 /* Update vectorial force */
1004 f[j_coord_offset+DIM*1+XX] -= tx;
1005 f[j_coord_offset+DIM*1+YY] -= ty;
1006 f[j_coord_offset+DIM*1+ZZ] -= tz;
1008 /**************************
1009 * CALCULATE INTERACTIONS *
1010 **************************/
1012 /* COULOMB ELECTROSTATICS */
1013 velec = qq22*rinv22;
1014 felec = velec*rinvsq22;
1018 /* Calculate temporary vectorial force */
1023 /* Update vectorial force */
1027 f[j_coord_offset+DIM*2+XX] -= tx;
1028 f[j_coord_offset+DIM*2+YY] -= ty;
1029 f[j_coord_offset+DIM*2+ZZ] -= tz;
1031 /* Inner loop uses 260 flops */
1033 /* End of innermost loop */
1036 f[i_coord_offset+DIM*0+XX] += fix0;
1037 f[i_coord_offset+DIM*0+YY] += fiy0;
1038 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1042 f[i_coord_offset+DIM*1+XX] += fix1;
1043 f[i_coord_offset+DIM*1+YY] += fiy1;
1044 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1048 f[i_coord_offset+DIM*2+XX] += fix2;
1049 f[i_coord_offset+DIM*2+YY] += fiy2;
1050 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1054 fshift[i_shift_offset+XX] += tx;
1055 fshift[i_shift_offset+YY] += ty;
1056 fshift[i_shift_offset+ZZ] += tz;
1058 /* Increment number of inner iterations */
1059 inneriter += j_index_end - j_index_start;
1061 /* Outer loop uses 30 flops */
1064 /* Increment number of outer iterations */
1067 /* Update outer/inner flops */
1069 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*260);