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_ElecCoul_VdwNone_GeomW4W4_VF_c
51 * Electrostatics interaction: Coulomb
52 * VdW interaction: None
53 * Geometry: Water4-Water4
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCoul_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;
110 /* Setup water-specific parameters */
111 inr = nlist->iinr[0];
112 iq1 = facel*charge[inr+1];
113 iq2 = facel*charge[inr+2];
114 iq3 = facel*charge[inr+3];
132 /* Start outer loop over neighborlists */
133 for(iidx=0; iidx<nri; iidx++)
135 /* Load shift vector for this list */
136 i_shift_offset = DIM*shiftidx[iidx];
137 shX = shiftvec[i_shift_offset+XX];
138 shY = shiftvec[i_shift_offset+YY];
139 shZ = shiftvec[i_shift_offset+ZZ];
141 /* Load limits for loop over neighbors */
142 j_index_start = jindex[iidx];
143 j_index_end = jindex[iidx+1];
145 /* Get outer coordinate index */
147 i_coord_offset = DIM*inr;
149 /* Load i particle coords and add shift vector */
150 ix1 = shX + x[i_coord_offset+DIM*1+XX];
151 iy1 = shY + x[i_coord_offset+DIM*1+YY];
152 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
153 ix2 = shX + x[i_coord_offset+DIM*2+XX];
154 iy2 = shY + x[i_coord_offset+DIM*2+YY];
155 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
156 ix3 = shX + x[i_coord_offset+DIM*3+XX];
157 iy3 = shY + x[i_coord_offset+DIM*3+YY];
158 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
170 /* Reset potential sums */
173 /* Start inner kernel loop */
174 for(jidx=j_index_start; jidx<j_index_end; jidx++)
176 /* Get j neighbor index, and coordinate index */
178 j_coord_offset = DIM*jnr;
180 /* load j atom coordinates */
181 jx1 = x[j_coord_offset+DIM*1+XX];
182 jy1 = x[j_coord_offset+DIM*1+YY];
183 jz1 = x[j_coord_offset+DIM*1+ZZ];
184 jx2 = x[j_coord_offset+DIM*2+XX];
185 jy2 = x[j_coord_offset+DIM*2+YY];
186 jz2 = x[j_coord_offset+DIM*2+ZZ];
187 jx3 = x[j_coord_offset+DIM*3+XX];
188 jy3 = x[j_coord_offset+DIM*3+YY];
189 jz3 = x[j_coord_offset+DIM*3+ZZ];
191 /* Calculate displacement vector */
220 /* Calculate squared distance and things based on it */
221 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
222 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
223 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
224 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
225 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
226 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
227 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
228 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
229 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
231 rinv11 = gmx_invsqrt(rsq11);
232 rinv12 = gmx_invsqrt(rsq12);
233 rinv13 = gmx_invsqrt(rsq13);
234 rinv21 = gmx_invsqrt(rsq21);
235 rinv22 = gmx_invsqrt(rsq22);
236 rinv23 = gmx_invsqrt(rsq23);
237 rinv31 = gmx_invsqrt(rsq31);
238 rinv32 = gmx_invsqrt(rsq32);
239 rinv33 = gmx_invsqrt(rsq33);
241 rinvsq11 = rinv11*rinv11;
242 rinvsq12 = rinv12*rinv12;
243 rinvsq13 = rinv13*rinv13;
244 rinvsq21 = rinv21*rinv21;
245 rinvsq22 = rinv22*rinv22;
246 rinvsq23 = rinv23*rinv23;
247 rinvsq31 = rinv31*rinv31;
248 rinvsq32 = rinv32*rinv32;
249 rinvsq33 = rinv33*rinv33;
251 /**************************
252 * CALCULATE INTERACTIONS *
253 **************************/
255 /* COULOMB ELECTROSTATICS */
257 felec = velec*rinvsq11;
259 /* Update potential sums from outer loop */
264 /* Calculate temporary vectorial force */
269 /* Update vectorial force */
273 f[j_coord_offset+DIM*1+XX] -= tx;
274 f[j_coord_offset+DIM*1+YY] -= ty;
275 f[j_coord_offset+DIM*1+ZZ] -= tz;
277 /**************************
278 * CALCULATE INTERACTIONS *
279 **************************/
281 /* COULOMB ELECTROSTATICS */
283 felec = velec*rinvsq12;
285 /* Update potential sums from outer loop */
290 /* Calculate temporary vectorial force */
295 /* Update vectorial force */
299 f[j_coord_offset+DIM*2+XX] -= tx;
300 f[j_coord_offset+DIM*2+YY] -= ty;
301 f[j_coord_offset+DIM*2+ZZ] -= tz;
303 /**************************
304 * CALCULATE INTERACTIONS *
305 **************************/
307 /* COULOMB ELECTROSTATICS */
309 felec = velec*rinvsq13;
311 /* Update potential sums from outer loop */
316 /* Calculate temporary vectorial force */
321 /* Update vectorial force */
325 f[j_coord_offset+DIM*3+XX] -= tx;
326 f[j_coord_offset+DIM*3+YY] -= ty;
327 f[j_coord_offset+DIM*3+ZZ] -= tz;
329 /**************************
330 * CALCULATE INTERACTIONS *
331 **************************/
333 /* COULOMB ELECTROSTATICS */
335 felec = velec*rinvsq21;
337 /* Update potential sums from outer loop */
342 /* Calculate temporary vectorial force */
347 /* Update vectorial force */
351 f[j_coord_offset+DIM*1+XX] -= tx;
352 f[j_coord_offset+DIM*1+YY] -= ty;
353 f[j_coord_offset+DIM*1+ZZ] -= tz;
355 /**************************
356 * CALCULATE INTERACTIONS *
357 **************************/
359 /* COULOMB ELECTROSTATICS */
361 felec = velec*rinvsq22;
363 /* Update potential sums from outer loop */
368 /* Calculate temporary vectorial force */
373 /* Update vectorial force */
377 f[j_coord_offset+DIM*2+XX] -= tx;
378 f[j_coord_offset+DIM*2+YY] -= ty;
379 f[j_coord_offset+DIM*2+ZZ] -= tz;
381 /**************************
382 * CALCULATE INTERACTIONS *
383 **************************/
385 /* COULOMB ELECTROSTATICS */
387 felec = velec*rinvsq23;
389 /* Update potential sums from outer loop */
394 /* Calculate temporary vectorial force */
399 /* Update vectorial force */
403 f[j_coord_offset+DIM*3+XX] -= tx;
404 f[j_coord_offset+DIM*3+YY] -= ty;
405 f[j_coord_offset+DIM*3+ZZ] -= tz;
407 /**************************
408 * CALCULATE INTERACTIONS *
409 **************************/
411 /* COULOMB ELECTROSTATICS */
413 felec = velec*rinvsq31;
415 /* Update potential sums from outer loop */
420 /* Calculate temporary vectorial force */
425 /* Update vectorial force */
429 f[j_coord_offset+DIM*1+XX] -= tx;
430 f[j_coord_offset+DIM*1+YY] -= ty;
431 f[j_coord_offset+DIM*1+ZZ] -= tz;
433 /**************************
434 * CALCULATE INTERACTIONS *
435 **************************/
437 /* COULOMB ELECTROSTATICS */
439 felec = velec*rinvsq32;
441 /* Update potential sums from outer loop */
446 /* Calculate temporary vectorial force */
451 /* Update vectorial force */
455 f[j_coord_offset+DIM*2+XX] -= tx;
456 f[j_coord_offset+DIM*2+YY] -= ty;
457 f[j_coord_offset+DIM*2+ZZ] -= tz;
459 /**************************
460 * CALCULATE INTERACTIONS *
461 **************************/
463 /* COULOMB ELECTROSTATICS */
465 felec = velec*rinvsq33;
467 /* Update potential sums from outer loop */
472 /* Calculate temporary vectorial force */
477 /* Update vectorial force */
481 f[j_coord_offset+DIM*3+XX] -= tx;
482 f[j_coord_offset+DIM*3+YY] -= ty;
483 f[j_coord_offset+DIM*3+ZZ] -= tz;
485 /* Inner loop uses 243 flops */
487 /* End of innermost loop */
490 f[i_coord_offset+DIM*1+XX] += fix1;
491 f[i_coord_offset+DIM*1+YY] += fiy1;
492 f[i_coord_offset+DIM*1+ZZ] += fiz1;
496 f[i_coord_offset+DIM*2+XX] += fix2;
497 f[i_coord_offset+DIM*2+YY] += fiy2;
498 f[i_coord_offset+DIM*2+ZZ] += fiz2;
502 f[i_coord_offset+DIM*3+XX] += fix3;
503 f[i_coord_offset+DIM*3+YY] += fiy3;
504 f[i_coord_offset+DIM*3+ZZ] += fiz3;
508 fshift[i_shift_offset+XX] += tx;
509 fshift[i_shift_offset+YY] += ty;
510 fshift[i_shift_offset+ZZ] += tz;
513 /* Update potential energies */
514 kernel_data->energygrp_elec[ggid] += velecsum;
516 /* Increment number of inner iterations */
517 inneriter += j_index_end - j_index_start;
519 /* Outer loop uses 31 flops */
522 /* Increment number of outer iterations */
525 /* Update outer/inner flops */
527 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_VF,outeriter*31 + inneriter*243);
530 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwNone_GeomW4W4_F_c
531 * Electrostatics interaction: Coulomb
532 * VdW interaction: None
533 * Geometry: Water4-Water4
534 * Calculate force/pot: Force
537 nb_kernel_ElecCoul_VdwNone_GeomW4W4_F_c
538 (t_nblist * gmx_restrict nlist,
539 rvec * gmx_restrict xx,
540 rvec * gmx_restrict ff,
541 t_forcerec * gmx_restrict fr,
542 t_mdatoms * gmx_restrict mdatoms,
543 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
544 t_nrnb * gmx_restrict nrnb)
546 int i_shift_offset,i_coord_offset,j_coord_offset;
547 int j_index_start,j_index_end;
548 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
549 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
550 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
551 real *shiftvec,*fshift,*x,*f;
553 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
555 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
557 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
559 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
561 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
563 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
564 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
565 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
566 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
567 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
568 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
569 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
570 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
571 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
572 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
573 real velec,felec,velecsum,facel,crf,krf,krf2;
581 jindex = nlist->jindex;
583 shiftidx = nlist->shift;
585 shiftvec = fr->shift_vec[0];
586 fshift = fr->fshift[0];
588 charge = mdatoms->chargeA;
590 /* Setup water-specific parameters */
591 inr = nlist->iinr[0];
592 iq1 = facel*charge[inr+1];
593 iq2 = facel*charge[inr+2];
594 iq3 = facel*charge[inr+3];
612 /* Start outer loop over neighborlists */
613 for(iidx=0; iidx<nri; iidx++)
615 /* Load shift vector for this list */
616 i_shift_offset = DIM*shiftidx[iidx];
617 shX = shiftvec[i_shift_offset+XX];
618 shY = shiftvec[i_shift_offset+YY];
619 shZ = shiftvec[i_shift_offset+ZZ];
621 /* Load limits for loop over neighbors */
622 j_index_start = jindex[iidx];
623 j_index_end = jindex[iidx+1];
625 /* Get outer coordinate index */
627 i_coord_offset = DIM*inr;
629 /* Load i particle coords and add shift vector */
630 ix1 = shX + x[i_coord_offset+DIM*1+XX];
631 iy1 = shY + x[i_coord_offset+DIM*1+YY];
632 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
633 ix2 = shX + x[i_coord_offset+DIM*2+XX];
634 iy2 = shY + x[i_coord_offset+DIM*2+YY];
635 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
636 ix3 = shX + x[i_coord_offset+DIM*3+XX];
637 iy3 = shY + x[i_coord_offset+DIM*3+YY];
638 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
650 /* Start inner kernel loop */
651 for(jidx=j_index_start; jidx<j_index_end; jidx++)
653 /* Get j neighbor index, and coordinate index */
655 j_coord_offset = DIM*jnr;
657 /* load j atom coordinates */
658 jx1 = x[j_coord_offset+DIM*1+XX];
659 jy1 = x[j_coord_offset+DIM*1+YY];
660 jz1 = x[j_coord_offset+DIM*1+ZZ];
661 jx2 = x[j_coord_offset+DIM*2+XX];
662 jy2 = x[j_coord_offset+DIM*2+YY];
663 jz2 = x[j_coord_offset+DIM*2+ZZ];
664 jx3 = x[j_coord_offset+DIM*3+XX];
665 jy3 = x[j_coord_offset+DIM*3+YY];
666 jz3 = x[j_coord_offset+DIM*3+ZZ];
668 /* Calculate displacement vector */
697 /* Calculate squared distance and things based on it */
698 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
699 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
700 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
701 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
702 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
703 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
704 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
705 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
706 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
708 rinv11 = gmx_invsqrt(rsq11);
709 rinv12 = gmx_invsqrt(rsq12);
710 rinv13 = gmx_invsqrt(rsq13);
711 rinv21 = gmx_invsqrt(rsq21);
712 rinv22 = gmx_invsqrt(rsq22);
713 rinv23 = gmx_invsqrt(rsq23);
714 rinv31 = gmx_invsqrt(rsq31);
715 rinv32 = gmx_invsqrt(rsq32);
716 rinv33 = gmx_invsqrt(rsq33);
718 rinvsq11 = rinv11*rinv11;
719 rinvsq12 = rinv12*rinv12;
720 rinvsq13 = rinv13*rinv13;
721 rinvsq21 = rinv21*rinv21;
722 rinvsq22 = rinv22*rinv22;
723 rinvsq23 = rinv23*rinv23;
724 rinvsq31 = rinv31*rinv31;
725 rinvsq32 = rinv32*rinv32;
726 rinvsq33 = rinv33*rinv33;
728 /**************************
729 * CALCULATE INTERACTIONS *
730 **************************/
732 /* COULOMB ELECTROSTATICS */
734 felec = velec*rinvsq11;
738 /* Calculate temporary vectorial force */
743 /* Update vectorial force */
747 f[j_coord_offset+DIM*1+XX] -= tx;
748 f[j_coord_offset+DIM*1+YY] -= ty;
749 f[j_coord_offset+DIM*1+ZZ] -= tz;
751 /**************************
752 * CALCULATE INTERACTIONS *
753 **************************/
755 /* COULOMB ELECTROSTATICS */
757 felec = velec*rinvsq12;
761 /* Calculate temporary vectorial force */
766 /* Update vectorial force */
770 f[j_coord_offset+DIM*2+XX] -= tx;
771 f[j_coord_offset+DIM*2+YY] -= ty;
772 f[j_coord_offset+DIM*2+ZZ] -= tz;
774 /**************************
775 * CALCULATE INTERACTIONS *
776 **************************/
778 /* COULOMB ELECTROSTATICS */
780 felec = velec*rinvsq13;
784 /* Calculate temporary vectorial force */
789 /* Update vectorial force */
793 f[j_coord_offset+DIM*3+XX] -= tx;
794 f[j_coord_offset+DIM*3+YY] -= ty;
795 f[j_coord_offset+DIM*3+ZZ] -= tz;
797 /**************************
798 * CALCULATE INTERACTIONS *
799 **************************/
801 /* COULOMB ELECTROSTATICS */
803 felec = velec*rinvsq21;
807 /* Calculate temporary vectorial force */
812 /* Update vectorial force */
816 f[j_coord_offset+DIM*1+XX] -= tx;
817 f[j_coord_offset+DIM*1+YY] -= ty;
818 f[j_coord_offset+DIM*1+ZZ] -= tz;
820 /**************************
821 * CALCULATE INTERACTIONS *
822 **************************/
824 /* COULOMB ELECTROSTATICS */
826 felec = velec*rinvsq22;
830 /* Calculate temporary vectorial force */
835 /* Update vectorial force */
839 f[j_coord_offset+DIM*2+XX] -= tx;
840 f[j_coord_offset+DIM*2+YY] -= ty;
841 f[j_coord_offset+DIM*2+ZZ] -= tz;
843 /**************************
844 * CALCULATE INTERACTIONS *
845 **************************/
847 /* COULOMB ELECTROSTATICS */
849 felec = velec*rinvsq23;
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 /* COULOMB ELECTROSTATICS */
872 felec = velec*rinvsq31;
876 /* Calculate temporary vectorial force */
881 /* Update vectorial force */
885 f[j_coord_offset+DIM*1+XX] -= tx;
886 f[j_coord_offset+DIM*1+YY] -= ty;
887 f[j_coord_offset+DIM*1+ZZ] -= tz;
889 /**************************
890 * CALCULATE INTERACTIONS *
891 **************************/
893 /* COULOMB ELECTROSTATICS */
895 felec = velec*rinvsq32;
899 /* Calculate temporary vectorial force */
904 /* Update vectorial force */
908 f[j_coord_offset+DIM*2+XX] -= tx;
909 f[j_coord_offset+DIM*2+YY] -= ty;
910 f[j_coord_offset+DIM*2+ZZ] -= tz;
912 /**************************
913 * CALCULATE INTERACTIONS *
914 **************************/
916 /* COULOMB ELECTROSTATICS */
918 felec = velec*rinvsq33;
922 /* Calculate temporary vectorial force */
927 /* Update vectorial force */
931 f[j_coord_offset+DIM*3+XX] -= tx;
932 f[j_coord_offset+DIM*3+YY] -= ty;
933 f[j_coord_offset+DIM*3+ZZ] -= tz;
935 /* Inner loop uses 234 flops */
937 /* End of innermost loop */
940 f[i_coord_offset+DIM*1+XX] += fix1;
941 f[i_coord_offset+DIM*1+YY] += fiy1;
942 f[i_coord_offset+DIM*1+ZZ] += fiz1;
946 f[i_coord_offset+DIM*2+XX] += fix2;
947 f[i_coord_offset+DIM*2+YY] += fiy2;
948 f[i_coord_offset+DIM*2+ZZ] += fiz2;
952 f[i_coord_offset+DIM*3+XX] += fix3;
953 f[i_coord_offset+DIM*3+YY] += fiy3;
954 f[i_coord_offset+DIM*3+ZZ] += fiz3;
958 fshift[i_shift_offset+XX] += tx;
959 fshift[i_shift_offset+YY] += ty;
960 fshift[i_shift_offset+ZZ] += tz;
962 /* Increment number of inner iterations */
963 inneriter += j_index_end - j_index_start;
965 /* Outer loop uses 30 flops */
968 /* Increment number of outer iterations */
971 /* Update outer/inner flops */
973 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_F,outeriter*30 + inneriter*234);