2 * Note: this file was generated by the Gromacs c kernel generator.
4 * This source code is part of
8 * Copyright (c) 2001-2012, The GROMACS Development Team
10 * Gromacs is a library for molecular simulation and trajectory analysis,
11 * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
12 * a full list of developers and information, check out http://www.gromacs.org
14 * This program is free software; you can redistribute it and/or modify it under
15 * the terms of the GNU Lesser General Public License as published by the Free
16 * Software Foundation; either version 2 of the License, or (at your option) any
19 * To help fund GROMACS development, we humbly ask that you cite
20 * the papers people have written on it - you can find them on the website.
28 #include "../nb_kernel.h"
29 #include "types/simple.h"
34 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomW3W3_VF_c
35 * Electrostatics interaction: ReactionField
36 * VdW interaction: None
37 * Geometry: Water3-Water3
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecRF_VdwNone_GeomW3W3_VF_c
42 (t_nblist * gmx_restrict nlist,
43 rvec * gmx_restrict xx,
44 rvec * gmx_restrict ff,
45 t_forcerec * gmx_restrict fr,
46 t_mdatoms * gmx_restrict mdatoms,
47 nb_kernel_data_t * gmx_restrict kernel_data,
48 t_nrnb * gmx_restrict nrnb)
50 int i_shift_offset,i_coord_offset,j_coord_offset;
51 int j_index_start,j_index_end;
52 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
53 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
54 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
55 real *shiftvec,*fshift,*x,*f;
57 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
59 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
61 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
63 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
65 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
67 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
68 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
69 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
70 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
71 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
72 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
73 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
74 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
75 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
76 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
77 real velec,felec,velecsum,facel,crf,krf,krf2;
85 jindex = nlist->jindex;
87 shiftidx = nlist->shift;
89 shiftvec = fr->shift_vec[0];
90 fshift = fr->fshift[0];
92 charge = mdatoms->chargeA;
97 /* Setup water-specific parameters */
99 iq0 = facel*charge[inr+0];
100 iq1 = facel*charge[inr+1];
101 iq2 = facel*charge[inr+2];
119 /* Start outer loop over neighborlists */
120 for(iidx=0; iidx<nri; iidx++)
122 /* Load shift vector for this list */
123 i_shift_offset = DIM*shiftidx[iidx];
124 shX = shiftvec[i_shift_offset+XX];
125 shY = shiftvec[i_shift_offset+YY];
126 shZ = shiftvec[i_shift_offset+ZZ];
128 /* Load limits for loop over neighbors */
129 j_index_start = jindex[iidx];
130 j_index_end = jindex[iidx+1];
132 /* Get outer coordinate index */
134 i_coord_offset = DIM*inr;
136 /* Load i particle coords and add shift vector */
137 ix0 = shX + x[i_coord_offset+DIM*0+XX];
138 iy0 = shY + x[i_coord_offset+DIM*0+YY];
139 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
140 ix1 = shX + x[i_coord_offset+DIM*1+XX];
141 iy1 = shY + x[i_coord_offset+DIM*1+YY];
142 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
143 ix2 = shX + x[i_coord_offset+DIM*2+XX];
144 iy2 = shY + x[i_coord_offset+DIM*2+YY];
145 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
157 /* Reset potential sums */
160 /* Start inner kernel loop */
161 for(jidx=j_index_start; jidx<j_index_end; jidx++)
163 /* Get j neighbor index, and coordinate index */
165 j_coord_offset = DIM*jnr;
167 /* load j atom coordinates */
168 jx0 = x[j_coord_offset+DIM*0+XX];
169 jy0 = x[j_coord_offset+DIM*0+YY];
170 jz0 = x[j_coord_offset+DIM*0+ZZ];
171 jx1 = x[j_coord_offset+DIM*1+XX];
172 jy1 = x[j_coord_offset+DIM*1+YY];
173 jz1 = x[j_coord_offset+DIM*1+ZZ];
174 jx2 = x[j_coord_offset+DIM*2+XX];
175 jy2 = x[j_coord_offset+DIM*2+YY];
176 jz2 = x[j_coord_offset+DIM*2+ZZ];
178 /* Calculate displacement vector */
207 /* Calculate squared distance and things based on it */
208 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
209 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
210 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
211 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
212 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
213 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
214 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
215 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
216 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
218 rinv00 = gmx_invsqrt(rsq00);
219 rinv01 = gmx_invsqrt(rsq01);
220 rinv02 = gmx_invsqrt(rsq02);
221 rinv10 = gmx_invsqrt(rsq10);
222 rinv11 = gmx_invsqrt(rsq11);
223 rinv12 = gmx_invsqrt(rsq12);
224 rinv20 = gmx_invsqrt(rsq20);
225 rinv21 = gmx_invsqrt(rsq21);
226 rinv22 = gmx_invsqrt(rsq22);
228 rinvsq00 = rinv00*rinv00;
229 rinvsq01 = rinv01*rinv01;
230 rinvsq02 = rinv02*rinv02;
231 rinvsq10 = rinv10*rinv10;
232 rinvsq11 = rinv11*rinv11;
233 rinvsq12 = rinv12*rinv12;
234 rinvsq20 = rinv20*rinv20;
235 rinvsq21 = rinv21*rinv21;
236 rinvsq22 = rinv22*rinv22;
238 /**************************
239 * CALCULATE INTERACTIONS *
240 **************************/
242 /* REACTION-FIELD ELECTROSTATICS */
243 velec = qq00*(rinv00+krf*rsq00-crf);
244 felec = qq00*(rinv00*rinvsq00-krf2);
246 /* Update potential sums from outer loop */
251 /* Calculate temporary vectorial force */
256 /* Update vectorial force */
260 f[j_coord_offset+DIM*0+XX] -= tx;
261 f[j_coord_offset+DIM*0+YY] -= ty;
262 f[j_coord_offset+DIM*0+ZZ] -= tz;
264 /**************************
265 * CALCULATE INTERACTIONS *
266 **************************/
268 /* REACTION-FIELD ELECTROSTATICS */
269 velec = qq01*(rinv01+krf*rsq01-crf);
270 felec = qq01*(rinv01*rinvsq01-krf2);
272 /* Update potential sums from outer loop */
277 /* Calculate temporary vectorial force */
282 /* Update vectorial force */
286 f[j_coord_offset+DIM*1+XX] -= tx;
287 f[j_coord_offset+DIM*1+YY] -= ty;
288 f[j_coord_offset+DIM*1+ZZ] -= tz;
290 /**************************
291 * CALCULATE INTERACTIONS *
292 **************************/
294 /* REACTION-FIELD ELECTROSTATICS */
295 velec = qq02*(rinv02+krf*rsq02-crf);
296 felec = qq02*(rinv02*rinvsq02-krf2);
298 /* Update potential sums from outer loop */
303 /* Calculate temporary vectorial force */
308 /* Update vectorial force */
312 f[j_coord_offset+DIM*2+XX] -= tx;
313 f[j_coord_offset+DIM*2+YY] -= ty;
314 f[j_coord_offset+DIM*2+ZZ] -= tz;
316 /**************************
317 * CALCULATE INTERACTIONS *
318 **************************/
320 /* REACTION-FIELD ELECTROSTATICS */
321 velec = qq10*(rinv10+krf*rsq10-crf);
322 felec = qq10*(rinv10*rinvsq10-krf2);
324 /* Update potential sums from outer loop */
329 /* Calculate temporary vectorial force */
334 /* Update vectorial force */
338 f[j_coord_offset+DIM*0+XX] -= tx;
339 f[j_coord_offset+DIM*0+YY] -= ty;
340 f[j_coord_offset+DIM*0+ZZ] -= tz;
342 /**************************
343 * CALCULATE INTERACTIONS *
344 **************************/
346 /* REACTION-FIELD ELECTROSTATICS */
347 velec = qq11*(rinv11+krf*rsq11-crf);
348 felec = qq11*(rinv11*rinvsq11-krf2);
350 /* Update potential sums from outer loop */
355 /* Calculate temporary vectorial force */
360 /* Update vectorial force */
364 f[j_coord_offset+DIM*1+XX] -= tx;
365 f[j_coord_offset+DIM*1+YY] -= ty;
366 f[j_coord_offset+DIM*1+ZZ] -= tz;
368 /**************************
369 * CALCULATE INTERACTIONS *
370 **************************/
372 /* REACTION-FIELD ELECTROSTATICS */
373 velec = qq12*(rinv12+krf*rsq12-crf);
374 felec = qq12*(rinv12*rinvsq12-krf2);
376 /* Update potential sums from outer loop */
381 /* Calculate temporary vectorial force */
386 /* Update vectorial force */
390 f[j_coord_offset+DIM*2+XX] -= tx;
391 f[j_coord_offset+DIM*2+YY] -= ty;
392 f[j_coord_offset+DIM*2+ZZ] -= tz;
394 /**************************
395 * CALCULATE INTERACTIONS *
396 **************************/
398 /* REACTION-FIELD ELECTROSTATICS */
399 velec = qq20*(rinv20+krf*rsq20-crf);
400 felec = qq20*(rinv20*rinvsq20-krf2);
402 /* Update potential sums from outer loop */
407 /* Calculate temporary vectorial force */
412 /* Update vectorial force */
416 f[j_coord_offset+DIM*0+XX] -= tx;
417 f[j_coord_offset+DIM*0+YY] -= ty;
418 f[j_coord_offset+DIM*0+ZZ] -= tz;
420 /**************************
421 * CALCULATE INTERACTIONS *
422 **************************/
424 /* REACTION-FIELD ELECTROSTATICS */
425 velec = qq21*(rinv21+krf*rsq21-crf);
426 felec = qq21*(rinv21*rinvsq21-krf2);
428 /* Update potential sums from outer loop */
433 /* Calculate temporary vectorial force */
438 /* Update vectorial force */
442 f[j_coord_offset+DIM*1+XX] -= tx;
443 f[j_coord_offset+DIM*1+YY] -= ty;
444 f[j_coord_offset+DIM*1+ZZ] -= tz;
446 /**************************
447 * CALCULATE INTERACTIONS *
448 **************************/
450 /* REACTION-FIELD ELECTROSTATICS */
451 velec = qq22*(rinv22+krf*rsq22-crf);
452 felec = qq22*(rinv22*rinvsq22-krf2);
454 /* Update potential sums from outer loop */
459 /* Calculate temporary vectorial force */
464 /* Update vectorial force */
468 f[j_coord_offset+DIM*2+XX] -= tx;
469 f[j_coord_offset+DIM*2+YY] -= ty;
470 f[j_coord_offset+DIM*2+ZZ] -= tz;
472 /* Inner loop uses 279 flops */
474 /* End of innermost loop */
477 f[i_coord_offset+DIM*0+XX] += fix0;
478 f[i_coord_offset+DIM*0+YY] += fiy0;
479 f[i_coord_offset+DIM*0+ZZ] += fiz0;
483 f[i_coord_offset+DIM*1+XX] += fix1;
484 f[i_coord_offset+DIM*1+YY] += fiy1;
485 f[i_coord_offset+DIM*1+ZZ] += fiz1;
489 f[i_coord_offset+DIM*2+XX] += fix2;
490 f[i_coord_offset+DIM*2+YY] += fiy2;
491 f[i_coord_offset+DIM*2+ZZ] += fiz2;
495 fshift[i_shift_offset+XX] += tx;
496 fshift[i_shift_offset+YY] += ty;
497 fshift[i_shift_offset+ZZ] += tz;
500 /* Update potential energies */
501 kernel_data->energygrp_elec[ggid] += velecsum;
503 /* Increment number of inner iterations */
504 inneriter += j_index_end - j_index_start;
506 /* Outer loop uses 31 flops */
509 /* Increment number of outer iterations */
512 /* Update outer/inner flops */
514 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_VF,outeriter*31 + inneriter*279);
517 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomW3W3_F_c
518 * Electrostatics interaction: ReactionField
519 * VdW interaction: None
520 * Geometry: Water3-Water3
521 * Calculate force/pot: Force
524 nb_kernel_ElecRF_VdwNone_GeomW3W3_F_c
525 (t_nblist * gmx_restrict nlist,
526 rvec * gmx_restrict xx,
527 rvec * gmx_restrict ff,
528 t_forcerec * gmx_restrict fr,
529 t_mdatoms * gmx_restrict mdatoms,
530 nb_kernel_data_t * gmx_restrict kernel_data,
531 t_nrnb * gmx_restrict nrnb)
533 int i_shift_offset,i_coord_offset,j_coord_offset;
534 int j_index_start,j_index_end;
535 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
536 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
537 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
538 real *shiftvec,*fshift,*x,*f;
540 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
542 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
544 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
546 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
548 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
550 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
551 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
552 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
553 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
554 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
555 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
556 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
557 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
558 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
559 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
560 real velec,felec,velecsum,facel,crf,krf,krf2;
568 jindex = nlist->jindex;
570 shiftidx = nlist->shift;
572 shiftvec = fr->shift_vec[0];
573 fshift = fr->fshift[0];
575 charge = mdatoms->chargeA;
580 /* Setup water-specific parameters */
581 inr = nlist->iinr[0];
582 iq0 = facel*charge[inr+0];
583 iq1 = facel*charge[inr+1];
584 iq2 = facel*charge[inr+2];
602 /* Start outer loop over neighborlists */
603 for(iidx=0; iidx<nri; iidx++)
605 /* Load shift vector for this list */
606 i_shift_offset = DIM*shiftidx[iidx];
607 shX = shiftvec[i_shift_offset+XX];
608 shY = shiftvec[i_shift_offset+YY];
609 shZ = shiftvec[i_shift_offset+ZZ];
611 /* Load limits for loop over neighbors */
612 j_index_start = jindex[iidx];
613 j_index_end = jindex[iidx+1];
615 /* Get outer coordinate index */
617 i_coord_offset = DIM*inr;
619 /* Load i particle coords and add shift vector */
620 ix0 = shX + x[i_coord_offset+DIM*0+XX];
621 iy0 = shY + x[i_coord_offset+DIM*0+YY];
622 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
623 ix1 = shX + x[i_coord_offset+DIM*1+XX];
624 iy1 = shY + x[i_coord_offset+DIM*1+YY];
625 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
626 ix2 = shX + x[i_coord_offset+DIM*2+XX];
627 iy2 = shY + x[i_coord_offset+DIM*2+YY];
628 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
640 /* Start inner kernel loop */
641 for(jidx=j_index_start; jidx<j_index_end; jidx++)
643 /* Get j neighbor index, and coordinate index */
645 j_coord_offset = DIM*jnr;
647 /* load j atom coordinates */
648 jx0 = x[j_coord_offset+DIM*0+XX];
649 jy0 = x[j_coord_offset+DIM*0+YY];
650 jz0 = x[j_coord_offset+DIM*0+ZZ];
651 jx1 = x[j_coord_offset+DIM*1+XX];
652 jy1 = x[j_coord_offset+DIM*1+YY];
653 jz1 = x[j_coord_offset+DIM*1+ZZ];
654 jx2 = x[j_coord_offset+DIM*2+XX];
655 jy2 = x[j_coord_offset+DIM*2+YY];
656 jz2 = x[j_coord_offset+DIM*2+ZZ];
658 /* Calculate displacement vector */
687 /* Calculate squared distance and things based on it */
688 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
689 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
690 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
691 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
692 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
693 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
694 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
695 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
696 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
698 rinv00 = gmx_invsqrt(rsq00);
699 rinv01 = gmx_invsqrt(rsq01);
700 rinv02 = gmx_invsqrt(rsq02);
701 rinv10 = gmx_invsqrt(rsq10);
702 rinv11 = gmx_invsqrt(rsq11);
703 rinv12 = gmx_invsqrt(rsq12);
704 rinv20 = gmx_invsqrt(rsq20);
705 rinv21 = gmx_invsqrt(rsq21);
706 rinv22 = gmx_invsqrt(rsq22);
708 rinvsq00 = rinv00*rinv00;
709 rinvsq01 = rinv01*rinv01;
710 rinvsq02 = rinv02*rinv02;
711 rinvsq10 = rinv10*rinv10;
712 rinvsq11 = rinv11*rinv11;
713 rinvsq12 = rinv12*rinv12;
714 rinvsq20 = rinv20*rinv20;
715 rinvsq21 = rinv21*rinv21;
716 rinvsq22 = rinv22*rinv22;
718 /**************************
719 * CALCULATE INTERACTIONS *
720 **************************/
722 /* REACTION-FIELD ELECTROSTATICS */
723 felec = qq00*(rinv00*rinvsq00-krf2);
727 /* Calculate temporary vectorial force */
732 /* Update vectorial force */
736 f[j_coord_offset+DIM*0+XX] -= tx;
737 f[j_coord_offset+DIM*0+YY] -= ty;
738 f[j_coord_offset+DIM*0+ZZ] -= tz;
740 /**************************
741 * CALCULATE INTERACTIONS *
742 **************************/
744 /* REACTION-FIELD ELECTROSTATICS */
745 felec = qq01*(rinv01*rinvsq01-krf2);
749 /* Calculate temporary vectorial force */
754 /* Update vectorial force */
758 f[j_coord_offset+DIM*1+XX] -= tx;
759 f[j_coord_offset+DIM*1+YY] -= ty;
760 f[j_coord_offset+DIM*1+ZZ] -= tz;
762 /**************************
763 * CALCULATE INTERACTIONS *
764 **************************/
766 /* REACTION-FIELD ELECTROSTATICS */
767 felec = qq02*(rinv02*rinvsq02-krf2);
771 /* Calculate temporary vectorial force */
776 /* Update vectorial force */
780 f[j_coord_offset+DIM*2+XX] -= tx;
781 f[j_coord_offset+DIM*2+YY] -= ty;
782 f[j_coord_offset+DIM*2+ZZ] -= tz;
784 /**************************
785 * CALCULATE INTERACTIONS *
786 **************************/
788 /* REACTION-FIELD ELECTROSTATICS */
789 felec = qq10*(rinv10*rinvsq10-krf2);
793 /* Calculate temporary vectorial force */
798 /* Update vectorial force */
802 f[j_coord_offset+DIM*0+XX] -= tx;
803 f[j_coord_offset+DIM*0+YY] -= ty;
804 f[j_coord_offset+DIM*0+ZZ] -= tz;
806 /**************************
807 * CALCULATE INTERACTIONS *
808 **************************/
810 /* REACTION-FIELD ELECTROSTATICS */
811 felec = qq11*(rinv11*rinvsq11-krf2);
815 /* Calculate temporary vectorial force */
820 /* Update vectorial force */
824 f[j_coord_offset+DIM*1+XX] -= tx;
825 f[j_coord_offset+DIM*1+YY] -= ty;
826 f[j_coord_offset+DIM*1+ZZ] -= tz;
828 /**************************
829 * CALCULATE INTERACTIONS *
830 **************************/
832 /* REACTION-FIELD ELECTROSTATICS */
833 felec = qq12*(rinv12*rinvsq12-krf2);
837 /* Calculate temporary vectorial force */
842 /* Update vectorial force */
846 f[j_coord_offset+DIM*2+XX] -= tx;
847 f[j_coord_offset+DIM*2+YY] -= ty;
848 f[j_coord_offset+DIM*2+ZZ] -= tz;
850 /**************************
851 * CALCULATE INTERACTIONS *
852 **************************/
854 /* REACTION-FIELD ELECTROSTATICS */
855 felec = qq20*(rinv20*rinvsq20-krf2);
859 /* Calculate temporary vectorial force */
864 /* Update vectorial force */
868 f[j_coord_offset+DIM*0+XX] -= tx;
869 f[j_coord_offset+DIM*0+YY] -= ty;
870 f[j_coord_offset+DIM*0+ZZ] -= tz;
872 /**************************
873 * CALCULATE INTERACTIONS *
874 **************************/
876 /* REACTION-FIELD ELECTROSTATICS */
877 felec = qq21*(rinv21*rinvsq21-krf2);
881 /* Calculate temporary vectorial force */
886 /* Update vectorial force */
890 f[j_coord_offset+DIM*1+XX] -= tx;
891 f[j_coord_offset+DIM*1+YY] -= ty;
892 f[j_coord_offset+DIM*1+ZZ] -= tz;
894 /**************************
895 * CALCULATE INTERACTIONS *
896 **************************/
898 /* REACTION-FIELD ELECTROSTATICS */
899 felec = qq22*(rinv22*rinvsq22-krf2);
903 /* Calculate temporary vectorial force */
908 /* Update vectorial force */
912 f[j_coord_offset+DIM*2+XX] -= tx;
913 f[j_coord_offset+DIM*2+YY] -= ty;
914 f[j_coord_offset+DIM*2+ZZ] -= tz;
916 /* Inner loop uses 234 flops */
918 /* End of innermost loop */
921 f[i_coord_offset+DIM*0+XX] += fix0;
922 f[i_coord_offset+DIM*0+YY] += fiy0;
923 f[i_coord_offset+DIM*0+ZZ] += fiz0;
927 f[i_coord_offset+DIM*1+XX] += fix1;
928 f[i_coord_offset+DIM*1+YY] += fiy1;
929 f[i_coord_offset+DIM*1+ZZ] += fiz1;
933 f[i_coord_offset+DIM*2+XX] += fix2;
934 f[i_coord_offset+DIM*2+YY] += fiy2;
935 f[i_coord_offset+DIM*2+ZZ] += fiz2;
939 fshift[i_shift_offset+XX] += tx;
940 fshift[i_shift_offset+YY] += ty;
941 fshift[i_shift_offset+ZZ] += tz;
943 /* Increment number of inner iterations */
944 inneriter += j_index_end - j_index_start;
946 /* Outer loop uses 30 flops */
949 /* Increment number of outer iterations */
952 /* Update outer/inner flops */
954 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W3W3_F,outeriter*30 + inneriter*234);