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_ElecCoul_VdwCSTab_GeomW3W3_VF_c
49 * Electrostatics interaction: Coulomb
50 * VdW interaction: CubicSplineTable
51 * Geometry: Water3-Water3
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecCoul_VdwCSTab_GeomW3W3_VF_c
56 (t_nblist * gmx_restrict nlist,
57 rvec * gmx_restrict xx,
58 rvec * gmx_restrict ff,
59 t_forcerec * gmx_restrict fr,
60 t_mdatoms * gmx_restrict mdatoms,
61 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
62 t_nrnb * gmx_restrict nrnb)
64 int i_shift_offset,i_coord_offset,j_coord_offset;
65 int j_index_start,j_index_end;
66 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
67 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
68 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
69 real *shiftvec,*fshift,*x,*f;
71 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
73 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
75 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
77 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
79 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
81 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
82 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
83 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
84 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
85 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
86 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
87 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
88 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
89 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
90 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
91 real velec,felec,velecsum,facel,crf,krf,krf2;
94 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
98 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
106 jindex = nlist->jindex;
108 shiftidx = nlist->shift;
110 shiftvec = fr->shift_vec[0];
111 fshift = fr->fshift[0];
113 charge = mdatoms->chargeA;
114 nvdwtype = fr->ntype;
116 vdwtype = mdatoms->typeA;
118 vftab = kernel_data->table_vdw->data;
119 vftabscale = kernel_data->table_vdw->scale;
121 /* Setup water-specific parameters */
122 inr = nlist->iinr[0];
123 iq0 = facel*charge[inr+0];
124 iq1 = facel*charge[inr+1];
125 iq2 = facel*charge[inr+2];
126 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
131 vdwjidx0 = 2*vdwtype[inr+0];
133 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
134 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
147 /* Start outer loop over neighborlists */
148 for(iidx=0; iidx<nri; iidx++)
150 /* Load shift vector for this list */
151 i_shift_offset = DIM*shiftidx[iidx];
152 shX = shiftvec[i_shift_offset+XX];
153 shY = shiftvec[i_shift_offset+YY];
154 shZ = shiftvec[i_shift_offset+ZZ];
156 /* Load limits for loop over neighbors */
157 j_index_start = jindex[iidx];
158 j_index_end = jindex[iidx+1];
160 /* Get outer coordinate index */
162 i_coord_offset = DIM*inr;
164 /* Load i particle coords and add shift vector */
165 ix0 = shX + x[i_coord_offset+DIM*0+XX];
166 iy0 = shY + x[i_coord_offset+DIM*0+YY];
167 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
168 ix1 = shX + x[i_coord_offset+DIM*1+XX];
169 iy1 = shY + x[i_coord_offset+DIM*1+YY];
170 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
171 ix2 = shX + x[i_coord_offset+DIM*2+XX];
172 iy2 = shY + x[i_coord_offset+DIM*2+YY];
173 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
185 /* Reset potential sums */
189 /* Start inner kernel loop */
190 for(jidx=j_index_start; jidx<j_index_end; jidx++)
192 /* Get j neighbor index, and coordinate index */
194 j_coord_offset = DIM*jnr;
196 /* load j atom coordinates */
197 jx0 = x[j_coord_offset+DIM*0+XX];
198 jy0 = x[j_coord_offset+DIM*0+YY];
199 jz0 = x[j_coord_offset+DIM*0+ZZ];
200 jx1 = x[j_coord_offset+DIM*1+XX];
201 jy1 = x[j_coord_offset+DIM*1+YY];
202 jz1 = x[j_coord_offset+DIM*1+ZZ];
203 jx2 = x[j_coord_offset+DIM*2+XX];
204 jy2 = x[j_coord_offset+DIM*2+YY];
205 jz2 = x[j_coord_offset+DIM*2+ZZ];
207 /* Calculate displacement vector */
236 /* Calculate squared distance and things based on it */
237 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
238 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
239 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
240 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
241 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
242 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
243 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
244 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
245 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
247 rinv00 = gmx_invsqrt(rsq00);
248 rinv01 = gmx_invsqrt(rsq01);
249 rinv02 = gmx_invsqrt(rsq02);
250 rinv10 = gmx_invsqrt(rsq10);
251 rinv11 = gmx_invsqrt(rsq11);
252 rinv12 = gmx_invsqrt(rsq12);
253 rinv20 = gmx_invsqrt(rsq20);
254 rinv21 = gmx_invsqrt(rsq21);
255 rinv22 = gmx_invsqrt(rsq22);
257 rinvsq00 = rinv00*rinv00;
258 rinvsq01 = rinv01*rinv01;
259 rinvsq02 = rinv02*rinv02;
260 rinvsq10 = rinv10*rinv10;
261 rinvsq11 = rinv11*rinv11;
262 rinvsq12 = rinv12*rinv12;
263 rinvsq20 = rinv20*rinv20;
264 rinvsq21 = rinv21*rinv21;
265 rinvsq22 = rinv22*rinv22;
267 /**************************
268 * CALCULATE INTERACTIONS *
269 **************************/
273 /* Calculate table index by multiplying r with table scale and truncate to integer */
279 /* COULOMB ELECTROSTATICS */
281 felec = velec*rinvsq00;
283 /* CUBIC SPLINE TABLE DISPERSION */
287 Geps = vfeps*vftab[vfitab+2];
288 Heps2 = vfeps*vfeps*vftab[vfitab+3];
292 FF = Fp+Geps+2.0*Heps2;
295 /* CUBIC SPLINE TABLE REPULSION */
298 Geps = vfeps*vftab[vfitab+6];
299 Heps2 = vfeps*vfeps*vftab[vfitab+7];
303 FF = Fp+Geps+2.0*Heps2;
306 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
308 /* Update potential sums from outer loop */
314 /* Calculate temporary vectorial force */
319 /* Update vectorial force */
323 f[j_coord_offset+DIM*0+XX] -= tx;
324 f[j_coord_offset+DIM*0+YY] -= ty;
325 f[j_coord_offset+DIM*0+ZZ] -= tz;
327 /**************************
328 * CALCULATE INTERACTIONS *
329 **************************/
331 /* COULOMB ELECTROSTATICS */
333 felec = velec*rinvsq01;
335 /* Update potential sums from outer loop */
340 /* Calculate temporary vectorial force */
345 /* Update vectorial force */
349 f[j_coord_offset+DIM*1+XX] -= tx;
350 f[j_coord_offset+DIM*1+YY] -= ty;
351 f[j_coord_offset+DIM*1+ZZ] -= tz;
353 /**************************
354 * CALCULATE INTERACTIONS *
355 **************************/
357 /* COULOMB ELECTROSTATICS */
359 felec = velec*rinvsq02;
361 /* Update potential sums from outer loop */
366 /* Calculate temporary vectorial force */
371 /* Update vectorial force */
375 f[j_coord_offset+DIM*2+XX] -= tx;
376 f[j_coord_offset+DIM*2+YY] -= ty;
377 f[j_coord_offset+DIM*2+ZZ] -= tz;
379 /**************************
380 * CALCULATE INTERACTIONS *
381 **************************/
383 /* COULOMB ELECTROSTATICS */
385 felec = velec*rinvsq10;
387 /* Update potential sums from outer loop */
392 /* Calculate temporary vectorial force */
397 /* Update vectorial force */
401 f[j_coord_offset+DIM*0+XX] -= tx;
402 f[j_coord_offset+DIM*0+YY] -= ty;
403 f[j_coord_offset+DIM*0+ZZ] -= tz;
405 /**************************
406 * CALCULATE INTERACTIONS *
407 **************************/
409 /* COULOMB ELECTROSTATICS */
411 felec = velec*rinvsq11;
413 /* Update potential sums from outer loop */
418 /* Calculate temporary vectorial force */
423 /* Update vectorial force */
427 f[j_coord_offset+DIM*1+XX] -= tx;
428 f[j_coord_offset+DIM*1+YY] -= ty;
429 f[j_coord_offset+DIM*1+ZZ] -= tz;
431 /**************************
432 * CALCULATE INTERACTIONS *
433 **************************/
435 /* COULOMB ELECTROSTATICS */
437 felec = velec*rinvsq12;
439 /* Update potential sums from outer loop */
444 /* Calculate temporary vectorial force */
449 /* Update vectorial force */
453 f[j_coord_offset+DIM*2+XX] -= tx;
454 f[j_coord_offset+DIM*2+YY] -= ty;
455 f[j_coord_offset+DIM*2+ZZ] -= tz;
457 /**************************
458 * CALCULATE INTERACTIONS *
459 **************************/
461 /* COULOMB ELECTROSTATICS */
463 felec = velec*rinvsq20;
465 /* Update potential sums from outer loop */
470 /* Calculate temporary vectorial force */
475 /* Update vectorial force */
479 f[j_coord_offset+DIM*0+XX] -= tx;
480 f[j_coord_offset+DIM*0+YY] -= ty;
481 f[j_coord_offset+DIM*0+ZZ] -= tz;
483 /**************************
484 * CALCULATE INTERACTIONS *
485 **************************/
487 /* COULOMB ELECTROSTATICS */
489 felec = velec*rinvsq21;
491 /* Update potential sums from outer loop */
496 /* Calculate temporary vectorial force */
501 /* Update vectorial force */
505 f[j_coord_offset+DIM*1+XX] -= tx;
506 f[j_coord_offset+DIM*1+YY] -= ty;
507 f[j_coord_offset+DIM*1+ZZ] -= tz;
509 /**************************
510 * CALCULATE INTERACTIONS *
511 **************************/
513 /* COULOMB ELECTROSTATICS */
515 felec = velec*rinvsq22;
517 /* Update potential sums from outer loop */
522 /* Calculate temporary vectorial force */
527 /* Update vectorial force */
531 f[j_coord_offset+DIM*2+XX] -= tx;
532 f[j_coord_offset+DIM*2+YY] -= ty;
533 f[j_coord_offset+DIM*2+ZZ] -= tz;
535 /* Inner loop uses 277 flops */
537 /* End of innermost loop */
540 f[i_coord_offset+DIM*0+XX] += fix0;
541 f[i_coord_offset+DIM*0+YY] += fiy0;
542 f[i_coord_offset+DIM*0+ZZ] += fiz0;
546 f[i_coord_offset+DIM*1+XX] += fix1;
547 f[i_coord_offset+DIM*1+YY] += fiy1;
548 f[i_coord_offset+DIM*1+ZZ] += fiz1;
552 f[i_coord_offset+DIM*2+XX] += fix2;
553 f[i_coord_offset+DIM*2+YY] += fiy2;
554 f[i_coord_offset+DIM*2+ZZ] += fiz2;
558 fshift[i_shift_offset+XX] += tx;
559 fshift[i_shift_offset+YY] += ty;
560 fshift[i_shift_offset+ZZ] += tz;
563 /* Update potential energies */
564 kernel_data->energygrp_elec[ggid] += velecsum;
565 kernel_data->energygrp_vdw[ggid] += vvdwsum;
567 /* Increment number of inner iterations */
568 inneriter += j_index_end - j_index_start;
570 /* Outer loop uses 32 flops */
573 /* Increment number of outer iterations */
576 /* Update outer/inner flops */
578 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*277);
581 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwCSTab_GeomW3W3_F_c
582 * Electrostatics interaction: Coulomb
583 * VdW interaction: CubicSplineTable
584 * Geometry: Water3-Water3
585 * Calculate force/pot: Force
588 nb_kernel_ElecCoul_VdwCSTab_GeomW3W3_F_c
589 (t_nblist * gmx_restrict nlist,
590 rvec * gmx_restrict xx,
591 rvec * gmx_restrict ff,
592 t_forcerec * gmx_restrict fr,
593 t_mdatoms * gmx_restrict mdatoms,
594 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
595 t_nrnb * gmx_restrict nrnb)
597 int i_shift_offset,i_coord_offset,j_coord_offset;
598 int j_index_start,j_index_end;
599 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
600 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
601 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
602 real *shiftvec,*fshift,*x,*f;
604 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
606 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
608 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
610 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
612 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
614 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
615 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
616 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
617 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
618 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
619 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
620 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
621 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
622 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
623 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
624 real velec,felec,velecsum,facel,crf,krf,krf2;
627 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
631 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
639 jindex = nlist->jindex;
641 shiftidx = nlist->shift;
643 shiftvec = fr->shift_vec[0];
644 fshift = fr->fshift[0];
646 charge = mdatoms->chargeA;
647 nvdwtype = fr->ntype;
649 vdwtype = mdatoms->typeA;
651 vftab = kernel_data->table_vdw->data;
652 vftabscale = kernel_data->table_vdw->scale;
654 /* Setup water-specific parameters */
655 inr = nlist->iinr[0];
656 iq0 = facel*charge[inr+0];
657 iq1 = facel*charge[inr+1];
658 iq2 = facel*charge[inr+2];
659 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
664 vdwjidx0 = 2*vdwtype[inr+0];
666 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
667 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
680 /* Start outer loop over neighborlists */
681 for(iidx=0; iidx<nri; iidx++)
683 /* Load shift vector for this list */
684 i_shift_offset = DIM*shiftidx[iidx];
685 shX = shiftvec[i_shift_offset+XX];
686 shY = shiftvec[i_shift_offset+YY];
687 shZ = shiftvec[i_shift_offset+ZZ];
689 /* Load limits for loop over neighbors */
690 j_index_start = jindex[iidx];
691 j_index_end = jindex[iidx+1];
693 /* Get outer coordinate index */
695 i_coord_offset = DIM*inr;
697 /* Load i particle coords and add shift vector */
698 ix0 = shX + x[i_coord_offset+DIM*0+XX];
699 iy0 = shY + x[i_coord_offset+DIM*0+YY];
700 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
701 ix1 = shX + x[i_coord_offset+DIM*1+XX];
702 iy1 = shY + x[i_coord_offset+DIM*1+YY];
703 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
704 ix2 = shX + x[i_coord_offset+DIM*2+XX];
705 iy2 = shY + x[i_coord_offset+DIM*2+YY];
706 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
718 /* Start inner kernel loop */
719 for(jidx=j_index_start; jidx<j_index_end; jidx++)
721 /* Get j neighbor index, and coordinate index */
723 j_coord_offset = DIM*jnr;
725 /* load j atom coordinates */
726 jx0 = x[j_coord_offset+DIM*0+XX];
727 jy0 = x[j_coord_offset+DIM*0+YY];
728 jz0 = x[j_coord_offset+DIM*0+ZZ];
729 jx1 = x[j_coord_offset+DIM*1+XX];
730 jy1 = x[j_coord_offset+DIM*1+YY];
731 jz1 = x[j_coord_offset+DIM*1+ZZ];
732 jx2 = x[j_coord_offset+DIM*2+XX];
733 jy2 = x[j_coord_offset+DIM*2+YY];
734 jz2 = x[j_coord_offset+DIM*2+ZZ];
736 /* Calculate displacement vector */
765 /* Calculate squared distance and things based on it */
766 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
767 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
768 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
769 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
770 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
771 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
772 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
773 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
774 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
776 rinv00 = gmx_invsqrt(rsq00);
777 rinv01 = gmx_invsqrt(rsq01);
778 rinv02 = gmx_invsqrt(rsq02);
779 rinv10 = gmx_invsqrt(rsq10);
780 rinv11 = gmx_invsqrt(rsq11);
781 rinv12 = gmx_invsqrt(rsq12);
782 rinv20 = gmx_invsqrt(rsq20);
783 rinv21 = gmx_invsqrt(rsq21);
784 rinv22 = gmx_invsqrt(rsq22);
786 rinvsq00 = rinv00*rinv00;
787 rinvsq01 = rinv01*rinv01;
788 rinvsq02 = rinv02*rinv02;
789 rinvsq10 = rinv10*rinv10;
790 rinvsq11 = rinv11*rinv11;
791 rinvsq12 = rinv12*rinv12;
792 rinvsq20 = rinv20*rinv20;
793 rinvsq21 = rinv21*rinv21;
794 rinvsq22 = rinv22*rinv22;
796 /**************************
797 * CALCULATE INTERACTIONS *
798 **************************/
802 /* Calculate table index by multiplying r with table scale and truncate to integer */
808 /* COULOMB ELECTROSTATICS */
810 felec = velec*rinvsq00;
812 /* CUBIC SPLINE TABLE DISPERSION */
815 Geps = vfeps*vftab[vfitab+2];
816 Heps2 = vfeps*vfeps*vftab[vfitab+3];
818 FF = Fp+Geps+2.0*Heps2;
821 /* CUBIC SPLINE TABLE REPULSION */
823 Geps = vfeps*vftab[vfitab+6];
824 Heps2 = vfeps*vfeps*vftab[vfitab+7];
826 FF = Fp+Geps+2.0*Heps2;
828 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
832 /* Calculate temporary vectorial force */
837 /* Update vectorial force */
841 f[j_coord_offset+DIM*0+XX] -= tx;
842 f[j_coord_offset+DIM*0+YY] -= ty;
843 f[j_coord_offset+DIM*0+ZZ] -= tz;
845 /**************************
846 * CALCULATE INTERACTIONS *
847 **************************/
849 /* COULOMB ELECTROSTATICS */
851 felec = velec*rinvsq01;
855 /* Calculate temporary vectorial force */
860 /* Update vectorial force */
864 f[j_coord_offset+DIM*1+XX] -= tx;
865 f[j_coord_offset+DIM*1+YY] -= ty;
866 f[j_coord_offset+DIM*1+ZZ] -= tz;
868 /**************************
869 * CALCULATE INTERACTIONS *
870 **************************/
872 /* COULOMB ELECTROSTATICS */
874 felec = velec*rinvsq02;
878 /* Calculate temporary vectorial force */
883 /* Update vectorial force */
887 f[j_coord_offset+DIM*2+XX] -= tx;
888 f[j_coord_offset+DIM*2+YY] -= ty;
889 f[j_coord_offset+DIM*2+ZZ] -= tz;
891 /**************************
892 * CALCULATE INTERACTIONS *
893 **************************/
895 /* COULOMB ELECTROSTATICS */
897 felec = velec*rinvsq10;
901 /* Calculate temporary vectorial force */
906 /* Update vectorial force */
910 f[j_coord_offset+DIM*0+XX] -= tx;
911 f[j_coord_offset+DIM*0+YY] -= ty;
912 f[j_coord_offset+DIM*0+ZZ] -= tz;
914 /**************************
915 * CALCULATE INTERACTIONS *
916 **************************/
918 /* COULOMB ELECTROSTATICS */
920 felec = velec*rinvsq11;
924 /* Calculate temporary vectorial force */
929 /* Update vectorial force */
933 f[j_coord_offset+DIM*1+XX] -= tx;
934 f[j_coord_offset+DIM*1+YY] -= ty;
935 f[j_coord_offset+DIM*1+ZZ] -= tz;
937 /**************************
938 * CALCULATE INTERACTIONS *
939 **************************/
941 /* COULOMB ELECTROSTATICS */
943 felec = velec*rinvsq12;
947 /* Calculate temporary vectorial force */
952 /* Update vectorial force */
956 f[j_coord_offset+DIM*2+XX] -= tx;
957 f[j_coord_offset+DIM*2+YY] -= ty;
958 f[j_coord_offset+DIM*2+ZZ] -= tz;
960 /**************************
961 * CALCULATE INTERACTIONS *
962 **************************/
964 /* COULOMB ELECTROSTATICS */
966 felec = velec*rinvsq20;
970 /* Calculate temporary vectorial force */
975 /* Update vectorial force */
979 f[j_coord_offset+DIM*0+XX] -= tx;
980 f[j_coord_offset+DIM*0+YY] -= ty;
981 f[j_coord_offset+DIM*0+ZZ] -= tz;
983 /**************************
984 * CALCULATE INTERACTIONS *
985 **************************/
987 /* COULOMB ELECTROSTATICS */
989 felec = velec*rinvsq21;
993 /* Calculate temporary vectorial force */
998 /* Update vectorial force */
1002 f[j_coord_offset+DIM*1+XX] -= tx;
1003 f[j_coord_offset+DIM*1+YY] -= ty;
1004 f[j_coord_offset+DIM*1+ZZ] -= tz;
1006 /**************************
1007 * CALCULATE INTERACTIONS *
1008 **************************/
1010 /* COULOMB ELECTROSTATICS */
1011 velec = qq22*rinv22;
1012 felec = velec*rinvsq22;
1016 /* Calculate temporary vectorial force */
1021 /* Update vectorial force */
1025 f[j_coord_offset+DIM*2+XX] -= tx;
1026 f[j_coord_offset+DIM*2+YY] -= ty;
1027 f[j_coord_offset+DIM*2+ZZ] -= tz;
1029 /* Inner loop uses 260 flops */
1031 /* End of innermost loop */
1034 f[i_coord_offset+DIM*0+XX] += fix0;
1035 f[i_coord_offset+DIM*0+YY] += fiy0;
1036 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1040 f[i_coord_offset+DIM*1+XX] += fix1;
1041 f[i_coord_offset+DIM*1+YY] += fiy1;
1042 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1046 f[i_coord_offset+DIM*2+XX] += fix2;
1047 f[i_coord_offset+DIM*2+YY] += fiy2;
1048 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1052 fshift[i_shift_offset+XX] += tx;
1053 fshift[i_shift_offset+YY] += ty;
1054 fshift[i_shift_offset+ZZ] += tz;
1056 /* Increment number of inner iterations */
1057 inneriter += j_index_end - j_index_start;
1059 /* Outer loop uses 30 flops */
1062 /* Increment number of outer iterations */
1065 /* Update outer/inner flops */
1067 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*260);