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_GeomW4W4_VF_c
35 * Electrostatics interaction: ReactionField
36 * VdW interaction: None
37 * Geometry: Water4-Water4
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecRF_VdwNone_GeomW4W4_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 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
59 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
61 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
63 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
65 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
67 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
68 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
69 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
70 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
71 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
72 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
73 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
74 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
75 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
76 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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 iq1 = facel*charge[inr+1];
100 iq2 = facel*charge[inr+2];
101 iq3 = facel*charge[inr+3];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
138 iy1 = shY + x[i_coord_offset+DIM*1+YY];
139 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
140 ix2 = shX + x[i_coord_offset+DIM*2+XX];
141 iy2 = shY + x[i_coord_offset+DIM*2+YY];
142 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
143 ix3 = shX + x[i_coord_offset+DIM*3+XX];
144 iy3 = shY + x[i_coord_offset+DIM*3+YY];
145 iz3 = shZ + x[i_coord_offset+DIM*3+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 jx1 = x[j_coord_offset+DIM*1+XX];
169 jy1 = x[j_coord_offset+DIM*1+YY];
170 jz1 = x[j_coord_offset+DIM*1+ZZ];
171 jx2 = x[j_coord_offset+DIM*2+XX];
172 jy2 = x[j_coord_offset+DIM*2+YY];
173 jz2 = x[j_coord_offset+DIM*2+ZZ];
174 jx3 = x[j_coord_offset+DIM*3+XX];
175 jy3 = x[j_coord_offset+DIM*3+YY];
176 jz3 = x[j_coord_offset+DIM*3+ZZ];
178 /* Calculate displacement vector */
207 /* Calculate squared distance and things based on it */
208 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
209 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
210 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
211 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
212 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
213 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
214 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
215 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
216 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
218 rinv11 = gmx_invsqrt(rsq11);
219 rinv12 = gmx_invsqrt(rsq12);
220 rinv13 = gmx_invsqrt(rsq13);
221 rinv21 = gmx_invsqrt(rsq21);
222 rinv22 = gmx_invsqrt(rsq22);
223 rinv23 = gmx_invsqrt(rsq23);
224 rinv31 = gmx_invsqrt(rsq31);
225 rinv32 = gmx_invsqrt(rsq32);
226 rinv33 = gmx_invsqrt(rsq33);
228 rinvsq11 = rinv11*rinv11;
229 rinvsq12 = rinv12*rinv12;
230 rinvsq13 = rinv13*rinv13;
231 rinvsq21 = rinv21*rinv21;
232 rinvsq22 = rinv22*rinv22;
233 rinvsq23 = rinv23*rinv23;
234 rinvsq31 = rinv31*rinv31;
235 rinvsq32 = rinv32*rinv32;
236 rinvsq33 = rinv33*rinv33;
238 /**************************
239 * CALCULATE INTERACTIONS *
240 **************************/
242 /* REACTION-FIELD ELECTROSTATICS */
243 velec = qq11*(rinv11+krf*rsq11-crf);
244 felec = qq11*(rinv11*rinvsq11-krf2);
246 /* Update potential sums from outer loop */
251 /* Calculate temporary vectorial force */
256 /* Update vectorial force */
260 f[j_coord_offset+DIM*1+XX] -= tx;
261 f[j_coord_offset+DIM*1+YY] -= ty;
262 f[j_coord_offset+DIM*1+ZZ] -= tz;
264 /**************************
265 * CALCULATE INTERACTIONS *
266 **************************/
268 /* REACTION-FIELD ELECTROSTATICS */
269 velec = qq12*(rinv12+krf*rsq12-crf);
270 felec = qq12*(rinv12*rinvsq12-krf2);
272 /* Update potential sums from outer loop */
277 /* Calculate temporary vectorial force */
282 /* Update vectorial force */
286 f[j_coord_offset+DIM*2+XX] -= tx;
287 f[j_coord_offset+DIM*2+YY] -= ty;
288 f[j_coord_offset+DIM*2+ZZ] -= tz;
290 /**************************
291 * CALCULATE INTERACTIONS *
292 **************************/
294 /* REACTION-FIELD ELECTROSTATICS */
295 velec = qq13*(rinv13+krf*rsq13-crf);
296 felec = qq13*(rinv13*rinvsq13-krf2);
298 /* Update potential sums from outer loop */
303 /* Calculate temporary vectorial force */
308 /* Update vectorial force */
312 f[j_coord_offset+DIM*3+XX] -= tx;
313 f[j_coord_offset+DIM*3+YY] -= ty;
314 f[j_coord_offset+DIM*3+ZZ] -= tz;
316 /**************************
317 * CALCULATE INTERACTIONS *
318 **************************/
320 /* REACTION-FIELD ELECTROSTATICS */
321 velec = qq21*(rinv21+krf*rsq21-crf);
322 felec = qq21*(rinv21*rinvsq21-krf2);
324 /* Update potential sums from outer loop */
329 /* Calculate temporary vectorial force */
334 /* Update vectorial force */
338 f[j_coord_offset+DIM*1+XX] -= tx;
339 f[j_coord_offset+DIM*1+YY] -= ty;
340 f[j_coord_offset+DIM*1+ZZ] -= tz;
342 /**************************
343 * CALCULATE INTERACTIONS *
344 **************************/
346 /* REACTION-FIELD ELECTROSTATICS */
347 velec = qq22*(rinv22+krf*rsq22-crf);
348 felec = qq22*(rinv22*rinvsq22-krf2);
350 /* Update potential sums from outer loop */
355 /* Calculate temporary vectorial force */
360 /* Update vectorial force */
364 f[j_coord_offset+DIM*2+XX] -= tx;
365 f[j_coord_offset+DIM*2+YY] -= ty;
366 f[j_coord_offset+DIM*2+ZZ] -= tz;
368 /**************************
369 * CALCULATE INTERACTIONS *
370 **************************/
372 /* REACTION-FIELD ELECTROSTATICS */
373 velec = qq23*(rinv23+krf*rsq23-crf);
374 felec = qq23*(rinv23*rinvsq23-krf2);
376 /* Update potential sums from outer loop */
381 /* Calculate temporary vectorial force */
386 /* Update vectorial force */
390 f[j_coord_offset+DIM*3+XX] -= tx;
391 f[j_coord_offset+DIM*3+YY] -= ty;
392 f[j_coord_offset+DIM*3+ZZ] -= tz;
394 /**************************
395 * CALCULATE INTERACTIONS *
396 **************************/
398 /* REACTION-FIELD ELECTROSTATICS */
399 velec = qq31*(rinv31+krf*rsq31-crf);
400 felec = qq31*(rinv31*rinvsq31-krf2);
402 /* Update potential sums from outer loop */
407 /* Calculate temporary vectorial force */
412 /* Update vectorial force */
416 f[j_coord_offset+DIM*1+XX] -= tx;
417 f[j_coord_offset+DIM*1+YY] -= ty;
418 f[j_coord_offset+DIM*1+ZZ] -= tz;
420 /**************************
421 * CALCULATE INTERACTIONS *
422 **************************/
424 /* REACTION-FIELD ELECTROSTATICS */
425 velec = qq32*(rinv32+krf*rsq32-crf);
426 felec = qq32*(rinv32*rinvsq32-krf2);
428 /* Update potential sums from outer loop */
433 /* Calculate temporary vectorial force */
438 /* Update vectorial force */
442 f[j_coord_offset+DIM*2+XX] -= tx;
443 f[j_coord_offset+DIM*2+YY] -= ty;
444 f[j_coord_offset+DIM*2+ZZ] -= tz;
446 /**************************
447 * CALCULATE INTERACTIONS *
448 **************************/
450 /* REACTION-FIELD ELECTROSTATICS */
451 velec = qq33*(rinv33+krf*rsq33-crf);
452 felec = qq33*(rinv33*rinvsq33-krf2);
454 /* Update potential sums from outer loop */
459 /* Calculate temporary vectorial force */
464 /* Update vectorial force */
468 f[j_coord_offset+DIM*3+XX] -= tx;
469 f[j_coord_offset+DIM*3+YY] -= ty;
470 f[j_coord_offset+DIM*3+ZZ] -= tz;
472 /* Inner loop uses 279 flops */
474 /* End of innermost loop */
477 f[i_coord_offset+DIM*1+XX] += fix1;
478 f[i_coord_offset+DIM*1+YY] += fiy1;
479 f[i_coord_offset+DIM*1+ZZ] += fiz1;
483 f[i_coord_offset+DIM*2+XX] += fix2;
484 f[i_coord_offset+DIM*2+YY] += fiy2;
485 f[i_coord_offset+DIM*2+ZZ] += fiz2;
489 f[i_coord_offset+DIM*3+XX] += fix3;
490 f[i_coord_offset+DIM*3+YY] += fiy3;
491 f[i_coord_offset+DIM*3+ZZ] += fiz3;
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_W4W4_VF,outeriter*31 + inneriter*279);
517 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwNone_GeomW4W4_F_c
518 * Electrostatics interaction: ReactionField
519 * VdW interaction: None
520 * Geometry: Water4-Water4
521 * Calculate force/pot: Force
524 nb_kernel_ElecRF_VdwNone_GeomW4W4_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 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
542 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
544 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
546 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
548 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
550 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
551 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
552 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
553 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
554 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
555 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
556 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
557 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
558 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
559 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
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 iq1 = facel*charge[inr+1];
583 iq2 = facel*charge[inr+2];
584 iq3 = facel*charge[inr+3];
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 ix1 = shX + x[i_coord_offset+DIM*1+XX];
621 iy1 = shY + x[i_coord_offset+DIM*1+YY];
622 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
623 ix2 = shX + x[i_coord_offset+DIM*2+XX];
624 iy2 = shY + x[i_coord_offset+DIM*2+YY];
625 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
626 ix3 = shX + x[i_coord_offset+DIM*3+XX];
627 iy3 = shY + x[i_coord_offset+DIM*3+YY];
628 iz3 = shZ + x[i_coord_offset+DIM*3+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 jx1 = x[j_coord_offset+DIM*1+XX];
649 jy1 = x[j_coord_offset+DIM*1+YY];
650 jz1 = x[j_coord_offset+DIM*1+ZZ];
651 jx2 = x[j_coord_offset+DIM*2+XX];
652 jy2 = x[j_coord_offset+DIM*2+YY];
653 jz2 = x[j_coord_offset+DIM*2+ZZ];
654 jx3 = x[j_coord_offset+DIM*3+XX];
655 jy3 = x[j_coord_offset+DIM*3+YY];
656 jz3 = x[j_coord_offset+DIM*3+ZZ];
658 /* Calculate displacement vector */
687 /* Calculate squared distance and things based on it */
688 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
689 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
690 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
691 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
692 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
693 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
694 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
695 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
696 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
698 rinv11 = gmx_invsqrt(rsq11);
699 rinv12 = gmx_invsqrt(rsq12);
700 rinv13 = gmx_invsqrt(rsq13);
701 rinv21 = gmx_invsqrt(rsq21);
702 rinv22 = gmx_invsqrt(rsq22);
703 rinv23 = gmx_invsqrt(rsq23);
704 rinv31 = gmx_invsqrt(rsq31);
705 rinv32 = gmx_invsqrt(rsq32);
706 rinv33 = gmx_invsqrt(rsq33);
708 rinvsq11 = rinv11*rinv11;
709 rinvsq12 = rinv12*rinv12;
710 rinvsq13 = rinv13*rinv13;
711 rinvsq21 = rinv21*rinv21;
712 rinvsq22 = rinv22*rinv22;
713 rinvsq23 = rinv23*rinv23;
714 rinvsq31 = rinv31*rinv31;
715 rinvsq32 = rinv32*rinv32;
716 rinvsq33 = rinv33*rinv33;
718 /**************************
719 * CALCULATE INTERACTIONS *
720 **************************/
722 /* REACTION-FIELD ELECTROSTATICS */
723 felec = qq11*(rinv11*rinvsq11-krf2);
727 /* Calculate temporary vectorial force */
732 /* Update vectorial force */
736 f[j_coord_offset+DIM*1+XX] -= tx;
737 f[j_coord_offset+DIM*1+YY] -= ty;
738 f[j_coord_offset+DIM*1+ZZ] -= tz;
740 /**************************
741 * CALCULATE INTERACTIONS *
742 **************************/
744 /* REACTION-FIELD ELECTROSTATICS */
745 felec = qq12*(rinv12*rinvsq12-krf2);
749 /* Calculate temporary vectorial force */
754 /* Update vectorial force */
758 f[j_coord_offset+DIM*2+XX] -= tx;
759 f[j_coord_offset+DIM*2+YY] -= ty;
760 f[j_coord_offset+DIM*2+ZZ] -= tz;
762 /**************************
763 * CALCULATE INTERACTIONS *
764 **************************/
766 /* REACTION-FIELD ELECTROSTATICS */
767 felec = qq13*(rinv13*rinvsq13-krf2);
771 /* Calculate temporary vectorial force */
776 /* Update vectorial force */
780 f[j_coord_offset+DIM*3+XX] -= tx;
781 f[j_coord_offset+DIM*3+YY] -= ty;
782 f[j_coord_offset+DIM*3+ZZ] -= tz;
784 /**************************
785 * CALCULATE INTERACTIONS *
786 **************************/
788 /* REACTION-FIELD ELECTROSTATICS */
789 felec = qq21*(rinv21*rinvsq21-krf2);
793 /* Calculate temporary vectorial force */
798 /* Update vectorial force */
802 f[j_coord_offset+DIM*1+XX] -= tx;
803 f[j_coord_offset+DIM*1+YY] -= ty;
804 f[j_coord_offset+DIM*1+ZZ] -= tz;
806 /**************************
807 * CALCULATE INTERACTIONS *
808 **************************/
810 /* REACTION-FIELD ELECTROSTATICS */
811 felec = qq22*(rinv22*rinvsq22-krf2);
815 /* Calculate temporary vectorial force */
820 /* Update vectorial force */
824 f[j_coord_offset+DIM*2+XX] -= tx;
825 f[j_coord_offset+DIM*2+YY] -= ty;
826 f[j_coord_offset+DIM*2+ZZ] -= tz;
828 /**************************
829 * CALCULATE INTERACTIONS *
830 **************************/
832 /* REACTION-FIELD ELECTROSTATICS */
833 felec = qq23*(rinv23*rinvsq23-krf2);
837 /* Calculate temporary vectorial force */
842 /* Update vectorial force */
846 f[j_coord_offset+DIM*3+XX] -= tx;
847 f[j_coord_offset+DIM*3+YY] -= ty;
848 f[j_coord_offset+DIM*3+ZZ] -= tz;
850 /**************************
851 * CALCULATE INTERACTIONS *
852 **************************/
854 /* REACTION-FIELD ELECTROSTATICS */
855 felec = qq31*(rinv31*rinvsq31-krf2);
859 /* Calculate temporary vectorial force */
864 /* Update vectorial force */
868 f[j_coord_offset+DIM*1+XX] -= tx;
869 f[j_coord_offset+DIM*1+YY] -= ty;
870 f[j_coord_offset+DIM*1+ZZ] -= tz;
872 /**************************
873 * CALCULATE INTERACTIONS *
874 **************************/
876 /* REACTION-FIELD ELECTROSTATICS */
877 felec = qq32*(rinv32*rinvsq32-krf2);
881 /* Calculate temporary vectorial force */
886 /* Update vectorial force */
890 f[j_coord_offset+DIM*2+XX] -= tx;
891 f[j_coord_offset+DIM*2+YY] -= ty;
892 f[j_coord_offset+DIM*2+ZZ] -= tz;
894 /**************************
895 * CALCULATE INTERACTIONS *
896 **************************/
898 /* REACTION-FIELD ELECTROSTATICS */
899 felec = qq33*(rinv33*rinvsq33-krf2);
903 /* Calculate temporary vectorial force */
908 /* Update vectorial force */
912 f[j_coord_offset+DIM*3+XX] -= tx;
913 f[j_coord_offset+DIM*3+YY] -= ty;
914 f[j_coord_offset+DIM*3+ZZ] -= tz;
916 /* Inner loop uses 234 flops */
918 /* End of innermost loop */
921 f[i_coord_offset+DIM*1+XX] += fix1;
922 f[i_coord_offset+DIM*1+YY] += fiy1;
923 f[i_coord_offset+DIM*1+ZZ] += fiz1;
927 f[i_coord_offset+DIM*2+XX] += fix2;
928 f[i_coord_offset+DIM*2+YY] += fiy2;
929 f[i_coord_offset+DIM*2+ZZ] += fiz2;
933 f[i_coord_offset+DIM*3+XX] += fix3;
934 f[i_coord_offset+DIM*3+YY] += fiy3;
935 f[i_coord_offset+DIM*3+ZZ] += fiz3;
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_W4W4_F,outeriter*30 + inneriter*234);