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 "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
48 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwCSTab_GeomW3W3_VF_c
49 * Electrostatics interaction: ReactionField
50 * VdW interaction: CubicSplineTable
51 * Geometry: Water3-Water3
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecRF_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;
117 nvdwtype = fr->ntype;
119 vdwtype = mdatoms->typeA;
121 vftab = kernel_data->table_vdw->data;
122 vftabscale = kernel_data->table_vdw->scale;
124 /* Setup water-specific parameters */
125 inr = nlist->iinr[0];
126 iq0 = facel*charge[inr+0];
127 iq1 = facel*charge[inr+1];
128 iq2 = facel*charge[inr+2];
129 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
134 vdwjidx0 = 2*vdwtype[inr+0];
136 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
137 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
150 /* Start outer loop over neighborlists */
151 for(iidx=0; iidx<nri; iidx++)
153 /* Load shift vector for this list */
154 i_shift_offset = DIM*shiftidx[iidx];
155 shX = shiftvec[i_shift_offset+XX];
156 shY = shiftvec[i_shift_offset+YY];
157 shZ = shiftvec[i_shift_offset+ZZ];
159 /* Load limits for loop over neighbors */
160 j_index_start = jindex[iidx];
161 j_index_end = jindex[iidx+1];
163 /* Get outer coordinate index */
165 i_coord_offset = DIM*inr;
167 /* Load i particle coords and add shift vector */
168 ix0 = shX + x[i_coord_offset+DIM*0+XX];
169 iy0 = shY + x[i_coord_offset+DIM*0+YY];
170 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
171 ix1 = shX + x[i_coord_offset+DIM*1+XX];
172 iy1 = shY + x[i_coord_offset+DIM*1+YY];
173 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
174 ix2 = shX + x[i_coord_offset+DIM*2+XX];
175 iy2 = shY + x[i_coord_offset+DIM*2+YY];
176 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
188 /* Reset potential sums */
192 /* Start inner kernel loop */
193 for(jidx=j_index_start; jidx<j_index_end; jidx++)
195 /* Get j neighbor index, and coordinate index */
197 j_coord_offset = DIM*jnr;
199 /* load j atom coordinates */
200 jx0 = x[j_coord_offset+DIM*0+XX];
201 jy0 = x[j_coord_offset+DIM*0+YY];
202 jz0 = x[j_coord_offset+DIM*0+ZZ];
203 jx1 = x[j_coord_offset+DIM*1+XX];
204 jy1 = x[j_coord_offset+DIM*1+YY];
205 jz1 = x[j_coord_offset+DIM*1+ZZ];
206 jx2 = x[j_coord_offset+DIM*2+XX];
207 jy2 = x[j_coord_offset+DIM*2+YY];
208 jz2 = x[j_coord_offset+DIM*2+ZZ];
210 /* Calculate displacement vector */
239 /* Calculate squared distance and things based on it */
240 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
241 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
242 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
243 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
244 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
245 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
246 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
247 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
248 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
250 rinv00 = gmx_invsqrt(rsq00);
251 rinv01 = gmx_invsqrt(rsq01);
252 rinv02 = gmx_invsqrt(rsq02);
253 rinv10 = gmx_invsqrt(rsq10);
254 rinv11 = gmx_invsqrt(rsq11);
255 rinv12 = gmx_invsqrt(rsq12);
256 rinv20 = gmx_invsqrt(rsq20);
257 rinv21 = gmx_invsqrt(rsq21);
258 rinv22 = gmx_invsqrt(rsq22);
260 rinvsq00 = rinv00*rinv00;
261 rinvsq01 = rinv01*rinv01;
262 rinvsq02 = rinv02*rinv02;
263 rinvsq10 = rinv10*rinv10;
264 rinvsq11 = rinv11*rinv11;
265 rinvsq12 = rinv12*rinv12;
266 rinvsq20 = rinv20*rinv20;
267 rinvsq21 = rinv21*rinv21;
268 rinvsq22 = rinv22*rinv22;
270 /**************************
271 * CALCULATE INTERACTIONS *
272 **************************/
276 /* Calculate table index by multiplying r with table scale and truncate to integer */
282 /* REACTION-FIELD ELECTROSTATICS */
283 velec = qq00*(rinv00+krf*rsq00-crf);
284 felec = qq00*(rinv00*rinvsq00-krf2);
286 /* CUBIC SPLINE TABLE DISPERSION */
290 Geps = vfeps*vftab[vfitab+2];
291 Heps2 = vfeps*vfeps*vftab[vfitab+3];
295 FF = Fp+Geps+2.0*Heps2;
298 /* CUBIC SPLINE TABLE REPULSION */
301 Geps = vfeps*vftab[vfitab+6];
302 Heps2 = vfeps*vfeps*vftab[vfitab+7];
306 FF = Fp+Geps+2.0*Heps2;
309 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
311 /* Update potential sums from outer loop */
317 /* Calculate temporary vectorial force */
322 /* Update vectorial force */
326 f[j_coord_offset+DIM*0+XX] -= tx;
327 f[j_coord_offset+DIM*0+YY] -= ty;
328 f[j_coord_offset+DIM*0+ZZ] -= tz;
330 /**************************
331 * CALCULATE INTERACTIONS *
332 **************************/
334 /* REACTION-FIELD ELECTROSTATICS */
335 velec = qq01*(rinv01+krf*rsq01-crf);
336 felec = qq01*(rinv01*rinvsq01-krf2);
338 /* Update potential sums from outer loop */
343 /* Calculate temporary vectorial force */
348 /* Update vectorial force */
352 f[j_coord_offset+DIM*1+XX] -= tx;
353 f[j_coord_offset+DIM*1+YY] -= ty;
354 f[j_coord_offset+DIM*1+ZZ] -= tz;
356 /**************************
357 * CALCULATE INTERACTIONS *
358 **************************/
360 /* REACTION-FIELD ELECTROSTATICS */
361 velec = qq02*(rinv02+krf*rsq02-crf);
362 felec = qq02*(rinv02*rinvsq02-krf2);
364 /* Update potential sums from outer loop */
369 /* Calculate temporary vectorial force */
374 /* Update vectorial force */
378 f[j_coord_offset+DIM*2+XX] -= tx;
379 f[j_coord_offset+DIM*2+YY] -= ty;
380 f[j_coord_offset+DIM*2+ZZ] -= tz;
382 /**************************
383 * CALCULATE INTERACTIONS *
384 **************************/
386 /* REACTION-FIELD ELECTROSTATICS */
387 velec = qq10*(rinv10+krf*rsq10-crf);
388 felec = qq10*(rinv10*rinvsq10-krf2);
390 /* Update potential sums from outer loop */
395 /* Calculate temporary vectorial force */
400 /* Update vectorial force */
404 f[j_coord_offset+DIM*0+XX] -= tx;
405 f[j_coord_offset+DIM*0+YY] -= ty;
406 f[j_coord_offset+DIM*0+ZZ] -= tz;
408 /**************************
409 * CALCULATE INTERACTIONS *
410 **************************/
412 /* REACTION-FIELD ELECTROSTATICS */
413 velec = qq11*(rinv11+krf*rsq11-crf);
414 felec = qq11*(rinv11*rinvsq11-krf2);
416 /* Update potential sums from outer loop */
421 /* Calculate temporary vectorial force */
426 /* Update vectorial force */
430 f[j_coord_offset+DIM*1+XX] -= tx;
431 f[j_coord_offset+DIM*1+YY] -= ty;
432 f[j_coord_offset+DIM*1+ZZ] -= tz;
434 /**************************
435 * CALCULATE INTERACTIONS *
436 **************************/
438 /* REACTION-FIELD ELECTROSTATICS */
439 velec = qq12*(rinv12+krf*rsq12-crf);
440 felec = qq12*(rinv12*rinvsq12-krf2);
442 /* Update potential sums from outer loop */
447 /* Calculate temporary vectorial force */
452 /* Update vectorial force */
456 f[j_coord_offset+DIM*2+XX] -= tx;
457 f[j_coord_offset+DIM*2+YY] -= ty;
458 f[j_coord_offset+DIM*2+ZZ] -= tz;
460 /**************************
461 * CALCULATE INTERACTIONS *
462 **************************/
464 /* REACTION-FIELD ELECTROSTATICS */
465 velec = qq20*(rinv20+krf*rsq20-crf);
466 felec = qq20*(rinv20*rinvsq20-krf2);
468 /* Update potential sums from outer loop */
473 /* Calculate temporary vectorial force */
478 /* Update vectorial force */
482 f[j_coord_offset+DIM*0+XX] -= tx;
483 f[j_coord_offset+DIM*0+YY] -= ty;
484 f[j_coord_offset+DIM*0+ZZ] -= tz;
486 /**************************
487 * CALCULATE INTERACTIONS *
488 **************************/
490 /* REACTION-FIELD ELECTROSTATICS */
491 velec = qq21*(rinv21+krf*rsq21-crf);
492 felec = qq21*(rinv21*rinvsq21-krf2);
494 /* Update potential sums from outer loop */
499 /* Calculate temporary vectorial force */
504 /* Update vectorial force */
508 f[j_coord_offset+DIM*1+XX] -= tx;
509 f[j_coord_offset+DIM*1+YY] -= ty;
510 f[j_coord_offset+DIM*1+ZZ] -= tz;
512 /**************************
513 * CALCULATE INTERACTIONS *
514 **************************/
516 /* REACTION-FIELD ELECTROSTATICS */
517 velec = qq22*(rinv22+krf*rsq22-crf);
518 felec = qq22*(rinv22*rinvsq22-krf2);
520 /* Update potential sums from outer loop */
525 /* Calculate temporary vectorial force */
530 /* Update vectorial force */
534 f[j_coord_offset+DIM*2+XX] -= tx;
535 f[j_coord_offset+DIM*2+YY] -= ty;
536 f[j_coord_offset+DIM*2+ZZ] -= tz;
538 /* Inner loop uses 313 flops */
540 /* End of innermost loop */
543 f[i_coord_offset+DIM*0+XX] += fix0;
544 f[i_coord_offset+DIM*0+YY] += fiy0;
545 f[i_coord_offset+DIM*0+ZZ] += fiz0;
549 f[i_coord_offset+DIM*1+XX] += fix1;
550 f[i_coord_offset+DIM*1+YY] += fiy1;
551 f[i_coord_offset+DIM*1+ZZ] += fiz1;
555 f[i_coord_offset+DIM*2+XX] += fix2;
556 f[i_coord_offset+DIM*2+YY] += fiy2;
557 f[i_coord_offset+DIM*2+ZZ] += fiz2;
561 fshift[i_shift_offset+XX] += tx;
562 fshift[i_shift_offset+YY] += ty;
563 fshift[i_shift_offset+ZZ] += tz;
566 /* Update potential energies */
567 kernel_data->energygrp_elec[ggid] += velecsum;
568 kernel_data->energygrp_vdw[ggid] += vvdwsum;
570 /* Increment number of inner iterations */
571 inneriter += j_index_end - j_index_start;
573 /* Outer loop uses 32 flops */
576 /* Increment number of outer iterations */
579 /* Update outer/inner flops */
581 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*313);
584 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwCSTab_GeomW3W3_F_c
585 * Electrostatics interaction: ReactionField
586 * VdW interaction: CubicSplineTable
587 * Geometry: Water3-Water3
588 * Calculate force/pot: Force
591 nb_kernel_ElecRF_VdwCSTab_GeomW3W3_F_c
592 (t_nblist * gmx_restrict nlist,
593 rvec * gmx_restrict xx,
594 rvec * gmx_restrict ff,
595 t_forcerec * gmx_restrict fr,
596 t_mdatoms * gmx_restrict mdatoms,
597 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
598 t_nrnb * gmx_restrict nrnb)
600 int i_shift_offset,i_coord_offset,j_coord_offset;
601 int j_index_start,j_index_end;
602 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
603 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
604 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
605 real *shiftvec,*fshift,*x,*f;
607 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
609 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
611 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
613 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
615 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
617 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
618 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
619 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
620 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
621 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
622 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
623 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
624 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
625 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
626 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
627 real velec,felec,velecsum,facel,crf,krf,krf2;
630 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
634 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
642 jindex = nlist->jindex;
644 shiftidx = nlist->shift;
646 shiftvec = fr->shift_vec[0];
647 fshift = fr->fshift[0];
649 charge = mdatoms->chargeA;
653 nvdwtype = fr->ntype;
655 vdwtype = mdatoms->typeA;
657 vftab = kernel_data->table_vdw->data;
658 vftabscale = kernel_data->table_vdw->scale;
660 /* Setup water-specific parameters */
661 inr = nlist->iinr[0];
662 iq0 = facel*charge[inr+0];
663 iq1 = facel*charge[inr+1];
664 iq2 = facel*charge[inr+2];
665 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
670 vdwjidx0 = 2*vdwtype[inr+0];
672 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
673 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
686 /* Start outer loop over neighborlists */
687 for(iidx=0; iidx<nri; iidx++)
689 /* Load shift vector for this list */
690 i_shift_offset = DIM*shiftidx[iidx];
691 shX = shiftvec[i_shift_offset+XX];
692 shY = shiftvec[i_shift_offset+YY];
693 shZ = shiftvec[i_shift_offset+ZZ];
695 /* Load limits for loop over neighbors */
696 j_index_start = jindex[iidx];
697 j_index_end = jindex[iidx+1];
699 /* Get outer coordinate index */
701 i_coord_offset = DIM*inr;
703 /* Load i particle coords and add shift vector */
704 ix0 = shX + x[i_coord_offset+DIM*0+XX];
705 iy0 = shY + x[i_coord_offset+DIM*0+YY];
706 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
707 ix1 = shX + x[i_coord_offset+DIM*1+XX];
708 iy1 = shY + x[i_coord_offset+DIM*1+YY];
709 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
710 ix2 = shX + x[i_coord_offset+DIM*2+XX];
711 iy2 = shY + x[i_coord_offset+DIM*2+YY];
712 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
724 /* Start inner kernel loop */
725 for(jidx=j_index_start; jidx<j_index_end; jidx++)
727 /* Get j neighbor index, and coordinate index */
729 j_coord_offset = DIM*jnr;
731 /* load j atom coordinates */
732 jx0 = x[j_coord_offset+DIM*0+XX];
733 jy0 = x[j_coord_offset+DIM*0+YY];
734 jz0 = x[j_coord_offset+DIM*0+ZZ];
735 jx1 = x[j_coord_offset+DIM*1+XX];
736 jy1 = x[j_coord_offset+DIM*1+YY];
737 jz1 = x[j_coord_offset+DIM*1+ZZ];
738 jx2 = x[j_coord_offset+DIM*2+XX];
739 jy2 = x[j_coord_offset+DIM*2+YY];
740 jz2 = x[j_coord_offset+DIM*2+ZZ];
742 /* Calculate displacement vector */
771 /* Calculate squared distance and things based on it */
772 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
773 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
774 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
775 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
776 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
777 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
778 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
779 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
780 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
782 rinv00 = gmx_invsqrt(rsq00);
783 rinv01 = gmx_invsqrt(rsq01);
784 rinv02 = gmx_invsqrt(rsq02);
785 rinv10 = gmx_invsqrt(rsq10);
786 rinv11 = gmx_invsqrt(rsq11);
787 rinv12 = gmx_invsqrt(rsq12);
788 rinv20 = gmx_invsqrt(rsq20);
789 rinv21 = gmx_invsqrt(rsq21);
790 rinv22 = gmx_invsqrt(rsq22);
792 rinvsq00 = rinv00*rinv00;
793 rinvsq01 = rinv01*rinv01;
794 rinvsq02 = rinv02*rinv02;
795 rinvsq10 = rinv10*rinv10;
796 rinvsq11 = rinv11*rinv11;
797 rinvsq12 = rinv12*rinv12;
798 rinvsq20 = rinv20*rinv20;
799 rinvsq21 = rinv21*rinv21;
800 rinvsq22 = rinv22*rinv22;
802 /**************************
803 * CALCULATE INTERACTIONS *
804 **************************/
808 /* Calculate table index by multiplying r with table scale and truncate to integer */
814 /* REACTION-FIELD ELECTROSTATICS */
815 felec = qq00*(rinv00*rinvsq00-krf2);
817 /* CUBIC SPLINE TABLE DISPERSION */
820 Geps = vfeps*vftab[vfitab+2];
821 Heps2 = vfeps*vfeps*vftab[vfitab+3];
823 FF = Fp+Geps+2.0*Heps2;
826 /* CUBIC SPLINE TABLE REPULSION */
828 Geps = vfeps*vftab[vfitab+6];
829 Heps2 = vfeps*vfeps*vftab[vfitab+7];
831 FF = Fp+Geps+2.0*Heps2;
833 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
837 /* Calculate temporary vectorial force */
842 /* Update vectorial force */
846 f[j_coord_offset+DIM*0+XX] -= tx;
847 f[j_coord_offset+DIM*0+YY] -= ty;
848 f[j_coord_offset+DIM*0+ZZ] -= tz;
850 /**************************
851 * CALCULATE INTERACTIONS *
852 **************************/
854 /* REACTION-FIELD ELECTROSTATICS */
855 felec = qq01*(rinv01*rinvsq01-krf2);
859 /* Calculate temporary vectorial force */
864 /* Update vectorial force */
868 f[j_coord_offset+DIM*1+XX] -= tx;
869 f[j_coord_offset+DIM*1+YY] -= ty;
870 f[j_coord_offset+DIM*1+ZZ] -= tz;
872 /**************************
873 * CALCULATE INTERACTIONS *
874 **************************/
876 /* REACTION-FIELD ELECTROSTATICS */
877 felec = qq02*(rinv02*rinvsq02-krf2);
881 /* Calculate temporary vectorial force */
886 /* Update vectorial force */
890 f[j_coord_offset+DIM*2+XX] -= tx;
891 f[j_coord_offset+DIM*2+YY] -= ty;
892 f[j_coord_offset+DIM*2+ZZ] -= tz;
894 /**************************
895 * CALCULATE INTERACTIONS *
896 **************************/
898 /* REACTION-FIELD ELECTROSTATICS */
899 felec = qq10*(rinv10*rinvsq10-krf2);
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 /* REACTION-FIELD ELECTROSTATICS */
921 felec = qq11*(rinv11*rinvsq11-krf2);
925 /* Calculate temporary vectorial force */
930 /* Update vectorial force */
934 f[j_coord_offset+DIM*1+XX] -= tx;
935 f[j_coord_offset+DIM*1+YY] -= ty;
936 f[j_coord_offset+DIM*1+ZZ] -= tz;
938 /**************************
939 * CALCULATE INTERACTIONS *
940 **************************/
942 /* REACTION-FIELD ELECTROSTATICS */
943 felec = qq12*(rinv12*rinvsq12-krf2);
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 /* REACTION-FIELD ELECTROSTATICS */
965 felec = qq20*(rinv20*rinvsq20-krf2);
969 /* Calculate temporary vectorial force */
974 /* Update vectorial force */
978 f[j_coord_offset+DIM*0+XX] -= tx;
979 f[j_coord_offset+DIM*0+YY] -= ty;
980 f[j_coord_offset+DIM*0+ZZ] -= tz;
982 /**************************
983 * CALCULATE INTERACTIONS *
984 **************************/
986 /* REACTION-FIELD ELECTROSTATICS */
987 felec = qq21*(rinv21*rinvsq21-krf2);
991 /* Calculate temporary vectorial force */
996 /* Update vectorial force */
1000 f[j_coord_offset+DIM*1+XX] -= tx;
1001 f[j_coord_offset+DIM*1+YY] -= ty;
1002 f[j_coord_offset+DIM*1+ZZ] -= tz;
1004 /**************************
1005 * CALCULATE INTERACTIONS *
1006 **************************/
1008 /* REACTION-FIELD ELECTROSTATICS */
1009 felec = qq22*(rinv22*rinvsq22-krf2);
1013 /* Calculate temporary vectorial force */
1018 /* Update vectorial force */
1022 f[j_coord_offset+DIM*2+XX] -= tx;
1023 f[j_coord_offset+DIM*2+YY] -= ty;
1024 f[j_coord_offset+DIM*2+ZZ] -= tz;
1026 /* Inner loop uses 260 flops */
1028 /* End of innermost loop */
1031 f[i_coord_offset+DIM*0+XX] += fix0;
1032 f[i_coord_offset+DIM*0+YY] += fiy0;
1033 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1037 f[i_coord_offset+DIM*1+XX] += fix1;
1038 f[i_coord_offset+DIM*1+YY] += fiy1;
1039 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1043 f[i_coord_offset+DIM*2+XX] += fix2;
1044 f[i_coord_offset+DIM*2+YY] += fiy2;
1045 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1049 fshift[i_shift_offset+XX] += tx;
1050 fshift[i_shift_offset+YY] += ty;
1051 fshift[i_shift_offset+ZZ] += tz;
1053 /* Increment number of inner iterations */
1054 inneriter += j_index_end - j_index_start;
1056 /* Outer loop uses 30 flops */
1059 /* Increment number of outer iterations */
1062 /* Update outer/inner flops */
1064 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*260);