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.
42 #include "../nb_kernel.h"
43 #include "gromacs/legacyheaders/types/simple.h"
44 #include "gromacs/math/vec.h"
45 #include "gromacs/legacyheaders/nrnb.h"
48 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwNone_GeomW4W4_VF_c
49 * Electrostatics interaction: Coulomb
50 * VdW interaction: None
51 * Geometry: Water4-Water4
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecCoul_VdwNone_GeomW4W4_VF_c
56 (t_nblist * gmx_restrict nlist,
57 rvec * gmx_restrict xx,
58 rvec * gmx_restrict ff,
59 t_forcerec * gmx_restrict fr,
60 t_mdatoms * gmx_restrict mdatoms,
61 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
62 t_nrnb * gmx_restrict nrnb)
64 int i_shift_offset,i_coord_offset,j_coord_offset;
65 int j_index_start,j_index_end;
66 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
67 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
68 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
69 real *shiftvec,*fshift,*x,*f;
71 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
73 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
75 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
77 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
79 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
81 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
82 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
83 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
84 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
85 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
86 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
87 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
88 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
89 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
90 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
91 real velec,felec,velecsum,facel,crf,krf,krf2;
99 jindex = nlist->jindex;
101 shiftidx = nlist->shift;
103 shiftvec = fr->shift_vec[0];
104 fshift = fr->fshift[0];
106 charge = mdatoms->chargeA;
108 /* Setup water-specific parameters */
109 inr = nlist->iinr[0];
110 iq1 = facel*charge[inr+1];
111 iq2 = facel*charge[inr+2];
112 iq3 = facel*charge[inr+3];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
149 iy1 = shY + x[i_coord_offset+DIM*1+YY];
150 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
151 ix2 = shX + x[i_coord_offset+DIM*2+XX];
152 iy2 = shY + x[i_coord_offset+DIM*2+YY];
153 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
154 ix3 = shX + x[i_coord_offset+DIM*3+XX];
155 iy3 = shY + x[i_coord_offset+DIM*3+YY];
156 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
168 /* Reset potential sums */
171 /* Start inner kernel loop */
172 for(jidx=j_index_start; jidx<j_index_end; jidx++)
174 /* Get j neighbor index, and coordinate index */
176 j_coord_offset = DIM*jnr;
178 /* load j atom coordinates */
179 jx1 = x[j_coord_offset+DIM*1+XX];
180 jy1 = x[j_coord_offset+DIM*1+YY];
181 jz1 = x[j_coord_offset+DIM*1+ZZ];
182 jx2 = x[j_coord_offset+DIM*2+XX];
183 jy2 = x[j_coord_offset+DIM*2+YY];
184 jz2 = x[j_coord_offset+DIM*2+ZZ];
185 jx3 = x[j_coord_offset+DIM*3+XX];
186 jy3 = x[j_coord_offset+DIM*3+YY];
187 jz3 = x[j_coord_offset+DIM*3+ZZ];
189 /* Calculate displacement vector */
218 /* Calculate squared distance and things based on it */
219 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
220 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
221 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
222 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
223 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
224 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
225 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
226 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
227 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
229 rinv11 = gmx_invsqrt(rsq11);
230 rinv12 = gmx_invsqrt(rsq12);
231 rinv13 = gmx_invsqrt(rsq13);
232 rinv21 = gmx_invsqrt(rsq21);
233 rinv22 = gmx_invsqrt(rsq22);
234 rinv23 = gmx_invsqrt(rsq23);
235 rinv31 = gmx_invsqrt(rsq31);
236 rinv32 = gmx_invsqrt(rsq32);
237 rinv33 = gmx_invsqrt(rsq33);
239 rinvsq11 = rinv11*rinv11;
240 rinvsq12 = rinv12*rinv12;
241 rinvsq13 = rinv13*rinv13;
242 rinvsq21 = rinv21*rinv21;
243 rinvsq22 = rinv22*rinv22;
244 rinvsq23 = rinv23*rinv23;
245 rinvsq31 = rinv31*rinv31;
246 rinvsq32 = rinv32*rinv32;
247 rinvsq33 = rinv33*rinv33;
249 /**************************
250 * CALCULATE INTERACTIONS *
251 **************************/
253 /* COULOMB ELECTROSTATICS */
255 felec = velec*rinvsq11;
257 /* Update potential sums from outer loop */
262 /* Calculate temporary vectorial force */
267 /* Update vectorial force */
271 f[j_coord_offset+DIM*1+XX] -= tx;
272 f[j_coord_offset+DIM*1+YY] -= ty;
273 f[j_coord_offset+DIM*1+ZZ] -= tz;
275 /**************************
276 * CALCULATE INTERACTIONS *
277 **************************/
279 /* COULOMB ELECTROSTATICS */
281 felec = velec*rinvsq12;
283 /* Update potential sums from outer loop */
288 /* Calculate temporary vectorial force */
293 /* Update vectorial force */
297 f[j_coord_offset+DIM*2+XX] -= tx;
298 f[j_coord_offset+DIM*2+YY] -= ty;
299 f[j_coord_offset+DIM*2+ZZ] -= tz;
301 /**************************
302 * CALCULATE INTERACTIONS *
303 **************************/
305 /* COULOMB ELECTROSTATICS */
307 felec = velec*rinvsq13;
309 /* Update potential sums from outer loop */
314 /* Calculate temporary vectorial force */
319 /* Update vectorial force */
323 f[j_coord_offset+DIM*3+XX] -= tx;
324 f[j_coord_offset+DIM*3+YY] -= ty;
325 f[j_coord_offset+DIM*3+ZZ] -= tz;
327 /**************************
328 * CALCULATE INTERACTIONS *
329 **************************/
331 /* COULOMB ELECTROSTATICS */
333 felec = velec*rinvsq21;
335 /* Update potential sums from outer loop */
340 /* Calculate temporary vectorial force */
345 /* Update vectorial force */
349 f[j_coord_offset+DIM*1+XX] -= tx;
350 f[j_coord_offset+DIM*1+YY] -= ty;
351 f[j_coord_offset+DIM*1+ZZ] -= tz;
353 /**************************
354 * CALCULATE INTERACTIONS *
355 **************************/
357 /* COULOMB ELECTROSTATICS */
359 felec = velec*rinvsq22;
361 /* Update potential sums from outer loop */
366 /* Calculate temporary vectorial force */
371 /* Update vectorial force */
375 f[j_coord_offset+DIM*2+XX] -= tx;
376 f[j_coord_offset+DIM*2+YY] -= ty;
377 f[j_coord_offset+DIM*2+ZZ] -= tz;
379 /**************************
380 * CALCULATE INTERACTIONS *
381 **************************/
383 /* COULOMB ELECTROSTATICS */
385 felec = velec*rinvsq23;
387 /* Update potential sums from outer loop */
392 /* Calculate temporary vectorial force */
397 /* Update vectorial force */
401 f[j_coord_offset+DIM*3+XX] -= tx;
402 f[j_coord_offset+DIM*3+YY] -= ty;
403 f[j_coord_offset+DIM*3+ZZ] -= tz;
405 /**************************
406 * CALCULATE INTERACTIONS *
407 **************************/
409 /* COULOMB ELECTROSTATICS */
411 felec = velec*rinvsq31;
413 /* Update potential sums from outer loop */
418 /* Calculate temporary vectorial force */
423 /* Update vectorial force */
427 f[j_coord_offset+DIM*1+XX] -= tx;
428 f[j_coord_offset+DIM*1+YY] -= ty;
429 f[j_coord_offset+DIM*1+ZZ] -= tz;
431 /**************************
432 * CALCULATE INTERACTIONS *
433 **************************/
435 /* COULOMB ELECTROSTATICS */
437 felec = velec*rinvsq32;
439 /* Update potential sums from outer loop */
444 /* Calculate temporary vectorial force */
449 /* Update vectorial force */
453 f[j_coord_offset+DIM*2+XX] -= tx;
454 f[j_coord_offset+DIM*2+YY] -= ty;
455 f[j_coord_offset+DIM*2+ZZ] -= tz;
457 /**************************
458 * CALCULATE INTERACTIONS *
459 **************************/
461 /* COULOMB ELECTROSTATICS */
463 felec = velec*rinvsq33;
465 /* Update potential sums from outer loop */
470 /* Calculate temporary vectorial force */
475 /* Update vectorial force */
479 f[j_coord_offset+DIM*3+XX] -= tx;
480 f[j_coord_offset+DIM*3+YY] -= ty;
481 f[j_coord_offset+DIM*3+ZZ] -= tz;
483 /* Inner loop uses 243 flops */
485 /* End of innermost loop */
488 f[i_coord_offset+DIM*1+XX] += fix1;
489 f[i_coord_offset+DIM*1+YY] += fiy1;
490 f[i_coord_offset+DIM*1+ZZ] += fiz1;
494 f[i_coord_offset+DIM*2+XX] += fix2;
495 f[i_coord_offset+DIM*2+YY] += fiy2;
496 f[i_coord_offset+DIM*2+ZZ] += fiz2;
500 f[i_coord_offset+DIM*3+XX] += fix3;
501 f[i_coord_offset+DIM*3+YY] += fiy3;
502 f[i_coord_offset+DIM*3+ZZ] += fiz3;
506 fshift[i_shift_offset+XX] += tx;
507 fshift[i_shift_offset+YY] += ty;
508 fshift[i_shift_offset+ZZ] += tz;
511 /* Update potential energies */
512 kernel_data->energygrp_elec[ggid] += velecsum;
514 /* Increment number of inner iterations */
515 inneriter += j_index_end - j_index_start;
517 /* Outer loop uses 31 flops */
520 /* Increment number of outer iterations */
523 /* Update outer/inner flops */
525 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_VF,outeriter*31 + inneriter*243);
528 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwNone_GeomW4W4_F_c
529 * Electrostatics interaction: Coulomb
530 * VdW interaction: None
531 * Geometry: Water4-Water4
532 * Calculate force/pot: Force
535 nb_kernel_ElecCoul_VdwNone_GeomW4W4_F_c
536 (t_nblist * gmx_restrict nlist,
537 rvec * gmx_restrict xx,
538 rvec * gmx_restrict ff,
539 t_forcerec * gmx_restrict fr,
540 t_mdatoms * gmx_restrict mdatoms,
541 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
542 t_nrnb * gmx_restrict nrnb)
544 int i_shift_offset,i_coord_offset,j_coord_offset;
545 int j_index_start,j_index_end;
546 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
547 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
548 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
549 real *shiftvec,*fshift,*x,*f;
551 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
553 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
555 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
557 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
559 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
561 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
562 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
563 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
564 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
565 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
566 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
567 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
568 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
569 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
570 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
571 real velec,felec,velecsum,facel,crf,krf,krf2;
579 jindex = nlist->jindex;
581 shiftidx = nlist->shift;
583 shiftvec = fr->shift_vec[0];
584 fshift = fr->fshift[0];
586 charge = mdatoms->chargeA;
588 /* Setup water-specific parameters */
589 inr = nlist->iinr[0];
590 iq1 = facel*charge[inr+1];
591 iq2 = facel*charge[inr+2];
592 iq3 = facel*charge[inr+3];
610 /* Start outer loop over neighborlists */
611 for(iidx=0; iidx<nri; iidx++)
613 /* Load shift vector for this list */
614 i_shift_offset = DIM*shiftidx[iidx];
615 shX = shiftvec[i_shift_offset+XX];
616 shY = shiftvec[i_shift_offset+YY];
617 shZ = shiftvec[i_shift_offset+ZZ];
619 /* Load limits for loop over neighbors */
620 j_index_start = jindex[iidx];
621 j_index_end = jindex[iidx+1];
623 /* Get outer coordinate index */
625 i_coord_offset = DIM*inr;
627 /* Load i particle coords and add shift vector */
628 ix1 = shX + x[i_coord_offset+DIM*1+XX];
629 iy1 = shY + x[i_coord_offset+DIM*1+YY];
630 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
631 ix2 = shX + x[i_coord_offset+DIM*2+XX];
632 iy2 = shY + x[i_coord_offset+DIM*2+YY];
633 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
634 ix3 = shX + x[i_coord_offset+DIM*3+XX];
635 iy3 = shY + x[i_coord_offset+DIM*3+YY];
636 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
648 /* Start inner kernel loop */
649 for(jidx=j_index_start; jidx<j_index_end; jidx++)
651 /* Get j neighbor index, and coordinate index */
653 j_coord_offset = DIM*jnr;
655 /* load j atom coordinates */
656 jx1 = x[j_coord_offset+DIM*1+XX];
657 jy1 = x[j_coord_offset+DIM*1+YY];
658 jz1 = x[j_coord_offset+DIM*1+ZZ];
659 jx2 = x[j_coord_offset+DIM*2+XX];
660 jy2 = x[j_coord_offset+DIM*2+YY];
661 jz2 = x[j_coord_offset+DIM*2+ZZ];
662 jx3 = x[j_coord_offset+DIM*3+XX];
663 jy3 = x[j_coord_offset+DIM*3+YY];
664 jz3 = x[j_coord_offset+DIM*3+ZZ];
666 /* Calculate displacement vector */
695 /* Calculate squared distance and things based on it */
696 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
697 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
698 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
699 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
700 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
701 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
702 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
703 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
704 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
706 rinv11 = gmx_invsqrt(rsq11);
707 rinv12 = gmx_invsqrt(rsq12);
708 rinv13 = gmx_invsqrt(rsq13);
709 rinv21 = gmx_invsqrt(rsq21);
710 rinv22 = gmx_invsqrt(rsq22);
711 rinv23 = gmx_invsqrt(rsq23);
712 rinv31 = gmx_invsqrt(rsq31);
713 rinv32 = gmx_invsqrt(rsq32);
714 rinv33 = gmx_invsqrt(rsq33);
716 rinvsq11 = rinv11*rinv11;
717 rinvsq12 = rinv12*rinv12;
718 rinvsq13 = rinv13*rinv13;
719 rinvsq21 = rinv21*rinv21;
720 rinvsq22 = rinv22*rinv22;
721 rinvsq23 = rinv23*rinv23;
722 rinvsq31 = rinv31*rinv31;
723 rinvsq32 = rinv32*rinv32;
724 rinvsq33 = rinv33*rinv33;
726 /**************************
727 * CALCULATE INTERACTIONS *
728 **************************/
730 /* COULOMB ELECTROSTATICS */
732 felec = velec*rinvsq11;
736 /* Calculate temporary vectorial force */
741 /* Update vectorial force */
745 f[j_coord_offset+DIM*1+XX] -= tx;
746 f[j_coord_offset+DIM*1+YY] -= ty;
747 f[j_coord_offset+DIM*1+ZZ] -= tz;
749 /**************************
750 * CALCULATE INTERACTIONS *
751 **************************/
753 /* COULOMB ELECTROSTATICS */
755 felec = velec*rinvsq12;
759 /* Calculate temporary vectorial force */
764 /* Update vectorial force */
768 f[j_coord_offset+DIM*2+XX] -= tx;
769 f[j_coord_offset+DIM*2+YY] -= ty;
770 f[j_coord_offset+DIM*2+ZZ] -= tz;
772 /**************************
773 * CALCULATE INTERACTIONS *
774 **************************/
776 /* COULOMB ELECTROSTATICS */
778 felec = velec*rinvsq13;
782 /* Calculate temporary vectorial force */
787 /* Update vectorial force */
791 f[j_coord_offset+DIM*3+XX] -= tx;
792 f[j_coord_offset+DIM*3+YY] -= ty;
793 f[j_coord_offset+DIM*3+ZZ] -= tz;
795 /**************************
796 * CALCULATE INTERACTIONS *
797 **************************/
799 /* COULOMB ELECTROSTATICS */
801 felec = velec*rinvsq21;
805 /* Calculate temporary vectorial force */
810 /* Update vectorial force */
814 f[j_coord_offset+DIM*1+XX] -= tx;
815 f[j_coord_offset+DIM*1+YY] -= ty;
816 f[j_coord_offset+DIM*1+ZZ] -= tz;
818 /**************************
819 * CALCULATE INTERACTIONS *
820 **************************/
822 /* COULOMB ELECTROSTATICS */
824 felec = velec*rinvsq22;
828 /* Calculate temporary vectorial force */
833 /* Update vectorial force */
837 f[j_coord_offset+DIM*2+XX] -= tx;
838 f[j_coord_offset+DIM*2+YY] -= ty;
839 f[j_coord_offset+DIM*2+ZZ] -= tz;
841 /**************************
842 * CALCULATE INTERACTIONS *
843 **************************/
845 /* COULOMB ELECTROSTATICS */
847 felec = velec*rinvsq23;
851 /* Calculate temporary vectorial force */
856 /* Update vectorial force */
860 f[j_coord_offset+DIM*3+XX] -= tx;
861 f[j_coord_offset+DIM*3+YY] -= ty;
862 f[j_coord_offset+DIM*3+ZZ] -= tz;
864 /**************************
865 * CALCULATE INTERACTIONS *
866 **************************/
868 /* COULOMB ELECTROSTATICS */
870 felec = velec*rinvsq31;
874 /* Calculate temporary vectorial force */
879 /* Update vectorial force */
883 f[j_coord_offset+DIM*1+XX] -= tx;
884 f[j_coord_offset+DIM*1+YY] -= ty;
885 f[j_coord_offset+DIM*1+ZZ] -= tz;
887 /**************************
888 * CALCULATE INTERACTIONS *
889 **************************/
891 /* COULOMB ELECTROSTATICS */
893 felec = velec*rinvsq32;
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 /* COULOMB ELECTROSTATICS */
916 felec = velec*rinvsq33;
920 /* Calculate temporary vectorial force */
925 /* Update vectorial force */
929 f[j_coord_offset+DIM*3+XX] -= tx;
930 f[j_coord_offset+DIM*3+YY] -= ty;
931 f[j_coord_offset+DIM*3+ZZ] -= tz;
933 /* Inner loop uses 234 flops */
935 /* End of innermost loop */
938 f[i_coord_offset+DIM*1+XX] += fix1;
939 f[i_coord_offset+DIM*1+YY] += fiy1;
940 f[i_coord_offset+DIM*1+ZZ] += fiz1;
944 f[i_coord_offset+DIM*2+XX] += fix2;
945 f[i_coord_offset+DIM*2+YY] += fiy2;
946 f[i_coord_offset+DIM*2+ZZ] += fiz2;
950 f[i_coord_offset+DIM*3+XX] += fix3;
951 f[i_coord_offset+DIM*3+YY] += fiy3;
952 f[i_coord_offset+DIM*3+ZZ] += fiz3;
956 fshift[i_shift_offset+XX] += tx;
957 fshift[i_shift_offset+YY] += ty;
958 fshift[i_shift_offset+ZZ] += tz;
960 /* Increment number of inner iterations */
961 inneriter += j_index_end - j_index_start;
963 /* Outer loop uses 30 flops */
966 /* Increment number of outer iterations */
969 /* Update outer/inner flops */
971 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_F,outeriter*30 + inneriter*234);