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_VdwLJ_GeomW3W3_VF_c
35 * Electrostatics interaction: ReactionField
36 * VdW interaction: LennardJones
37 * Geometry: Water3-Water3
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecRF_VdwLJ_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;
89 jindex = nlist->jindex;
91 shiftidx = nlist->shift;
93 shiftvec = fr->shift_vec[0];
94 fshift = fr->fshift[0];
96 charge = mdatoms->chargeA;
100 nvdwtype = fr->ntype;
102 vdwtype = mdatoms->typeA;
104 /* Setup water-specific parameters */
105 inr = nlist->iinr[0];
106 iq0 = facel*charge[inr+0];
107 iq1 = facel*charge[inr+1];
108 iq2 = facel*charge[inr+2];
109 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
114 vdwjidx0 = 2*vdwtype[inr+0];
116 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
117 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
130 /* Start outer loop over neighborlists */
131 for(iidx=0; iidx<nri; iidx++)
133 /* Load shift vector for this list */
134 i_shift_offset = DIM*shiftidx[iidx];
135 shX = shiftvec[i_shift_offset+XX];
136 shY = shiftvec[i_shift_offset+YY];
137 shZ = shiftvec[i_shift_offset+ZZ];
139 /* Load limits for loop over neighbors */
140 j_index_start = jindex[iidx];
141 j_index_end = jindex[iidx+1];
143 /* Get outer coordinate index */
145 i_coord_offset = DIM*inr;
147 /* Load i particle coords and add shift vector */
148 ix0 = shX + x[i_coord_offset+DIM*0+XX];
149 iy0 = shY + x[i_coord_offset+DIM*0+YY];
150 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
151 ix1 = shX + x[i_coord_offset+DIM*1+XX];
152 iy1 = shY + x[i_coord_offset+DIM*1+YY];
153 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
154 ix2 = shX + x[i_coord_offset+DIM*2+XX];
155 iy2 = shY + x[i_coord_offset+DIM*2+YY];
156 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
168 /* Reset potential sums */
172 /* Start inner kernel loop */
173 for(jidx=j_index_start; jidx<j_index_end; jidx++)
175 /* Get j neighbor index, and coordinate index */
177 j_coord_offset = DIM*jnr;
179 /* load j atom coordinates */
180 jx0 = x[j_coord_offset+DIM*0+XX];
181 jy0 = x[j_coord_offset+DIM*0+YY];
182 jz0 = x[j_coord_offset+DIM*0+ZZ];
183 jx1 = x[j_coord_offset+DIM*1+XX];
184 jy1 = x[j_coord_offset+DIM*1+YY];
185 jz1 = x[j_coord_offset+DIM*1+ZZ];
186 jx2 = x[j_coord_offset+DIM*2+XX];
187 jy2 = x[j_coord_offset+DIM*2+YY];
188 jz2 = x[j_coord_offset+DIM*2+ZZ];
190 /* Calculate displacement vector */
219 /* Calculate squared distance and things based on it */
220 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
221 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
222 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
223 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
224 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
225 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
226 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
227 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
228 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
230 rinv00 = gmx_invsqrt(rsq00);
231 rinv01 = gmx_invsqrt(rsq01);
232 rinv02 = gmx_invsqrt(rsq02);
233 rinv10 = gmx_invsqrt(rsq10);
234 rinv11 = gmx_invsqrt(rsq11);
235 rinv12 = gmx_invsqrt(rsq12);
236 rinv20 = gmx_invsqrt(rsq20);
237 rinv21 = gmx_invsqrt(rsq21);
238 rinv22 = gmx_invsqrt(rsq22);
240 rinvsq00 = rinv00*rinv00;
241 rinvsq01 = rinv01*rinv01;
242 rinvsq02 = rinv02*rinv02;
243 rinvsq10 = rinv10*rinv10;
244 rinvsq11 = rinv11*rinv11;
245 rinvsq12 = rinv12*rinv12;
246 rinvsq20 = rinv20*rinv20;
247 rinvsq21 = rinv21*rinv21;
248 rinvsq22 = rinv22*rinv22;
250 /**************************
251 * CALCULATE INTERACTIONS *
252 **************************/
254 /* REACTION-FIELD ELECTROSTATICS */
255 velec = qq00*(rinv00+krf*rsq00-crf);
256 felec = qq00*(rinv00*rinvsq00-krf2);
258 /* LENNARD-JONES DISPERSION/REPULSION */
260 rinvsix = rinvsq00*rinvsq00*rinvsq00;
261 vvdw6 = c6_00*rinvsix;
262 vvdw12 = c12_00*rinvsix*rinvsix;
263 vvdw = vvdw12*(1.0/12.0) - vvdw6*(1.0/6.0);
264 fvdw = (vvdw12-vvdw6)*rinvsq00;
266 /* Update potential sums from outer loop */
272 /* Calculate temporary vectorial force */
277 /* Update vectorial force */
281 f[j_coord_offset+DIM*0+XX] -= tx;
282 f[j_coord_offset+DIM*0+YY] -= ty;
283 f[j_coord_offset+DIM*0+ZZ] -= tz;
285 /**************************
286 * CALCULATE INTERACTIONS *
287 **************************/
289 /* REACTION-FIELD ELECTROSTATICS */
290 velec = qq01*(rinv01+krf*rsq01-crf);
291 felec = qq01*(rinv01*rinvsq01-krf2);
293 /* Update potential sums from outer loop */
298 /* Calculate temporary vectorial force */
303 /* Update vectorial force */
307 f[j_coord_offset+DIM*1+XX] -= tx;
308 f[j_coord_offset+DIM*1+YY] -= ty;
309 f[j_coord_offset+DIM*1+ZZ] -= tz;
311 /**************************
312 * CALCULATE INTERACTIONS *
313 **************************/
315 /* REACTION-FIELD ELECTROSTATICS */
316 velec = qq02*(rinv02+krf*rsq02-crf);
317 felec = qq02*(rinv02*rinvsq02-krf2);
319 /* Update potential sums from outer loop */
324 /* Calculate temporary vectorial force */
329 /* Update vectorial force */
333 f[j_coord_offset+DIM*2+XX] -= tx;
334 f[j_coord_offset+DIM*2+YY] -= ty;
335 f[j_coord_offset+DIM*2+ZZ] -= tz;
337 /**************************
338 * CALCULATE INTERACTIONS *
339 **************************/
341 /* REACTION-FIELD ELECTROSTATICS */
342 velec = qq10*(rinv10+krf*rsq10-crf);
343 felec = qq10*(rinv10*rinvsq10-krf2);
345 /* Update potential sums from outer loop */
350 /* Calculate temporary vectorial force */
355 /* Update vectorial force */
359 f[j_coord_offset+DIM*0+XX] -= tx;
360 f[j_coord_offset+DIM*0+YY] -= ty;
361 f[j_coord_offset+DIM*0+ZZ] -= tz;
363 /**************************
364 * CALCULATE INTERACTIONS *
365 **************************/
367 /* REACTION-FIELD ELECTROSTATICS */
368 velec = qq11*(rinv11+krf*rsq11-crf);
369 felec = qq11*(rinv11*rinvsq11-krf2);
371 /* Update potential sums from outer loop */
376 /* Calculate temporary vectorial force */
381 /* Update vectorial force */
385 f[j_coord_offset+DIM*1+XX] -= tx;
386 f[j_coord_offset+DIM*1+YY] -= ty;
387 f[j_coord_offset+DIM*1+ZZ] -= tz;
389 /**************************
390 * CALCULATE INTERACTIONS *
391 **************************/
393 /* REACTION-FIELD ELECTROSTATICS */
394 velec = qq12*(rinv12+krf*rsq12-crf);
395 felec = qq12*(rinv12*rinvsq12-krf2);
397 /* Update potential sums from outer loop */
402 /* Calculate temporary vectorial force */
407 /* Update vectorial force */
411 f[j_coord_offset+DIM*2+XX] -= tx;
412 f[j_coord_offset+DIM*2+YY] -= ty;
413 f[j_coord_offset+DIM*2+ZZ] -= tz;
415 /**************************
416 * CALCULATE INTERACTIONS *
417 **************************/
419 /* REACTION-FIELD ELECTROSTATICS */
420 velec = qq20*(rinv20+krf*rsq20-crf);
421 felec = qq20*(rinv20*rinvsq20-krf2);
423 /* Update potential sums from outer loop */
428 /* Calculate temporary vectorial force */
433 /* Update vectorial force */
437 f[j_coord_offset+DIM*0+XX] -= tx;
438 f[j_coord_offset+DIM*0+YY] -= ty;
439 f[j_coord_offset+DIM*0+ZZ] -= tz;
441 /**************************
442 * CALCULATE INTERACTIONS *
443 **************************/
445 /* REACTION-FIELD ELECTROSTATICS */
446 velec = qq21*(rinv21+krf*rsq21-crf);
447 felec = qq21*(rinv21*rinvsq21-krf2);
449 /* Update potential sums from outer loop */
454 /* Calculate temporary vectorial force */
459 /* Update vectorial force */
463 f[j_coord_offset+DIM*1+XX] -= tx;
464 f[j_coord_offset+DIM*1+YY] -= ty;
465 f[j_coord_offset+DIM*1+ZZ] -= tz;
467 /**************************
468 * CALCULATE INTERACTIONS *
469 **************************/
471 /* REACTION-FIELD ELECTROSTATICS */
472 velec = qq22*(rinv22+krf*rsq22-crf);
473 felec = qq22*(rinv22*rinvsq22-krf2);
475 /* Update potential sums from outer loop */
480 /* Calculate temporary vectorial force */
485 /* Update vectorial force */
489 f[j_coord_offset+DIM*2+XX] -= tx;
490 f[j_coord_offset+DIM*2+YY] -= ty;
491 f[j_coord_offset+DIM*2+ZZ] -= tz;
493 /* Inner loop uses 291 flops */
495 /* End of innermost loop */
498 f[i_coord_offset+DIM*0+XX] += fix0;
499 f[i_coord_offset+DIM*0+YY] += fiy0;
500 f[i_coord_offset+DIM*0+ZZ] += fiz0;
504 f[i_coord_offset+DIM*1+XX] += fix1;
505 f[i_coord_offset+DIM*1+YY] += fiy1;
506 f[i_coord_offset+DIM*1+ZZ] += fiz1;
510 f[i_coord_offset+DIM*2+XX] += fix2;
511 f[i_coord_offset+DIM*2+YY] += fiy2;
512 f[i_coord_offset+DIM*2+ZZ] += fiz2;
516 fshift[i_shift_offset+XX] += tx;
517 fshift[i_shift_offset+YY] += ty;
518 fshift[i_shift_offset+ZZ] += tz;
521 /* Update potential energies */
522 kernel_data->energygrp_elec[ggid] += velecsum;
523 kernel_data->energygrp_vdw[ggid] += vvdwsum;
525 /* Increment number of inner iterations */
526 inneriter += j_index_end - j_index_start;
528 /* Outer loop uses 32 flops */
531 /* Increment number of outer iterations */
534 /* Update outer/inner flops */
536 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*291);
539 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwLJ_GeomW3W3_F_c
540 * Electrostatics interaction: ReactionField
541 * VdW interaction: LennardJones
542 * Geometry: Water3-Water3
543 * Calculate force/pot: Force
546 nb_kernel_ElecRF_VdwLJ_GeomW3W3_F_c
547 (t_nblist * gmx_restrict nlist,
548 rvec * gmx_restrict xx,
549 rvec * gmx_restrict ff,
550 t_forcerec * gmx_restrict fr,
551 t_mdatoms * gmx_restrict mdatoms,
552 nb_kernel_data_t * gmx_restrict kernel_data,
553 t_nrnb * gmx_restrict nrnb)
555 int i_shift_offset,i_coord_offset,j_coord_offset;
556 int j_index_start,j_index_end;
557 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
558 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
559 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
560 real *shiftvec,*fshift,*x,*f;
562 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
564 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
566 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
568 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
570 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
572 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
573 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
574 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
575 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
576 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
577 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
578 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
579 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
580 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
581 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
582 real velec,felec,velecsum,facel,crf,krf,krf2;
585 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
594 jindex = nlist->jindex;
596 shiftidx = nlist->shift;
598 shiftvec = fr->shift_vec[0];
599 fshift = fr->fshift[0];
601 charge = mdatoms->chargeA;
605 nvdwtype = fr->ntype;
607 vdwtype = mdatoms->typeA;
609 /* Setup water-specific parameters */
610 inr = nlist->iinr[0];
611 iq0 = facel*charge[inr+0];
612 iq1 = facel*charge[inr+1];
613 iq2 = facel*charge[inr+2];
614 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
619 vdwjidx0 = 2*vdwtype[inr+0];
621 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
622 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
635 /* Start outer loop over neighborlists */
636 for(iidx=0; iidx<nri; iidx++)
638 /* Load shift vector for this list */
639 i_shift_offset = DIM*shiftidx[iidx];
640 shX = shiftvec[i_shift_offset+XX];
641 shY = shiftvec[i_shift_offset+YY];
642 shZ = shiftvec[i_shift_offset+ZZ];
644 /* Load limits for loop over neighbors */
645 j_index_start = jindex[iidx];
646 j_index_end = jindex[iidx+1];
648 /* Get outer coordinate index */
650 i_coord_offset = DIM*inr;
652 /* Load i particle coords and add shift vector */
653 ix0 = shX + x[i_coord_offset+DIM*0+XX];
654 iy0 = shY + x[i_coord_offset+DIM*0+YY];
655 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
656 ix1 = shX + x[i_coord_offset+DIM*1+XX];
657 iy1 = shY + x[i_coord_offset+DIM*1+YY];
658 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
659 ix2 = shX + x[i_coord_offset+DIM*2+XX];
660 iy2 = shY + x[i_coord_offset+DIM*2+YY];
661 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
673 /* Start inner kernel loop */
674 for(jidx=j_index_start; jidx<j_index_end; jidx++)
676 /* Get j neighbor index, and coordinate index */
678 j_coord_offset = DIM*jnr;
680 /* load j atom coordinates */
681 jx0 = x[j_coord_offset+DIM*0+XX];
682 jy0 = x[j_coord_offset+DIM*0+YY];
683 jz0 = x[j_coord_offset+DIM*0+ZZ];
684 jx1 = x[j_coord_offset+DIM*1+XX];
685 jy1 = x[j_coord_offset+DIM*1+YY];
686 jz1 = x[j_coord_offset+DIM*1+ZZ];
687 jx2 = x[j_coord_offset+DIM*2+XX];
688 jy2 = x[j_coord_offset+DIM*2+YY];
689 jz2 = x[j_coord_offset+DIM*2+ZZ];
691 /* Calculate displacement vector */
720 /* Calculate squared distance and things based on it */
721 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
722 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
723 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
724 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
725 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
726 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
727 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
728 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
729 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
731 rinv00 = gmx_invsqrt(rsq00);
732 rinv01 = gmx_invsqrt(rsq01);
733 rinv02 = gmx_invsqrt(rsq02);
734 rinv10 = gmx_invsqrt(rsq10);
735 rinv11 = gmx_invsqrt(rsq11);
736 rinv12 = gmx_invsqrt(rsq12);
737 rinv20 = gmx_invsqrt(rsq20);
738 rinv21 = gmx_invsqrt(rsq21);
739 rinv22 = gmx_invsqrt(rsq22);
741 rinvsq00 = rinv00*rinv00;
742 rinvsq01 = rinv01*rinv01;
743 rinvsq02 = rinv02*rinv02;
744 rinvsq10 = rinv10*rinv10;
745 rinvsq11 = rinv11*rinv11;
746 rinvsq12 = rinv12*rinv12;
747 rinvsq20 = rinv20*rinv20;
748 rinvsq21 = rinv21*rinv21;
749 rinvsq22 = rinv22*rinv22;
751 /**************************
752 * CALCULATE INTERACTIONS *
753 **************************/
755 /* REACTION-FIELD ELECTROSTATICS */
756 felec = qq00*(rinv00*rinvsq00-krf2);
758 /* LENNARD-JONES DISPERSION/REPULSION */
760 rinvsix = rinvsq00*rinvsq00*rinvsq00;
761 fvdw = (c12_00*rinvsix-c6_00)*rinvsix*rinvsq00;
765 /* Calculate temporary vectorial force */
770 /* Update vectorial force */
774 f[j_coord_offset+DIM*0+XX] -= tx;
775 f[j_coord_offset+DIM*0+YY] -= ty;
776 f[j_coord_offset+DIM*0+ZZ] -= tz;
778 /**************************
779 * CALCULATE INTERACTIONS *
780 **************************/
782 /* REACTION-FIELD ELECTROSTATICS */
783 felec = qq01*(rinv01*rinvsq01-krf2);
787 /* Calculate temporary vectorial force */
792 /* Update vectorial force */
796 f[j_coord_offset+DIM*1+XX] -= tx;
797 f[j_coord_offset+DIM*1+YY] -= ty;
798 f[j_coord_offset+DIM*1+ZZ] -= tz;
800 /**************************
801 * CALCULATE INTERACTIONS *
802 **************************/
804 /* REACTION-FIELD ELECTROSTATICS */
805 felec = qq02*(rinv02*rinvsq02-krf2);
809 /* Calculate temporary vectorial force */
814 /* Update vectorial force */
818 f[j_coord_offset+DIM*2+XX] -= tx;
819 f[j_coord_offset+DIM*2+YY] -= ty;
820 f[j_coord_offset+DIM*2+ZZ] -= tz;
822 /**************************
823 * CALCULATE INTERACTIONS *
824 **************************/
826 /* REACTION-FIELD ELECTROSTATICS */
827 felec = qq10*(rinv10*rinvsq10-krf2);
831 /* Calculate temporary vectorial force */
836 /* Update vectorial force */
840 f[j_coord_offset+DIM*0+XX] -= tx;
841 f[j_coord_offset+DIM*0+YY] -= ty;
842 f[j_coord_offset+DIM*0+ZZ] -= tz;
844 /**************************
845 * CALCULATE INTERACTIONS *
846 **************************/
848 /* REACTION-FIELD ELECTROSTATICS */
849 felec = qq11*(rinv11*rinvsq11-krf2);
853 /* Calculate temporary vectorial force */
858 /* Update vectorial force */
862 f[j_coord_offset+DIM*1+XX] -= tx;
863 f[j_coord_offset+DIM*1+YY] -= ty;
864 f[j_coord_offset+DIM*1+ZZ] -= tz;
866 /**************************
867 * CALCULATE INTERACTIONS *
868 **************************/
870 /* REACTION-FIELD ELECTROSTATICS */
871 felec = qq12*(rinv12*rinvsq12-krf2);
875 /* Calculate temporary vectorial force */
880 /* Update vectorial force */
884 f[j_coord_offset+DIM*2+XX] -= tx;
885 f[j_coord_offset+DIM*2+YY] -= ty;
886 f[j_coord_offset+DIM*2+ZZ] -= tz;
888 /**************************
889 * CALCULATE INTERACTIONS *
890 **************************/
892 /* REACTION-FIELD ELECTROSTATICS */
893 felec = qq20*(rinv20*rinvsq20-krf2);
897 /* Calculate temporary vectorial force */
902 /* Update vectorial force */
906 f[j_coord_offset+DIM*0+XX] -= tx;
907 f[j_coord_offset+DIM*0+YY] -= ty;
908 f[j_coord_offset+DIM*0+ZZ] -= tz;
910 /**************************
911 * CALCULATE INTERACTIONS *
912 **************************/
914 /* REACTION-FIELD ELECTROSTATICS */
915 felec = qq21*(rinv21*rinvsq21-krf2);
919 /* Calculate temporary vectorial force */
924 /* Update vectorial force */
928 f[j_coord_offset+DIM*1+XX] -= tx;
929 f[j_coord_offset+DIM*1+YY] -= ty;
930 f[j_coord_offset+DIM*1+ZZ] -= tz;
932 /**************************
933 * CALCULATE INTERACTIONS *
934 **************************/
936 /* REACTION-FIELD ELECTROSTATICS */
937 felec = qq22*(rinv22*rinvsq22-krf2);
941 /* Calculate temporary vectorial force */
946 /* Update vectorial force */
950 f[j_coord_offset+DIM*2+XX] -= tx;
951 f[j_coord_offset+DIM*2+YY] -= ty;
952 f[j_coord_offset+DIM*2+ZZ] -= tz;
954 /* Inner loop uses 241 flops */
956 /* End of innermost loop */
959 f[i_coord_offset+DIM*0+XX] += fix0;
960 f[i_coord_offset+DIM*0+YY] += fiy0;
961 f[i_coord_offset+DIM*0+ZZ] += fiz0;
965 f[i_coord_offset+DIM*1+XX] += fix1;
966 f[i_coord_offset+DIM*1+YY] += fiy1;
967 f[i_coord_offset+DIM*1+ZZ] += fiz1;
971 f[i_coord_offset+DIM*2+XX] += fix2;
972 f[i_coord_offset+DIM*2+YY] += fiy2;
973 f[i_coord_offset+DIM*2+ZZ] += fiz2;
977 fshift[i_shift_offset+XX] += tx;
978 fshift[i_shift_offset+YY] += ty;
979 fshift[i_shift_offset+ZZ] += tz;
981 /* Increment number of inner iterations */
982 inneriter += j_index_end - j_index_start;
984 /* Outer loop uses 30 flops */
987 /* Increment number of outer iterations */
990 /* Update outer/inner flops */
992 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*241);