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 "types/simple.h"
44 #include "gromacs/math/vec.h"
48 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomW3W3_VF_c
49 * Electrostatics interaction: ReactionField
50 * VdW interaction: None
51 * Geometry: Water3-Water3
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecRF_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];
133 /* Start outer loop over neighborlists */
134 for(iidx=0; iidx<nri; iidx++)
136 /* Load shift vector for this list */
137 i_shift_offset = DIM*shiftidx[iidx];
138 shX = shiftvec[i_shift_offset+XX];
139 shY = shiftvec[i_shift_offset+YY];
140 shZ = shiftvec[i_shift_offset+ZZ];
142 /* Load limits for loop over neighbors */
143 j_index_start = jindex[iidx];
144 j_index_end = jindex[iidx+1];
146 /* Get outer coordinate index */
148 i_coord_offset = DIM*inr;
150 /* Load i particle coords and add shift vector */
151 ix0 = shX + x[i_coord_offset+DIM*0+XX];
152 iy0 = shY + x[i_coord_offset+DIM*0+YY];
153 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
154 ix1 = shX + x[i_coord_offset+DIM*1+XX];
155 iy1 = shY + x[i_coord_offset+DIM*1+YY];
156 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
157 ix2 = shX + x[i_coord_offset+DIM*2+XX];
158 iy2 = shY + x[i_coord_offset+DIM*2+YY];
159 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
171 /* Reset potential sums */
174 /* Start inner kernel loop */
175 for(jidx=j_index_start; jidx<j_index_end; jidx++)
177 /* Get j neighbor index, and coordinate index */
179 j_coord_offset = DIM*jnr;
181 /* load j atom coordinates */
182 jx0 = x[j_coord_offset+DIM*0+XX];
183 jy0 = x[j_coord_offset+DIM*0+YY];
184 jz0 = x[j_coord_offset+DIM*0+ZZ];
185 jx1 = x[j_coord_offset+DIM*1+XX];
186 jy1 = x[j_coord_offset+DIM*1+YY];
187 jz1 = x[j_coord_offset+DIM*1+ZZ];
188 jx2 = x[j_coord_offset+DIM*2+XX];
189 jy2 = x[j_coord_offset+DIM*2+YY];
190 jz2 = x[j_coord_offset+DIM*2+ZZ];
192 /* Calculate displacement vector */
221 /* Calculate squared distance and things based on it */
222 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
223 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
224 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
225 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
226 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
227 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
228 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
229 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
230 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
232 rinv00 = gmx_invsqrt(rsq00);
233 rinv01 = gmx_invsqrt(rsq01);
234 rinv02 = gmx_invsqrt(rsq02);
235 rinv10 = gmx_invsqrt(rsq10);
236 rinv11 = gmx_invsqrt(rsq11);
237 rinv12 = gmx_invsqrt(rsq12);
238 rinv20 = gmx_invsqrt(rsq20);
239 rinv21 = gmx_invsqrt(rsq21);
240 rinv22 = gmx_invsqrt(rsq22);
242 rinvsq00 = rinv00*rinv00;
243 rinvsq01 = rinv01*rinv01;
244 rinvsq02 = rinv02*rinv02;
245 rinvsq10 = rinv10*rinv10;
246 rinvsq11 = rinv11*rinv11;
247 rinvsq12 = rinv12*rinv12;
248 rinvsq20 = rinv20*rinv20;
249 rinvsq21 = rinv21*rinv21;
250 rinvsq22 = rinv22*rinv22;
252 /**************************
253 * CALCULATE INTERACTIONS *
254 **************************/
256 /* REACTION-FIELD ELECTROSTATICS */
257 velec = qq00*(rinv00+krf*rsq00-crf);
258 felec = qq00*(rinv00*rinvsq00-krf2);
260 /* Update potential sums from outer loop */
265 /* Calculate temporary vectorial force */
270 /* Update vectorial force */
274 f[j_coord_offset+DIM*0+XX] -= tx;
275 f[j_coord_offset+DIM*0+YY] -= ty;
276 f[j_coord_offset+DIM*0+ZZ] -= tz;
278 /**************************
279 * CALCULATE INTERACTIONS *
280 **************************/
282 /* REACTION-FIELD ELECTROSTATICS */
283 velec = qq01*(rinv01+krf*rsq01-crf);
284 felec = qq01*(rinv01*rinvsq01-krf2);
286 /* Update potential sums from outer loop */
291 /* Calculate temporary vectorial force */
296 /* Update vectorial force */
300 f[j_coord_offset+DIM*1+XX] -= tx;
301 f[j_coord_offset+DIM*1+YY] -= ty;
302 f[j_coord_offset+DIM*1+ZZ] -= tz;
304 /**************************
305 * CALCULATE INTERACTIONS *
306 **************************/
308 /* REACTION-FIELD ELECTROSTATICS */
309 velec = qq02*(rinv02+krf*rsq02-crf);
310 felec = qq02*(rinv02*rinvsq02-krf2);
312 /* Update potential sums from outer loop */
317 /* Calculate temporary vectorial force */
322 /* Update vectorial force */
326 f[j_coord_offset+DIM*2+XX] -= tx;
327 f[j_coord_offset+DIM*2+YY] -= ty;
328 f[j_coord_offset+DIM*2+ZZ] -= tz;
330 /**************************
331 * CALCULATE INTERACTIONS *
332 **************************/
334 /* REACTION-FIELD ELECTROSTATICS */
335 velec = qq10*(rinv10+krf*rsq10-crf);
336 felec = qq10*(rinv10*rinvsq10-krf2);
338 /* Update potential sums from outer loop */
343 /* Calculate temporary vectorial force */
348 /* Update vectorial force */
352 f[j_coord_offset+DIM*0+XX] -= tx;
353 f[j_coord_offset+DIM*0+YY] -= ty;
354 f[j_coord_offset+DIM*0+ZZ] -= tz;
356 /**************************
357 * CALCULATE INTERACTIONS *
358 **************************/
360 /* REACTION-FIELD ELECTROSTATICS */
361 velec = qq11*(rinv11+krf*rsq11-crf);
362 felec = qq11*(rinv11*rinvsq11-krf2);
364 /* Update potential sums from outer loop */
369 /* Calculate temporary vectorial force */
374 /* Update vectorial force */
378 f[j_coord_offset+DIM*1+XX] -= tx;
379 f[j_coord_offset+DIM*1+YY] -= ty;
380 f[j_coord_offset+DIM*1+ZZ] -= tz;
382 /**************************
383 * CALCULATE INTERACTIONS *
384 **************************/
386 /* REACTION-FIELD ELECTROSTATICS */
387 velec = qq12*(rinv12+krf*rsq12-crf);
388 felec = qq12*(rinv12*rinvsq12-krf2);
390 /* Update potential sums from outer loop */
395 /* Calculate temporary vectorial force */
400 /* Update vectorial force */
404 f[j_coord_offset+DIM*2+XX] -= tx;
405 f[j_coord_offset+DIM*2+YY] -= ty;
406 f[j_coord_offset+DIM*2+ZZ] -= tz;
408 /**************************
409 * CALCULATE INTERACTIONS *
410 **************************/
412 /* REACTION-FIELD ELECTROSTATICS */
413 velec = qq20*(rinv20+krf*rsq20-crf);
414 felec = qq20*(rinv20*rinvsq20-krf2);
416 /* Update potential sums from outer loop */
421 /* Calculate temporary vectorial force */
426 /* Update vectorial force */
430 f[j_coord_offset+DIM*0+XX] -= tx;
431 f[j_coord_offset+DIM*0+YY] -= ty;
432 f[j_coord_offset+DIM*0+ZZ] -= tz;
434 /**************************
435 * CALCULATE INTERACTIONS *
436 **************************/
438 /* REACTION-FIELD ELECTROSTATICS */
439 velec = qq21*(rinv21+krf*rsq21-crf);
440 felec = qq21*(rinv21*rinvsq21-krf2);
442 /* Update potential sums from outer loop */
447 /* Calculate temporary vectorial force */
452 /* Update vectorial force */
456 f[j_coord_offset+DIM*1+XX] -= tx;
457 f[j_coord_offset+DIM*1+YY] -= ty;
458 f[j_coord_offset+DIM*1+ZZ] -= tz;
460 /**************************
461 * CALCULATE INTERACTIONS *
462 **************************/
464 /* REACTION-FIELD ELECTROSTATICS */
465 velec = qq22*(rinv22+krf*rsq22-crf);
466 felec = qq22*(rinv22*rinvsq22-krf2);
468 /* Update potential sums from outer loop */
473 /* Calculate temporary vectorial force */
478 /* Update vectorial force */
482 f[j_coord_offset+DIM*2+XX] -= tx;
483 f[j_coord_offset+DIM*2+YY] -= ty;
484 f[j_coord_offset+DIM*2+ZZ] -= tz;
486 /* Inner loop uses 279 flops */
488 /* End of innermost loop */
491 f[i_coord_offset+DIM*0+XX] += fix0;
492 f[i_coord_offset+DIM*0+YY] += fiy0;
493 f[i_coord_offset+DIM*0+ZZ] += fiz0;
497 f[i_coord_offset+DIM*1+XX] += fix1;
498 f[i_coord_offset+DIM*1+YY] += fiy1;
499 f[i_coord_offset+DIM*1+ZZ] += fiz1;
503 f[i_coord_offset+DIM*2+XX] += fix2;
504 f[i_coord_offset+DIM*2+YY] += fiy2;
505 f[i_coord_offset+DIM*2+ZZ] += fiz2;
509 fshift[i_shift_offset+XX] += tx;
510 fshift[i_shift_offset+YY] += ty;
511 fshift[i_shift_offset+ZZ] += tz;
514 /* Update potential energies */
515 kernel_data->energygrp_elec[ggid] += velecsum;
517 /* Increment number of inner iterations */
518 inneriter += j_index_end - j_index_start;
520 /* Outer loop uses 31 flops */
523 /* Increment number of outer iterations */
526 /* Update outer/inner flops */
528 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_VF,outeriter*31 + inneriter*279);
531 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomW3W3_F_c
532 * Electrostatics interaction: ReactionField
533 * VdW interaction: None
534 * Geometry: Water3-Water3
535 * Calculate force/pot: Force
538 nb_kernel_ElecRF_VdwNone_GeomW3W3_F_c
539 (t_nblist * gmx_restrict nlist,
540 rvec * gmx_restrict xx,
541 rvec * gmx_restrict ff,
542 t_forcerec * gmx_restrict fr,
543 t_mdatoms * gmx_restrict mdatoms,
544 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
545 t_nrnb * gmx_restrict nrnb)
547 int i_shift_offset,i_coord_offset,j_coord_offset;
548 int j_index_start,j_index_end;
549 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
550 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
551 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
552 real *shiftvec,*fshift,*x,*f;
554 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
556 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
558 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
560 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
562 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
564 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
565 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
566 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
567 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
568 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
569 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
570 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
571 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
572 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
573 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
574 real velec,felec,velecsum,facel,crf,krf,krf2;
582 jindex = nlist->jindex;
584 shiftidx = nlist->shift;
586 shiftvec = fr->shift_vec[0];
587 fshift = fr->fshift[0];
589 charge = mdatoms->chargeA;
594 /* Setup water-specific parameters */
595 inr = nlist->iinr[0];
596 iq0 = facel*charge[inr+0];
597 iq1 = facel*charge[inr+1];
598 iq2 = facel*charge[inr+2];
616 /* Start outer loop over neighborlists */
617 for(iidx=0; iidx<nri; iidx++)
619 /* Load shift vector for this list */
620 i_shift_offset = DIM*shiftidx[iidx];
621 shX = shiftvec[i_shift_offset+XX];
622 shY = shiftvec[i_shift_offset+YY];
623 shZ = shiftvec[i_shift_offset+ZZ];
625 /* Load limits for loop over neighbors */
626 j_index_start = jindex[iidx];
627 j_index_end = jindex[iidx+1];
629 /* Get outer coordinate index */
631 i_coord_offset = DIM*inr;
633 /* Load i particle coords and add shift vector */
634 ix0 = shX + x[i_coord_offset+DIM*0+XX];
635 iy0 = shY + x[i_coord_offset+DIM*0+YY];
636 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
637 ix1 = shX + x[i_coord_offset+DIM*1+XX];
638 iy1 = shY + x[i_coord_offset+DIM*1+YY];
639 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
640 ix2 = shX + x[i_coord_offset+DIM*2+XX];
641 iy2 = shY + x[i_coord_offset+DIM*2+YY];
642 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
654 /* Start inner kernel loop */
655 for(jidx=j_index_start; jidx<j_index_end; jidx++)
657 /* Get j neighbor index, and coordinate index */
659 j_coord_offset = DIM*jnr;
661 /* load j atom coordinates */
662 jx0 = x[j_coord_offset+DIM*0+XX];
663 jy0 = x[j_coord_offset+DIM*0+YY];
664 jz0 = x[j_coord_offset+DIM*0+ZZ];
665 jx1 = x[j_coord_offset+DIM*1+XX];
666 jy1 = x[j_coord_offset+DIM*1+YY];
667 jz1 = x[j_coord_offset+DIM*1+ZZ];
668 jx2 = x[j_coord_offset+DIM*2+XX];
669 jy2 = x[j_coord_offset+DIM*2+YY];
670 jz2 = x[j_coord_offset+DIM*2+ZZ];
672 /* Calculate displacement vector */
701 /* Calculate squared distance and things based on it */
702 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
703 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
704 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
705 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
706 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
707 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
708 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
709 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
710 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
712 rinv00 = gmx_invsqrt(rsq00);
713 rinv01 = gmx_invsqrt(rsq01);
714 rinv02 = gmx_invsqrt(rsq02);
715 rinv10 = gmx_invsqrt(rsq10);
716 rinv11 = gmx_invsqrt(rsq11);
717 rinv12 = gmx_invsqrt(rsq12);
718 rinv20 = gmx_invsqrt(rsq20);
719 rinv21 = gmx_invsqrt(rsq21);
720 rinv22 = gmx_invsqrt(rsq22);
722 rinvsq00 = rinv00*rinv00;
723 rinvsq01 = rinv01*rinv01;
724 rinvsq02 = rinv02*rinv02;
725 rinvsq10 = rinv10*rinv10;
726 rinvsq11 = rinv11*rinv11;
727 rinvsq12 = rinv12*rinv12;
728 rinvsq20 = rinv20*rinv20;
729 rinvsq21 = rinv21*rinv21;
730 rinvsq22 = rinv22*rinv22;
732 /**************************
733 * CALCULATE INTERACTIONS *
734 **************************/
736 /* REACTION-FIELD ELECTROSTATICS */
737 felec = qq00*(rinv00*rinvsq00-krf2);
741 /* Calculate temporary vectorial force */
746 /* Update vectorial force */
750 f[j_coord_offset+DIM*0+XX] -= tx;
751 f[j_coord_offset+DIM*0+YY] -= ty;
752 f[j_coord_offset+DIM*0+ZZ] -= tz;
754 /**************************
755 * CALCULATE INTERACTIONS *
756 **************************/
758 /* REACTION-FIELD ELECTROSTATICS */
759 felec = qq01*(rinv01*rinvsq01-krf2);
763 /* Calculate temporary vectorial force */
768 /* Update vectorial force */
772 f[j_coord_offset+DIM*1+XX] -= tx;
773 f[j_coord_offset+DIM*1+YY] -= ty;
774 f[j_coord_offset+DIM*1+ZZ] -= tz;
776 /**************************
777 * CALCULATE INTERACTIONS *
778 **************************/
780 /* REACTION-FIELD ELECTROSTATICS */
781 felec = qq02*(rinv02*rinvsq02-krf2);
785 /* Calculate temporary vectorial force */
790 /* Update vectorial force */
794 f[j_coord_offset+DIM*2+XX] -= tx;
795 f[j_coord_offset+DIM*2+YY] -= ty;
796 f[j_coord_offset+DIM*2+ZZ] -= tz;
798 /**************************
799 * CALCULATE INTERACTIONS *
800 **************************/
802 /* REACTION-FIELD ELECTROSTATICS */
803 felec = qq10*(rinv10*rinvsq10-krf2);
807 /* Calculate temporary vectorial force */
812 /* Update vectorial force */
816 f[j_coord_offset+DIM*0+XX] -= tx;
817 f[j_coord_offset+DIM*0+YY] -= ty;
818 f[j_coord_offset+DIM*0+ZZ] -= tz;
820 /**************************
821 * CALCULATE INTERACTIONS *
822 **************************/
824 /* REACTION-FIELD ELECTROSTATICS */
825 felec = qq11*(rinv11*rinvsq11-krf2);
829 /* Calculate temporary vectorial force */
834 /* Update vectorial force */
838 f[j_coord_offset+DIM*1+XX] -= tx;
839 f[j_coord_offset+DIM*1+YY] -= ty;
840 f[j_coord_offset+DIM*1+ZZ] -= tz;
842 /**************************
843 * CALCULATE INTERACTIONS *
844 **************************/
846 /* REACTION-FIELD ELECTROSTATICS */
847 felec = qq12*(rinv12*rinvsq12-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;
864 /**************************
865 * CALCULATE INTERACTIONS *
866 **************************/
868 /* REACTION-FIELD ELECTROSTATICS */
869 felec = qq20*(rinv20*rinvsq20-krf2);
873 /* Calculate temporary vectorial force */
878 /* Update vectorial force */
882 f[j_coord_offset+DIM*0+XX] -= tx;
883 f[j_coord_offset+DIM*0+YY] -= ty;
884 f[j_coord_offset+DIM*0+ZZ] -= tz;
886 /**************************
887 * CALCULATE INTERACTIONS *
888 **************************/
890 /* REACTION-FIELD ELECTROSTATICS */
891 felec = qq21*(rinv21*rinvsq21-krf2);
895 /* Calculate temporary vectorial force */
900 /* Update vectorial force */
904 f[j_coord_offset+DIM*1+XX] -= tx;
905 f[j_coord_offset+DIM*1+YY] -= ty;
906 f[j_coord_offset+DIM*1+ZZ] -= tz;
908 /**************************
909 * CALCULATE INTERACTIONS *
910 **************************/
912 /* REACTION-FIELD ELECTROSTATICS */
913 felec = qq22*(rinv22*rinvsq22-krf2);
917 /* Calculate temporary vectorial force */
922 /* Update vectorial force */
926 f[j_coord_offset+DIM*2+XX] -= tx;
927 f[j_coord_offset+DIM*2+YY] -= ty;
928 f[j_coord_offset+DIM*2+ZZ] -= tz;
930 /* Inner loop uses 234 flops */
932 /* End of innermost loop */
935 f[i_coord_offset+DIM*0+XX] += fix0;
936 f[i_coord_offset+DIM*0+YY] += fiy0;
937 f[i_coord_offset+DIM*0+ZZ] += fiz0;
941 f[i_coord_offset+DIM*1+XX] += fix1;
942 f[i_coord_offset+DIM*1+YY] += fiy1;
943 f[i_coord_offset+DIM*1+ZZ] += fiz1;
947 f[i_coord_offset+DIM*2+XX] += fix2;
948 f[i_coord_offset+DIM*2+YY] += fiy2;
949 f[i_coord_offset+DIM*2+ZZ] += fiz2;
953 fshift[i_shift_offset+XX] += tx;
954 fshift[i_shift_offset+YY] += ty;
955 fshift[i_shift_offset+ZZ] += tz;
957 /* Increment number of inner iterations */
958 inneriter += j_index_end - j_index_start;
960 /* Outer loop uses 30 flops */
963 /* Increment number of outer iterations */
966 /* Update outer/inner flops */
968 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_F,outeriter*30 + inneriter*234);