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_GeomW3W3_VF_c
49 * Electrostatics interaction: ReactionField
50 * VdW interaction: None
51 * Geometry: Water3-Water3
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecRFCut_VdwNone_GeomW3W3_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 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
73 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
75 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
77 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
79 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
81 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
82 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
83 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
84 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
85 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
86 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
87 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
88 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
89 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
90 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
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 iq0 = facel*charge[inr+0];
114 iq1 = facel*charge[inr+1];
115 iq2 = facel*charge[inr+2];
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 ix0 = shX + x[i_coord_offset+DIM*0+XX];
156 iy0 = shY + x[i_coord_offset+DIM*0+YY];
157 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
158 ix1 = shX + x[i_coord_offset+DIM*1+XX];
159 iy1 = shY + x[i_coord_offset+DIM*1+YY];
160 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
161 ix2 = shX + x[i_coord_offset+DIM*2+XX];
162 iy2 = shY + x[i_coord_offset+DIM*2+YY];
163 iz2 = shZ + x[i_coord_offset+DIM*2+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 jx0 = x[j_coord_offset+DIM*0+XX];
187 jy0 = x[j_coord_offset+DIM*0+YY];
188 jz0 = x[j_coord_offset+DIM*0+ZZ];
189 jx1 = x[j_coord_offset+DIM*1+XX];
190 jy1 = x[j_coord_offset+DIM*1+YY];
191 jz1 = x[j_coord_offset+DIM*1+ZZ];
192 jx2 = x[j_coord_offset+DIM*2+XX];
193 jy2 = x[j_coord_offset+DIM*2+YY];
194 jz2 = x[j_coord_offset+DIM*2+ZZ];
196 /* Calculate displacement vector */
225 /* Calculate squared distance and things based on it */
226 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
227 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
228 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
229 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
230 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
231 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
232 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
233 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
234 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
236 rinv00 = gmx_invsqrt(rsq00);
237 rinv01 = gmx_invsqrt(rsq01);
238 rinv02 = gmx_invsqrt(rsq02);
239 rinv10 = gmx_invsqrt(rsq10);
240 rinv11 = gmx_invsqrt(rsq11);
241 rinv12 = gmx_invsqrt(rsq12);
242 rinv20 = gmx_invsqrt(rsq20);
243 rinv21 = gmx_invsqrt(rsq21);
244 rinv22 = gmx_invsqrt(rsq22);
246 rinvsq00 = rinv00*rinv00;
247 rinvsq01 = rinv01*rinv01;
248 rinvsq02 = rinv02*rinv02;
249 rinvsq10 = rinv10*rinv10;
250 rinvsq11 = rinv11*rinv11;
251 rinvsq12 = rinv12*rinv12;
252 rinvsq20 = rinv20*rinv20;
253 rinvsq21 = rinv21*rinv21;
254 rinvsq22 = rinv22*rinv22;
256 /**************************
257 * CALCULATE INTERACTIONS *
258 **************************/
263 /* REACTION-FIELD ELECTROSTATICS */
264 velec = qq00*(rinv00+krf*rsq00-crf);
265 felec = qq00*(rinv00*rinvsq00-krf2);
267 /* Update potential sums from outer loop */
272 /* Calculate temporary vectorial force */
277 /* Update vectorial force */
281 f[j_coord_offset+DIM*0+XX] -= tx;
282 f[j_coord_offset+DIM*0+YY] -= ty;
283 f[j_coord_offset+DIM*0+ZZ] -= tz;
287 /**************************
288 * CALCULATE INTERACTIONS *
289 **************************/
294 /* REACTION-FIELD ELECTROSTATICS */
295 velec = qq01*(rinv01+krf*rsq01-crf);
296 felec = qq01*(rinv01*rinvsq01-krf2);
298 /* Update potential sums from outer loop */
303 /* Calculate temporary vectorial force */
308 /* Update vectorial force */
312 f[j_coord_offset+DIM*1+XX] -= tx;
313 f[j_coord_offset+DIM*1+YY] -= ty;
314 f[j_coord_offset+DIM*1+ZZ] -= tz;
318 /**************************
319 * CALCULATE INTERACTIONS *
320 **************************/
325 /* REACTION-FIELD ELECTROSTATICS */
326 velec = qq02*(rinv02+krf*rsq02-crf);
327 felec = qq02*(rinv02*rinvsq02-krf2);
329 /* Update potential sums from outer loop */
334 /* Calculate temporary vectorial force */
339 /* Update vectorial force */
343 f[j_coord_offset+DIM*2+XX] -= tx;
344 f[j_coord_offset+DIM*2+YY] -= ty;
345 f[j_coord_offset+DIM*2+ZZ] -= tz;
349 /**************************
350 * CALCULATE INTERACTIONS *
351 **************************/
356 /* REACTION-FIELD ELECTROSTATICS */
357 velec = qq10*(rinv10+krf*rsq10-crf);
358 felec = qq10*(rinv10*rinvsq10-krf2);
360 /* Update potential sums from outer loop */
365 /* Calculate temporary vectorial force */
370 /* Update vectorial force */
374 f[j_coord_offset+DIM*0+XX] -= tx;
375 f[j_coord_offset+DIM*0+YY] -= ty;
376 f[j_coord_offset+DIM*0+ZZ] -= tz;
380 /**************************
381 * CALCULATE INTERACTIONS *
382 **************************/
387 /* REACTION-FIELD ELECTROSTATICS */
388 velec = qq11*(rinv11+krf*rsq11-crf);
389 felec = qq11*(rinv11*rinvsq11-krf2);
391 /* Update potential sums from outer loop */
396 /* Calculate temporary vectorial force */
401 /* Update vectorial force */
405 f[j_coord_offset+DIM*1+XX] -= tx;
406 f[j_coord_offset+DIM*1+YY] -= ty;
407 f[j_coord_offset+DIM*1+ZZ] -= tz;
411 /**************************
412 * CALCULATE INTERACTIONS *
413 **************************/
418 /* REACTION-FIELD ELECTROSTATICS */
419 velec = qq12*(rinv12+krf*rsq12-crf);
420 felec = qq12*(rinv12*rinvsq12-krf2);
422 /* Update potential sums from outer loop */
427 /* Calculate temporary vectorial force */
432 /* Update vectorial force */
436 f[j_coord_offset+DIM*2+XX] -= tx;
437 f[j_coord_offset+DIM*2+YY] -= ty;
438 f[j_coord_offset+DIM*2+ZZ] -= tz;
442 /**************************
443 * CALCULATE INTERACTIONS *
444 **************************/
449 /* REACTION-FIELD ELECTROSTATICS */
450 velec = qq20*(rinv20+krf*rsq20-crf);
451 felec = qq20*(rinv20*rinvsq20-krf2);
453 /* Update potential sums from outer loop */
458 /* Calculate temporary vectorial force */
463 /* Update vectorial force */
467 f[j_coord_offset+DIM*0+XX] -= tx;
468 f[j_coord_offset+DIM*0+YY] -= ty;
469 f[j_coord_offset+DIM*0+ZZ] -= tz;
473 /**************************
474 * CALCULATE INTERACTIONS *
475 **************************/
480 /* REACTION-FIELD ELECTROSTATICS */
481 velec = qq21*(rinv21+krf*rsq21-crf);
482 felec = qq21*(rinv21*rinvsq21-krf2);
484 /* Update potential sums from outer loop */
489 /* Calculate temporary vectorial force */
494 /* Update vectorial force */
498 f[j_coord_offset+DIM*1+XX] -= tx;
499 f[j_coord_offset+DIM*1+YY] -= ty;
500 f[j_coord_offset+DIM*1+ZZ] -= tz;
504 /**************************
505 * CALCULATE INTERACTIONS *
506 **************************/
511 /* REACTION-FIELD ELECTROSTATICS */
512 velec = qq22*(rinv22+krf*rsq22-crf);
513 felec = qq22*(rinv22*rinvsq22-krf2);
515 /* Update potential sums from outer loop */
520 /* Calculate temporary vectorial force */
525 /* Update vectorial force */
529 f[j_coord_offset+DIM*2+XX] -= tx;
530 f[j_coord_offset+DIM*2+YY] -= ty;
531 f[j_coord_offset+DIM*2+ZZ] -= tz;
535 /* Inner loop uses 279 flops */
537 /* End of innermost loop */
540 f[i_coord_offset+DIM*0+XX] += fix0;
541 f[i_coord_offset+DIM*0+YY] += fiy0;
542 f[i_coord_offset+DIM*0+ZZ] += fiz0;
546 f[i_coord_offset+DIM*1+XX] += fix1;
547 f[i_coord_offset+DIM*1+YY] += fiy1;
548 f[i_coord_offset+DIM*1+ZZ] += fiz1;
552 f[i_coord_offset+DIM*2+XX] += fix2;
553 f[i_coord_offset+DIM*2+YY] += fiy2;
554 f[i_coord_offset+DIM*2+ZZ] += fiz2;
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_W3W3_VF,outeriter*31 + inneriter*279);
580 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomW3W3_F_c
581 * Electrostatics interaction: ReactionField
582 * VdW interaction: None
583 * Geometry: Water3-Water3
584 * Calculate force/pot: Force
587 nb_kernel_ElecRFCut_VdwNone_GeomW3W3_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 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
605 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
607 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
609 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
611 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
613 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
614 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
615 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
616 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
617 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
618 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
619 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
620 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
621 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
622 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
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 iq0 = facel*charge[inr+0];
646 iq1 = facel*charge[inr+1];
647 iq2 = facel*charge[inr+2];
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 ix0 = shX + x[i_coord_offset+DIM*0+XX];
688 iy0 = shY + x[i_coord_offset+DIM*0+YY];
689 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
690 ix1 = shX + x[i_coord_offset+DIM*1+XX];
691 iy1 = shY + x[i_coord_offset+DIM*1+YY];
692 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
693 ix2 = shX + x[i_coord_offset+DIM*2+XX];
694 iy2 = shY + x[i_coord_offset+DIM*2+YY];
695 iz2 = shZ + x[i_coord_offset+DIM*2+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 jx0 = x[j_coord_offset+DIM*0+XX];
716 jy0 = x[j_coord_offset+DIM*0+YY];
717 jz0 = x[j_coord_offset+DIM*0+ZZ];
718 jx1 = x[j_coord_offset+DIM*1+XX];
719 jy1 = x[j_coord_offset+DIM*1+YY];
720 jz1 = x[j_coord_offset+DIM*1+ZZ];
721 jx2 = x[j_coord_offset+DIM*2+XX];
722 jy2 = x[j_coord_offset+DIM*2+YY];
723 jz2 = x[j_coord_offset+DIM*2+ZZ];
725 /* Calculate displacement vector */
754 /* Calculate squared distance and things based on it */
755 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
756 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
757 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
758 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
759 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
760 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
761 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
762 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
763 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
765 rinv00 = gmx_invsqrt(rsq00);
766 rinv01 = gmx_invsqrt(rsq01);
767 rinv02 = gmx_invsqrt(rsq02);
768 rinv10 = gmx_invsqrt(rsq10);
769 rinv11 = gmx_invsqrt(rsq11);
770 rinv12 = gmx_invsqrt(rsq12);
771 rinv20 = gmx_invsqrt(rsq20);
772 rinv21 = gmx_invsqrt(rsq21);
773 rinv22 = gmx_invsqrt(rsq22);
775 rinvsq00 = rinv00*rinv00;
776 rinvsq01 = rinv01*rinv01;
777 rinvsq02 = rinv02*rinv02;
778 rinvsq10 = rinv10*rinv10;
779 rinvsq11 = rinv11*rinv11;
780 rinvsq12 = rinv12*rinv12;
781 rinvsq20 = rinv20*rinv20;
782 rinvsq21 = rinv21*rinv21;
783 rinvsq22 = rinv22*rinv22;
785 /**************************
786 * CALCULATE INTERACTIONS *
787 **************************/
792 /* REACTION-FIELD ELECTROSTATICS */
793 felec = qq00*(rinv00*rinvsq00-krf2);
797 /* Calculate temporary vectorial force */
802 /* Update vectorial force */
806 f[j_coord_offset+DIM*0+XX] -= tx;
807 f[j_coord_offset+DIM*0+YY] -= ty;
808 f[j_coord_offset+DIM*0+ZZ] -= tz;
812 /**************************
813 * CALCULATE INTERACTIONS *
814 **************************/
819 /* REACTION-FIELD ELECTROSTATICS */
820 felec = qq01*(rinv01*rinvsq01-krf2);
824 /* Calculate temporary vectorial force */
829 /* Update vectorial force */
833 f[j_coord_offset+DIM*1+XX] -= tx;
834 f[j_coord_offset+DIM*1+YY] -= ty;
835 f[j_coord_offset+DIM*1+ZZ] -= tz;
839 /**************************
840 * CALCULATE INTERACTIONS *
841 **************************/
846 /* REACTION-FIELD ELECTROSTATICS */
847 felec = qq02*(rinv02*rinvsq02-krf2);
851 /* Calculate temporary vectorial force */
856 /* Update vectorial force */
860 f[j_coord_offset+DIM*2+XX] -= tx;
861 f[j_coord_offset+DIM*2+YY] -= ty;
862 f[j_coord_offset+DIM*2+ZZ] -= tz;
866 /**************************
867 * CALCULATE INTERACTIONS *
868 **************************/
873 /* REACTION-FIELD ELECTROSTATICS */
874 felec = qq10*(rinv10*rinvsq10-krf2);
878 /* Calculate temporary vectorial force */
883 /* Update vectorial force */
887 f[j_coord_offset+DIM*0+XX] -= tx;
888 f[j_coord_offset+DIM*0+YY] -= ty;
889 f[j_coord_offset+DIM*0+ZZ] -= tz;
893 /**************************
894 * CALCULATE INTERACTIONS *
895 **************************/
900 /* REACTION-FIELD ELECTROSTATICS */
901 felec = qq11*(rinv11*rinvsq11-krf2);
905 /* Calculate temporary vectorial force */
910 /* Update vectorial force */
914 f[j_coord_offset+DIM*1+XX] -= tx;
915 f[j_coord_offset+DIM*1+YY] -= ty;
916 f[j_coord_offset+DIM*1+ZZ] -= tz;
920 /**************************
921 * CALCULATE INTERACTIONS *
922 **************************/
927 /* REACTION-FIELD ELECTROSTATICS */
928 felec = qq12*(rinv12*rinvsq12-krf2);
932 /* Calculate temporary vectorial force */
937 /* Update vectorial force */
941 f[j_coord_offset+DIM*2+XX] -= tx;
942 f[j_coord_offset+DIM*2+YY] -= ty;
943 f[j_coord_offset+DIM*2+ZZ] -= tz;
947 /**************************
948 * CALCULATE INTERACTIONS *
949 **************************/
954 /* REACTION-FIELD ELECTROSTATICS */
955 felec = qq20*(rinv20*rinvsq20-krf2);
959 /* Calculate temporary vectorial force */
964 /* Update vectorial force */
968 f[j_coord_offset+DIM*0+XX] -= tx;
969 f[j_coord_offset+DIM*0+YY] -= ty;
970 f[j_coord_offset+DIM*0+ZZ] -= tz;
974 /**************************
975 * CALCULATE INTERACTIONS *
976 **************************/
981 /* REACTION-FIELD ELECTROSTATICS */
982 felec = qq21*(rinv21*rinvsq21-krf2);
986 /* Calculate temporary vectorial force */
991 /* Update vectorial force */
995 f[j_coord_offset+DIM*1+XX] -= tx;
996 f[j_coord_offset+DIM*1+YY] -= ty;
997 f[j_coord_offset+DIM*1+ZZ] -= tz;
1001 /**************************
1002 * CALCULATE INTERACTIONS *
1003 **************************/
1008 /* REACTION-FIELD ELECTROSTATICS */
1009 felec = qq22*(rinv22*rinvsq22-krf2);
1013 /* Calculate temporary vectorial force */
1018 /* Update vectorial force */
1022 f[j_coord_offset+DIM*2+XX] -= tx;
1023 f[j_coord_offset+DIM*2+YY] -= ty;
1024 f[j_coord_offset+DIM*2+ZZ] -= tz;
1028 /* Inner loop uses 234 flops */
1030 /* End of innermost loop */
1033 f[i_coord_offset+DIM*0+XX] += fix0;
1034 f[i_coord_offset+DIM*0+YY] += fiy0;
1035 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1039 f[i_coord_offset+DIM*1+XX] += fix1;
1040 f[i_coord_offset+DIM*1+YY] += fiy1;
1041 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1045 f[i_coord_offset+DIM*2+XX] += fix2;
1046 f[i_coord_offset+DIM*2+YY] += fiy2;
1047 f[i_coord_offset+DIM*2+ZZ] += fiz2;
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_W3W3_F,outeriter*30 + inneriter*234);