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_ElecRFCut_VdwLJSh_GeomW3W3_VF_c
35 * Electrostatics interaction: ReactionField
36 * VdW interaction: LennardJones
37 * Geometry: Water3-Water3
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecRFCut_VdwLJSh_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;
80 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
89 jindex = nlist->jindex;
91 shiftidx = nlist->shift;
93 shiftvec = fr->shift_vec[0];
94 fshift = fr->fshift[0];
96 charge = mdatoms->chargeA;
100 nvdwtype = fr->ntype;
102 vdwtype = mdatoms->typeA;
104 /* Setup water-specific parameters */
105 inr = nlist->iinr[0];
106 iq0 = facel*charge[inr+0];
107 iq1 = facel*charge[inr+1];
108 iq2 = facel*charge[inr+2];
109 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
114 vdwjidx0 = 2*vdwtype[inr+0];
116 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
117 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
127 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
128 rcutoff = fr->rcoulomb;
129 rcutoff2 = rcutoff*rcutoff;
131 sh_vdw_invrcut6 = fr->ic->sh_invrc6;
137 /* Start outer loop over neighborlists */
138 for(iidx=0; iidx<nri; iidx++)
140 /* Load shift vector for this list */
141 i_shift_offset = DIM*shiftidx[iidx];
142 shX = shiftvec[i_shift_offset+XX];
143 shY = shiftvec[i_shift_offset+YY];
144 shZ = shiftvec[i_shift_offset+ZZ];
146 /* Load limits for loop over neighbors */
147 j_index_start = jindex[iidx];
148 j_index_end = jindex[iidx+1];
150 /* Get outer coordinate index */
152 i_coord_offset = DIM*inr;
154 /* Load i particle coords and add shift vector */
155 ix0 = shX + x[i_coord_offset+DIM*0+XX];
156 iy0 = shY + x[i_coord_offset+DIM*0+YY];
157 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
158 ix1 = shX + x[i_coord_offset+DIM*1+XX];
159 iy1 = shY + x[i_coord_offset+DIM*1+YY];
160 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
161 ix2 = shX + x[i_coord_offset+DIM*2+XX];
162 iy2 = shY + x[i_coord_offset+DIM*2+YY];
163 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
175 /* Reset potential sums */
179 /* Start inner kernel loop */
180 for(jidx=j_index_start; jidx<j_index_end; jidx++)
182 /* Get j neighbor index, and coordinate index */
184 j_coord_offset = DIM*jnr;
186 /* load j atom coordinates */
187 jx0 = x[j_coord_offset+DIM*0+XX];
188 jy0 = x[j_coord_offset+DIM*0+YY];
189 jz0 = x[j_coord_offset+DIM*0+ZZ];
190 jx1 = x[j_coord_offset+DIM*1+XX];
191 jy1 = x[j_coord_offset+DIM*1+YY];
192 jz1 = x[j_coord_offset+DIM*1+ZZ];
193 jx2 = x[j_coord_offset+DIM*2+XX];
194 jy2 = x[j_coord_offset+DIM*2+YY];
195 jz2 = x[j_coord_offset+DIM*2+ZZ];
197 /* Calculate displacement vector */
226 /* Calculate squared distance and things based on it */
227 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
228 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
229 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
230 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
231 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
232 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
233 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
234 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
235 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
237 rinv00 = gmx_invsqrt(rsq00);
238 rinv01 = gmx_invsqrt(rsq01);
239 rinv02 = gmx_invsqrt(rsq02);
240 rinv10 = gmx_invsqrt(rsq10);
241 rinv11 = gmx_invsqrt(rsq11);
242 rinv12 = gmx_invsqrt(rsq12);
243 rinv20 = gmx_invsqrt(rsq20);
244 rinv21 = gmx_invsqrt(rsq21);
245 rinv22 = gmx_invsqrt(rsq22);
247 rinvsq00 = rinv00*rinv00;
248 rinvsq01 = rinv01*rinv01;
249 rinvsq02 = rinv02*rinv02;
250 rinvsq10 = rinv10*rinv10;
251 rinvsq11 = rinv11*rinv11;
252 rinvsq12 = rinv12*rinv12;
253 rinvsq20 = rinv20*rinv20;
254 rinvsq21 = rinv21*rinv21;
255 rinvsq22 = rinv22*rinv22;
257 /**************************
258 * CALCULATE INTERACTIONS *
259 **************************/
264 /* REACTION-FIELD ELECTROSTATICS */
265 velec = qq00*(rinv00+krf*rsq00-crf);
266 felec = qq00*(rinv00*rinvsq00-krf2);
268 /* LENNARD-JONES DISPERSION/REPULSION */
270 rinvsix = rinvsq00*rinvsq00*rinvsq00;
271 vvdw6 = c6_00*rinvsix;
272 vvdw12 = c12_00*rinvsix*rinvsix;
273 vvdw = (vvdw12 - c12_00*sh_vdw_invrcut6*sh_vdw_invrcut6)*(1.0/12.0) - (vvdw6 - c6_00*sh_vdw_invrcut6)*(1.0/6.0);
274 fvdw = (vvdw12-vvdw6)*rinvsq00;
276 /* Update potential sums from outer loop */
282 /* Calculate temporary vectorial force */
287 /* Update vectorial force */
291 f[j_coord_offset+DIM*0+XX] -= tx;
292 f[j_coord_offset+DIM*0+YY] -= ty;
293 f[j_coord_offset+DIM*0+ZZ] -= tz;
297 /**************************
298 * CALCULATE INTERACTIONS *
299 **************************/
304 /* REACTION-FIELD ELECTROSTATICS */
305 velec = qq01*(rinv01+krf*rsq01-crf);
306 felec = qq01*(rinv01*rinvsq01-krf2);
308 /* Update potential sums from outer loop */
313 /* Calculate temporary vectorial force */
318 /* Update vectorial force */
322 f[j_coord_offset+DIM*1+XX] -= tx;
323 f[j_coord_offset+DIM*1+YY] -= ty;
324 f[j_coord_offset+DIM*1+ZZ] -= tz;
328 /**************************
329 * CALCULATE INTERACTIONS *
330 **************************/
335 /* REACTION-FIELD ELECTROSTATICS */
336 velec = qq02*(rinv02+krf*rsq02-crf);
337 felec = qq02*(rinv02*rinvsq02-krf2);
339 /* Update potential sums from outer loop */
344 /* Calculate temporary vectorial force */
349 /* Update vectorial force */
353 f[j_coord_offset+DIM*2+XX] -= tx;
354 f[j_coord_offset+DIM*2+YY] -= ty;
355 f[j_coord_offset+DIM*2+ZZ] -= tz;
359 /**************************
360 * CALCULATE INTERACTIONS *
361 **************************/
366 /* REACTION-FIELD ELECTROSTATICS */
367 velec = qq10*(rinv10+krf*rsq10-crf);
368 felec = qq10*(rinv10*rinvsq10-krf2);
370 /* Update potential sums from outer loop */
375 /* Calculate temporary vectorial force */
380 /* Update vectorial force */
384 f[j_coord_offset+DIM*0+XX] -= tx;
385 f[j_coord_offset+DIM*0+YY] -= ty;
386 f[j_coord_offset+DIM*0+ZZ] -= tz;
390 /**************************
391 * CALCULATE INTERACTIONS *
392 **************************/
397 /* REACTION-FIELD ELECTROSTATICS */
398 velec = qq11*(rinv11+krf*rsq11-crf);
399 felec = qq11*(rinv11*rinvsq11-krf2);
401 /* Update potential sums from outer loop */
406 /* Calculate temporary vectorial force */
411 /* Update vectorial force */
415 f[j_coord_offset+DIM*1+XX] -= tx;
416 f[j_coord_offset+DIM*1+YY] -= ty;
417 f[j_coord_offset+DIM*1+ZZ] -= tz;
421 /**************************
422 * CALCULATE INTERACTIONS *
423 **************************/
428 /* REACTION-FIELD ELECTROSTATICS */
429 velec = qq12*(rinv12+krf*rsq12-crf);
430 felec = qq12*(rinv12*rinvsq12-krf2);
432 /* Update potential sums from outer loop */
437 /* Calculate temporary vectorial force */
442 /* Update vectorial force */
446 f[j_coord_offset+DIM*2+XX] -= tx;
447 f[j_coord_offset+DIM*2+YY] -= ty;
448 f[j_coord_offset+DIM*2+ZZ] -= tz;
452 /**************************
453 * CALCULATE INTERACTIONS *
454 **************************/
459 /* REACTION-FIELD ELECTROSTATICS */
460 velec = qq20*(rinv20+krf*rsq20-crf);
461 felec = qq20*(rinv20*rinvsq20-krf2);
463 /* Update potential sums from outer loop */
468 /* Calculate temporary vectorial force */
473 /* Update vectorial force */
477 f[j_coord_offset+DIM*0+XX] -= tx;
478 f[j_coord_offset+DIM*0+YY] -= ty;
479 f[j_coord_offset+DIM*0+ZZ] -= tz;
483 /**************************
484 * CALCULATE INTERACTIONS *
485 **************************/
490 /* REACTION-FIELD ELECTROSTATICS */
491 velec = qq21*(rinv21+krf*rsq21-crf);
492 felec = qq21*(rinv21*rinvsq21-krf2);
494 /* Update potential sums from outer loop */
499 /* Calculate temporary vectorial force */
504 /* Update vectorial force */
508 f[j_coord_offset+DIM*1+XX] -= tx;
509 f[j_coord_offset+DIM*1+YY] -= ty;
510 f[j_coord_offset+DIM*1+ZZ] -= tz;
514 /**************************
515 * CALCULATE INTERACTIONS *
516 **************************/
521 /* REACTION-FIELD ELECTROSTATICS */
522 velec = qq22*(rinv22+krf*rsq22-crf);
523 felec = qq22*(rinv22*rinvsq22-krf2);
525 /* Update potential sums from outer loop */
530 /* Calculate temporary vectorial force */
535 /* Update vectorial force */
539 f[j_coord_offset+DIM*2+XX] -= tx;
540 f[j_coord_offset+DIM*2+YY] -= ty;
541 f[j_coord_offset+DIM*2+ZZ] -= tz;
545 /* Inner loop uses 296 flops */
547 /* End of innermost loop */
550 f[i_coord_offset+DIM*0+XX] += fix0;
551 f[i_coord_offset+DIM*0+YY] += fiy0;
552 f[i_coord_offset+DIM*0+ZZ] += fiz0;
556 f[i_coord_offset+DIM*1+XX] += fix1;
557 f[i_coord_offset+DIM*1+YY] += fiy1;
558 f[i_coord_offset+DIM*1+ZZ] += fiz1;
562 f[i_coord_offset+DIM*2+XX] += fix2;
563 f[i_coord_offset+DIM*2+YY] += fiy2;
564 f[i_coord_offset+DIM*2+ZZ] += fiz2;
568 fshift[i_shift_offset+XX] += tx;
569 fshift[i_shift_offset+YY] += ty;
570 fshift[i_shift_offset+ZZ] += tz;
573 /* Update potential energies */
574 kernel_data->energygrp_elec[ggid] += velecsum;
575 kernel_data->energygrp_vdw[ggid] += vvdwsum;
577 /* Increment number of inner iterations */
578 inneriter += j_index_end - j_index_start;
580 /* Outer loop uses 32 flops */
583 /* Increment number of outer iterations */
586 /* Update outer/inner flops */
588 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*296);
591 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwLJSh_GeomW3W3_F_c
592 * Electrostatics interaction: ReactionField
593 * VdW interaction: LennardJones
594 * Geometry: Water3-Water3
595 * Calculate force/pot: Force
598 nb_kernel_ElecRFCut_VdwLJSh_GeomW3W3_F_c
599 (t_nblist * gmx_restrict nlist,
600 rvec * gmx_restrict xx,
601 rvec * gmx_restrict ff,
602 t_forcerec * gmx_restrict fr,
603 t_mdatoms * gmx_restrict mdatoms,
604 nb_kernel_data_t * gmx_restrict kernel_data,
605 t_nrnb * gmx_restrict nrnb)
607 int i_shift_offset,i_coord_offset,j_coord_offset;
608 int j_index_start,j_index_end;
609 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
610 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
611 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
612 real *shiftvec,*fshift,*x,*f;
614 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
616 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
618 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
620 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
622 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
624 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
625 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
626 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
627 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
628 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
629 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
630 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
631 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
632 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
633 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
634 real velec,felec,velecsum,facel,crf,krf,krf2;
637 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
646 jindex = nlist->jindex;
648 shiftidx = nlist->shift;
650 shiftvec = fr->shift_vec[0];
651 fshift = fr->fshift[0];
653 charge = mdatoms->chargeA;
657 nvdwtype = fr->ntype;
659 vdwtype = mdatoms->typeA;
661 /* Setup water-specific parameters */
662 inr = nlist->iinr[0];
663 iq0 = facel*charge[inr+0];
664 iq1 = facel*charge[inr+1];
665 iq2 = facel*charge[inr+2];
666 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
671 vdwjidx0 = 2*vdwtype[inr+0];
673 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
674 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
684 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
685 rcutoff = fr->rcoulomb;
686 rcutoff2 = rcutoff*rcutoff;
688 sh_vdw_invrcut6 = fr->ic->sh_invrc6;
694 /* Start outer loop over neighborlists */
695 for(iidx=0; iidx<nri; iidx++)
697 /* Load shift vector for this list */
698 i_shift_offset = DIM*shiftidx[iidx];
699 shX = shiftvec[i_shift_offset+XX];
700 shY = shiftvec[i_shift_offset+YY];
701 shZ = shiftvec[i_shift_offset+ZZ];
703 /* Load limits for loop over neighbors */
704 j_index_start = jindex[iidx];
705 j_index_end = jindex[iidx+1];
707 /* Get outer coordinate index */
709 i_coord_offset = DIM*inr;
711 /* Load i particle coords and add shift vector */
712 ix0 = shX + x[i_coord_offset+DIM*0+XX];
713 iy0 = shY + x[i_coord_offset+DIM*0+YY];
714 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
715 ix1 = shX + x[i_coord_offset+DIM*1+XX];
716 iy1 = shY + x[i_coord_offset+DIM*1+YY];
717 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
718 ix2 = shX + x[i_coord_offset+DIM*2+XX];
719 iy2 = shY + x[i_coord_offset+DIM*2+YY];
720 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
732 /* Start inner kernel loop */
733 for(jidx=j_index_start; jidx<j_index_end; jidx++)
735 /* Get j neighbor index, and coordinate index */
737 j_coord_offset = DIM*jnr;
739 /* load j atom coordinates */
740 jx0 = x[j_coord_offset+DIM*0+XX];
741 jy0 = x[j_coord_offset+DIM*0+YY];
742 jz0 = x[j_coord_offset+DIM*0+ZZ];
743 jx1 = x[j_coord_offset+DIM*1+XX];
744 jy1 = x[j_coord_offset+DIM*1+YY];
745 jz1 = x[j_coord_offset+DIM*1+ZZ];
746 jx2 = x[j_coord_offset+DIM*2+XX];
747 jy2 = x[j_coord_offset+DIM*2+YY];
748 jz2 = x[j_coord_offset+DIM*2+ZZ];
750 /* Calculate displacement vector */
779 /* Calculate squared distance and things based on it */
780 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
781 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
782 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
783 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
784 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
785 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
786 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
787 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
788 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
790 rinv00 = gmx_invsqrt(rsq00);
791 rinv01 = gmx_invsqrt(rsq01);
792 rinv02 = gmx_invsqrt(rsq02);
793 rinv10 = gmx_invsqrt(rsq10);
794 rinv11 = gmx_invsqrt(rsq11);
795 rinv12 = gmx_invsqrt(rsq12);
796 rinv20 = gmx_invsqrt(rsq20);
797 rinv21 = gmx_invsqrt(rsq21);
798 rinv22 = gmx_invsqrt(rsq22);
800 rinvsq00 = rinv00*rinv00;
801 rinvsq01 = rinv01*rinv01;
802 rinvsq02 = rinv02*rinv02;
803 rinvsq10 = rinv10*rinv10;
804 rinvsq11 = rinv11*rinv11;
805 rinvsq12 = rinv12*rinv12;
806 rinvsq20 = rinv20*rinv20;
807 rinvsq21 = rinv21*rinv21;
808 rinvsq22 = rinv22*rinv22;
810 /**************************
811 * CALCULATE INTERACTIONS *
812 **************************/
817 /* REACTION-FIELD ELECTROSTATICS */
818 felec = qq00*(rinv00*rinvsq00-krf2);
820 /* LENNARD-JONES DISPERSION/REPULSION */
822 rinvsix = rinvsq00*rinvsq00*rinvsq00;
823 fvdw = (c12_00*rinvsix-c6_00)*rinvsix*rinvsq00;
827 /* Calculate temporary vectorial force */
832 /* Update vectorial force */
836 f[j_coord_offset+DIM*0+XX] -= tx;
837 f[j_coord_offset+DIM*0+YY] -= ty;
838 f[j_coord_offset+DIM*0+ZZ] -= tz;
842 /**************************
843 * CALCULATE INTERACTIONS *
844 **************************/
849 /* REACTION-FIELD ELECTROSTATICS */
850 felec = qq01*(rinv01*rinvsq01-krf2);
854 /* Calculate temporary vectorial force */
859 /* Update vectorial force */
863 f[j_coord_offset+DIM*1+XX] -= tx;
864 f[j_coord_offset+DIM*1+YY] -= ty;
865 f[j_coord_offset+DIM*1+ZZ] -= tz;
869 /**************************
870 * CALCULATE INTERACTIONS *
871 **************************/
876 /* REACTION-FIELD ELECTROSTATICS */
877 felec = qq02*(rinv02*rinvsq02-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;
896 /**************************
897 * CALCULATE INTERACTIONS *
898 **************************/
903 /* REACTION-FIELD ELECTROSTATICS */
904 felec = qq10*(rinv10*rinvsq10-krf2);
908 /* Calculate temporary vectorial force */
913 /* Update vectorial force */
917 f[j_coord_offset+DIM*0+XX] -= tx;
918 f[j_coord_offset+DIM*0+YY] -= ty;
919 f[j_coord_offset+DIM*0+ZZ] -= tz;
923 /**************************
924 * CALCULATE INTERACTIONS *
925 **************************/
930 /* REACTION-FIELD ELECTROSTATICS */
931 felec = qq11*(rinv11*rinvsq11-krf2);
935 /* Calculate temporary vectorial force */
940 /* Update vectorial force */
944 f[j_coord_offset+DIM*1+XX] -= tx;
945 f[j_coord_offset+DIM*1+YY] -= ty;
946 f[j_coord_offset+DIM*1+ZZ] -= tz;
950 /**************************
951 * CALCULATE INTERACTIONS *
952 **************************/
957 /* REACTION-FIELD ELECTROSTATICS */
958 felec = qq12*(rinv12*rinvsq12-krf2);
962 /* Calculate temporary vectorial force */
967 /* Update vectorial force */
971 f[j_coord_offset+DIM*2+XX] -= tx;
972 f[j_coord_offset+DIM*2+YY] -= ty;
973 f[j_coord_offset+DIM*2+ZZ] -= tz;
977 /**************************
978 * CALCULATE INTERACTIONS *
979 **************************/
984 /* REACTION-FIELD ELECTROSTATICS */
985 felec = qq20*(rinv20*rinvsq20-krf2);
989 /* Calculate temporary vectorial force */
994 /* Update vectorial force */
998 f[j_coord_offset+DIM*0+XX] -= tx;
999 f[j_coord_offset+DIM*0+YY] -= ty;
1000 f[j_coord_offset+DIM*0+ZZ] -= tz;
1004 /**************************
1005 * CALCULATE INTERACTIONS *
1006 **************************/
1011 /* REACTION-FIELD ELECTROSTATICS */
1012 felec = qq21*(rinv21*rinvsq21-krf2);
1016 /* Calculate temporary vectorial force */
1021 /* Update vectorial force */
1025 f[j_coord_offset+DIM*1+XX] -= tx;
1026 f[j_coord_offset+DIM*1+YY] -= ty;
1027 f[j_coord_offset+DIM*1+ZZ] -= tz;
1031 /**************************
1032 * CALCULATE INTERACTIONS *
1033 **************************/
1038 /* REACTION-FIELD ELECTROSTATICS */
1039 felec = qq22*(rinv22*rinvsq22-krf2);
1043 /* Calculate temporary vectorial force */
1048 /* Update vectorial force */
1052 f[j_coord_offset+DIM*2+XX] -= tx;
1053 f[j_coord_offset+DIM*2+YY] -= ty;
1054 f[j_coord_offset+DIM*2+ZZ] -= tz;
1058 /* Inner loop uses 241 flops */
1060 /* End of innermost loop */
1063 f[i_coord_offset+DIM*0+XX] += fix0;
1064 f[i_coord_offset+DIM*0+YY] += fiy0;
1065 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1069 f[i_coord_offset+DIM*1+XX] += fix1;
1070 f[i_coord_offset+DIM*1+YY] += fiy1;
1071 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1075 f[i_coord_offset+DIM*2+XX] += fix2;
1076 f[i_coord_offset+DIM*2+YY] += fiy2;
1077 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1081 fshift[i_shift_offset+XX] += tx;
1082 fshift[i_shift_offset+YY] += ty;
1083 fshift[i_shift_offset+ZZ] += tz;
1085 /* Increment number of inner iterations */
1086 inneriter += j_index_end - j_index_start;
1088 /* Outer loop uses 30 flops */
1091 /* Increment number of outer iterations */
1094 /* Update outer/inner flops */
1096 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*241);