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_ElecRF_VdwCSTab_GeomW3W3_VF_c
35 * Electrostatics interaction: ReactionField
36 * VdW interaction: CubicSplineTable
37 * Geometry: Water3-Water3
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecRF_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];
136 /* Start outer loop over neighborlists */
137 for(iidx=0; iidx<nri; iidx++)
139 /* Load shift vector for this list */
140 i_shift_offset = DIM*shiftidx[iidx];
141 shX = shiftvec[i_shift_offset+XX];
142 shY = shiftvec[i_shift_offset+YY];
143 shZ = shiftvec[i_shift_offset+ZZ];
145 /* Load limits for loop over neighbors */
146 j_index_start = jindex[iidx];
147 j_index_end = jindex[iidx+1];
149 /* Get outer coordinate index */
151 i_coord_offset = DIM*inr;
153 /* Load i particle coords and add shift vector */
154 ix0 = shX + x[i_coord_offset+DIM*0+XX];
155 iy0 = shY + x[i_coord_offset+DIM*0+YY];
156 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
157 ix1 = shX + x[i_coord_offset+DIM*1+XX];
158 iy1 = shY + x[i_coord_offset+DIM*1+YY];
159 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
160 ix2 = shX + x[i_coord_offset+DIM*2+XX];
161 iy2 = shY + x[i_coord_offset+DIM*2+YY];
162 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
174 /* Reset potential sums */
178 /* Start inner kernel loop */
179 for(jidx=j_index_start; jidx<j_index_end; jidx++)
181 /* Get j neighbor index, and coordinate index */
183 j_coord_offset = DIM*jnr;
185 /* load j atom coordinates */
186 jx0 = x[j_coord_offset+DIM*0+XX];
187 jy0 = x[j_coord_offset+DIM*0+YY];
188 jz0 = x[j_coord_offset+DIM*0+ZZ];
189 jx1 = x[j_coord_offset+DIM*1+XX];
190 jy1 = x[j_coord_offset+DIM*1+YY];
191 jz1 = x[j_coord_offset+DIM*1+ZZ];
192 jx2 = x[j_coord_offset+DIM*2+XX];
193 jy2 = x[j_coord_offset+DIM*2+YY];
194 jz2 = x[j_coord_offset+DIM*2+ZZ];
196 /* Calculate displacement vector */
225 /* Calculate squared distance and things based on it */
226 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
227 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
228 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
229 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
230 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
231 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
232 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
233 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
234 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
236 rinv00 = gmx_invsqrt(rsq00);
237 rinv01 = gmx_invsqrt(rsq01);
238 rinv02 = gmx_invsqrt(rsq02);
239 rinv10 = gmx_invsqrt(rsq10);
240 rinv11 = gmx_invsqrt(rsq11);
241 rinv12 = gmx_invsqrt(rsq12);
242 rinv20 = gmx_invsqrt(rsq20);
243 rinv21 = gmx_invsqrt(rsq21);
244 rinv22 = gmx_invsqrt(rsq22);
246 rinvsq00 = rinv00*rinv00;
247 rinvsq01 = rinv01*rinv01;
248 rinvsq02 = rinv02*rinv02;
249 rinvsq10 = rinv10*rinv10;
250 rinvsq11 = rinv11*rinv11;
251 rinvsq12 = rinv12*rinv12;
252 rinvsq20 = rinv20*rinv20;
253 rinvsq21 = rinv21*rinv21;
254 rinvsq22 = rinv22*rinv22;
256 /**************************
257 * CALCULATE INTERACTIONS *
258 **************************/
262 /* Calculate table index by multiplying r with table scale and truncate to integer */
268 /* REACTION-FIELD ELECTROSTATICS */
269 velec = qq00*(rinv00+krf*rsq00-crf);
270 felec = qq00*(rinv00*rinvsq00-krf2);
272 /* CUBIC SPLINE TABLE DISPERSION */
276 Geps = vfeps*vftab[vfitab+2];
277 Heps2 = vfeps*vfeps*vftab[vfitab+3];
281 FF = Fp+Geps+2.0*Heps2;
284 /* CUBIC SPLINE TABLE REPULSION */
287 Geps = vfeps*vftab[vfitab+6];
288 Heps2 = vfeps*vfeps*vftab[vfitab+7];
292 FF = Fp+Geps+2.0*Heps2;
295 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
297 /* Update potential sums from outer loop */
303 /* Calculate temporary vectorial force */
308 /* Update vectorial force */
312 f[j_coord_offset+DIM*0+XX] -= tx;
313 f[j_coord_offset+DIM*0+YY] -= ty;
314 f[j_coord_offset+DIM*0+ZZ] -= tz;
316 /**************************
317 * CALCULATE INTERACTIONS *
318 **************************/
320 /* REACTION-FIELD ELECTROSTATICS */
321 velec = qq01*(rinv01+krf*rsq01-crf);
322 felec = qq01*(rinv01*rinvsq01-krf2);
324 /* Update potential sums from outer loop */
329 /* Calculate temporary vectorial force */
334 /* Update vectorial force */
338 f[j_coord_offset+DIM*1+XX] -= tx;
339 f[j_coord_offset+DIM*1+YY] -= ty;
340 f[j_coord_offset+DIM*1+ZZ] -= tz;
342 /**************************
343 * CALCULATE INTERACTIONS *
344 **************************/
346 /* REACTION-FIELD ELECTROSTATICS */
347 velec = qq02*(rinv02+krf*rsq02-crf);
348 felec = qq02*(rinv02*rinvsq02-krf2);
350 /* Update potential sums from outer loop */
355 /* Calculate temporary vectorial force */
360 /* Update vectorial force */
364 f[j_coord_offset+DIM*2+XX] -= tx;
365 f[j_coord_offset+DIM*2+YY] -= ty;
366 f[j_coord_offset+DIM*2+ZZ] -= tz;
368 /**************************
369 * CALCULATE INTERACTIONS *
370 **************************/
372 /* REACTION-FIELD ELECTROSTATICS */
373 velec = qq10*(rinv10+krf*rsq10-crf);
374 felec = qq10*(rinv10*rinvsq10-krf2);
376 /* Update potential sums from outer loop */
381 /* Calculate temporary vectorial force */
386 /* Update vectorial force */
390 f[j_coord_offset+DIM*0+XX] -= tx;
391 f[j_coord_offset+DIM*0+YY] -= ty;
392 f[j_coord_offset+DIM*0+ZZ] -= tz;
394 /**************************
395 * CALCULATE INTERACTIONS *
396 **************************/
398 /* REACTION-FIELD ELECTROSTATICS */
399 velec = qq11*(rinv11+krf*rsq11-crf);
400 felec = qq11*(rinv11*rinvsq11-krf2);
402 /* Update potential sums from outer loop */
407 /* Calculate temporary vectorial force */
412 /* Update vectorial force */
416 f[j_coord_offset+DIM*1+XX] -= tx;
417 f[j_coord_offset+DIM*1+YY] -= ty;
418 f[j_coord_offset+DIM*1+ZZ] -= tz;
420 /**************************
421 * CALCULATE INTERACTIONS *
422 **************************/
424 /* REACTION-FIELD ELECTROSTATICS */
425 velec = qq12*(rinv12+krf*rsq12-crf);
426 felec = qq12*(rinv12*rinvsq12-krf2);
428 /* Update potential sums from outer loop */
433 /* Calculate temporary vectorial force */
438 /* Update vectorial force */
442 f[j_coord_offset+DIM*2+XX] -= tx;
443 f[j_coord_offset+DIM*2+YY] -= ty;
444 f[j_coord_offset+DIM*2+ZZ] -= tz;
446 /**************************
447 * CALCULATE INTERACTIONS *
448 **************************/
450 /* REACTION-FIELD ELECTROSTATICS */
451 velec = qq20*(rinv20+krf*rsq20-crf);
452 felec = qq20*(rinv20*rinvsq20-krf2);
454 /* Update potential sums from outer loop */
459 /* Calculate temporary vectorial force */
464 /* Update vectorial force */
468 f[j_coord_offset+DIM*0+XX] -= tx;
469 f[j_coord_offset+DIM*0+YY] -= ty;
470 f[j_coord_offset+DIM*0+ZZ] -= tz;
472 /**************************
473 * CALCULATE INTERACTIONS *
474 **************************/
476 /* REACTION-FIELD ELECTROSTATICS */
477 velec = qq21*(rinv21+krf*rsq21-crf);
478 felec = qq21*(rinv21*rinvsq21-krf2);
480 /* Update potential sums from outer loop */
485 /* Calculate temporary vectorial force */
490 /* Update vectorial force */
494 f[j_coord_offset+DIM*1+XX] -= tx;
495 f[j_coord_offset+DIM*1+YY] -= ty;
496 f[j_coord_offset+DIM*1+ZZ] -= tz;
498 /**************************
499 * CALCULATE INTERACTIONS *
500 **************************/
502 /* REACTION-FIELD ELECTROSTATICS */
503 velec = qq22*(rinv22+krf*rsq22-crf);
504 felec = qq22*(rinv22*rinvsq22-krf2);
506 /* Update potential sums from outer loop */
511 /* Calculate temporary vectorial force */
516 /* Update vectorial force */
520 f[j_coord_offset+DIM*2+XX] -= tx;
521 f[j_coord_offset+DIM*2+YY] -= ty;
522 f[j_coord_offset+DIM*2+ZZ] -= tz;
524 /* Inner loop uses 313 flops */
526 /* End of innermost loop */
529 f[i_coord_offset+DIM*0+XX] += fix0;
530 f[i_coord_offset+DIM*0+YY] += fiy0;
531 f[i_coord_offset+DIM*0+ZZ] += fiz0;
535 f[i_coord_offset+DIM*1+XX] += fix1;
536 f[i_coord_offset+DIM*1+YY] += fiy1;
537 f[i_coord_offset+DIM*1+ZZ] += fiz1;
541 f[i_coord_offset+DIM*2+XX] += fix2;
542 f[i_coord_offset+DIM*2+YY] += fiy2;
543 f[i_coord_offset+DIM*2+ZZ] += fiz2;
547 fshift[i_shift_offset+XX] += tx;
548 fshift[i_shift_offset+YY] += ty;
549 fshift[i_shift_offset+ZZ] += tz;
552 /* Update potential energies */
553 kernel_data->energygrp_elec[ggid] += velecsum;
554 kernel_data->energygrp_vdw[ggid] += vvdwsum;
556 /* Increment number of inner iterations */
557 inneriter += j_index_end - j_index_start;
559 /* Outer loop uses 32 flops */
562 /* Increment number of outer iterations */
565 /* Update outer/inner flops */
567 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*313);
570 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwCSTab_GeomW3W3_F_c
571 * Electrostatics interaction: ReactionField
572 * VdW interaction: CubicSplineTable
573 * Geometry: Water3-Water3
574 * Calculate force/pot: Force
577 nb_kernel_ElecRF_VdwCSTab_GeomW3W3_F_c
578 (t_nblist * gmx_restrict nlist,
579 rvec * gmx_restrict xx,
580 rvec * gmx_restrict ff,
581 t_forcerec * gmx_restrict fr,
582 t_mdatoms * gmx_restrict mdatoms,
583 nb_kernel_data_t * gmx_restrict kernel_data,
584 t_nrnb * gmx_restrict nrnb)
586 int i_shift_offset,i_coord_offset,j_coord_offset;
587 int j_index_start,j_index_end;
588 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
589 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
590 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
591 real *shiftvec,*fshift,*x,*f;
593 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
595 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
597 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
599 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
601 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
603 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
604 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
605 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
606 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
607 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
608 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
609 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
610 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
611 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
612 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
613 real velec,felec,velecsum,facel,crf,krf,krf2;
616 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
620 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
628 jindex = nlist->jindex;
630 shiftidx = nlist->shift;
632 shiftvec = fr->shift_vec[0];
633 fshift = fr->fshift[0];
635 charge = mdatoms->chargeA;
639 nvdwtype = fr->ntype;
641 vdwtype = mdatoms->typeA;
643 vftab = kernel_data->table_vdw->data;
644 vftabscale = kernel_data->table_vdw->scale;
646 /* Setup water-specific parameters */
647 inr = nlist->iinr[0];
648 iq0 = facel*charge[inr+0];
649 iq1 = facel*charge[inr+1];
650 iq2 = facel*charge[inr+2];
651 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
656 vdwjidx0 = 2*vdwtype[inr+0];
658 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
659 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
672 /* Start outer loop over neighborlists */
673 for(iidx=0; iidx<nri; iidx++)
675 /* Load shift vector for this list */
676 i_shift_offset = DIM*shiftidx[iidx];
677 shX = shiftvec[i_shift_offset+XX];
678 shY = shiftvec[i_shift_offset+YY];
679 shZ = shiftvec[i_shift_offset+ZZ];
681 /* Load limits for loop over neighbors */
682 j_index_start = jindex[iidx];
683 j_index_end = jindex[iidx+1];
685 /* Get outer coordinate index */
687 i_coord_offset = DIM*inr;
689 /* Load i particle coords and add shift vector */
690 ix0 = shX + x[i_coord_offset+DIM*0+XX];
691 iy0 = shY + x[i_coord_offset+DIM*0+YY];
692 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
693 ix1 = shX + x[i_coord_offset+DIM*1+XX];
694 iy1 = shY + x[i_coord_offset+DIM*1+YY];
695 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
696 ix2 = shX + x[i_coord_offset+DIM*2+XX];
697 iy2 = shY + x[i_coord_offset+DIM*2+YY];
698 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
710 /* Start inner kernel loop */
711 for(jidx=j_index_start; jidx<j_index_end; jidx++)
713 /* Get j neighbor index, and coordinate index */
715 j_coord_offset = DIM*jnr;
717 /* load j atom coordinates */
718 jx0 = x[j_coord_offset+DIM*0+XX];
719 jy0 = x[j_coord_offset+DIM*0+YY];
720 jz0 = x[j_coord_offset+DIM*0+ZZ];
721 jx1 = x[j_coord_offset+DIM*1+XX];
722 jy1 = x[j_coord_offset+DIM*1+YY];
723 jz1 = x[j_coord_offset+DIM*1+ZZ];
724 jx2 = x[j_coord_offset+DIM*2+XX];
725 jy2 = x[j_coord_offset+DIM*2+YY];
726 jz2 = x[j_coord_offset+DIM*2+ZZ];
728 /* Calculate displacement vector */
757 /* Calculate squared distance and things based on it */
758 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
759 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
760 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
761 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
762 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
763 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
764 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
765 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
766 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
768 rinv00 = gmx_invsqrt(rsq00);
769 rinv01 = gmx_invsqrt(rsq01);
770 rinv02 = gmx_invsqrt(rsq02);
771 rinv10 = gmx_invsqrt(rsq10);
772 rinv11 = gmx_invsqrt(rsq11);
773 rinv12 = gmx_invsqrt(rsq12);
774 rinv20 = gmx_invsqrt(rsq20);
775 rinv21 = gmx_invsqrt(rsq21);
776 rinv22 = gmx_invsqrt(rsq22);
778 rinvsq00 = rinv00*rinv00;
779 rinvsq01 = rinv01*rinv01;
780 rinvsq02 = rinv02*rinv02;
781 rinvsq10 = rinv10*rinv10;
782 rinvsq11 = rinv11*rinv11;
783 rinvsq12 = rinv12*rinv12;
784 rinvsq20 = rinv20*rinv20;
785 rinvsq21 = rinv21*rinv21;
786 rinvsq22 = rinv22*rinv22;
788 /**************************
789 * CALCULATE INTERACTIONS *
790 **************************/
794 /* Calculate table index by multiplying r with table scale and truncate to integer */
800 /* REACTION-FIELD ELECTROSTATICS */
801 felec = qq00*(rinv00*rinvsq00-krf2);
803 /* CUBIC SPLINE TABLE DISPERSION */
807 Geps = vfeps*vftab[vfitab+2];
808 Heps2 = vfeps*vfeps*vftab[vfitab+3];
810 FF = Fp+Geps+2.0*Heps2;
813 /* CUBIC SPLINE TABLE REPULSION */
816 Geps = vfeps*vftab[vfitab+6];
817 Heps2 = vfeps*vfeps*vftab[vfitab+7];
819 FF = Fp+Geps+2.0*Heps2;
821 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
825 /* Calculate temporary vectorial force */
830 /* Update vectorial force */
834 f[j_coord_offset+DIM*0+XX] -= tx;
835 f[j_coord_offset+DIM*0+YY] -= ty;
836 f[j_coord_offset+DIM*0+ZZ] -= tz;
838 /**************************
839 * CALCULATE INTERACTIONS *
840 **************************/
842 /* REACTION-FIELD ELECTROSTATICS */
843 felec = qq01*(rinv01*rinvsq01-krf2);
847 /* Calculate temporary vectorial force */
852 /* Update vectorial force */
856 f[j_coord_offset+DIM*1+XX] -= tx;
857 f[j_coord_offset+DIM*1+YY] -= ty;
858 f[j_coord_offset+DIM*1+ZZ] -= tz;
860 /**************************
861 * CALCULATE INTERACTIONS *
862 **************************/
864 /* REACTION-FIELD ELECTROSTATICS */
865 felec = qq02*(rinv02*rinvsq02-krf2);
869 /* Calculate temporary vectorial force */
874 /* Update vectorial force */
878 f[j_coord_offset+DIM*2+XX] -= tx;
879 f[j_coord_offset+DIM*2+YY] -= ty;
880 f[j_coord_offset+DIM*2+ZZ] -= tz;
882 /**************************
883 * CALCULATE INTERACTIONS *
884 **************************/
886 /* REACTION-FIELD ELECTROSTATICS */
887 felec = qq10*(rinv10*rinvsq10-krf2);
891 /* Calculate temporary vectorial force */
896 /* Update vectorial force */
900 f[j_coord_offset+DIM*0+XX] -= tx;
901 f[j_coord_offset+DIM*0+YY] -= ty;
902 f[j_coord_offset+DIM*0+ZZ] -= tz;
904 /**************************
905 * CALCULATE INTERACTIONS *
906 **************************/
908 /* REACTION-FIELD ELECTROSTATICS */
909 felec = qq11*(rinv11*rinvsq11-krf2);
913 /* Calculate temporary vectorial force */
918 /* Update vectorial force */
922 f[j_coord_offset+DIM*1+XX] -= tx;
923 f[j_coord_offset+DIM*1+YY] -= ty;
924 f[j_coord_offset+DIM*1+ZZ] -= tz;
926 /**************************
927 * CALCULATE INTERACTIONS *
928 **************************/
930 /* REACTION-FIELD ELECTROSTATICS */
931 felec = qq12*(rinv12*rinvsq12-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;
948 /**************************
949 * CALCULATE INTERACTIONS *
950 **************************/
952 /* REACTION-FIELD ELECTROSTATICS */
953 felec = qq20*(rinv20*rinvsq20-krf2);
957 /* Calculate temporary vectorial force */
962 /* Update vectorial force */
966 f[j_coord_offset+DIM*0+XX] -= tx;
967 f[j_coord_offset+DIM*0+YY] -= ty;
968 f[j_coord_offset+DIM*0+ZZ] -= tz;
970 /**************************
971 * CALCULATE INTERACTIONS *
972 **************************/
974 /* REACTION-FIELD ELECTROSTATICS */
975 felec = qq21*(rinv21*rinvsq21-krf2);
979 /* Calculate temporary vectorial force */
984 /* Update vectorial force */
988 f[j_coord_offset+DIM*1+XX] -= tx;
989 f[j_coord_offset+DIM*1+YY] -= ty;
990 f[j_coord_offset+DIM*1+ZZ] -= tz;
992 /**************************
993 * CALCULATE INTERACTIONS *
994 **************************/
996 /* REACTION-FIELD ELECTROSTATICS */
997 felec = qq22*(rinv22*rinvsq22-krf2);
1001 /* Calculate temporary vectorial force */
1006 /* Update vectorial force */
1010 f[j_coord_offset+DIM*2+XX] -= tx;
1011 f[j_coord_offset+DIM*2+YY] -= ty;
1012 f[j_coord_offset+DIM*2+ZZ] -= tz;
1014 /* Inner loop uses 260 flops */
1016 /* End of innermost loop */
1019 f[i_coord_offset+DIM*0+XX] += fix0;
1020 f[i_coord_offset+DIM*0+YY] += fiy0;
1021 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1025 f[i_coord_offset+DIM*1+XX] += fix1;
1026 f[i_coord_offset+DIM*1+YY] += fiy1;
1027 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1031 f[i_coord_offset+DIM*2+XX] += fix2;
1032 f[i_coord_offset+DIM*2+YY] += fiy2;
1033 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1037 fshift[i_shift_offset+XX] += tx;
1038 fshift[i_shift_offset+YY] += ty;
1039 fshift[i_shift_offset+ZZ] += tz;
1041 /* Increment number of inner iterations */
1042 inneriter += j_index_end - j_index_start;
1044 /* Outer loop uses 30 flops */
1047 /* Increment number of outer iterations */
1050 /* Update outer/inner flops */
1052 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*260);