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_VdwNone_GeomW3W3_VF_c
35 * Electrostatics interaction: ReactionField
36 * VdW interaction: None
37 * Geometry: Water3-Water3
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecRFCut_VdwNone_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;
85 jindex = nlist->jindex;
87 shiftidx = nlist->shift;
89 shiftvec = fr->shift_vec[0];
90 fshift = fr->fshift[0];
92 charge = mdatoms->chargeA;
97 /* Setup water-specific parameters */
99 iq0 = facel*charge[inr+0];
100 iq1 = facel*charge[inr+1];
101 iq2 = facel*charge[inr+2];
116 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
117 rcutoff = fr->rcoulomb;
118 rcutoff2 = rcutoff*rcutoff;
123 /* Start outer loop over neighborlists */
124 for(iidx=0; iidx<nri; iidx++)
126 /* Load shift vector for this list */
127 i_shift_offset = DIM*shiftidx[iidx];
128 shX = shiftvec[i_shift_offset+XX];
129 shY = shiftvec[i_shift_offset+YY];
130 shZ = shiftvec[i_shift_offset+ZZ];
132 /* Load limits for loop over neighbors */
133 j_index_start = jindex[iidx];
134 j_index_end = jindex[iidx+1];
136 /* Get outer coordinate index */
138 i_coord_offset = DIM*inr;
140 /* Load i particle coords and add shift vector */
141 ix0 = shX + x[i_coord_offset+DIM*0+XX];
142 iy0 = shY + x[i_coord_offset+DIM*0+YY];
143 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
144 ix1 = shX + x[i_coord_offset+DIM*1+XX];
145 iy1 = shY + x[i_coord_offset+DIM*1+YY];
146 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
147 ix2 = shX + x[i_coord_offset+DIM*2+XX];
148 iy2 = shY + x[i_coord_offset+DIM*2+YY];
149 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
161 /* Reset potential sums */
164 /* Start inner kernel loop */
165 for(jidx=j_index_start; jidx<j_index_end; jidx++)
167 /* Get j neighbor index, and coordinate index */
169 j_coord_offset = DIM*jnr;
171 /* load j atom coordinates */
172 jx0 = x[j_coord_offset+DIM*0+XX];
173 jy0 = x[j_coord_offset+DIM*0+YY];
174 jz0 = x[j_coord_offset+DIM*0+ZZ];
175 jx1 = x[j_coord_offset+DIM*1+XX];
176 jy1 = x[j_coord_offset+DIM*1+YY];
177 jz1 = x[j_coord_offset+DIM*1+ZZ];
178 jx2 = x[j_coord_offset+DIM*2+XX];
179 jy2 = x[j_coord_offset+DIM*2+YY];
180 jz2 = x[j_coord_offset+DIM*2+ZZ];
182 /* Calculate displacement vector */
211 /* Calculate squared distance and things based on it */
212 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
213 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
214 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
215 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
216 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
217 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
218 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
219 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
220 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
222 rinv00 = gmx_invsqrt(rsq00);
223 rinv01 = gmx_invsqrt(rsq01);
224 rinv02 = gmx_invsqrt(rsq02);
225 rinv10 = gmx_invsqrt(rsq10);
226 rinv11 = gmx_invsqrt(rsq11);
227 rinv12 = gmx_invsqrt(rsq12);
228 rinv20 = gmx_invsqrt(rsq20);
229 rinv21 = gmx_invsqrt(rsq21);
230 rinv22 = gmx_invsqrt(rsq22);
232 rinvsq00 = rinv00*rinv00;
233 rinvsq01 = rinv01*rinv01;
234 rinvsq02 = rinv02*rinv02;
235 rinvsq10 = rinv10*rinv10;
236 rinvsq11 = rinv11*rinv11;
237 rinvsq12 = rinv12*rinv12;
238 rinvsq20 = rinv20*rinv20;
239 rinvsq21 = rinv21*rinv21;
240 rinvsq22 = rinv22*rinv22;
242 /**************************
243 * CALCULATE INTERACTIONS *
244 **************************/
249 /* REACTION-FIELD ELECTROSTATICS */
250 velec = qq00*(rinv00+krf*rsq00-crf);
251 felec = qq00*(rinv00*rinvsq00-krf2);
253 /* Update potential sums from outer loop */
258 /* Calculate temporary vectorial force */
263 /* Update vectorial force */
267 f[j_coord_offset+DIM*0+XX] -= tx;
268 f[j_coord_offset+DIM*0+YY] -= ty;
269 f[j_coord_offset+DIM*0+ZZ] -= tz;
273 /**************************
274 * CALCULATE INTERACTIONS *
275 **************************/
280 /* REACTION-FIELD ELECTROSTATICS */
281 velec = qq01*(rinv01+krf*rsq01-crf);
282 felec = qq01*(rinv01*rinvsq01-krf2);
284 /* Update potential sums from outer loop */
289 /* Calculate temporary vectorial force */
294 /* Update vectorial force */
298 f[j_coord_offset+DIM*1+XX] -= tx;
299 f[j_coord_offset+DIM*1+YY] -= ty;
300 f[j_coord_offset+DIM*1+ZZ] -= tz;
304 /**************************
305 * CALCULATE INTERACTIONS *
306 **************************/
311 /* REACTION-FIELD ELECTROSTATICS */
312 velec = qq02*(rinv02+krf*rsq02-crf);
313 felec = qq02*(rinv02*rinvsq02-krf2);
315 /* Update potential sums from outer loop */
320 /* Calculate temporary vectorial force */
325 /* Update vectorial force */
329 f[j_coord_offset+DIM*2+XX] -= tx;
330 f[j_coord_offset+DIM*2+YY] -= ty;
331 f[j_coord_offset+DIM*2+ZZ] -= tz;
335 /**************************
336 * CALCULATE INTERACTIONS *
337 **************************/
342 /* REACTION-FIELD ELECTROSTATICS */
343 velec = qq10*(rinv10+krf*rsq10-crf);
344 felec = qq10*(rinv10*rinvsq10-krf2);
346 /* Update potential sums from outer loop */
351 /* Calculate temporary vectorial force */
356 /* Update vectorial force */
360 f[j_coord_offset+DIM*0+XX] -= tx;
361 f[j_coord_offset+DIM*0+YY] -= ty;
362 f[j_coord_offset+DIM*0+ZZ] -= tz;
366 /**************************
367 * CALCULATE INTERACTIONS *
368 **************************/
373 /* REACTION-FIELD ELECTROSTATICS */
374 velec = qq11*(rinv11+krf*rsq11-crf);
375 felec = qq11*(rinv11*rinvsq11-krf2);
377 /* Update potential sums from outer loop */
382 /* Calculate temporary vectorial force */
387 /* Update vectorial force */
391 f[j_coord_offset+DIM*1+XX] -= tx;
392 f[j_coord_offset+DIM*1+YY] -= ty;
393 f[j_coord_offset+DIM*1+ZZ] -= tz;
397 /**************************
398 * CALCULATE INTERACTIONS *
399 **************************/
404 /* REACTION-FIELD ELECTROSTATICS */
405 velec = qq12*(rinv12+krf*rsq12-crf);
406 felec = qq12*(rinv12*rinvsq12-krf2);
408 /* Update potential sums from outer loop */
413 /* Calculate temporary vectorial force */
418 /* Update vectorial force */
422 f[j_coord_offset+DIM*2+XX] -= tx;
423 f[j_coord_offset+DIM*2+YY] -= ty;
424 f[j_coord_offset+DIM*2+ZZ] -= tz;
428 /**************************
429 * CALCULATE INTERACTIONS *
430 **************************/
435 /* REACTION-FIELD ELECTROSTATICS */
436 velec = qq20*(rinv20+krf*rsq20-crf);
437 felec = qq20*(rinv20*rinvsq20-krf2);
439 /* Update potential sums from outer loop */
444 /* Calculate temporary vectorial force */
449 /* Update vectorial force */
453 f[j_coord_offset+DIM*0+XX] -= tx;
454 f[j_coord_offset+DIM*0+YY] -= ty;
455 f[j_coord_offset+DIM*0+ZZ] -= tz;
459 /**************************
460 * CALCULATE INTERACTIONS *
461 **************************/
466 /* REACTION-FIELD ELECTROSTATICS */
467 velec = qq21*(rinv21+krf*rsq21-crf);
468 felec = qq21*(rinv21*rinvsq21-krf2);
470 /* Update potential sums from outer loop */
475 /* Calculate temporary vectorial force */
480 /* Update vectorial force */
484 f[j_coord_offset+DIM*1+XX] -= tx;
485 f[j_coord_offset+DIM*1+YY] -= ty;
486 f[j_coord_offset+DIM*1+ZZ] -= tz;
490 /**************************
491 * CALCULATE INTERACTIONS *
492 **************************/
497 /* REACTION-FIELD ELECTROSTATICS */
498 velec = qq22*(rinv22+krf*rsq22-crf);
499 felec = qq22*(rinv22*rinvsq22-krf2);
501 /* Update potential sums from outer loop */
506 /* Calculate temporary vectorial force */
511 /* Update vectorial force */
515 f[j_coord_offset+DIM*2+XX] -= tx;
516 f[j_coord_offset+DIM*2+YY] -= ty;
517 f[j_coord_offset+DIM*2+ZZ] -= tz;
521 /* Inner loop uses 279 flops */
523 /* End of innermost loop */
526 f[i_coord_offset+DIM*0+XX] += fix0;
527 f[i_coord_offset+DIM*0+YY] += fiy0;
528 f[i_coord_offset+DIM*0+ZZ] += fiz0;
532 f[i_coord_offset+DIM*1+XX] += fix1;
533 f[i_coord_offset+DIM*1+YY] += fiy1;
534 f[i_coord_offset+DIM*1+ZZ] += fiz1;
538 f[i_coord_offset+DIM*2+XX] += fix2;
539 f[i_coord_offset+DIM*2+YY] += fiy2;
540 f[i_coord_offset+DIM*2+ZZ] += fiz2;
544 fshift[i_shift_offset+XX] += tx;
545 fshift[i_shift_offset+YY] += ty;
546 fshift[i_shift_offset+ZZ] += tz;
549 /* Update potential energies */
550 kernel_data->energygrp_elec[ggid] += velecsum;
552 /* Increment number of inner iterations */
553 inneriter += j_index_end - j_index_start;
555 /* Outer loop uses 31 flops */
558 /* Increment number of outer iterations */
561 /* Update outer/inner flops */
563 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_VF,outeriter*31 + inneriter*279);
566 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomW3W3_F_c
567 * Electrostatics interaction: ReactionField
568 * VdW interaction: None
569 * Geometry: Water3-Water3
570 * Calculate force/pot: Force
573 nb_kernel_ElecRFCut_VdwNone_GeomW3W3_F_c
574 (t_nblist * gmx_restrict nlist,
575 rvec * gmx_restrict xx,
576 rvec * gmx_restrict ff,
577 t_forcerec * gmx_restrict fr,
578 t_mdatoms * gmx_restrict mdatoms,
579 nb_kernel_data_t * gmx_restrict kernel_data,
580 t_nrnb * gmx_restrict nrnb)
582 int i_shift_offset,i_coord_offset,j_coord_offset;
583 int j_index_start,j_index_end;
584 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
585 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
586 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
587 real *shiftvec,*fshift,*x,*f;
589 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
591 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
593 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
595 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
597 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
599 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
600 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
601 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
602 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
603 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
604 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
605 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
606 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
607 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
608 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
609 real velec,felec,velecsum,facel,crf,krf,krf2;
617 jindex = nlist->jindex;
619 shiftidx = nlist->shift;
621 shiftvec = fr->shift_vec[0];
622 fshift = fr->fshift[0];
624 charge = mdatoms->chargeA;
629 /* Setup water-specific parameters */
630 inr = nlist->iinr[0];
631 iq0 = facel*charge[inr+0];
632 iq1 = facel*charge[inr+1];
633 iq2 = facel*charge[inr+2];
648 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
649 rcutoff = fr->rcoulomb;
650 rcutoff2 = rcutoff*rcutoff;
655 /* Start outer loop over neighborlists */
656 for(iidx=0; iidx<nri; iidx++)
658 /* Load shift vector for this list */
659 i_shift_offset = DIM*shiftidx[iidx];
660 shX = shiftvec[i_shift_offset+XX];
661 shY = shiftvec[i_shift_offset+YY];
662 shZ = shiftvec[i_shift_offset+ZZ];
664 /* Load limits for loop over neighbors */
665 j_index_start = jindex[iidx];
666 j_index_end = jindex[iidx+1];
668 /* Get outer coordinate index */
670 i_coord_offset = DIM*inr;
672 /* Load i particle coords and add shift vector */
673 ix0 = shX + x[i_coord_offset+DIM*0+XX];
674 iy0 = shY + x[i_coord_offset+DIM*0+YY];
675 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
676 ix1 = shX + x[i_coord_offset+DIM*1+XX];
677 iy1 = shY + x[i_coord_offset+DIM*1+YY];
678 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
679 ix2 = shX + x[i_coord_offset+DIM*2+XX];
680 iy2 = shY + x[i_coord_offset+DIM*2+YY];
681 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
693 /* Start inner kernel loop */
694 for(jidx=j_index_start; jidx<j_index_end; jidx++)
696 /* Get j neighbor index, and coordinate index */
698 j_coord_offset = DIM*jnr;
700 /* load j atom coordinates */
701 jx0 = x[j_coord_offset+DIM*0+XX];
702 jy0 = x[j_coord_offset+DIM*0+YY];
703 jz0 = x[j_coord_offset+DIM*0+ZZ];
704 jx1 = x[j_coord_offset+DIM*1+XX];
705 jy1 = x[j_coord_offset+DIM*1+YY];
706 jz1 = x[j_coord_offset+DIM*1+ZZ];
707 jx2 = x[j_coord_offset+DIM*2+XX];
708 jy2 = x[j_coord_offset+DIM*2+YY];
709 jz2 = x[j_coord_offset+DIM*2+ZZ];
711 /* Calculate displacement vector */
740 /* Calculate squared distance and things based on it */
741 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
742 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
743 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
744 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
745 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
746 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
747 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
748 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
749 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
751 rinv00 = gmx_invsqrt(rsq00);
752 rinv01 = gmx_invsqrt(rsq01);
753 rinv02 = gmx_invsqrt(rsq02);
754 rinv10 = gmx_invsqrt(rsq10);
755 rinv11 = gmx_invsqrt(rsq11);
756 rinv12 = gmx_invsqrt(rsq12);
757 rinv20 = gmx_invsqrt(rsq20);
758 rinv21 = gmx_invsqrt(rsq21);
759 rinv22 = gmx_invsqrt(rsq22);
761 rinvsq00 = rinv00*rinv00;
762 rinvsq01 = rinv01*rinv01;
763 rinvsq02 = rinv02*rinv02;
764 rinvsq10 = rinv10*rinv10;
765 rinvsq11 = rinv11*rinv11;
766 rinvsq12 = rinv12*rinv12;
767 rinvsq20 = rinv20*rinv20;
768 rinvsq21 = rinv21*rinv21;
769 rinvsq22 = rinv22*rinv22;
771 /**************************
772 * CALCULATE INTERACTIONS *
773 **************************/
778 /* REACTION-FIELD ELECTROSTATICS */
779 felec = qq00*(rinv00*rinvsq00-krf2);
783 /* Calculate temporary vectorial force */
788 /* Update vectorial force */
792 f[j_coord_offset+DIM*0+XX] -= tx;
793 f[j_coord_offset+DIM*0+YY] -= ty;
794 f[j_coord_offset+DIM*0+ZZ] -= tz;
798 /**************************
799 * CALCULATE INTERACTIONS *
800 **************************/
805 /* REACTION-FIELD ELECTROSTATICS */
806 felec = qq01*(rinv01*rinvsq01-krf2);
810 /* Calculate temporary vectorial force */
815 /* Update vectorial force */
819 f[j_coord_offset+DIM*1+XX] -= tx;
820 f[j_coord_offset+DIM*1+YY] -= ty;
821 f[j_coord_offset+DIM*1+ZZ] -= tz;
825 /**************************
826 * CALCULATE INTERACTIONS *
827 **************************/
832 /* REACTION-FIELD ELECTROSTATICS */
833 felec = qq02*(rinv02*rinvsq02-krf2);
837 /* Calculate temporary vectorial force */
842 /* Update vectorial force */
846 f[j_coord_offset+DIM*2+XX] -= tx;
847 f[j_coord_offset+DIM*2+YY] -= ty;
848 f[j_coord_offset+DIM*2+ZZ] -= tz;
852 /**************************
853 * CALCULATE INTERACTIONS *
854 **************************/
859 /* REACTION-FIELD ELECTROSTATICS */
860 felec = qq10*(rinv10*rinvsq10-krf2);
864 /* Calculate temporary vectorial force */
869 /* Update vectorial force */
873 f[j_coord_offset+DIM*0+XX] -= tx;
874 f[j_coord_offset+DIM*0+YY] -= ty;
875 f[j_coord_offset+DIM*0+ZZ] -= tz;
879 /**************************
880 * CALCULATE INTERACTIONS *
881 **************************/
886 /* REACTION-FIELD ELECTROSTATICS */
887 felec = qq11*(rinv11*rinvsq11-krf2);
891 /* Calculate temporary vectorial force */
896 /* Update vectorial force */
900 f[j_coord_offset+DIM*1+XX] -= tx;
901 f[j_coord_offset+DIM*1+YY] -= ty;
902 f[j_coord_offset+DIM*1+ZZ] -= tz;
906 /**************************
907 * CALCULATE INTERACTIONS *
908 **************************/
913 /* REACTION-FIELD ELECTROSTATICS */
914 felec = qq12*(rinv12*rinvsq12-krf2);
918 /* Calculate temporary vectorial force */
923 /* Update vectorial force */
927 f[j_coord_offset+DIM*2+XX] -= tx;
928 f[j_coord_offset+DIM*2+YY] -= ty;
929 f[j_coord_offset+DIM*2+ZZ] -= tz;
933 /**************************
934 * CALCULATE INTERACTIONS *
935 **************************/
940 /* REACTION-FIELD ELECTROSTATICS */
941 felec = qq20*(rinv20*rinvsq20-krf2);
945 /* Calculate temporary vectorial force */
950 /* Update vectorial force */
954 f[j_coord_offset+DIM*0+XX] -= tx;
955 f[j_coord_offset+DIM*0+YY] -= ty;
956 f[j_coord_offset+DIM*0+ZZ] -= tz;
960 /**************************
961 * CALCULATE INTERACTIONS *
962 **************************/
967 /* REACTION-FIELD ELECTROSTATICS */
968 felec = qq21*(rinv21*rinvsq21-krf2);
972 /* Calculate temporary vectorial force */
977 /* Update vectorial force */
981 f[j_coord_offset+DIM*1+XX] -= tx;
982 f[j_coord_offset+DIM*1+YY] -= ty;
983 f[j_coord_offset+DIM*1+ZZ] -= tz;
987 /**************************
988 * CALCULATE INTERACTIONS *
989 **************************/
994 /* REACTION-FIELD ELECTROSTATICS */
995 felec = qq22*(rinv22*rinvsq22-krf2);
999 /* Calculate temporary vectorial force */
1004 /* Update vectorial force */
1008 f[j_coord_offset+DIM*2+XX] -= tx;
1009 f[j_coord_offset+DIM*2+YY] -= ty;
1010 f[j_coord_offset+DIM*2+ZZ] -= tz;
1014 /* Inner loop uses 234 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_W3W3_F,outeriter*30 + inneriter*234);