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.
44 #include "../nb_kernel.h"
45 #include "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomW4W4_VF_c
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: None
53 * Geometry: Water4-Water4
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRF_VdwNone_GeomW4W4_VF_c
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 int i_shift_offset,i_coord_offset,j_coord_offset;
67 int j_index_start,j_index_end;
68 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
69 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
70 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
71 real *shiftvec,*fshift,*x,*f;
73 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
75 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
77 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
79 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
81 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
83 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
84 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
85 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
86 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
87 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
88 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
89 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
90 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
91 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
92 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
93 real velec,felec,velecsum,facel,crf,krf,krf2;
101 jindex = nlist->jindex;
103 shiftidx = nlist->shift;
105 shiftvec = fr->shift_vec[0];
106 fshift = fr->fshift[0];
108 charge = mdatoms->chargeA;
113 /* Setup water-specific parameters */
114 inr = nlist->iinr[0];
115 iq1 = facel*charge[inr+1];
116 iq2 = facel*charge[inr+2];
117 iq3 = facel*charge[inr+3];
135 /* Start outer loop over neighborlists */
136 for(iidx=0; iidx<nri; iidx++)
138 /* Load shift vector for this list */
139 i_shift_offset = DIM*shiftidx[iidx];
140 shX = shiftvec[i_shift_offset+XX];
141 shY = shiftvec[i_shift_offset+YY];
142 shZ = shiftvec[i_shift_offset+ZZ];
144 /* Load limits for loop over neighbors */
145 j_index_start = jindex[iidx];
146 j_index_end = jindex[iidx+1];
148 /* Get outer coordinate index */
150 i_coord_offset = DIM*inr;
152 /* Load i particle coords and add shift vector */
153 ix1 = shX + x[i_coord_offset+DIM*1+XX];
154 iy1 = shY + x[i_coord_offset+DIM*1+YY];
155 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
156 ix2 = shX + x[i_coord_offset+DIM*2+XX];
157 iy2 = shY + x[i_coord_offset+DIM*2+YY];
158 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
159 ix3 = shX + x[i_coord_offset+DIM*3+XX];
160 iy3 = shY + x[i_coord_offset+DIM*3+YY];
161 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
173 /* Reset potential sums */
176 /* Start inner kernel loop */
177 for(jidx=j_index_start; jidx<j_index_end; jidx++)
179 /* Get j neighbor index, and coordinate index */
181 j_coord_offset = DIM*jnr;
183 /* load j atom coordinates */
184 jx1 = x[j_coord_offset+DIM*1+XX];
185 jy1 = x[j_coord_offset+DIM*1+YY];
186 jz1 = x[j_coord_offset+DIM*1+ZZ];
187 jx2 = x[j_coord_offset+DIM*2+XX];
188 jy2 = x[j_coord_offset+DIM*2+YY];
189 jz2 = x[j_coord_offset+DIM*2+ZZ];
190 jx3 = x[j_coord_offset+DIM*3+XX];
191 jy3 = x[j_coord_offset+DIM*3+YY];
192 jz3 = x[j_coord_offset+DIM*3+ZZ];
194 /* Calculate displacement vector */
223 /* Calculate squared distance and things based on it */
224 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
225 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
226 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
227 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
228 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
229 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
230 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
231 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
232 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
234 rinv11 = gmx_invsqrt(rsq11);
235 rinv12 = gmx_invsqrt(rsq12);
236 rinv13 = gmx_invsqrt(rsq13);
237 rinv21 = gmx_invsqrt(rsq21);
238 rinv22 = gmx_invsqrt(rsq22);
239 rinv23 = gmx_invsqrt(rsq23);
240 rinv31 = gmx_invsqrt(rsq31);
241 rinv32 = gmx_invsqrt(rsq32);
242 rinv33 = gmx_invsqrt(rsq33);
244 rinvsq11 = rinv11*rinv11;
245 rinvsq12 = rinv12*rinv12;
246 rinvsq13 = rinv13*rinv13;
247 rinvsq21 = rinv21*rinv21;
248 rinvsq22 = rinv22*rinv22;
249 rinvsq23 = rinv23*rinv23;
250 rinvsq31 = rinv31*rinv31;
251 rinvsq32 = rinv32*rinv32;
252 rinvsq33 = rinv33*rinv33;
254 /**************************
255 * CALCULATE INTERACTIONS *
256 **************************/
258 /* REACTION-FIELD ELECTROSTATICS */
259 velec = qq11*(rinv11+krf*rsq11-crf);
260 felec = qq11*(rinv11*rinvsq11-krf2);
262 /* Update potential sums from outer loop */
267 /* Calculate temporary vectorial force */
272 /* Update vectorial force */
276 f[j_coord_offset+DIM*1+XX] -= tx;
277 f[j_coord_offset+DIM*1+YY] -= ty;
278 f[j_coord_offset+DIM*1+ZZ] -= tz;
280 /**************************
281 * CALCULATE INTERACTIONS *
282 **************************/
284 /* REACTION-FIELD ELECTROSTATICS */
285 velec = qq12*(rinv12+krf*rsq12-crf);
286 felec = qq12*(rinv12*rinvsq12-krf2);
288 /* Update potential sums from outer loop */
293 /* Calculate temporary vectorial force */
298 /* Update vectorial force */
302 f[j_coord_offset+DIM*2+XX] -= tx;
303 f[j_coord_offset+DIM*2+YY] -= ty;
304 f[j_coord_offset+DIM*2+ZZ] -= tz;
306 /**************************
307 * CALCULATE INTERACTIONS *
308 **************************/
310 /* REACTION-FIELD ELECTROSTATICS */
311 velec = qq13*(rinv13+krf*rsq13-crf);
312 felec = qq13*(rinv13*rinvsq13-krf2);
314 /* Update potential sums from outer loop */
319 /* Calculate temporary vectorial force */
324 /* Update vectorial force */
328 f[j_coord_offset+DIM*3+XX] -= tx;
329 f[j_coord_offset+DIM*3+YY] -= ty;
330 f[j_coord_offset+DIM*3+ZZ] -= tz;
332 /**************************
333 * CALCULATE INTERACTIONS *
334 **************************/
336 /* REACTION-FIELD ELECTROSTATICS */
337 velec = qq21*(rinv21+krf*rsq21-crf);
338 felec = qq21*(rinv21*rinvsq21-krf2);
340 /* Update potential sums from outer loop */
345 /* Calculate temporary vectorial force */
350 /* Update vectorial force */
354 f[j_coord_offset+DIM*1+XX] -= tx;
355 f[j_coord_offset+DIM*1+YY] -= ty;
356 f[j_coord_offset+DIM*1+ZZ] -= tz;
358 /**************************
359 * CALCULATE INTERACTIONS *
360 **************************/
362 /* REACTION-FIELD ELECTROSTATICS */
363 velec = qq22*(rinv22+krf*rsq22-crf);
364 felec = qq22*(rinv22*rinvsq22-krf2);
366 /* Update potential sums from outer loop */
371 /* Calculate temporary vectorial force */
376 /* Update vectorial force */
380 f[j_coord_offset+DIM*2+XX] -= tx;
381 f[j_coord_offset+DIM*2+YY] -= ty;
382 f[j_coord_offset+DIM*2+ZZ] -= tz;
384 /**************************
385 * CALCULATE INTERACTIONS *
386 **************************/
388 /* REACTION-FIELD ELECTROSTATICS */
389 velec = qq23*(rinv23+krf*rsq23-crf);
390 felec = qq23*(rinv23*rinvsq23-krf2);
392 /* Update potential sums from outer loop */
397 /* Calculate temporary vectorial force */
402 /* Update vectorial force */
406 f[j_coord_offset+DIM*3+XX] -= tx;
407 f[j_coord_offset+DIM*3+YY] -= ty;
408 f[j_coord_offset+DIM*3+ZZ] -= tz;
410 /**************************
411 * CALCULATE INTERACTIONS *
412 **************************/
414 /* REACTION-FIELD ELECTROSTATICS */
415 velec = qq31*(rinv31+krf*rsq31-crf);
416 felec = qq31*(rinv31*rinvsq31-krf2);
418 /* Update potential sums from outer loop */
423 /* Calculate temporary vectorial force */
428 /* Update vectorial force */
432 f[j_coord_offset+DIM*1+XX] -= tx;
433 f[j_coord_offset+DIM*1+YY] -= ty;
434 f[j_coord_offset+DIM*1+ZZ] -= tz;
436 /**************************
437 * CALCULATE INTERACTIONS *
438 **************************/
440 /* REACTION-FIELD ELECTROSTATICS */
441 velec = qq32*(rinv32+krf*rsq32-crf);
442 felec = qq32*(rinv32*rinvsq32-krf2);
444 /* Update potential sums from outer loop */
449 /* Calculate temporary vectorial force */
454 /* Update vectorial force */
458 f[j_coord_offset+DIM*2+XX] -= tx;
459 f[j_coord_offset+DIM*2+YY] -= ty;
460 f[j_coord_offset+DIM*2+ZZ] -= tz;
462 /**************************
463 * CALCULATE INTERACTIONS *
464 **************************/
466 /* REACTION-FIELD ELECTROSTATICS */
467 velec = qq33*(rinv33+krf*rsq33-crf);
468 felec = qq33*(rinv33*rinvsq33-krf2);
470 /* Update potential sums from outer loop */
475 /* Calculate temporary vectorial force */
480 /* Update vectorial force */
484 f[j_coord_offset+DIM*3+XX] -= tx;
485 f[j_coord_offset+DIM*3+YY] -= ty;
486 f[j_coord_offset+DIM*3+ZZ] -= tz;
488 /* Inner loop uses 279 flops */
490 /* End of innermost loop */
493 f[i_coord_offset+DIM*1+XX] += fix1;
494 f[i_coord_offset+DIM*1+YY] += fiy1;
495 f[i_coord_offset+DIM*1+ZZ] += fiz1;
499 f[i_coord_offset+DIM*2+XX] += fix2;
500 f[i_coord_offset+DIM*2+YY] += fiy2;
501 f[i_coord_offset+DIM*2+ZZ] += fiz2;
505 f[i_coord_offset+DIM*3+XX] += fix3;
506 f[i_coord_offset+DIM*3+YY] += fiy3;
507 f[i_coord_offset+DIM*3+ZZ] += fiz3;
511 fshift[i_shift_offset+XX] += tx;
512 fshift[i_shift_offset+YY] += ty;
513 fshift[i_shift_offset+ZZ] += tz;
516 /* Update potential energies */
517 kernel_data->energygrp_elec[ggid] += velecsum;
519 /* Increment number of inner iterations */
520 inneriter += j_index_end - j_index_start;
522 /* Outer loop uses 31 flops */
525 /* Increment number of outer iterations */
528 /* Update outer/inner flops */
530 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_VF,outeriter*31 + inneriter*279);
533 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomW4W4_F_c
534 * Electrostatics interaction: ReactionField
535 * VdW interaction: None
536 * Geometry: Water4-Water4
537 * Calculate force/pot: Force
540 nb_kernel_ElecRF_VdwNone_GeomW4W4_F_c
541 (t_nblist * gmx_restrict nlist,
542 rvec * gmx_restrict xx,
543 rvec * gmx_restrict ff,
544 t_forcerec * gmx_restrict fr,
545 t_mdatoms * gmx_restrict mdatoms,
546 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
547 t_nrnb * gmx_restrict nrnb)
549 int i_shift_offset,i_coord_offset,j_coord_offset;
550 int j_index_start,j_index_end;
551 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
552 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
553 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
554 real *shiftvec,*fshift,*x,*f;
556 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
558 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
560 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
562 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
564 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
566 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
567 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
568 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
569 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
570 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
571 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
572 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
573 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
574 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
575 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
576 real velec,felec,velecsum,facel,crf,krf,krf2;
584 jindex = nlist->jindex;
586 shiftidx = nlist->shift;
588 shiftvec = fr->shift_vec[0];
589 fshift = fr->fshift[0];
591 charge = mdatoms->chargeA;
596 /* Setup water-specific parameters */
597 inr = nlist->iinr[0];
598 iq1 = facel*charge[inr+1];
599 iq2 = facel*charge[inr+2];
600 iq3 = facel*charge[inr+3];
618 /* Start outer loop over neighborlists */
619 for(iidx=0; iidx<nri; iidx++)
621 /* Load shift vector for this list */
622 i_shift_offset = DIM*shiftidx[iidx];
623 shX = shiftvec[i_shift_offset+XX];
624 shY = shiftvec[i_shift_offset+YY];
625 shZ = shiftvec[i_shift_offset+ZZ];
627 /* Load limits for loop over neighbors */
628 j_index_start = jindex[iidx];
629 j_index_end = jindex[iidx+1];
631 /* Get outer coordinate index */
633 i_coord_offset = DIM*inr;
635 /* Load i particle coords and add shift vector */
636 ix1 = shX + x[i_coord_offset+DIM*1+XX];
637 iy1 = shY + x[i_coord_offset+DIM*1+YY];
638 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
639 ix2 = shX + x[i_coord_offset+DIM*2+XX];
640 iy2 = shY + x[i_coord_offset+DIM*2+YY];
641 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
642 ix3 = shX + x[i_coord_offset+DIM*3+XX];
643 iy3 = shY + x[i_coord_offset+DIM*3+YY];
644 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
656 /* Start inner kernel loop */
657 for(jidx=j_index_start; jidx<j_index_end; jidx++)
659 /* Get j neighbor index, and coordinate index */
661 j_coord_offset = DIM*jnr;
663 /* load j atom coordinates */
664 jx1 = x[j_coord_offset+DIM*1+XX];
665 jy1 = x[j_coord_offset+DIM*1+YY];
666 jz1 = x[j_coord_offset+DIM*1+ZZ];
667 jx2 = x[j_coord_offset+DIM*2+XX];
668 jy2 = x[j_coord_offset+DIM*2+YY];
669 jz2 = x[j_coord_offset+DIM*2+ZZ];
670 jx3 = x[j_coord_offset+DIM*3+XX];
671 jy3 = x[j_coord_offset+DIM*3+YY];
672 jz3 = x[j_coord_offset+DIM*3+ZZ];
674 /* Calculate displacement vector */
703 /* Calculate squared distance and things based on it */
704 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
705 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
706 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
707 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
708 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
709 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
710 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
711 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
712 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
714 rinv11 = gmx_invsqrt(rsq11);
715 rinv12 = gmx_invsqrt(rsq12);
716 rinv13 = gmx_invsqrt(rsq13);
717 rinv21 = gmx_invsqrt(rsq21);
718 rinv22 = gmx_invsqrt(rsq22);
719 rinv23 = gmx_invsqrt(rsq23);
720 rinv31 = gmx_invsqrt(rsq31);
721 rinv32 = gmx_invsqrt(rsq32);
722 rinv33 = gmx_invsqrt(rsq33);
724 rinvsq11 = rinv11*rinv11;
725 rinvsq12 = rinv12*rinv12;
726 rinvsq13 = rinv13*rinv13;
727 rinvsq21 = rinv21*rinv21;
728 rinvsq22 = rinv22*rinv22;
729 rinvsq23 = rinv23*rinv23;
730 rinvsq31 = rinv31*rinv31;
731 rinvsq32 = rinv32*rinv32;
732 rinvsq33 = rinv33*rinv33;
734 /**************************
735 * CALCULATE INTERACTIONS *
736 **************************/
738 /* REACTION-FIELD ELECTROSTATICS */
739 felec = qq11*(rinv11*rinvsq11-krf2);
743 /* Calculate temporary vectorial force */
748 /* Update vectorial force */
752 f[j_coord_offset+DIM*1+XX] -= tx;
753 f[j_coord_offset+DIM*1+YY] -= ty;
754 f[j_coord_offset+DIM*1+ZZ] -= tz;
756 /**************************
757 * CALCULATE INTERACTIONS *
758 **************************/
760 /* REACTION-FIELD ELECTROSTATICS */
761 felec = qq12*(rinv12*rinvsq12-krf2);
765 /* Calculate temporary vectorial force */
770 /* Update vectorial force */
774 f[j_coord_offset+DIM*2+XX] -= tx;
775 f[j_coord_offset+DIM*2+YY] -= ty;
776 f[j_coord_offset+DIM*2+ZZ] -= tz;
778 /**************************
779 * CALCULATE INTERACTIONS *
780 **************************/
782 /* REACTION-FIELD ELECTROSTATICS */
783 felec = qq13*(rinv13*rinvsq13-krf2);
787 /* Calculate temporary vectorial force */
792 /* Update vectorial force */
796 f[j_coord_offset+DIM*3+XX] -= tx;
797 f[j_coord_offset+DIM*3+YY] -= ty;
798 f[j_coord_offset+DIM*3+ZZ] -= tz;
800 /**************************
801 * CALCULATE INTERACTIONS *
802 **************************/
804 /* REACTION-FIELD ELECTROSTATICS */
805 felec = qq21*(rinv21*rinvsq21-krf2);
809 /* Calculate temporary vectorial force */
814 /* Update vectorial force */
818 f[j_coord_offset+DIM*1+XX] -= tx;
819 f[j_coord_offset+DIM*1+YY] -= ty;
820 f[j_coord_offset+DIM*1+ZZ] -= tz;
822 /**************************
823 * CALCULATE INTERACTIONS *
824 **************************/
826 /* REACTION-FIELD ELECTROSTATICS */
827 felec = qq22*(rinv22*rinvsq22-krf2);
831 /* Calculate temporary vectorial force */
836 /* Update vectorial force */
840 f[j_coord_offset+DIM*2+XX] -= tx;
841 f[j_coord_offset+DIM*2+YY] -= ty;
842 f[j_coord_offset+DIM*2+ZZ] -= tz;
844 /**************************
845 * CALCULATE INTERACTIONS *
846 **************************/
848 /* REACTION-FIELD ELECTROSTATICS */
849 felec = qq23*(rinv23*rinvsq23-krf2);
853 /* Calculate temporary vectorial force */
858 /* Update vectorial force */
862 f[j_coord_offset+DIM*3+XX] -= tx;
863 f[j_coord_offset+DIM*3+YY] -= ty;
864 f[j_coord_offset+DIM*3+ZZ] -= tz;
866 /**************************
867 * CALCULATE INTERACTIONS *
868 **************************/
870 /* REACTION-FIELD ELECTROSTATICS */
871 felec = qq31*(rinv31*rinvsq31-krf2);
875 /* Calculate temporary vectorial force */
880 /* Update vectorial force */
884 f[j_coord_offset+DIM*1+XX] -= tx;
885 f[j_coord_offset+DIM*1+YY] -= ty;
886 f[j_coord_offset+DIM*1+ZZ] -= tz;
888 /**************************
889 * CALCULATE INTERACTIONS *
890 **************************/
892 /* REACTION-FIELD ELECTROSTATICS */
893 felec = qq32*(rinv32*rinvsq32-krf2);
897 /* Calculate temporary vectorial force */
902 /* Update vectorial force */
906 f[j_coord_offset+DIM*2+XX] -= tx;
907 f[j_coord_offset+DIM*2+YY] -= ty;
908 f[j_coord_offset+DIM*2+ZZ] -= tz;
910 /**************************
911 * CALCULATE INTERACTIONS *
912 **************************/
914 /* REACTION-FIELD ELECTROSTATICS */
915 felec = qq33*(rinv33*rinvsq33-krf2);
919 /* Calculate temporary vectorial force */
924 /* Update vectorial force */
928 f[j_coord_offset+DIM*3+XX] -= tx;
929 f[j_coord_offset+DIM*3+YY] -= ty;
930 f[j_coord_offset+DIM*3+ZZ] -= tz;
932 /* Inner loop uses 234 flops */
934 /* End of innermost loop */
937 f[i_coord_offset+DIM*1+XX] += fix1;
938 f[i_coord_offset+DIM*1+YY] += fiy1;
939 f[i_coord_offset+DIM*1+ZZ] += fiz1;
943 f[i_coord_offset+DIM*2+XX] += fix2;
944 f[i_coord_offset+DIM*2+YY] += fiy2;
945 f[i_coord_offset+DIM*2+ZZ] += fiz2;
949 f[i_coord_offset+DIM*3+XX] += fix3;
950 f[i_coord_offset+DIM*3+YY] += fiy3;
951 f[i_coord_offset+DIM*3+ZZ] += fiz3;
955 fshift[i_shift_offset+XX] += tx;
956 fshift[i_shift_offset+YY] += ty;
957 fshift[i_shift_offset+ZZ] += tz;
959 /* Increment number of inner iterations */
960 inneriter += j_index_end - j_index_start;
962 /* Outer loop uses 30 flops */
965 /* Increment number of outer iterations */
968 /* Update outer/inner flops */
970 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_F,outeriter*30 + inneriter*234);