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_ElecRFCut_VdwNone_GeomW4W4_VF_c
49 * Electrostatics interaction: ReactionField
50 * VdW interaction: None
51 * Geometry: Water4-Water4
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecRFCut_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;
111 /* Setup water-specific parameters */
112 inr = nlist->iinr[0];
113 iq1 = facel*charge[inr+1];
114 iq2 = facel*charge[inr+2];
115 iq3 = facel*charge[inr+3];
130 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
131 rcutoff = fr->rcoulomb;
132 rcutoff2 = rcutoff*rcutoff;
137 /* Start outer loop over neighborlists */
138 for(iidx=0; iidx<nri; iidx++)
140 /* Load shift vector for this list */
141 i_shift_offset = DIM*shiftidx[iidx];
142 shX = shiftvec[i_shift_offset+XX];
143 shY = shiftvec[i_shift_offset+YY];
144 shZ = shiftvec[i_shift_offset+ZZ];
146 /* Load limits for loop over neighbors */
147 j_index_start = jindex[iidx];
148 j_index_end = jindex[iidx+1];
150 /* Get outer coordinate index */
152 i_coord_offset = DIM*inr;
154 /* Load i particle coords and add shift vector */
155 ix1 = shX + x[i_coord_offset+DIM*1+XX];
156 iy1 = shY + x[i_coord_offset+DIM*1+YY];
157 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
158 ix2 = shX + x[i_coord_offset+DIM*2+XX];
159 iy2 = shY + x[i_coord_offset+DIM*2+YY];
160 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
161 ix3 = shX + x[i_coord_offset+DIM*3+XX];
162 iy3 = shY + x[i_coord_offset+DIM*3+YY];
163 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
175 /* Reset potential sums */
178 /* Start inner kernel loop */
179 for(jidx=j_index_start; jidx<j_index_end; jidx++)
181 /* Get j neighbor index, and coordinate index */
183 j_coord_offset = DIM*jnr;
185 /* load j atom coordinates */
186 jx1 = x[j_coord_offset+DIM*1+XX];
187 jy1 = x[j_coord_offset+DIM*1+YY];
188 jz1 = x[j_coord_offset+DIM*1+ZZ];
189 jx2 = x[j_coord_offset+DIM*2+XX];
190 jy2 = x[j_coord_offset+DIM*2+YY];
191 jz2 = x[j_coord_offset+DIM*2+ZZ];
192 jx3 = x[j_coord_offset+DIM*3+XX];
193 jy3 = x[j_coord_offset+DIM*3+YY];
194 jz3 = x[j_coord_offset+DIM*3+ZZ];
196 /* Calculate displacement vector */
225 /* Calculate squared distance and things based on it */
226 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
227 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
228 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
229 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
230 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
231 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
232 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
233 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
234 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
236 rinv11 = gmx_invsqrt(rsq11);
237 rinv12 = gmx_invsqrt(rsq12);
238 rinv13 = gmx_invsqrt(rsq13);
239 rinv21 = gmx_invsqrt(rsq21);
240 rinv22 = gmx_invsqrt(rsq22);
241 rinv23 = gmx_invsqrt(rsq23);
242 rinv31 = gmx_invsqrt(rsq31);
243 rinv32 = gmx_invsqrt(rsq32);
244 rinv33 = gmx_invsqrt(rsq33);
246 rinvsq11 = rinv11*rinv11;
247 rinvsq12 = rinv12*rinv12;
248 rinvsq13 = rinv13*rinv13;
249 rinvsq21 = rinv21*rinv21;
250 rinvsq22 = rinv22*rinv22;
251 rinvsq23 = rinv23*rinv23;
252 rinvsq31 = rinv31*rinv31;
253 rinvsq32 = rinv32*rinv32;
254 rinvsq33 = rinv33*rinv33;
256 /**************************
257 * CALCULATE INTERACTIONS *
258 **************************/
263 /* REACTION-FIELD ELECTROSTATICS */
264 velec = qq11*(rinv11+krf*rsq11-crf);
265 felec = qq11*(rinv11*rinvsq11-krf2);
267 /* Update potential sums from outer loop */
272 /* Calculate temporary vectorial force */
277 /* Update vectorial force */
281 f[j_coord_offset+DIM*1+XX] -= tx;
282 f[j_coord_offset+DIM*1+YY] -= ty;
283 f[j_coord_offset+DIM*1+ZZ] -= tz;
287 /**************************
288 * CALCULATE INTERACTIONS *
289 **************************/
294 /* REACTION-FIELD ELECTROSTATICS */
295 velec = qq12*(rinv12+krf*rsq12-crf);
296 felec = qq12*(rinv12*rinvsq12-krf2);
298 /* Update potential sums from outer loop */
303 /* Calculate temporary vectorial force */
308 /* Update vectorial force */
312 f[j_coord_offset+DIM*2+XX] -= tx;
313 f[j_coord_offset+DIM*2+YY] -= ty;
314 f[j_coord_offset+DIM*2+ZZ] -= tz;
318 /**************************
319 * CALCULATE INTERACTIONS *
320 **************************/
325 /* REACTION-FIELD ELECTROSTATICS */
326 velec = qq13*(rinv13+krf*rsq13-crf);
327 felec = qq13*(rinv13*rinvsq13-krf2);
329 /* Update potential sums from outer loop */
334 /* Calculate temporary vectorial force */
339 /* Update vectorial force */
343 f[j_coord_offset+DIM*3+XX] -= tx;
344 f[j_coord_offset+DIM*3+YY] -= ty;
345 f[j_coord_offset+DIM*3+ZZ] -= tz;
349 /**************************
350 * CALCULATE INTERACTIONS *
351 **************************/
356 /* REACTION-FIELD ELECTROSTATICS */
357 velec = qq21*(rinv21+krf*rsq21-crf);
358 felec = qq21*(rinv21*rinvsq21-krf2);
360 /* Update potential sums from outer loop */
365 /* Calculate temporary vectorial force */
370 /* Update vectorial force */
374 f[j_coord_offset+DIM*1+XX] -= tx;
375 f[j_coord_offset+DIM*1+YY] -= ty;
376 f[j_coord_offset+DIM*1+ZZ] -= tz;
380 /**************************
381 * CALCULATE INTERACTIONS *
382 **************************/
387 /* REACTION-FIELD ELECTROSTATICS */
388 velec = qq22*(rinv22+krf*rsq22-crf);
389 felec = qq22*(rinv22*rinvsq22-krf2);
391 /* Update potential sums from outer loop */
396 /* Calculate temporary vectorial force */
401 /* Update vectorial force */
405 f[j_coord_offset+DIM*2+XX] -= tx;
406 f[j_coord_offset+DIM*2+YY] -= ty;
407 f[j_coord_offset+DIM*2+ZZ] -= tz;
411 /**************************
412 * CALCULATE INTERACTIONS *
413 **************************/
418 /* REACTION-FIELD ELECTROSTATICS */
419 velec = qq23*(rinv23+krf*rsq23-crf);
420 felec = qq23*(rinv23*rinvsq23-krf2);
422 /* Update potential sums from outer loop */
427 /* Calculate temporary vectorial force */
432 /* Update vectorial force */
436 f[j_coord_offset+DIM*3+XX] -= tx;
437 f[j_coord_offset+DIM*3+YY] -= ty;
438 f[j_coord_offset+DIM*3+ZZ] -= tz;
442 /**************************
443 * CALCULATE INTERACTIONS *
444 **************************/
449 /* REACTION-FIELD ELECTROSTATICS */
450 velec = qq31*(rinv31+krf*rsq31-crf);
451 felec = qq31*(rinv31*rinvsq31-krf2);
453 /* Update potential sums from outer loop */
458 /* Calculate temporary vectorial force */
463 /* Update vectorial force */
467 f[j_coord_offset+DIM*1+XX] -= tx;
468 f[j_coord_offset+DIM*1+YY] -= ty;
469 f[j_coord_offset+DIM*1+ZZ] -= tz;
473 /**************************
474 * CALCULATE INTERACTIONS *
475 **************************/
480 /* REACTION-FIELD ELECTROSTATICS */
481 velec = qq32*(rinv32+krf*rsq32-crf);
482 felec = qq32*(rinv32*rinvsq32-krf2);
484 /* Update potential sums from outer loop */
489 /* Calculate temporary vectorial force */
494 /* Update vectorial force */
498 f[j_coord_offset+DIM*2+XX] -= tx;
499 f[j_coord_offset+DIM*2+YY] -= ty;
500 f[j_coord_offset+DIM*2+ZZ] -= tz;
504 /**************************
505 * CALCULATE INTERACTIONS *
506 **************************/
511 /* REACTION-FIELD ELECTROSTATICS */
512 velec = qq33*(rinv33+krf*rsq33-crf);
513 felec = qq33*(rinv33*rinvsq33-krf2);
515 /* Update potential sums from outer loop */
520 /* Calculate temporary vectorial force */
525 /* Update vectorial force */
529 f[j_coord_offset+DIM*3+XX] -= tx;
530 f[j_coord_offset+DIM*3+YY] -= ty;
531 f[j_coord_offset+DIM*3+ZZ] -= tz;
535 /* Inner loop uses 279 flops */
537 /* End of innermost loop */
540 f[i_coord_offset+DIM*1+XX] += fix1;
541 f[i_coord_offset+DIM*1+YY] += fiy1;
542 f[i_coord_offset+DIM*1+ZZ] += fiz1;
546 f[i_coord_offset+DIM*2+XX] += fix2;
547 f[i_coord_offset+DIM*2+YY] += fiy2;
548 f[i_coord_offset+DIM*2+ZZ] += fiz2;
552 f[i_coord_offset+DIM*3+XX] += fix3;
553 f[i_coord_offset+DIM*3+YY] += fiy3;
554 f[i_coord_offset+DIM*3+ZZ] += fiz3;
558 fshift[i_shift_offset+XX] += tx;
559 fshift[i_shift_offset+YY] += ty;
560 fshift[i_shift_offset+ZZ] += tz;
563 /* Update potential energies */
564 kernel_data->energygrp_elec[ggid] += velecsum;
566 /* Increment number of inner iterations */
567 inneriter += j_index_end - j_index_start;
569 /* Outer loop uses 31 flops */
572 /* Increment number of outer iterations */
575 /* Update outer/inner flops */
577 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_VF,outeriter*31 + inneriter*279);
580 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomW4W4_F_c
581 * Electrostatics interaction: ReactionField
582 * VdW interaction: None
583 * Geometry: Water4-Water4
584 * Calculate force/pot: Force
587 nb_kernel_ElecRFCut_VdwNone_GeomW4W4_F_c
588 (t_nblist * gmx_restrict nlist,
589 rvec * gmx_restrict xx,
590 rvec * gmx_restrict ff,
591 t_forcerec * gmx_restrict fr,
592 t_mdatoms * gmx_restrict mdatoms,
593 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
594 t_nrnb * gmx_restrict nrnb)
596 int i_shift_offset,i_coord_offset,j_coord_offset;
597 int j_index_start,j_index_end;
598 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
599 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
600 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
601 real *shiftvec,*fshift,*x,*f;
603 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
605 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
607 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
609 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
611 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
613 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
614 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
615 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
616 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
617 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
618 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
619 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
620 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
621 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
622 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
623 real velec,felec,velecsum,facel,crf,krf,krf2;
631 jindex = nlist->jindex;
633 shiftidx = nlist->shift;
635 shiftvec = fr->shift_vec[0];
636 fshift = fr->fshift[0];
638 charge = mdatoms->chargeA;
643 /* Setup water-specific parameters */
644 inr = nlist->iinr[0];
645 iq1 = facel*charge[inr+1];
646 iq2 = facel*charge[inr+2];
647 iq3 = facel*charge[inr+3];
662 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
663 rcutoff = fr->rcoulomb;
664 rcutoff2 = rcutoff*rcutoff;
669 /* Start outer loop over neighborlists */
670 for(iidx=0; iidx<nri; iidx++)
672 /* Load shift vector for this list */
673 i_shift_offset = DIM*shiftidx[iidx];
674 shX = shiftvec[i_shift_offset+XX];
675 shY = shiftvec[i_shift_offset+YY];
676 shZ = shiftvec[i_shift_offset+ZZ];
678 /* Load limits for loop over neighbors */
679 j_index_start = jindex[iidx];
680 j_index_end = jindex[iidx+1];
682 /* Get outer coordinate index */
684 i_coord_offset = DIM*inr;
686 /* Load i particle coords and add shift vector */
687 ix1 = shX + x[i_coord_offset+DIM*1+XX];
688 iy1 = shY + x[i_coord_offset+DIM*1+YY];
689 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
690 ix2 = shX + x[i_coord_offset+DIM*2+XX];
691 iy2 = shY + x[i_coord_offset+DIM*2+YY];
692 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
693 ix3 = shX + x[i_coord_offset+DIM*3+XX];
694 iy3 = shY + x[i_coord_offset+DIM*3+YY];
695 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
707 /* Start inner kernel loop */
708 for(jidx=j_index_start; jidx<j_index_end; jidx++)
710 /* Get j neighbor index, and coordinate index */
712 j_coord_offset = DIM*jnr;
714 /* load j atom coordinates */
715 jx1 = x[j_coord_offset+DIM*1+XX];
716 jy1 = x[j_coord_offset+DIM*1+YY];
717 jz1 = x[j_coord_offset+DIM*1+ZZ];
718 jx2 = x[j_coord_offset+DIM*2+XX];
719 jy2 = x[j_coord_offset+DIM*2+YY];
720 jz2 = x[j_coord_offset+DIM*2+ZZ];
721 jx3 = x[j_coord_offset+DIM*3+XX];
722 jy3 = x[j_coord_offset+DIM*3+YY];
723 jz3 = x[j_coord_offset+DIM*3+ZZ];
725 /* Calculate displacement vector */
754 /* Calculate squared distance and things based on it */
755 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
756 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
757 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
758 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
759 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
760 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
761 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
762 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
763 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
765 rinv11 = gmx_invsqrt(rsq11);
766 rinv12 = gmx_invsqrt(rsq12);
767 rinv13 = gmx_invsqrt(rsq13);
768 rinv21 = gmx_invsqrt(rsq21);
769 rinv22 = gmx_invsqrt(rsq22);
770 rinv23 = gmx_invsqrt(rsq23);
771 rinv31 = gmx_invsqrt(rsq31);
772 rinv32 = gmx_invsqrt(rsq32);
773 rinv33 = gmx_invsqrt(rsq33);
775 rinvsq11 = rinv11*rinv11;
776 rinvsq12 = rinv12*rinv12;
777 rinvsq13 = rinv13*rinv13;
778 rinvsq21 = rinv21*rinv21;
779 rinvsq22 = rinv22*rinv22;
780 rinvsq23 = rinv23*rinv23;
781 rinvsq31 = rinv31*rinv31;
782 rinvsq32 = rinv32*rinv32;
783 rinvsq33 = rinv33*rinv33;
785 /**************************
786 * CALCULATE INTERACTIONS *
787 **************************/
792 /* REACTION-FIELD ELECTROSTATICS */
793 felec = qq11*(rinv11*rinvsq11-krf2);
797 /* Calculate temporary vectorial force */
802 /* Update vectorial force */
806 f[j_coord_offset+DIM*1+XX] -= tx;
807 f[j_coord_offset+DIM*1+YY] -= ty;
808 f[j_coord_offset+DIM*1+ZZ] -= tz;
812 /**************************
813 * CALCULATE INTERACTIONS *
814 **************************/
819 /* REACTION-FIELD ELECTROSTATICS */
820 felec = qq12*(rinv12*rinvsq12-krf2);
824 /* Calculate temporary vectorial force */
829 /* Update vectorial force */
833 f[j_coord_offset+DIM*2+XX] -= tx;
834 f[j_coord_offset+DIM*2+YY] -= ty;
835 f[j_coord_offset+DIM*2+ZZ] -= tz;
839 /**************************
840 * CALCULATE INTERACTIONS *
841 **************************/
846 /* REACTION-FIELD ELECTROSTATICS */
847 felec = qq13*(rinv13*rinvsq13-krf2);
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;
866 /**************************
867 * CALCULATE INTERACTIONS *
868 **************************/
873 /* REACTION-FIELD ELECTROSTATICS */
874 felec = qq21*(rinv21*rinvsq21-krf2);
878 /* Calculate temporary vectorial force */
883 /* Update vectorial force */
887 f[j_coord_offset+DIM*1+XX] -= tx;
888 f[j_coord_offset+DIM*1+YY] -= ty;
889 f[j_coord_offset+DIM*1+ZZ] -= tz;
893 /**************************
894 * CALCULATE INTERACTIONS *
895 **************************/
900 /* REACTION-FIELD ELECTROSTATICS */
901 felec = qq22*(rinv22*rinvsq22-krf2);
905 /* Calculate temporary vectorial force */
910 /* Update vectorial force */
914 f[j_coord_offset+DIM*2+XX] -= tx;
915 f[j_coord_offset+DIM*2+YY] -= ty;
916 f[j_coord_offset+DIM*2+ZZ] -= tz;
920 /**************************
921 * CALCULATE INTERACTIONS *
922 **************************/
927 /* REACTION-FIELD ELECTROSTATICS */
928 felec = qq23*(rinv23*rinvsq23-krf2);
932 /* Calculate temporary vectorial force */
937 /* Update vectorial force */
941 f[j_coord_offset+DIM*3+XX] -= tx;
942 f[j_coord_offset+DIM*3+YY] -= ty;
943 f[j_coord_offset+DIM*3+ZZ] -= tz;
947 /**************************
948 * CALCULATE INTERACTIONS *
949 **************************/
954 /* REACTION-FIELD ELECTROSTATICS */
955 felec = qq31*(rinv31*rinvsq31-krf2);
959 /* Calculate temporary vectorial force */
964 /* Update vectorial force */
968 f[j_coord_offset+DIM*1+XX] -= tx;
969 f[j_coord_offset+DIM*1+YY] -= ty;
970 f[j_coord_offset+DIM*1+ZZ] -= tz;
974 /**************************
975 * CALCULATE INTERACTIONS *
976 **************************/
981 /* REACTION-FIELD ELECTROSTATICS */
982 felec = qq32*(rinv32*rinvsq32-krf2);
986 /* Calculate temporary vectorial force */
991 /* Update vectorial force */
995 f[j_coord_offset+DIM*2+XX] -= tx;
996 f[j_coord_offset+DIM*2+YY] -= ty;
997 f[j_coord_offset+DIM*2+ZZ] -= tz;
1001 /**************************
1002 * CALCULATE INTERACTIONS *
1003 **************************/
1008 /* REACTION-FIELD ELECTROSTATICS */
1009 felec = qq33*(rinv33*rinvsq33-krf2);
1013 /* Calculate temporary vectorial force */
1018 /* Update vectorial force */
1022 f[j_coord_offset+DIM*3+XX] -= tx;
1023 f[j_coord_offset+DIM*3+YY] -= ty;
1024 f[j_coord_offset+DIM*3+ZZ] -= tz;
1028 /* Inner loop uses 234 flops */
1030 /* End of innermost loop */
1033 f[i_coord_offset+DIM*1+XX] += fix1;
1034 f[i_coord_offset+DIM*1+YY] += fiy1;
1035 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1039 f[i_coord_offset+DIM*2+XX] += fix2;
1040 f[i_coord_offset+DIM*2+YY] += fiy2;
1041 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1045 f[i_coord_offset+DIM*3+XX] += fix3;
1046 f[i_coord_offset+DIM*3+YY] += fiy3;
1047 f[i_coord_offset+DIM*3+ZZ] += fiz3;
1051 fshift[i_shift_offset+XX] += tx;
1052 fshift[i_shift_offset+YY] += ty;
1053 fshift[i_shift_offset+ZZ] += tz;
1055 /* Increment number of inner iterations */
1056 inneriter += j_index_end - j_index_start;
1058 /* Outer loop uses 30 flops */
1061 /* Increment number of outer iterations */
1064 /* Update outer/inner flops */
1066 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4W4_F,outeriter*30 + inneriter*234);