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_ElecRFCut_VdwNone_GeomW3W3_VF_c
51 * Electrostatics interaction: ReactionField
52 * VdW interaction: None
53 * Geometry: Water3-Water3
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecRFCut_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];
132 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
133 rcutoff = fr->rcoulomb;
134 rcutoff2 = rcutoff*rcutoff;
139 /* Start outer loop over neighborlists */
140 for(iidx=0; iidx<nri; iidx++)
142 /* Load shift vector for this list */
143 i_shift_offset = DIM*shiftidx[iidx];
144 shX = shiftvec[i_shift_offset+XX];
145 shY = shiftvec[i_shift_offset+YY];
146 shZ = shiftvec[i_shift_offset+ZZ];
148 /* Load limits for loop over neighbors */
149 j_index_start = jindex[iidx];
150 j_index_end = jindex[iidx+1];
152 /* Get outer coordinate index */
154 i_coord_offset = DIM*inr;
156 /* Load i particle coords and add shift vector */
157 ix0 = shX + x[i_coord_offset+DIM*0+XX];
158 iy0 = shY + x[i_coord_offset+DIM*0+YY];
159 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
160 ix1 = shX + x[i_coord_offset+DIM*1+XX];
161 iy1 = shY + x[i_coord_offset+DIM*1+YY];
162 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
163 ix2 = shX + x[i_coord_offset+DIM*2+XX];
164 iy2 = shY + x[i_coord_offset+DIM*2+YY];
165 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
177 /* Reset potential sums */
180 /* Start inner kernel loop */
181 for(jidx=j_index_start; jidx<j_index_end; jidx++)
183 /* Get j neighbor index, and coordinate index */
185 j_coord_offset = DIM*jnr;
187 /* load j atom coordinates */
188 jx0 = x[j_coord_offset+DIM*0+XX];
189 jy0 = x[j_coord_offset+DIM*0+YY];
190 jz0 = x[j_coord_offset+DIM*0+ZZ];
191 jx1 = x[j_coord_offset+DIM*1+XX];
192 jy1 = x[j_coord_offset+DIM*1+YY];
193 jz1 = x[j_coord_offset+DIM*1+ZZ];
194 jx2 = x[j_coord_offset+DIM*2+XX];
195 jy2 = x[j_coord_offset+DIM*2+YY];
196 jz2 = x[j_coord_offset+DIM*2+ZZ];
198 /* Calculate displacement vector */
227 /* Calculate squared distance and things based on it */
228 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
229 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
230 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
231 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
232 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
233 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
234 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
235 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
236 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
238 rinv00 = gmx_invsqrt(rsq00);
239 rinv01 = gmx_invsqrt(rsq01);
240 rinv02 = gmx_invsqrt(rsq02);
241 rinv10 = gmx_invsqrt(rsq10);
242 rinv11 = gmx_invsqrt(rsq11);
243 rinv12 = gmx_invsqrt(rsq12);
244 rinv20 = gmx_invsqrt(rsq20);
245 rinv21 = gmx_invsqrt(rsq21);
246 rinv22 = gmx_invsqrt(rsq22);
248 rinvsq00 = rinv00*rinv00;
249 rinvsq01 = rinv01*rinv01;
250 rinvsq02 = rinv02*rinv02;
251 rinvsq10 = rinv10*rinv10;
252 rinvsq11 = rinv11*rinv11;
253 rinvsq12 = rinv12*rinv12;
254 rinvsq20 = rinv20*rinv20;
255 rinvsq21 = rinv21*rinv21;
256 rinvsq22 = rinv22*rinv22;
258 /**************************
259 * CALCULATE INTERACTIONS *
260 **************************/
265 /* REACTION-FIELD ELECTROSTATICS */
266 velec = qq00*(rinv00+krf*rsq00-crf);
267 felec = qq00*(rinv00*rinvsq00-krf2);
269 /* Update potential sums from outer loop */
274 /* Calculate temporary vectorial force */
279 /* Update vectorial force */
283 f[j_coord_offset+DIM*0+XX] -= tx;
284 f[j_coord_offset+DIM*0+YY] -= ty;
285 f[j_coord_offset+DIM*0+ZZ] -= tz;
289 /**************************
290 * CALCULATE INTERACTIONS *
291 **************************/
296 /* REACTION-FIELD ELECTROSTATICS */
297 velec = qq01*(rinv01+krf*rsq01-crf);
298 felec = qq01*(rinv01*rinvsq01-krf2);
300 /* Update potential sums from outer loop */
305 /* Calculate temporary vectorial force */
310 /* Update vectorial force */
314 f[j_coord_offset+DIM*1+XX] -= tx;
315 f[j_coord_offset+DIM*1+YY] -= ty;
316 f[j_coord_offset+DIM*1+ZZ] -= tz;
320 /**************************
321 * CALCULATE INTERACTIONS *
322 **************************/
327 /* REACTION-FIELD ELECTROSTATICS */
328 velec = qq02*(rinv02+krf*rsq02-crf);
329 felec = qq02*(rinv02*rinvsq02-krf2);
331 /* Update potential sums from outer loop */
336 /* Calculate temporary vectorial force */
341 /* Update vectorial force */
345 f[j_coord_offset+DIM*2+XX] -= tx;
346 f[j_coord_offset+DIM*2+YY] -= ty;
347 f[j_coord_offset+DIM*2+ZZ] -= tz;
351 /**************************
352 * CALCULATE INTERACTIONS *
353 **************************/
358 /* REACTION-FIELD ELECTROSTATICS */
359 velec = qq10*(rinv10+krf*rsq10-crf);
360 felec = qq10*(rinv10*rinvsq10-krf2);
362 /* Update potential sums from outer loop */
367 /* Calculate temporary vectorial force */
372 /* Update vectorial force */
376 f[j_coord_offset+DIM*0+XX] -= tx;
377 f[j_coord_offset+DIM*0+YY] -= ty;
378 f[j_coord_offset+DIM*0+ZZ] -= tz;
382 /**************************
383 * CALCULATE INTERACTIONS *
384 **************************/
389 /* REACTION-FIELD ELECTROSTATICS */
390 velec = qq11*(rinv11+krf*rsq11-crf);
391 felec = qq11*(rinv11*rinvsq11-krf2);
393 /* Update potential sums from outer loop */
398 /* Calculate temporary vectorial force */
403 /* Update vectorial force */
407 f[j_coord_offset+DIM*1+XX] -= tx;
408 f[j_coord_offset+DIM*1+YY] -= ty;
409 f[j_coord_offset+DIM*1+ZZ] -= tz;
413 /**************************
414 * CALCULATE INTERACTIONS *
415 **************************/
420 /* REACTION-FIELD ELECTROSTATICS */
421 velec = qq12*(rinv12+krf*rsq12-crf);
422 felec = qq12*(rinv12*rinvsq12-krf2);
424 /* Update potential sums from outer loop */
429 /* Calculate temporary vectorial force */
434 /* Update vectorial force */
438 f[j_coord_offset+DIM*2+XX] -= tx;
439 f[j_coord_offset+DIM*2+YY] -= ty;
440 f[j_coord_offset+DIM*2+ZZ] -= tz;
444 /**************************
445 * CALCULATE INTERACTIONS *
446 **************************/
451 /* REACTION-FIELD ELECTROSTATICS */
452 velec = qq20*(rinv20+krf*rsq20-crf);
453 felec = qq20*(rinv20*rinvsq20-krf2);
455 /* Update potential sums from outer loop */
460 /* Calculate temporary vectorial force */
465 /* Update vectorial force */
469 f[j_coord_offset+DIM*0+XX] -= tx;
470 f[j_coord_offset+DIM*0+YY] -= ty;
471 f[j_coord_offset+DIM*0+ZZ] -= tz;
475 /**************************
476 * CALCULATE INTERACTIONS *
477 **************************/
482 /* REACTION-FIELD ELECTROSTATICS */
483 velec = qq21*(rinv21+krf*rsq21-crf);
484 felec = qq21*(rinv21*rinvsq21-krf2);
486 /* Update potential sums from outer loop */
491 /* Calculate temporary vectorial force */
496 /* Update vectorial force */
500 f[j_coord_offset+DIM*1+XX] -= tx;
501 f[j_coord_offset+DIM*1+YY] -= ty;
502 f[j_coord_offset+DIM*1+ZZ] -= tz;
506 /**************************
507 * CALCULATE INTERACTIONS *
508 **************************/
513 /* REACTION-FIELD ELECTROSTATICS */
514 velec = qq22*(rinv22+krf*rsq22-crf);
515 felec = qq22*(rinv22*rinvsq22-krf2);
517 /* Update potential sums from outer loop */
522 /* Calculate temporary vectorial force */
527 /* Update vectorial force */
531 f[j_coord_offset+DIM*2+XX] -= tx;
532 f[j_coord_offset+DIM*2+YY] -= ty;
533 f[j_coord_offset+DIM*2+ZZ] -= tz;
537 /* Inner loop uses 279 flops */
539 /* End of innermost loop */
542 f[i_coord_offset+DIM*0+XX] += fix0;
543 f[i_coord_offset+DIM*0+YY] += fiy0;
544 f[i_coord_offset+DIM*0+ZZ] += fiz0;
548 f[i_coord_offset+DIM*1+XX] += fix1;
549 f[i_coord_offset+DIM*1+YY] += fiy1;
550 f[i_coord_offset+DIM*1+ZZ] += fiz1;
554 f[i_coord_offset+DIM*2+XX] += fix2;
555 f[i_coord_offset+DIM*2+YY] += fiy2;
556 f[i_coord_offset+DIM*2+ZZ] += fiz2;
560 fshift[i_shift_offset+XX] += tx;
561 fshift[i_shift_offset+YY] += ty;
562 fshift[i_shift_offset+ZZ] += tz;
565 /* Update potential energies */
566 kernel_data->energygrp_elec[ggid] += velecsum;
568 /* Increment number of inner iterations */
569 inneriter += j_index_end - j_index_start;
571 /* Outer loop uses 31 flops */
574 /* Increment number of outer iterations */
577 /* Update outer/inner flops */
579 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_VF,outeriter*31 + inneriter*279);
582 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwNone_GeomW3W3_F_c
583 * Electrostatics interaction: ReactionField
584 * VdW interaction: None
585 * Geometry: Water3-Water3
586 * Calculate force/pot: Force
589 nb_kernel_ElecRFCut_VdwNone_GeomW3W3_F_c
590 (t_nblist * gmx_restrict nlist,
591 rvec * gmx_restrict xx,
592 rvec * gmx_restrict ff,
593 t_forcerec * gmx_restrict fr,
594 t_mdatoms * gmx_restrict mdatoms,
595 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
596 t_nrnb * gmx_restrict nrnb)
598 int i_shift_offset,i_coord_offset,j_coord_offset;
599 int j_index_start,j_index_end;
600 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
601 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
602 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
603 real *shiftvec,*fshift,*x,*f;
605 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
607 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
609 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
611 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
613 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
615 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
616 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
617 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
618 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
619 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
620 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
621 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
622 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
623 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
624 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
625 real velec,felec,velecsum,facel,crf,krf,krf2;
633 jindex = nlist->jindex;
635 shiftidx = nlist->shift;
637 shiftvec = fr->shift_vec[0];
638 fshift = fr->fshift[0];
640 charge = mdatoms->chargeA;
645 /* Setup water-specific parameters */
646 inr = nlist->iinr[0];
647 iq0 = facel*charge[inr+0];
648 iq1 = facel*charge[inr+1];
649 iq2 = facel*charge[inr+2];
664 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
665 rcutoff = fr->rcoulomb;
666 rcutoff2 = rcutoff*rcutoff;
671 /* Start outer loop over neighborlists */
672 for(iidx=0; iidx<nri; iidx++)
674 /* Load shift vector for this list */
675 i_shift_offset = DIM*shiftidx[iidx];
676 shX = shiftvec[i_shift_offset+XX];
677 shY = shiftvec[i_shift_offset+YY];
678 shZ = shiftvec[i_shift_offset+ZZ];
680 /* Load limits for loop over neighbors */
681 j_index_start = jindex[iidx];
682 j_index_end = jindex[iidx+1];
684 /* Get outer coordinate index */
686 i_coord_offset = DIM*inr;
688 /* Load i particle coords and add shift vector */
689 ix0 = shX + x[i_coord_offset+DIM*0+XX];
690 iy0 = shY + x[i_coord_offset+DIM*0+YY];
691 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
692 ix1 = shX + x[i_coord_offset+DIM*1+XX];
693 iy1 = shY + x[i_coord_offset+DIM*1+YY];
694 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
695 ix2 = shX + x[i_coord_offset+DIM*2+XX];
696 iy2 = shY + x[i_coord_offset+DIM*2+YY];
697 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
709 /* Start inner kernel loop */
710 for(jidx=j_index_start; jidx<j_index_end; jidx++)
712 /* Get j neighbor index, and coordinate index */
714 j_coord_offset = DIM*jnr;
716 /* load j atom coordinates */
717 jx0 = x[j_coord_offset+DIM*0+XX];
718 jy0 = x[j_coord_offset+DIM*0+YY];
719 jz0 = x[j_coord_offset+DIM*0+ZZ];
720 jx1 = x[j_coord_offset+DIM*1+XX];
721 jy1 = x[j_coord_offset+DIM*1+YY];
722 jz1 = x[j_coord_offset+DIM*1+ZZ];
723 jx2 = x[j_coord_offset+DIM*2+XX];
724 jy2 = x[j_coord_offset+DIM*2+YY];
725 jz2 = x[j_coord_offset+DIM*2+ZZ];
727 /* Calculate displacement vector */
756 /* Calculate squared distance and things based on it */
757 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
758 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
759 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
760 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
761 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
762 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
763 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
764 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
765 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
767 rinv00 = gmx_invsqrt(rsq00);
768 rinv01 = gmx_invsqrt(rsq01);
769 rinv02 = gmx_invsqrt(rsq02);
770 rinv10 = gmx_invsqrt(rsq10);
771 rinv11 = gmx_invsqrt(rsq11);
772 rinv12 = gmx_invsqrt(rsq12);
773 rinv20 = gmx_invsqrt(rsq20);
774 rinv21 = gmx_invsqrt(rsq21);
775 rinv22 = gmx_invsqrt(rsq22);
777 rinvsq00 = rinv00*rinv00;
778 rinvsq01 = rinv01*rinv01;
779 rinvsq02 = rinv02*rinv02;
780 rinvsq10 = rinv10*rinv10;
781 rinvsq11 = rinv11*rinv11;
782 rinvsq12 = rinv12*rinv12;
783 rinvsq20 = rinv20*rinv20;
784 rinvsq21 = rinv21*rinv21;
785 rinvsq22 = rinv22*rinv22;
787 /**************************
788 * CALCULATE INTERACTIONS *
789 **************************/
794 /* REACTION-FIELD ELECTROSTATICS */
795 felec = qq00*(rinv00*rinvsq00-krf2);
799 /* Calculate temporary vectorial force */
804 /* Update vectorial force */
808 f[j_coord_offset+DIM*0+XX] -= tx;
809 f[j_coord_offset+DIM*0+YY] -= ty;
810 f[j_coord_offset+DIM*0+ZZ] -= tz;
814 /**************************
815 * CALCULATE INTERACTIONS *
816 **************************/
821 /* REACTION-FIELD ELECTROSTATICS */
822 felec = qq01*(rinv01*rinvsq01-krf2);
826 /* Calculate temporary vectorial force */
831 /* Update vectorial force */
835 f[j_coord_offset+DIM*1+XX] -= tx;
836 f[j_coord_offset+DIM*1+YY] -= ty;
837 f[j_coord_offset+DIM*1+ZZ] -= tz;
841 /**************************
842 * CALCULATE INTERACTIONS *
843 **************************/
848 /* REACTION-FIELD ELECTROSTATICS */
849 felec = qq02*(rinv02*rinvsq02-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;
868 /**************************
869 * CALCULATE INTERACTIONS *
870 **************************/
875 /* REACTION-FIELD ELECTROSTATICS */
876 felec = qq10*(rinv10*rinvsq10-krf2);
880 /* Calculate temporary vectorial force */
885 /* Update vectorial force */
889 f[j_coord_offset+DIM*0+XX] -= tx;
890 f[j_coord_offset+DIM*0+YY] -= ty;
891 f[j_coord_offset+DIM*0+ZZ] -= tz;
895 /**************************
896 * CALCULATE INTERACTIONS *
897 **************************/
902 /* REACTION-FIELD ELECTROSTATICS */
903 felec = qq11*(rinv11*rinvsq11-krf2);
907 /* Calculate temporary vectorial force */
912 /* Update vectorial force */
916 f[j_coord_offset+DIM*1+XX] -= tx;
917 f[j_coord_offset+DIM*1+YY] -= ty;
918 f[j_coord_offset+DIM*1+ZZ] -= tz;
922 /**************************
923 * CALCULATE INTERACTIONS *
924 **************************/
929 /* REACTION-FIELD ELECTROSTATICS */
930 felec = qq12*(rinv12*rinvsq12-krf2);
934 /* Calculate temporary vectorial force */
939 /* Update vectorial force */
943 f[j_coord_offset+DIM*2+XX] -= tx;
944 f[j_coord_offset+DIM*2+YY] -= ty;
945 f[j_coord_offset+DIM*2+ZZ] -= tz;
949 /**************************
950 * CALCULATE INTERACTIONS *
951 **************************/
956 /* REACTION-FIELD ELECTROSTATICS */
957 felec = qq20*(rinv20*rinvsq20-krf2);
961 /* Calculate temporary vectorial force */
966 /* Update vectorial force */
970 f[j_coord_offset+DIM*0+XX] -= tx;
971 f[j_coord_offset+DIM*0+YY] -= ty;
972 f[j_coord_offset+DIM*0+ZZ] -= tz;
976 /**************************
977 * CALCULATE INTERACTIONS *
978 **************************/
983 /* REACTION-FIELD ELECTROSTATICS */
984 felec = qq21*(rinv21*rinvsq21-krf2);
988 /* Calculate temporary vectorial force */
993 /* Update vectorial force */
997 f[j_coord_offset+DIM*1+XX] -= tx;
998 f[j_coord_offset+DIM*1+YY] -= ty;
999 f[j_coord_offset+DIM*1+ZZ] -= tz;
1003 /**************************
1004 * CALCULATE INTERACTIONS *
1005 **************************/
1010 /* REACTION-FIELD ELECTROSTATICS */
1011 felec = qq22*(rinv22*rinvsq22-krf2);
1015 /* Calculate temporary vectorial force */
1020 /* Update vectorial force */
1024 f[j_coord_offset+DIM*2+XX] -= tx;
1025 f[j_coord_offset+DIM*2+YY] -= ty;
1026 f[j_coord_offset+DIM*2+ZZ] -= tz;
1030 /* Inner loop uses 234 flops */
1032 /* End of innermost loop */
1035 f[i_coord_offset+DIM*0+XX] += fix0;
1036 f[i_coord_offset+DIM*0+YY] += fiy0;
1037 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1041 f[i_coord_offset+DIM*1+XX] += fix1;
1042 f[i_coord_offset+DIM*1+YY] += fiy1;
1043 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1047 f[i_coord_offset+DIM*2+XX] += fix2;
1048 f[i_coord_offset+DIM*2+YY] += fiy2;
1049 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1053 fshift[i_shift_offset+XX] += tx;
1054 fshift[i_shift_offset+YY] += ty;
1055 fshift[i_shift_offset+ZZ] += tz;
1057 /* Increment number of inner iterations */
1058 inneriter += j_index_end - j_index_start;
1060 /* Outer loop uses 30 flops */
1063 /* Increment number of outer iterations */
1066 /* Update outer/inner flops */
1068 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_F,outeriter*30 + inneriter*234);