2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, 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 "types/simple.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomW3W3_VF_c
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: None
53 * Geometry: Water3-Water3
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRF_VdwNone_GeomW3W3_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 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
75 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
77 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
79 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
81 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
83 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
84 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
85 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
86 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
87 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
88 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
89 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
90 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
91 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
92 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
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 iq0 = facel*charge[inr+0];
116 iq1 = facel*charge[inr+1];
117 iq2 = facel*charge[inr+2];
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 ix0 = shX + x[i_coord_offset+DIM*0+XX];
154 iy0 = shY + x[i_coord_offset+DIM*0+YY];
155 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
156 ix1 = shX + x[i_coord_offset+DIM*1+XX];
157 iy1 = shY + x[i_coord_offset+DIM*1+YY];
158 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
159 ix2 = shX + x[i_coord_offset+DIM*2+XX];
160 iy2 = shY + x[i_coord_offset+DIM*2+YY];
161 iz2 = shZ + x[i_coord_offset+DIM*2+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 jx0 = x[j_coord_offset+DIM*0+XX];
185 jy0 = x[j_coord_offset+DIM*0+YY];
186 jz0 = x[j_coord_offset+DIM*0+ZZ];
187 jx1 = x[j_coord_offset+DIM*1+XX];
188 jy1 = x[j_coord_offset+DIM*1+YY];
189 jz1 = x[j_coord_offset+DIM*1+ZZ];
190 jx2 = x[j_coord_offset+DIM*2+XX];
191 jy2 = x[j_coord_offset+DIM*2+YY];
192 jz2 = x[j_coord_offset+DIM*2+ZZ];
194 /* Calculate displacement vector */
223 /* Calculate squared distance and things based on it */
224 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
225 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
226 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
227 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
228 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
229 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
230 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
231 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
232 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
234 rinv00 = gmx_invsqrt(rsq00);
235 rinv01 = gmx_invsqrt(rsq01);
236 rinv02 = gmx_invsqrt(rsq02);
237 rinv10 = gmx_invsqrt(rsq10);
238 rinv11 = gmx_invsqrt(rsq11);
239 rinv12 = gmx_invsqrt(rsq12);
240 rinv20 = gmx_invsqrt(rsq20);
241 rinv21 = gmx_invsqrt(rsq21);
242 rinv22 = gmx_invsqrt(rsq22);
244 rinvsq00 = rinv00*rinv00;
245 rinvsq01 = rinv01*rinv01;
246 rinvsq02 = rinv02*rinv02;
247 rinvsq10 = rinv10*rinv10;
248 rinvsq11 = rinv11*rinv11;
249 rinvsq12 = rinv12*rinv12;
250 rinvsq20 = rinv20*rinv20;
251 rinvsq21 = rinv21*rinv21;
252 rinvsq22 = rinv22*rinv22;
254 /**************************
255 * CALCULATE INTERACTIONS *
256 **************************/
258 /* REACTION-FIELD ELECTROSTATICS */
259 velec = qq00*(rinv00+krf*rsq00-crf);
260 felec = qq00*(rinv00*rinvsq00-krf2);
262 /* Update potential sums from outer loop */
267 /* Calculate temporary vectorial force */
272 /* Update vectorial force */
276 f[j_coord_offset+DIM*0+XX] -= tx;
277 f[j_coord_offset+DIM*0+YY] -= ty;
278 f[j_coord_offset+DIM*0+ZZ] -= tz;
280 /**************************
281 * CALCULATE INTERACTIONS *
282 **************************/
284 /* REACTION-FIELD ELECTROSTATICS */
285 velec = qq01*(rinv01+krf*rsq01-crf);
286 felec = qq01*(rinv01*rinvsq01-krf2);
288 /* Update potential sums from outer loop */
293 /* Calculate temporary vectorial force */
298 /* Update vectorial force */
302 f[j_coord_offset+DIM*1+XX] -= tx;
303 f[j_coord_offset+DIM*1+YY] -= ty;
304 f[j_coord_offset+DIM*1+ZZ] -= tz;
306 /**************************
307 * CALCULATE INTERACTIONS *
308 **************************/
310 /* REACTION-FIELD ELECTROSTATICS */
311 velec = qq02*(rinv02+krf*rsq02-crf);
312 felec = qq02*(rinv02*rinvsq02-krf2);
314 /* Update potential sums from outer loop */
319 /* Calculate temporary vectorial force */
324 /* Update vectorial force */
328 f[j_coord_offset+DIM*2+XX] -= tx;
329 f[j_coord_offset+DIM*2+YY] -= ty;
330 f[j_coord_offset+DIM*2+ZZ] -= tz;
332 /**************************
333 * CALCULATE INTERACTIONS *
334 **************************/
336 /* REACTION-FIELD ELECTROSTATICS */
337 velec = qq10*(rinv10+krf*rsq10-crf);
338 felec = qq10*(rinv10*rinvsq10-krf2);
340 /* Update potential sums from outer loop */
345 /* Calculate temporary vectorial force */
350 /* Update vectorial force */
354 f[j_coord_offset+DIM*0+XX] -= tx;
355 f[j_coord_offset+DIM*0+YY] -= ty;
356 f[j_coord_offset+DIM*0+ZZ] -= tz;
358 /**************************
359 * CALCULATE INTERACTIONS *
360 **************************/
362 /* REACTION-FIELD ELECTROSTATICS */
363 velec = qq11*(rinv11+krf*rsq11-crf);
364 felec = qq11*(rinv11*rinvsq11-krf2);
366 /* Update potential sums from outer loop */
371 /* Calculate temporary vectorial force */
376 /* Update vectorial force */
380 f[j_coord_offset+DIM*1+XX] -= tx;
381 f[j_coord_offset+DIM*1+YY] -= ty;
382 f[j_coord_offset+DIM*1+ZZ] -= tz;
384 /**************************
385 * CALCULATE INTERACTIONS *
386 **************************/
388 /* REACTION-FIELD ELECTROSTATICS */
389 velec = qq12*(rinv12+krf*rsq12-crf);
390 felec = qq12*(rinv12*rinvsq12-krf2);
392 /* Update potential sums from outer loop */
397 /* Calculate temporary vectorial force */
402 /* Update vectorial force */
406 f[j_coord_offset+DIM*2+XX] -= tx;
407 f[j_coord_offset+DIM*2+YY] -= ty;
408 f[j_coord_offset+DIM*2+ZZ] -= tz;
410 /**************************
411 * CALCULATE INTERACTIONS *
412 **************************/
414 /* REACTION-FIELD ELECTROSTATICS */
415 velec = qq20*(rinv20+krf*rsq20-crf);
416 felec = qq20*(rinv20*rinvsq20-krf2);
418 /* Update potential sums from outer loop */
423 /* Calculate temporary vectorial force */
428 /* Update vectorial force */
432 f[j_coord_offset+DIM*0+XX] -= tx;
433 f[j_coord_offset+DIM*0+YY] -= ty;
434 f[j_coord_offset+DIM*0+ZZ] -= tz;
436 /**************************
437 * CALCULATE INTERACTIONS *
438 **************************/
440 /* REACTION-FIELD ELECTROSTATICS */
441 velec = qq21*(rinv21+krf*rsq21-crf);
442 felec = qq21*(rinv21*rinvsq21-krf2);
444 /* Update potential sums from outer loop */
449 /* Calculate temporary vectorial force */
454 /* Update vectorial force */
458 f[j_coord_offset+DIM*1+XX] -= tx;
459 f[j_coord_offset+DIM*1+YY] -= ty;
460 f[j_coord_offset+DIM*1+ZZ] -= tz;
462 /**************************
463 * CALCULATE INTERACTIONS *
464 **************************/
466 /* REACTION-FIELD ELECTROSTATICS */
467 velec = qq22*(rinv22+krf*rsq22-crf);
468 felec = qq22*(rinv22*rinvsq22-krf2);
470 /* Update potential sums from outer loop */
475 /* Calculate temporary vectorial force */
480 /* Update vectorial force */
484 f[j_coord_offset+DIM*2+XX] -= tx;
485 f[j_coord_offset+DIM*2+YY] -= ty;
486 f[j_coord_offset+DIM*2+ZZ] -= tz;
488 /* Inner loop uses 279 flops */
490 /* End of innermost loop */
493 f[i_coord_offset+DIM*0+XX] += fix0;
494 f[i_coord_offset+DIM*0+YY] += fiy0;
495 f[i_coord_offset+DIM*0+ZZ] += fiz0;
499 f[i_coord_offset+DIM*1+XX] += fix1;
500 f[i_coord_offset+DIM*1+YY] += fiy1;
501 f[i_coord_offset+DIM*1+ZZ] += fiz1;
505 f[i_coord_offset+DIM*2+XX] += fix2;
506 f[i_coord_offset+DIM*2+YY] += fiy2;
507 f[i_coord_offset+DIM*2+ZZ] += fiz2;
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_W3W3_VF,outeriter*31 + inneriter*279);
533 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomW3W3_F_c
534 * Electrostatics interaction: ReactionField
535 * VdW interaction: None
536 * Geometry: Water3-Water3
537 * Calculate force/pot: Force
540 nb_kernel_ElecRF_VdwNone_GeomW3W3_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 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
558 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
560 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
562 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
564 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
566 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
567 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
568 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
569 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
570 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
571 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
572 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
573 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
574 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
575 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
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 iq0 = facel*charge[inr+0];
599 iq1 = facel*charge[inr+1];
600 iq2 = facel*charge[inr+2];
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 ix0 = shX + x[i_coord_offset+DIM*0+XX];
637 iy0 = shY + x[i_coord_offset+DIM*0+YY];
638 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
639 ix1 = shX + x[i_coord_offset+DIM*1+XX];
640 iy1 = shY + x[i_coord_offset+DIM*1+YY];
641 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
642 ix2 = shX + x[i_coord_offset+DIM*2+XX];
643 iy2 = shY + x[i_coord_offset+DIM*2+YY];
644 iz2 = shZ + x[i_coord_offset+DIM*2+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 jx0 = x[j_coord_offset+DIM*0+XX];
665 jy0 = x[j_coord_offset+DIM*0+YY];
666 jz0 = x[j_coord_offset+DIM*0+ZZ];
667 jx1 = x[j_coord_offset+DIM*1+XX];
668 jy1 = x[j_coord_offset+DIM*1+YY];
669 jz1 = x[j_coord_offset+DIM*1+ZZ];
670 jx2 = x[j_coord_offset+DIM*2+XX];
671 jy2 = x[j_coord_offset+DIM*2+YY];
672 jz2 = x[j_coord_offset+DIM*2+ZZ];
674 /* Calculate displacement vector */
703 /* Calculate squared distance and things based on it */
704 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
705 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
706 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
707 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
708 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
709 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
710 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
711 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
712 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
714 rinv00 = gmx_invsqrt(rsq00);
715 rinv01 = gmx_invsqrt(rsq01);
716 rinv02 = gmx_invsqrt(rsq02);
717 rinv10 = gmx_invsqrt(rsq10);
718 rinv11 = gmx_invsqrt(rsq11);
719 rinv12 = gmx_invsqrt(rsq12);
720 rinv20 = gmx_invsqrt(rsq20);
721 rinv21 = gmx_invsqrt(rsq21);
722 rinv22 = gmx_invsqrt(rsq22);
724 rinvsq00 = rinv00*rinv00;
725 rinvsq01 = rinv01*rinv01;
726 rinvsq02 = rinv02*rinv02;
727 rinvsq10 = rinv10*rinv10;
728 rinvsq11 = rinv11*rinv11;
729 rinvsq12 = rinv12*rinv12;
730 rinvsq20 = rinv20*rinv20;
731 rinvsq21 = rinv21*rinv21;
732 rinvsq22 = rinv22*rinv22;
734 /**************************
735 * CALCULATE INTERACTIONS *
736 **************************/
738 /* REACTION-FIELD ELECTROSTATICS */
739 felec = qq00*(rinv00*rinvsq00-krf2);
743 /* Calculate temporary vectorial force */
748 /* Update vectorial force */
752 f[j_coord_offset+DIM*0+XX] -= tx;
753 f[j_coord_offset+DIM*0+YY] -= ty;
754 f[j_coord_offset+DIM*0+ZZ] -= tz;
756 /**************************
757 * CALCULATE INTERACTIONS *
758 **************************/
760 /* REACTION-FIELD ELECTROSTATICS */
761 felec = qq01*(rinv01*rinvsq01-krf2);
765 /* Calculate temporary vectorial force */
770 /* Update vectorial force */
774 f[j_coord_offset+DIM*1+XX] -= tx;
775 f[j_coord_offset+DIM*1+YY] -= ty;
776 f[j_coord_offset+DIM*1+ZZ] -= tz;
778 /**************************
779 * CALCULATE INTERACTIONS *
780 **************************/
782 /* REACTION-FIELD ELECTROSTATICS */
783 felec = qq02*(rinv02*rinvsq02-krf2);
787 /* Calculate temporary vectorial force */
792 /* Update vectorial force */
796 f[j_coord_offset+DIM*2+XX] -= tx;
797 f[j_coord_offset+DIM*2+YY] -= ty;
798 f[j_coord_offset+DIM*2+ZZ] -= tz;
800 /**************************
801 * CALCULATE INTERACTIONS *
802 **************************/
804 /* REACTION-FIELD ELECTROSTATICS */
805 felec = qq10*(rinv10*rinvsq10-krf2);
809 /* Calculate temporary vectorial force */
814 /* Update vectorial force */
818 f[j_coord_offset+DIM*0+XX] -= tx;
819 f[j_coord_offset+DIM*0+YY] -= ty;
820 f[j_coord_offset+DIM*0+ZZ] -= tz;
822 /**************************
823 * CALCULATE INTERACTIONS *
824 **************************/
826 /* REACTION-FIELD ELECTROSTATICS */
827 felec = qq11*(rinv11*rinvsq11-krf2);
831 /* Calculate temporary vectorial force */
836 /* Update vectorial force */
840 f[j_coord_offset+DIM*1+XX] -= tx;
841 f[j_coord_offset+DIM*1+YY] -= ty;
842 f[j_coord_offset+DIM*1+ZZ] -= tz;
844 /**************************
845 * CALCULATE INTERACTIONS *
846 **************************/
848 /* REACTION-FIELD ELECTROSTATICS */
849 felec = qq12*(rinv12*rinvsq12-krf2);
853 /* Calculate temporary vectorial force */
858 /* Update vectorial force */
862 f[j_coord_offset+DIM*2+XX] -= tx;
863 f[j_coord_offset+DIM*2+YY] -= ty;
864 f[j_coord_offset+DIM*2+ZZ] -= tz;
866 /**************************
867 * CALCULATE INTERACTIONS *
868 **************************/
870 /* REACTION-FIELD ELECTROSTATICS */
871 felec = qq20*(rinv20*rinvsq20-krf2);
875 /* Calculate temporary vectorial force */
880 /* Update vectorial force */
884 f[j_coord_offset+DIM*0+XX] -= tx;
885 f[j_coord_offset+DIM*0+YY] -= ty;
886 f[j_coord_offset+DIM*0+ZZ] -= tz;
888 /**************************
889 * CALCULATE INTERACTIONS *
890 **************************/
892 /* REACTION-FIELD ELECTROSTATICS */
893 felec = qq21*(rinv21*rinvsq21-krf2);
897 /* Calculate temporary vectorial force */
902 /* Update vectorial force */
906 f[j_coord_offset+DIM*1+XX] -= tx;
907 f[j_coord_offset+DIM*1+YY] -= ty;
908 f[j_coord_offset+DIM*1+ZZ] -= tz;
910 /**************************
911 * CALCULATE INTERACTIONS *
912 **************************/
914 /* REACTION-FIELD ELECTROSTATICS */
915 felec = qq22*(rinv22*rinvsq22-krf2);
919 /* Calculate temporary vectorial force */
924 /* Update vectorial force */
928 f[j_coord_offset+DIM*2+XX] -= tx;
929 f[j_coord_offset+DIM*2+YY] -= ty;
930 f[j_coord_offset+DIM*2+ZZ] -= tz;
932 /* Inner loop uses 234 flops */
934 /* End of innermost loop */
937 f[i_coord_offset+DIM*0+XX] += fix0;
938 f[i_coord_offset+DIM*0+YY] += fiy0;
939 f[i_coord_offset+DIM*0+ZZ] += fiz0;
943 f[i_coord_offset+DIM*1+XX] += fix1;
944 f[i_coord_offset+DIM*1+YY] += fiy1;
945 f[i_coord_offset+DIM*1+ZZ] += fiz1;
949 f[i_coord_offset+DIM*2+XX] += fix2;
950 f[i_coord_offset+DIM*2+YY] += fiy2;
951 f[i_coord_offset+DIM*2+ZZ] += fiz2;
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_W3W3_F,outeriter*30 + inneriter*234);