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_GeomW4W4_VF_c
35 * Electrostatics interaction: ReactionField
36 * VdW interaction: None
37 * Geometry: Water4-Water4
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecRFCut_VdwNone_GeomW4W4_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 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
59 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
61 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
63 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
65 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
67 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
68 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
69 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
70 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
71 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
72 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
73 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
74 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
75 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
76 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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 iq1 = facel*charge[inr+1];
100 iq2 = facel*charge[inr+2];
101 iq3 = facel*charge[inr+3];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
142 iy1 = shY + x[i_coord_offset+DIM*1+YY];
143 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
144 ix2 = shX + x[i_coord_offset+DIM*2+XX];
145 iy2 = shY + x[i_coord_offset+DIM*2+YY];
146 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
147 ix3 = shX + x[i_coord_offset+DIM*3+XX];
148 iy3 = shY + x[i_coord_offset+DIM*3+YY];
149 iz3 = shZ + x[i_coord_offset+DIM*3+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 jx1 = x[j_coord_offset+DIM*1+XX];
173 jy1 = x[j_coord_offset+DIM*1+YY];
174 jz1 = x[j_coord_offset+DIM*1+ZZ];
175 jx2 = x[j_coord_offset+DIM*2+XX];
176 jy2 = x[j_coord_offset+DIM*2+YY];
177 jz2 = x[j_coord_offset+DIM*2+ZZ];
178 jx3 = x[j_coord_offset+DIM*3+XX];
179 jy3 = x[j_coord_offset+DIM*3+YY];
180 jz3 = x[j_coord_offset+DIM*3+ZZ];
182 /* Calculate displacement vector */
211 /* Calculate squared distance and things based on it */
212 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
213 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
214 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
215 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
216 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
217 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
218 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
219 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
220 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
222 rinv11 = gmx_invsqrt(rsq11);
223 rinv12 = gmx_invsqrt(rsq12);
224 rinv13 = gmx_invsqrt(rsq13);
225 rinv21 = gmx_invsqrt(rsq21);
226 rinv22 = gmx_invsqrt(rsq22);
227 rinv23 = gmx_invsqrt(rsq23);
228 rinv31 = gmx_invsqrt(rsq31);
229 rinv32 = gmx_invsqrt(rsq32);
230 rinv33 = gmx_invsqrt(rsq33);
232 rinvsq11 = rinv11*rinv11;
233 rinvsq12 = rinv12*rinv12;
234 rinvsq13 = rinv13*rinv13;
235 rinvsq21 = rinv21*rinv21;
236 rinvsq22 = rinv22*rinv22;
237 rinvsq23 = rinv23*rinv23;
238 rinvsq31 = rinv31*rinv31;
239 rinvsq32 = rinv32*rinv32;
240 rinvsq33 = rinv33*rinv33;
242 /**************************
243 * CALCULATE INTERACTIONS *
244 **************************/
249 /* REACTION-FIELD ELECTROSTATICS */
250 velec = qq11*(rinv11+krf*rsq11-crf);
251 felec = qq11*(rinv11*rinvsq11-krf2);
253 /* Update potential sums from outer loop */
258 /* Calculate temporary vectorial force */
263 /* Update vectorial force */
267 f[j_coord_offset+DIM*1+XX] -= tx;
268 f[j_coord_offset+DIM*1+YY] -= ty;
269 f[j_coord_offset+DIM*1+ZZ] -= tz;
273 /**************************
274 * CALCULATE INTERACTIONS *
275 **************************/
280 /* REACTION-FIELD ELECTROSTATICS */
281 velec = qq12*(rinv12+krf*rsq12-crf);
282 felec = qq12*(rinv12*rinvsq12-krf2);
284 /* Update potential sums from outer loop */
289 /* Calculate temporary vectorial force */
294 /* Update vectorial force */
298 f[j_coord_offset+DIM*2+XX] -= tx;
299 f[j_coord_offset+DIM*2+YY] -= ty;
300 f[j_coord_offset+DIM*2+ZZ] -= tz;
304 /**************************
305 * CALCULATE INTERACTIONS *
306 **************************/
311 /* REACTION-FIELD ELECTROSTATICS */
312 velec = qq13*(rinv13+krf*rsq13-crf);
313 felec = qq13*(rinv13*rinvsq13-krf2);
315 /* Update potential sums from outer loop */
320 /* Calculate temporary vectorial force */
325 /* Update vectorial force */
329 f[j_coord_offset+DIM*3+XX] -= tx;
330 f[j_coord_offset+DIM*3+YY] -= ty;
331 f[j_coord_offset+DIM*3+ZZ] -= tz;
335 /**************************
336 * CALCULATE INTERACTIONS *
337 **************************/
342 /* REACTION-FIELD ELECTROSTATICS */
343 velec = qq21*(rinv21+krf*rsq21-crf);
344 felec = qq21*(rinv21*rinvsq21-krf2);
346 /* Update potential sums from outer loop */
351 /* Calculate temporary vectorial force */
356 /* Update vectorial force */
360 f[j_coord_offset+DIM*1+XX] -= tx;
361 f[j_coord_offset+DIM*1+YY] -= ty;
362 f[j_coord_offset+DIM*1+ZZ] -= tz;
366 /**************************
367 * CALCULATE INTERACTIONS *
368 **************************/
373 /* REACTION-FIELD ELECTROSTATICS */
374 velec = qq22*(rinv22+krf*rsq22-crf);
375 felec = qq22*(rinv22*rinvsq22-krf2);
377 /* Update potential sums from outer loop */
382 /* Calculate temporary vectorial force */
387 /* Update vectorial force */
391 f[j_coord_offset+DIM*2+XX] -= tx;
392 f[j_coord_offset+DIM*2+YY] -= ty;
393 f[j_coord_offset+DIM*2+ZZ] -= tz;
397 /**************************
398 * CALCULATE INTERACTIONS *
399 **************************/
404 /* REACTION-FIELD ELECTROSTATICS */
405 velec = qq23*(rinv23+krf*rsq23-crf);
406 felec = qq23*(rinv23*rinvsq23-krf2);
408 /* Update potential sums from outer loop */
413 /* Calculate temporary vectorial force */
418 /* Update vectorial force */
422 f[j_coord_offset+DIM*3+XX] -= tx;
423 f[j_coord_offset+DIM*3+YY] -= ty;
424 f[j_coord_offset+DIM*3+ZZ] -= tz;
428 /**************************
429 * CALCULATE INTERACTIONS *
430 **************************/
435 /* REACTION-FIELD ELECTROSTATICS */
436 velec = qq31*(rinv31+krf*rsq31-crf);
437 felec = qq31*(rinv31*rinvsq31-krf2);
439 /* Update potential sums from outer loop */
444 /* Calculate temporary vectorial force */
449 /* Update vectorial force */
453 f[j_coord_offset+DIM*1+XX] -= tx;
454 f[j_coord_offset+DIM*1+YY] -= ty;
455 f[j_coord_offset+DIM*1+ZZ] -= tz;
459 /**************************
460 * CALCULATE INTERACTIONS *
461 **************************/
466 /* REACTION-FIELD ELECTROSTATICS */
467 velec = qq32*(rinv32+krf*rsq32-crf);
468 felec = qq32*(rinv32*rinvsq32-krf2);
470 /* Update potential sums from outer loop */
475 /* Calculate temporary vectorial force */
480 /* Update vectorial force */
484 f[j_coord_offset+DIM*2+XX] -= tx;
485 f[j_coord_offset+DIM*2+YY] -= ty;
486 f[j_coord_offset+DIM*2+ZZ] -= tz;
490 /**************************
491 * CALCULATE INTERACTIONS *
492 **************************/
497 /* REACTION-FIELD ELECTROSTATICS */
498 velec = qq33*(rinv33+krf*rsq33-crf);
499 felec = qq33*(rinv33*rinvsq33-krf2);
501 /* Update potential sums from outer loop */
506 /* Calculate temporary vectorial force */
511 /* Update vectorial force */
515 f[j_coord_offset+DIM*3+XX] -= tx;
516 f[j_coord_offset+DIM*3+YY] -= ty;
517 f[j_coord_offset+DIM*3+ZZ] -= tz;
521 /* Inner loop uses 279 flops */
523 /* End of innermost loop */
526 f[i_coord_offset+DIM*1+XX] += fix1;
527 f[i_coord_offset+DIM*1+YY] += fiy1;
528 f[i_coord_offset+DIM*1+ZZ] += fiz1;
532 f[i_coord_offset+DIM*2+XX] += fix2;
533 f[i_coord_offset+DIM*2+YY] += fiy2;
534 f[i_coord_offset+DIM*2+ZZ] += fiz2;
538 f[i_coord_offset+DIM*3+XX] += fix3;
539 f[i_coord_offset+DIM*3+YY] += fiy3;
540 f[i_coord_offset+DIM*3+ZZ] += fiz3;
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_W4W4_VF,outeriter*31 + inneriter*279);
566 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomW4W4_F_c
567 * Electrostatics interaction: ReactionField
568 * VdW interaction: None
569 * Geometry: Water4-Water4
570 * Calculate force/pot: Force
573 nb_kernel_ElecRFCut_VdwNone_GeomW4W4_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 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
591 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
593 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
595 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
597 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
599 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
600 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
601 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
602 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
603 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
604 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
605 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
606 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
607 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
608 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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 iq1 = facel*charge[inr+1];
632 iq2 = facel*charge[inr+2];
633 iq3 = facel*charge[inr+3];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
674 iy1 = shY + x[i_coord_offset+DIM*1+YY];
675 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
676 ix2 = shX + x[i_coord_offset+DIM*2+XX];
677 iy2 = shY + x[i_coord_offset+DIM*2+YY];
678 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
679 ix3 = shX + x[i_coord_offset+DIM*3+XX];
680 iy3 = shY + x[i_coord_offset+DIM*3+YY];
681 iz3 = shZ + x[i_coord_offset+DIM*3+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 jx1 = x[j_coord_offset+DIM*1+XX];
702 jy1 = x[j_coord_offset+DIM*1+YY];
703 jz1 = x[j_coord_offset+DIM*1+ZZ];
704 jx2 = x[j_coord_offset+DIM*2+XX];
705 jy2 = x[j_coord_offset+DIM*2+YY];
706 jz2 = x[j_coord_offset+DIM*2+ZZ];
707 jx3 = x[j_coord_offset+DIM*3+XX];
708 jy3 = x[j_coord_offset+DIM*3+YY];
709 jz3 = x[j_coord_offset+DIM*3+ZZ];
711 /* Calculate displacement vector */
740 /* Calculate squared distance and things based on it */
741 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
742 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
743 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
744 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
745 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
746 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
747 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
748 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
749 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
751 rinv11 = gmx_invsqrt(rsq11);
752 rinv12 = gmx_invsqrt(rsq12);
753 rinv13 = gmx_invsqrt(rsq13);
754 rinv21 = gmx_invsqrt(rsq21);
755 rinv22 = gmx_invsqrt(rsq22);
756 rinv23 = gmx_invsqrt(rsq23);
757 rinv31 = gmx_invsqrt(rsq31);
758 rinv32 = gmx_invsqrt(rsq32);
759 rinv33 = gmx_invsqrt(rsq33);
761 rinvsq11 = rinv11*rinv11;
762 rinvsq12 = rinv12*rinv12;
763 rinvsq13 = rinv13*rinv13;
764 rinvsq21 = rinv21*rinv21;
765 rinvsq22 = rinv22*rinv22;
766 rinvsq23 = rinv23*rinv23;
767 rinvsq31 = rinv31*rinv31;
768 rinvsq32 = rinv32*rinv32;
769 rinvsq33 = rinv33*rinv33;
771 /**************************
772 * CALCULATE INTERACTIONS *
773 **************************/
778 /* REACTION-FIELD ELECTROSTATICS */
779 felec = qq11*(rinv11*rinvsq11-krf2);
783 /* Calculate temporary vectorial force */
788 /* Update vectorial force */
792 f[j_coord_offset+DIM*1+XX] -= tx;
793 f[j_coord_offset+DIM*1+YY] -= ty;
794 f[j_coord_offset+DIM*1+ZZ] -= tz;
798 /**************************
799 * CALCULATE INTERACTIONS *
800 **************************/
805 /* REACTION-FIELD ELECTROSTATICS */
806 felec = qq12*(rinv12*rinvsq12-krf2);
810 /* Calculate temporary vectorial force */
815 /* Update vectorial force */
819 f[j_coord_offset+DIM*2+XX] -= tx;
820 f[j_coord_offset+DIM*2+YY] -= ty;
821 f[j_coord_offset+DIM*2+ZZ] -= tz;
825 /**************************
826 * CALCULATE INTERACTIONS *
827 **************************/
832 /* REACTION-FIELD ELECTROSTATICS */
833 felec = qq13*(rinv13*rinvsq13-krf2);
837 /* Calculate temporary vectorial force */
842 /* Update vectorial force */
846 f[j_coord_offset+DIM*3+XX] -= tx;
847 f[j_coord_offset+DIM*3+YY] -= ty;
848 f[j_coord_offset+DIM*3+ZZ] -= tz;
852 /**************************
853 * CALCULATE INTERACTIONS *
854 **************************/
859 /* REACTION-FIELD ELECTROSTATICS */
860 felec = qq21*(rinv21*rinvsq21-krf2);
864 /* Calculate temporary vectorial force */
869 /* Update vectorial force */
873 f[j_coord_offset+DIM*1+XX] -= tx;
874 f[j_coord_offset+DIM*1+YY] -= ty;
875 f[j_coord_offset+DIM*1+ZZ] -= tz;
879 /**************************
880 * CALCULATE INTERACTIONS *
881 **************************/
886 /* REACTION-FIELD ELECTROSTATICS */
887 felec = qq22*(rinv22*rinvsq22-krf2);
891 /* Calculate temporary vectorial force */
896 /* Update vectorial force */
900 f[j_coord_offset+DIM*2+XX] -= tx;
901 f[j_coord_offset+DIM*2+YY] -= ty;
902 f[j_coord_offset+DIM*2+ZZ] -= tz;
906 /**************************
907 * CALCULATE INTERACTIONS *
908 **************************/
913 /* REACTION-FIELD ELECTROSTATICS */
914 felec = qq23*(rinv23*rinvsq23-krf2);
918 /* Calculate temporary vectorial force */
923 /* Update vectorial force */
927 f[j_coord_offset+DIM*3+XX] -= tx;
928 f[j_coord_offset+DIM*3+YY] -= ty;
929 f[j_coord_offset+DIM*3+ZZ] -= tz;
933 /**************************
934 * CALCULATE INTERACTIONS *
935 **************************/
940 /* REACTION-FIELD ELECTROSTATICS */
941 felec = qq31*(rinv31*rinvsq31-krf2);
945 /* Calculate temporary vectorial force */
950 /* Update vectorial force */
954 f[j_coord_offset+DIM*1+XX] -= tx;
955 f[j_coord_offset+DIM*1+YY] -= ty;
956 f[j_coord_offset+DIM*1+ZZ] -= tz;
960 /**************************
961 * CALCULATE INTERACTIONS *
962 **************************/
967 /* REACTION-FIELD ELECTROSTATICS */
968 felec = qq32*(rinv32*rinvsq32-krf2);
972 /* Calculate temporary vectorial force */
977 /* Update vectorial force */
981 f[j_coord_offset+DIM*2+XX] -= tx;
982 f[j_coord_offset+DIM*2+YY] -= ty;
983 f[j_coord_offset+DIM*2+ZZ] -= tz;
987 /**************************
988 * CALCULATE INTERACTIONS *
989 **************************/
994 /* REACTION-FIELD ELECTROSTATICS */
995 felec = qq33*(rinv33*rinvsq33-krf2);
999 /* Calculate temporary vectorial force */
1004 /* Update vectorial force */
1008 f[j_coord_offset+DIM*3+XX] -= tx;
1009 f[j_coord_offset+DIM*3+YY] -= ty;
1010 f[j_coord_offset+DIM*3+ZZ] -= tz;
1014 /* Inner loop uses 234 flops */
1016 /* End of innermost loop */
1019 f[i_coord_offset+DIM*1+XX] += fix1;
1020 f[i_coord_offset+DIM*1+YY] += fiy1;
1021 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1025 f[i_coord_offset+DIM*2+XX] += fix2;
1026 f[i_coord_offset+DIM*2+YY] += fiy2;
1027 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1031 f[i_coord_offset+DIM*3+XX] += fix3;
1032 f[i_coord_offset+DIM*3+YY] += fiy3;
1033 f[i_coord_offset+DIM*3+ZZ] += fiz3;
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_W4W4_F,outeriter*30 + inneriter*234);