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_ElecRFCut_VdwCSTab_GeomW3W3_VF_c
35 * Electrostatics interaction: ReactionField
36 * VdW interaction: CubicSplineTable
37 * Geometry: Water3-Water3
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecRFCut_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;
103 nvdwtype = fr->ntype;
105 vdwtype = mdatoms->typeA;
107 vftab = kernel_data->table_vdw->data;
108 vftabscale = kernel_data->table_vdw->scale;
110 /* Setup water-specific parameters */
111 inr = nlist->iinr[0];
112 iq0 = facel*charge[inr+0];
113 iq1 = facel*charge[inr+1];
114 iq2 = facel*charge[inr+2];
115 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
120 vdwjidx0 = 2*vdwtype[inr+0];
122 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
123 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
133 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
134 rcutoff = fr->rcoulomb;
135 rcutoff2 = rcutoff*rcutoff;
140 /* Start outer loop over neighborlists */
141 for(iidx=0; iidx<nri; iidx++)
143 /* Load shift vector for this list */
144 i_shift_offset = DIM*shiftidx[iidx];
145 shX = shiftvec[i_shift_offset+XX];
146 shY = shiftvec[i_shift_offset+YY];
147 shZ = shiftvec[i_shift_offset+ZZ];
149 /* Load limits for loop over neighbors */
150 j_index_start = jindex[iidx];
151 j_index_end = jindex[iidx+1];
153 /* Get outer coordinate index */
155 i_coord_offset = DIM*inr;
157 /* Load i particle coords and add shift vector */
158 ix0 = shX + x[i_coord_offset+DIM*0+XX];
159 iy0 = shY + x[i_coord_offset+DIM*0+YY];
160 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
161 ix1 = shX + x[i_coord_offset+DIM*1+XX];
162 iy1 = shY + x[i_coord_offset+DIM*1+YY];
163 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
164 ix2 = shX + x[i_coord_offset+DIM*2+XX];
165 iy2 = shY + x[i_coord_offset+DIM*2+YY];
166 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
178 /* Reset potential sums */
182 /* Start inner kernel loop */
183 for(jidx=j_index_start; jidx<j_index_end; jidx++)
185 /* Get j neighbor index, and coordinate index */
187 j_coord_offset = DIM*jnr;
189 /* load j atom coordinates */
190 jx0 = x[j_coord_offset+DIM*0+XX];
191 jy0 = x[j_coord_offset+DIM*0+YY];
192 jz0 = x[j_coord_offset+DIM*0+ZZ];
193 jx1 = x[j_coord_offset+DIM*1+XX];
194 jy1 = x[j_coord_offset+DIM*1+YY];
195 jz1 = x[j_coord_offset+DIM*1+ZZ];
196 jx2 = x[j_coord_offset+DIM*2+XX];
197 jy2 = x[j_coord_offset+DIM*2+YY];
198 jz2 = x[j_coord_offset+DIM*2+ZZ];
200 /* Calculate displacement vector */
229 /* Calculate squared distance and things based on it */
230 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
231 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
232 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
233 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
234 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
235 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
236 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
237 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
238 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
240 rinv00 = gmx_invsqrt(rsq00);
241 rinv01 = gmx_invsqrt(rsq01);
242 rinv02 = gmx_invsqrt(rsq02);
243 rinv10 = gmx_invsqrt(rsq10);
244 rinv11 = gmx_invsqrt(rsq11);
245 rinv12 = gmx_invsqrt(rsq12);
246 rinv20 = gmx_invsqrt(rsq20);
247 rinv21 = gmx_invsqrt(rsq21);
248 rinv22 = gmx_invsqrt(rsq22);
250 rinvsq00 = rinv00*rinv00;
251 rinvsq01 = rinv01*rinv01;
252 rinvsq02 = rinv02*rinv02;
253 rinvsq10 = rinv10*rinv10;
254 rinvsq11 = rinv11*rinv11;
255 rinvsq12 = rinv12*rinv12;
256 rinvsq20 = rinv20*rinv20;
257 rinvsq21 = rinv21*rinv21;
258 rinvsq22 = rinv22*rinv22;
260 /**************************
261 * CALCULATE INTERACTIONS *
262 **************************/
269 /* Calculate table index by multiplying r with table scale and truncate to integer */
275 /* REACTION-FIELD ELECTROSTATICS */
276 velec = qq00*(rinv00+krf*rsq00-crf);
277 felec = qq00*(rinv00*rinvsq00-krf2);
279 /* CUBIC SPLINE TABLE DISPERSION */
283 Geps = vfeps*vftab[vfitab+2];
284 Heps2 = vfeps*vfeps*vftab[vfitab+3];
288 FF = Fp+Geps+2.0*Heps2;
291 /* CUBIC SPLINE TABLE REPULSION */
294 Geps = vfeps*vftab[vfitab+6];
295 Heps2 = vfeps*vfeps*vftab[vfitab+7];
299 FF = Fp+Geps+2.0*Heps2;
302 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
304 /* Update potential sums from outer loop */
310 /* Calculate temporary vectorial force */
315 /* Update vectorial force */
319 f[j_coord_offset+DIM*0+XX] -= tx;
320 f[j_coord_offset+DIM*0+YY] -= ty;
321 f[j_coord_offset+DIM*0+ZZ] -= tz;
325 /**************************
326 * CALCULATE INTERACTIONS *
327 **************************/
332 /* REACTION-FIELD ELECTROSTATICS */
333 velec = qq01*(rinv01+krf*rsq01-crf);
334 felec = qq01*(rinv01*rinvsq01-krf2);
336 /* Update potential sums from outer loop */
341 /* Calculate temporary vectorial force */
346 /* Update vectorial force */
350 f[j_coord_offset+DIM*1+XX] -= tx;
351 f[j_coord_offset+DIM*1+YY] -= ty;
352 f[j_coord_offset+DIM*1+ZZ] -= tz;
356 /**************************
357 * CALCULATE INTERACTIONS *
358 **************************/
363 /* REACTION-FIELD ELECTROSTATICS */
364 velec = qq02*(rinv02+krf*rsq02-crf);
365 felec = qq02*(rinv02*rinvsq02-krf2);
367 /* Update potential sums from outer loop */
372 /* Calculate temporary vectorial force */
377 /* Update vectorial force */
381 f[j_coord_offset+DIM*2+XX] -= tx;
382 f[j_coord_offset+DIM*2+YY] -= ty;
383 f[j_coord_offset+DIM*2+ZZ] -= tz;
387 /**************************
388 * CALCULATE INTERACTIONS *
389 **************************/
394 /* REACTION-FIELD ELECTROSTATICS */
395 velec = qq10*(rinv10+krf*rsq10-crf);
396 felec = qq10*(rinv10*rinvsq10-krf2);
398 /* Update potential sums from outer loop */
403 /* Calculate temporary vectorial force */
408 /* Update vectorial force */
412 f[j_coord_offset+DIM*0+XX] -= tx;
413 f[j_coord_offset+DIM*0+YY] -= ty;
414 f[j_coord_offset+DIM*0+ZZ] -= tz;
418 /**************************
419 * CALCULATE INTERACTIONS *
420 **************************/
425 /* REACTION-FIELD ELECTROSTATICS */
426 velec = qq11*(rinv11+krf*rsq11-crf);
427 felec = qq11*(rinv11*rinvsq11-krf2);
429 /* Update potential sums from outer loop */
434 /* Calculate temporary vectorial force */
439 /* Update vectorial force */
443 f[j_coord_offset+DIM*1+XX] -= tx;
444 f[j_coord_offset+DIM*1+YY] -= ty;
445 f[j_coord_offset+DIM*1+ZZ] -= tz;
449 /**************************
450 * CALCULATE INTERACTIONS *
451 **************************/
456 /* REACTION-FIELD ELECTROSTATICS */
457 velec = qq12*(rinv12+krf*rsq12-crf);
458 felec = qq12*(rinv12*rinvsq12-krf2);
460 /* Update potential sums from outer loop */
465 /* Calculate temporary vectorial force */
470 /* Update vectorial force */
474 f[j_coord_offset+DIM*2+XX] -= tx;
475 f[j_coord_offset+DIM*2+YY] -= ty;
476 f[j_coord_offset+DIM*2+ZZ] -= tz;
480 /**************************
481 * CALCULATE INTERACTIONS *
482 **************************/
487 /* REACTION-FIELD ELECTROSTATICS */
488 velec = qq20*(rinv20+krf*rsq20-crf);
489 felec = qq20*(rinv20*rinvsq20-krf2);
491 /* Update potential sums from outer loop */
496 /* Calculate temporary vectorial force */
501 /* Update vectorial force */
505 f[j_coord_offset+DIM*0+XX] -= tx;
506 f[j_coord_offset+DIM*0+YY] -= ty;
507 f[j_coord_offset+DIM*0+ZZ] -= tz;
511 /**************************
512 * CALCULATE INTERACTIONS *
513 **************************/
518 /* REACTION-FIELD ELECTROSTATICS */
519 velec = qq21*(rinv21+krf*rsq21-crf);
520 felec = qq21*(rinv21*rinvsq21-krf2);
522 /* Update potential sums from outer loop */
527 /* Calculate temporary vectorial force */
532 /* Update vectorial force */
536 f[j_coord_offset+DIM*1+XX] -= tx;
537 f[j_coord_offset+DIM*1+YY] -= ty;
538 f[j_coord_offset+DIM*1+ZZ] -= tz;
542 /**************************
543 * CALCULATE INTERACTIONS *
544 **************************/
549 /* REACTION-FIELD ELECTROSTATICS */
550 velec = qq22*(rinv22+krf*rsq22-crf);
551 felec = qq22*(rinv22*rinvsq22-krf2);
553 /* Update potential sums from outer loop */
558 /* Calculate temporary vectorial force */
563 /* Update vectorial force */
567 f[j_coord_offset+DIM*2+XX] -= tx;
568 f[j_coord_offset+DIM*2+YY] -= ty;
569 f[j_coord_offset+DIM*2+ZZ] -= tz;
573 /* Inner loop uses 313 flops */
575 /* End of innermost loop */
578 f[i_coord_offset+DIM*0+XX] += fix0;
579 f[i_coord_offset+DIM*0+YY] += fiy0;
580 f[i_coord_offset+DIM*0+ZZ] += fiz0;
584 f[i_coord_offset+DIM*1+XX] += fix1;
585 f[i_coord_offset+DIM*1+YY] += fiy1;
586 f[i_coord_offset+DIM*1+ZZ] += fiz1;
590 f[i_coord_offset+DIM*2+XX] += fix2;
591 f[i_coord_offset+DIM*2+YY] += fiy2;
592 f[i_coord_offset+DIM*2+ZZ] += fiz2;
596 fshift[i_shift_offset+XX] += tx;
597 fshift[i_shift_offset+YY] += ty;
598 fshift[i_shift_offset+ZZ] += tz;
601 /* Update potential energies */
602 kernel_data->energygrp_elec[ggid] += velecsum;
603 kernel_data->energygrp_vdw[ggid] += vvdwsum;
605 /* Increment number of inner iterations */
606 inneriter += j_index_end - j_index_start;
608 /* Outer loop uses 32 flops */
611 /* Increment number of outer iterations */
614 /* Update outer/inner flops */
616 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*313);
619 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomW3W3_F_c
620 * Electrostatics interaction: ReactionField
621 * VdW interaction: CubicSplineTable
622 * Geometry: Water3-Water3
623 * Calculate force/pot: Force
626 nb_kernel_ElecRFCut_VdwCSTab_GeomW3W3_F_c
627 (t_nblist * gmx_restrict nlist,
628 rvec * gmx_restrict xx,
629 rvec * gmx_restrict ff,
630 t_forcerec * gmx_restrict fr,
631 t_mdatoms * gmx_restrict mdatoms,
632 nb_kernel_data_t * gmx_restrict kernel_data,
633 t_nrnb * gmx_restrict nrnb)
635 int i_shift_offset,i_coord_offset,j_coord_offset;
636 int j_index_start,j_index_end;
637 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
638 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
639 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
640 real *shiftvec,*fshift,*x,*f;
642 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
644 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
646 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
648 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
650 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
652 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
653 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
654 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
655 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
656 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
657 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
658 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
659 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
660 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
661 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
662 real velec,felec,velecsum,facel,crf,krf,krf2;
665 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
669 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
677 jindex = nlist->jindex;
679 shiftidx = nlist->shift;
681 shiftvec = fr->shift_vec[0];
682 fshift = fr->fshift[0];
684 charge = mdatoms->chargeA;
688 nvdwtype = fr->ntype;
690 vdwtype = mdatoms->typeA;
692 vftab = kernel_data->table_vdw->data;
693 vftabscale = kernel_data->table_vdw->scale;
695 /* Setup water-specific parameters */
696 inr = nlist->iinr[0];
697 iq0 = facel*charge[inr+0];
698 iq1 = facel*charge[inr+1];
699 iq2 = facel*charge[inr+2];
700 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
705 vdwjidx0 = 2*vdwtype[inr+0];
707 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
708 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
718 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
719 rcutoff = fr->rcoulomb;
720 rcutoff2 = rcutoff*rcutoff;
725 /* Start outer loop over neighborlists */
726 for(iidx=0; iidx<nri; iidx++)
728 /* Load shift vector for this list */
729 i_shift_offset = DIM*shiftidx[iidx];
730 shX = shiftvec[i_shift_offset+XX];
731 shY = shiftvec[i_shift_offset+YY];
732 shZ = shiftvec[i_shift_offset+ZZ];
734 /* Load limits for loop over neighbors */
735 j_index_start = jindex[iidx];
736 j_index_end = jindex[iidx+1];
738 /* Get outer coordinate index */
740 i_coord_offset = DIM*inr;
742 /* Load i particle coords and add shift vector */
743 ix0 = shX + x[i_coord_offset+DIM*0+XX];
744 iy0 = shY + x[i_coord_offset+DIM*0+YY];
745 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
746 ix1 = shX + x[i_coord_offset+DIM*1+XX];
747 iy1 = shY + x[i_coord_offset+DIM*1+YY];
748 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
749 ix2 = shX + x[i_coord_offset+DIM*2+XX];
750 iy2 = shY + x[i_coord_offset+DIM*2+YY];
751 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
763 /* Start inner kernel loop */
764 for(jidx=j_index_start; jidx<j_index_end; jidx++)
766 /* Get j neighbor index, and coordinate index */
768 j_coord_offset = DIM*jnr;
770 /* load j atom coordinates */
771 jx0 = x[j_coord_offset+DIM*0+XX];
772 jy0 = x[j_coord_offset+DIM*0+YY];
773 jz0 = x[j_coord_offset+DIM*0+ZZ];
774 jx1 = x[j_coord_offset+DIM*1+XX];
775 jy1 = x[j_coord_offset+DIM*1+YY];
776 jz1 = x[j_coord_offset+DIM*1+ZZ];
777 jx2 = x[j_coord_offset+DIM*2+XX];
778 jy2 = x[j_coord_offset+DIM*2+YY];
779 jz2 = x[j_coord_offset+DIM*2+ZZ];
781 /* Calculate displacement vector */
810 /* Calculate squared distance and things based on it */
811 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
812 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
813 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
814 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
815 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
816 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
817 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
818 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
819 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
821 rinv00 = gmx_invsqrt(rsq00);
822 rinv01 = gmx_invsqrt(rsq01);
823 rinv02 = gmx_invsqrt(rsq02);
824 rinv10 = gmx_invsqrt(rsq10);
825 rinv11 = gmx_invsqrt(rsq11);
826 rinv12 = gmx_invsqrt(rsq12);
827 rinv20 = gmx_invsqrt(rsq20);
828 rinv21 = gmx_invsqrt(rsq21);
829 rinv22 = gmx_invsqrt(rsq22);
831 rinvsq00 = rinv00*rinv00;
832 rinvsq01 = rinv01*rinv01;
833 rinvsq02 = rinv02*rinv02;
834 rinvsq10 = rinv10*rinv10;
835 rinvsq11 = rinv11*rinv11;
836 rinvsq12 = rinv12*rinv12;
837 rinvsq20 = rinv20*rinv20;
838 rinvsq21 = rinv21*rinv21;
839 rinvsq22 = rinv22*rinv22;
841 /**************************
842 * CALCULATE INTERACTIONS *
843 **************************/
850 /* Calculate table index by multiplying r with table scale and truncate to integer */
856 /* REACTION-FIELD ELECTROSTATICS */
857 felec = qq00*(rinv00*rinvsq00-krf2);
859 /* CUBIC SPLINE TABLE DISPERSION */
863 Geps = vfeps*vftab[vfitab+2];
864 Heps2 = vfeps*vfeps*vftab[vfitab+3];
866 FF = Fp+Geps+2.0*Heps2;
869 /* CUBIC SPLINE TABLE REPULSION */
872 Geps = vfeps*vftab[vfitab+6];
873 Heps2 = vfeps*vfeps*vftab[vfitab+7];
875 FF = Fp+Geps+2.0*Heps2;
877 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
881 /* Calculate temporary vectorial force */
886 /* Update vectorial force */
890 f[j_coord_offset+DIM*0+XX] -= tx;
891 f[j_coord_offset+DIM*0+YY] -= ty;
892 f[j_coord_offset+DIM*0+ZZ] -= tz;
896 /**************************
897 * CALCULATE INTERACTIONS *
898 **************************/
903 /* REACTION-FIELD ELECTROSTATICS */
904 felec = qq01*(rinv01*rinvsq01-krf2);
908 /* Calculate temporary vectorial force */
913 /* Update vectorial force */
917 f[j_coord_offset+DIM*1+XX] -= tx;
918 f[j_coord_offset+DIM*1+YY] -= ty;
919 f[j_coord_offset+DIM*1+ZZ] -= tz;
923 /**************************
924 * CALCULATE INTERACTIONS *
925 **************************/
930 /* REACTION-FIELD ELECTROSTATICS */
931 felec = qq02*(rinv02*rinvsq02-krf2);
935 /* Calculate temporary vectorial force */
940 /* Update vectorial force */
944 f[j_coord_offset+DIM*2+XX] -= tx;
945 f[j_coord_offset+DIM*2+YY] -= ty;
946 f[j_coord_offset+DIM*2+ZZ] -= tz;
950 /**************************
951 * CALCULATE INTERACTIONS *
952 **************************/
957 /* REACTION-FIELD ELECTROSTATICS */
958 felec = qq10*(rinv10*rinvsq10-krf2);
962 /* Calculate temporary vectorial force */
967 /* Update vectorial force */
971 f[j_coord_offset+DIM*0+XX] -= tx;
972 f[j_coord_offset+DIM*0+YY] -= ty;
973 f[j_coord_offset+DIM*0+ZZ] -= tz;
977 /**************************
978 * CALCULATE INTERACTIONS *
979 **************************/
984 /* REACTION-FIELD ELECTROSTATICS */
985 felec = qq11*(rinv11*rinvsq11-krf2);
989 /* Calculate temporary vectorial force */
994 /* Update vectorial force */
998 f[j_coord_offset+DIM*1+XX] -= tx;
999 f[j_coord_offset+DIM*1+YY] -= ty;
1000 f[j_coord_offset+DIM*1+ZZ] -= tz;
1004 /**************************
1005 * CALCULATE INTERACTIONS *
1006 **************************/
1011 /* REACTION-FIELD ELECTROSTATICS */
1012 felec = qq12*(rinv12*rinvsq12-krf2);
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;
1031 /**************************
1032 * CALCULATE INTERACTIONS *
1033 **************************/
1038 /* REACTION-FIELD ELECTROSTATICS */
1039 felec = qq20*(rinv20*rinvsq20-krf2);
1043 /* Calculate temporary vectorial force */
1048 /* Update vectorial force */
1052 f[j_coord_offset+DIM*0+XX] -= tx;
1053 f[j_coord_offset+DIM*0+YY] -= ty;
1054 f[j_coord_offset+DIM*0+ZZ] -= tz;
1058 /**************************
1059 * CALCULATE INTERACTIONS *
1060 **************************/
1065 /* REACTION-FIELD ELECTROSTATICS */
1066 felec = qq21*(rinv21*rinvsq21-krf2);
1070 /* Calculate temporary vectorial force */
1075 /* Update vectorial force */
1079 f[j_coord_offset+DIM*1+XX] -= tx;
1080 f[j_coord_offset+DIM*1+YY] -= ty;
1081 f[j_coord_offset+DIM*1+ZZ] -= tz;
1085 /**************************
1086 * CALCULATE INTERACTIONS *
1087 **************************/
1092 /* REACTION-FIELD ELECTROSTATICS */
1093 felec = qq22*(rinv22*rinvsq22-krf2);
1097 /* Calculate temporary vectorial force */
1102 /* Update vectorial force */
1106 f[j_coord_offset+DIM*2+XX] -= tx;
1107 f[j_coord_offset+DIM*2+YY] -= ty;
1108 f[j_coord_offset+DIM*2+ZZ] -= tz;
1112 /* Inner loop uses 260 flops */
1114 /* End of innermost loop */
1117 f[i_coord_offset+DIM*0+XX] += fix0;
1118 f[i_coord_offset+DIM*0+YY] += fiy0;
1119 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1123 f[i_coord_offset+DIM*1+XX] += fix1;
1124 f[i_coord_offset+DIM*1+YY] += fiy1;
1125 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1129 f[i_coord_offset+DIM*2+XX] += fix2;
1130 f[i_coord_offset+DIM*2+YY] += fiy2;
1131 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1135 fshift[i_shift_offset+XX] += tx;
1136 fshift[i_shift_offset+YY] += ty;
1137 fshift[i_shift_offset+ZZ] += tz;
1139 /* Increment number of inner iterations */
1140 inneriter += j_index_end - j_index_start;
1142 /* Outer loop uses 30 flops */
1145 /* Increment number of outer iterations */
1148 /* Update outer/inner flops */
1150 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*260);