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_GeomW4W4_VF_c
49 * Electrostatics interaction: ReactionField
50 * VdW interaction: None
51 * Geometry: Water4-Water4
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecRF_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];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
152 iy1 = shY + x[i_coord_offset+DIM*1+YY];
153 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
154 ix2 = shX + x[i_coord_offset+DIM*2+XX];
155 iy2 = shY + x[i_coord_offset+DIM*2+YY];
156 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
157 ix3 = shX + x[i_coord_offset+DIM*3+XX];
158 iy3 = shY + x[i_coord_offset+DIM*3+YY];
159 iz3 = shZ + x[i_coord_offset+DIM*3+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 jx1 = x[j_coord_offset+DIM*1+XX];
183 jy1 = x[j_coord_offset+DIM*1+YY];
184 jz1 = x[j_coord_offset+DIM*1+ZZ];
185 jx2 = x[j_coord_offset+DIM*2+XX];
186 jy2 = x[j_coord_offset+DIM*2+YY];
187 jz2 = x[j_coord_offset+DIM*2+ZZ];
188 jx3 = x[j_coord_offset+DIM*3+XX];
189 jy3 = x[j_coord_offset+DIM*3+YY];
190 jz3 = x[j_coord_offset+DIM*3+ZZ];
192 /* Calculate displacement vector */
221 /* Calculate squared distance and things based on it */
222 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
223 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
224 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
225 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
226 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
227 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
228 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
229 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
230 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
232 rinv11 = gmx_invsqrt(rsq11);
233 rinv12 = gmx_invsqrt(rsq12);
234 rinv13 = gmx_invsqrt(rsq13);
235 rinv21 = gmx_invsqrt(rsq21);
236 rinv22 = gmx_invsqrt(rsq22);
237 rinv23 = gmx_invsqrt(rsq23);
238 rinv31 = gmx_invsqrt(rsq31);
239 rinv32 = gmx_invsqrt(rsq32);
240 rinv33 = gmx_invsqrt(rsq33);
242 rinvsq11 = rinv11*rinv11;
243 rinvsq12 = rinv12*rinv12;
244 rinvsq13 = rinv13*rinv13;
245 rinvsq21 = rinv21*rinv21;
246 rinvsq22 = rinv22*rinv22;
247 rinvsq23 = rinv23*rinv23;
248 rinvsq31 = rinv31*rinv31;
249 rinvsq32 = rinv32*rinv32;
250 rinvsq33 = rinv33*rinv33;
252 /**************************
253 * CALCULATE INTERACTIONS *
254 **************************/
256 /* REACTION-FIELD ELECTROSTATICS */
257 velec = qq11*(rinv11+krf*rsq11-crf);
258 felec = qq11*(rinv11*rinvsq11-krf2);
260 /* Update potential sums from outer loop */
265 /* Calculate temporary vectorial force */
270 /* Update vectorial force */
274 f[j_coord_offset+DIM*1+XX] -= tx;
275 f[j_coord_offset+DIM*1+YY] -= ty;
276 f[j_coord_offset+DIM*1+ZZ] -= tz;
278 /**************************
279 * CALCULATE INTERACTIONS *
280 **************************/
282 /* REACTION-FIELD ELECTROSTATICS */
283 velec = qq12*(rinv12+krf*rsq12-crf);
284 felec = qq12*(rinv12*rinvsq12-krf2);
286 /* Update potential sums from outer loop */
291 /* Calculate temporary vectorial force */
296 /* Update vectorial force */
300 f[j_coord_offset+DIM*2+XX] -= tx;
301 f[j_coord_offset+DIM*2+YY] -= ty;
302 f[j_coord_offset+DIM*2+ZZ] -= tz;
304 /**************************
305 * CALCULATE INTERACTIONS *
306 **************************/
308 /* REACTION-FIELD ELECTROSTATICS */
309 velec = qq13*(rinv13+krf*rsq13-crf);
310 felec = qq13*(rinv13*rinvsq13-krf2);
312 /* Update potential sums from outer loop */
317 /* Calculate temporary vectorial force */
322 /* Update vectorial force */
326 f[j_coord_offset+DIM*3+XX] -= tx;
327 f[j_coord_offset+DIM*3+YY] -= ty;
328 f[j_coord_offset+DIM*3+ZZ] -= tz;
330 /**************************
331 * CALCULATE INTERACTIONS *
332 **************************/
334 /* REACTION-FIELD ELECTROSTATICS */
335 velec = qq21*(rinv21+krf*rsq21-crf);
336 felec = qq21*(rinv21*rinvsq21-krf2);
338 /* Update potential sums from outer loop */
343 /* Calculate temporary vectorial force */
348 /* Update vectorial force */
352 f[j_coord_offset+DIM*1+XX] -= tx;
353 f[j_coord_offset+DIM*1+YY] -= ty;
354 f[j_coord_offset+DIM*1+ZZ] -= tz;
356 /**************************
357 * CALCULATE INTERACTIONS *
358 **************************/
360 /* REACTION-FIELD ELECTROSTATICS */
361 velec = qq22*(rinv22+krf*rsq22-crf);
362 felec = qq22*(rinv22*rinvsq22-krf2);
364 /* Update potential sums from outer loop */
369 /* Calculate temporary vectorial force */
374 /* Update vectorial force */
378 f[j_coord_offset+DIM*2+XX] -= tx;
379 f[j_coord_offset+DIM*2+YY] -= ty;
380 f[j_coord_offset+DIM*2+ZZ] -= tz;
382 /**************************
383 * CALCULATE INTERACTIONS *
384 **************************/
386 /* REACTION-FIELD ELECTROSTATICS */
387 velec = qq23*(rinv23+krf*rsq23-crf);
388 felec = qq23*(rinv23*rinvsq23-krf2);
390 /* Update potential sums from outer loop */
395 /* Calculate temporary vectorial force */
400 /* Update vectorial force */
404 f[j_coord_offset+DIM*3+XX] -= tx;
405 f[j_coord_offset+DIM*3+YY] -= ty;
406 f[j_coord_offset+DIM*3+ZZ] -= tz;
408 /**************************
409 * CALCULATE INTERACTIONS *
410 **************************/
412 /* REACTION-FIELD ELECTROSTATICS */
413 velec = qq31*(rinv31+krf*rsq31-crf);
414 felec = qq31*(rinv31*rinvsq31-krf2);
416 /* Update potential sums from outer loop */
421 /* Calculate temporary vectorial force */
426 /* Update vectorial force */
430 f[j_coord_offset+DIM*1+XX] -= tx;
431 f[j_coord_offset+DIM*1+YY] -= ty;
432 f[j_coord_offset+DIM*1+ZZ] -= tz;
434 /**************************
435 * CALCULATE INTERACTIONS *
436 **************************/
438 /* REACTION-FIELD ELECTROSTATICS */
439 velec = qq32*(rinv32+krf*rsq32-crf);
440 felec = qq32*(rinv32*rinvsq32-krf2);
442 /* Update potential sums from outer loop */
447 /* Calculate temporary vectorial force */
452 /* Update vectorial force */
456 f[j_coord_offset+DIM*2+XX] -= tx;
457 f[j_coord_offset+DIM*2+YY] -= ty;
458 f[j_coord_offset+DIM*2+ZZ] -= tz;
460 /**************************
461 * CALCULATE INTERACTIONS *
462 **************************/
464 /* REACTION-FIELD ELECTROSTATICS */
465 velec = qq33*(rinv33+krf*rsq33-crf);
466 felec = qq33*(rinv33*rinvsq33-krf2);
468 /* Update potential sums from outer loop */
473 /* Calculate temporary vectorial force */
478 /* Update vectorial force */
482 f[j_coord_offset+DIM*3+XX] -= tx;
483 f[j_coord_offset+DIM*3+YY] -= ty;
484 f[j_coord_offset+DIM*3+ZZ] -= tz;
486 /* Inner loop uses 279 flops */
488 /* End of innermost loop */
491 f[i_coord_offset+DIM*1+XX] += fix1;
492 f[i_coord_offset+DIM*1+YY] += fiy1;
493 f[i_coord_offset+DIM*1+ZZ] += fiz1;
497 f[i_coord_offset+DIM*2+XX] += fix2;
498 f[i_coord_offset+DIM*2+YY] += fiy2;
499 f[i_coord_offset+DIM*2+ZZ] += fiz2;
503 f[i_coord_offset+DIM*3+XX] += fix3;
504 f[i_coord_offset+DIM*3+YY] += fiy3;
505 f[i_coord_offset+DIM*3+ZZ] += fiz3;
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_W4W4_VF,outeriter*31 + inneriter*279);
531 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomW4W4_F_c
532 * Electrostatics interaction: ReactionField
533 * VdW interaction: None
534 * Geometry: Water4-Water4
535 * Calculate force/pot: Force
538 nb_kernel_ElecRF_VdwNone_GeomW4W4_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 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
556 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
558 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
560 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
562 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
564 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
565 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
566 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
567 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
568 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
569 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
570 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
571 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
572 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
573 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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 iq1 = facel*charge[inr+1];
597 iq2 = facel*charge[inr+2];
598 iq3 = facel*charge[inr+3];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
635 iy1 = shY + x[i_coord_offset+DIM*1+YY];
636 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
637 ix2 = shX + x[i_coord_offset+DIM*2+XX];
638 iy2 = shY + x[i_coord_offset+DIM*2+YY];
639 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
640 ix3 = shX + x[i_coord_offset+DIM*3+XX];
641 iy3 = shY + x[i_coord_offset+DIM*3+YY];
642 iz3 = shZ + x[i_coord_offset+DIM*3+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 jx1 = x[j_coord_offset+DIM*1+XX];
663 jy1 = x[j_coord_offset+DIM*1+YY];
664 jz1 = x[j_coord_offset+DIM*1+ZZ];
665 jx2 = x[j_coord_offset+DIM*2+XX];
666 jy2 = x[j_coord_offset+DIM*2+YY];
667 jz2 = x[j_coord_offset+DIM*2+ZZ];
668 jx3 = x[j_coord_offset+DIM*3+XX];
669 jy3 = x[j_coord_offset+DIM*3+YY];
670 jz3 = x[j_coord_offset+DIM*3+ZZ];
672 /* Calculate displacement vector */
701 /* Calculate squared distance and things based on it */
702 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
703 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
704 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
705 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
706 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
707 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
708 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
709 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
710 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
712 rinv11 = gmx_invsqrt(rsq11);
713 rinv12 = gmx_invsqrt(rsq12);
714 rinv13 = gmx_invsqrt(rsq13);
715 rinv21 = gmx_invsqrt(rsq21);
716 rinv22 = gmx_invsqrt(rsq22);
717 rinv23 = gmx_invsqrt(rsq23);
718 rinv31 = gmx_invsqrt(rsq31);
719 rinv32 = gmx_invsqrt(rsq32);
720 rinv33 = gmx_invsqrt(rsq33);
722 rinvsq11 = rinv11*rinv11;
723 rinvsq12 = rinv12*rinv12;
724 rinvsq13 = rinv13*rinv13;
725 rinvsq21 = rinv21*rinv21;
726 rinvsq22 = rinv22*rinv22;
727 rinvsq23 = rinv23*rinv23;
728 rinvsq31 = rinv31*rinv31;
729 rinvsq32 = rinv32*rinv32;
730 rinvsq33 = rinv33*rinv33;
732 /**************************
733 * CALCULATE INTERACTIONS *
734 **************************/
736 /* REACTION-FIELD ELECTROSTATICS */
737 felec = qq11*(rinv11*rinvsq11-krf2);
741 /* Calculate temporary vectorial force */
746 /* Update vectorial force */
750 f[j_coord_offset+DIM*1+XX] -= tx;
751 f[j_coord_offset+DIM*1+YY] -= ty;
752 f[j_coord_offset+DIM*1+ZZ] -= tz;
754 /**************************
755 * CALCULATE INTERACTIONS *
756 **************************/
758 /* REACTION-FIELD ELECTROSTATICS */
759 felec = qq12*(rinv12*rinvsq12-krf2);
763 /* Calculate temporary vectorial force */
768 /* Update vectorial force */
772 f[j_coord_offset+DIM*2+XX] -= tx;
773 f[j_coord_offset+DIM*2+YY] -= ty;
774 f[j_coord_offset+DIM*2+ZZ] -= tz;
776 /**************************
777 * CALCULATE INTERACTIONS *
778 **************************/
780 /* REACTION-FIELD ELECTROSTATICS */
781 felec = qq13*(rinv13*rinvsq13-krf2);
785 /* Calculate temporary vectorial force */
790 /* Update vectorial force */
794 f[j_coord_offset+DIM*3+XX] -= tx;
795 f[j_coord_offset+DIM*3+YY] -= ty;
796 f[j_coord_offset+DIM*3+ZZ] -= tz;
798 /**************************
799 * CALCULATE INTERACTIONS *
800 **************************/
802 /* REACTION-FIELD ELECTROSTATICS */
803 felec = qq21*(rinv21*rinvsq21-krf2);
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 /* REACTION-FIELD ELECTROSTATICS */
825 felec = qq22*(rinv22*rinvsq22-krf2);
829 /* Calculate temporary vectorial force */
834 /* Update vectorial force */
838 f[j_coord_offset+DIM*2+XX] -= tx;
839 f[j_coord_offset+DIM*2+YY] -= ty;
840 f[j_coord_offset+DIM*2+ZZ] -= tz;
842 /**************************
843 * CALCULATE INTERACTIONS *
844 **************************/
846 /* REACTION-FIELD ELECTROSTATICS */
847 felec = qq23*(rinv23*rinvsq23-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;
864 /**************************
865 * CALCULATE INTERACTIONS *
866 **************************/
868 /* REACTION-FIELD ELECTROSTATICS */
869 felec = qq31*(rinv31*rinvsq31-krf2);
873 /* Calculate temporary vectorial force */
878 /* Update vectorial force */
882 f[j_coord_offset+DIM*1+XX] -= tx;
883 f[j_coord_offset+DIM*1+YY] -= ty;
884 f[j_coord_offset+DIM*1+ZZ] -= tz;
886 /**************************
887 * CALCULATE INTERACTIONS *
888 **************************/
890 /* REACTION-FIELD ELECTROSTATICS */
891 felec = qq32*(rinv32*rinvsq32-krf2);
895 /* Calculate temporary vectorial force */
900 /* Update vectorial force */
904 f[j_coord_offset+DIM*2+XX] -= tx;
905 f[j_coord_offset+DIM*2+YY] -= ty;
906 f[j_coord_offset+DIM*2+ZZ] -= tz;
908 /**************************
909 * CALCULATE INTERACTIONS *
910 **************************/
912 /* REACTION-FIELD ELECTROSTATICS */
913 felec = qq33*(rinv33*rinvsq33-krf2);
917 /* Calculate temporary vectorial force */
922 /* Update vectorial force */
926 f[j_coord_offset+DIM*3+XX] -= tx;
927 f[j_coord_offset+DIM*3+YY] -= ty;
928 f[j_coord_offset+DIM*3+ZZ] -= tz;
930 /* Inner loop uses 234 flops */
932 /* End of innermost loop */
935 f[i_coord_offset+DIM*1+XX] += fix1;
936 f[i_coord_offset+DIM*1+YY] += fiy1;
937 f[i_coord_offset+DIM*1+ZZ] += fiz1;
941 f[i_coord_offset+DIM*2+XX] += fix2;
942 f[i_coord_offset+DIM*2+YY] += fiy2;
943 f[i_coord_offset+DIM*2+ZZ] += fiz2;
947 f[i_coord_offset+DIM*3+XX] += fix3;
948 f[i_coord_offset+DIM*3+YY] += fiy3;
949 f[i_coord_offset+DIM*3+ZZ] += fiz3;
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_W4W4_F,outeriter*30 + inneriter*234);