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_VdwBhamSh_GeomW3W3_VF_c
35 * Electrostatics interaction: ReactionField
36 * VdW interaction: Buckingham
37 * Geometry: Water3-Water3
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecRFCut_VdwBhamSh_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 = 3*nvdwtype*vdwtype[inr+0];
114 vdwjidx0 = 3*vdwtype[inr+0];
116 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
117 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
118 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
128 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
129 rcutoff = fr->rcoulomb;
130 rcutoff2 = rcutoff*rcutoff;
132 sh_vdw_invrcut6 = fr->ic->sh_invrc6;
138 /* Start outer loop over neighborlists */
139 for(iidx=0; iidx<nri; iidx++)
141 /* Load shift vector for this list */
142 i_shift_offset = DIM*shiftidx[iidx];
143 shX = shiftvec[i_shift_offset+XX];
144 shY = shiftvec[i_shift_offset+YY];
145 shZ = shiftvec[i_shift_offset+ZZ];
147 /* Load limits for loop over neighbors */
148 j_index_start = jindex[iidx];
149 j_index_end = jindex[iidx+1];
151 /* Get outer coordinate index */
153 i_coord_offset = DIM*inr;
155 /* Load i particle coords and add shift vector */
156 ix0 = shX + x[i_coord_offset+DIM*0+XX];
157 iy0 = shY + x[i_coord_offset+DIM*0+YY];
158 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
159 ix1 = shX + x[i_coord_offset+DIM*1+XX];
160 iy1 = shY + x[i_coord_offset+DIM*1+YY];
161 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
162 ix2 = shX + x[i_coord_offset+DIM*2+XX];
163 iy2 = shY + x[i_coord_offset+DIM*2+YY];
164 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
176 /* 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 **************************/
267 /* REACTION-FIELD ELECTROSTATICS */
268 velec = qq00*(rinv00+krf*rsq00-crf);
269 felec = qq00*(rinv00*rinvsq00-krf2);
271 /* BUCKINGHAM DISPERSION/REPULSION */
272 rinvsix = rinvsq00*rinvsq00*rinvsq00;
273 vvdw6 = c6_00*rinvsix;
275 vvdwexp = cexp1_00*exp(-br);
276 vvdw = (vvdwexp-cexp1_00*exp(-cexp2_00*rvdw)) - (vvdw6 - c6_00*sh_vdw_invrcut6)*(1.0/6.0);
277 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
279 /* Update potential sums from outer loop */
285 /* Calculate temporary vectorial force */
290 /* Update vectorial force */
294 f[j_coord_offset+DIM*0+XX] -= tx;
295 f[j_coord_offset+DIM*0+YY] -= ty;
296 f[j_coord_offset+DIM*0+ZZ] -= tz;
300 /**************************
301 * CALCULATE INTERACTIONS *
302 **************************/
307 /* REACTION-FIELD ELECTROSTATICS */
308 velec = qq01*(rinv01+krf*rsq01-crf);
309 felec = qq01*(rinv01*rinvsq01-krf2);
311 /* Update potential sums from outer loop */
316 /* Calculate temporary vectorial force */
321 /* Update vectorial force */
325 f[j_coord_offset+DIM*1+XX] -= tx;
326 f[j_coord_offset+DIM*1+YY] -= ty;
327 f[j_coord_offset+DIM*1+ZZ] -= tz;
331 /**************************
332 * CALCULATE INTERACTIONS *
333 **************************/
338 /* REACTION-FIELD ELECTROSTATICS */
339 velec = qq02*(rinv02+krf*rsq02-crf);
340 felec = qq02*(rinv02*rinvsq02-krf2);
342 /* Update potential sums from outer loop */
347 /* Calculate temporary vectorial force */
352 /* Update vectorial force */
356 f[j_coord_offset+DIM*2+XX] -= tx;
357 f[j_coord_offset+DIM*2+YY] -= ty;
358 f[j_coord_offset+DIM*2+ZZ] -= tz;
362 /**************************
363 * CALCULATE INTERACTIONS *
364 **************************/
369 /* REACTION-FIELD ELECTROSTATICS */
370 velec = qq10*(rinv10+krf*rsq10-crf);
371 felec = qq10*(rinv10*rinvsq10-krf2);
373 /* Update potential sums from outer loop */
378 /* Calculate temporary vectorial force */
383 /* Update vectorial force */
387 f[j_coord_offset+DIM*0+XX] -= tx;
388 f[j_coord_offset+DIM*0+YY] -= ty;
389 f[j_coord_offset+DIM*0+ZZ] -= tz;
393 /**************************
394 * CALCULATE INTERACTIONS *
395 **************************/
400 /* REACTION-FIELD ELECTROSTATICS */
401 velec = qq11*(rinv11+krf*rsq11-crf);
402 felec = qq11*(rinv11*rinvsq11-krf2);
404 /* Update potential sums from outer loop */
409 /* Calculate temporary vectorial force */
414 /* Update vectorial force */
418 f[j_coord_offset+DIM*1+XX] -= tx;
419 f[j_coord_offset+DIM*1+YY] -= ty;
420 f[j_coord_offset+DIM*1+ZZ] -= tz;
424 /**************************
425 * CALCULATE INTERACTIONS *
426 **************************/
431 /* REACTION-FIELD ELECTROSTATICS */
432 velec = qq12*(rinv12+krf*rsq12-crf);
433 felec = qq12*(rinv12*rinvsq12-krf2);
435 /* Update potential sums from outer loop */
440 /* Calculate temporary vectorial force */
445 /* Update vectorial force */
449 f[j_coord_offset+DIM*2+XX] -= tx;
450 f[j_coord_offset+DIM*2+YY] -= ty;
451 f[j_coord_offset+DIM*2+ZZ] -= tz;
455 /**************************
456 * CALCULATE INTERACTIONS *
457 **************************/
462 /* REACTION-FIELD ELECTROSTATICS */
463 velec = qq20*(rinv20+krf*rsq20-crf);
464 felec = qq20*(rinv20*rinvsq20-krf2);
466 /* Update potential sums from outer loop */
471 /* Calculate temporary vectorial force */
476 /* Update vectorial force */
480 f[j_coord_offset+DIM*0+XX] -= tx;
481 f[j_coord_offset+DIM*0+YY] -= ty;
482 f[j_coord_offset+DIM*0+ZZ] -= tz;
486 /**************************
487 * CALCULATE INTERACTIONS *
488 **************************/
493 /* REACTION-FIELD ELECTROSTATICS */
494 velec = qq21*(rinv21+krf*rsq21-crf);
495 felec = qq21*(rinv21*rinvsq21-krf2);
497 /* Update potential sums from outer loop */
502 /* Calculate temporary vectorial force */
507 /* Update vectorial force */
511 f[j_coord_offset+DIM*1+XX] -= tx;
512 f[j_coord_offset+DIM*1+YY] -= ty;
513 f[j_coord_offset+DIM*1+ZZ] -= tz;
517 /**************************
518 * CALCULATE INTERACTIONS *
519 **************************/
524 /* REACTION-FIELD ELECTROSTATICS */
525 velec = qq22*(rinv22+krf*rsq22-crf);
526 felec = qq22*(rinv22*rinvsq22-krf2);
528 /* Update potential sums from outer loop */
533 /* Calculate temporary vectorial force */
538 /* Update vectorial force */
542 f[j_coord_offset+DIM*2+XX] -= tx;
543 f[j_coord_offset+DIM*2+YY] -= ty;
544 f[j_coord_offset+DIM*2+ZZ] -= tz;
548 /* Inner loop uses 349 flops */
550 /* End of innermost loop */
553 f[i_coord_offset+DIM*0+XX] += fix0;
554 f[i_coord_offset+DIM*0+YY] += fiy0;
555 f[i_coord_offset+DIM*0+ZZ] += fiz0;
559 f[i_coord_offset+DIM*1+XX] += fix1;
560 f[i_coord_offset+DIM*1+YY] += fiy1;
561 f[i_coord_offset+DIM*1+ZZ] += fiz1;
565 f[i_coord_offset+DIM*2+XX] += fix2;
566 f[i_coord_offset+DIM*2+YY] += fiy2;
567 f[i_coord_offset+DIM*2+ZZ] += fiz2;
571 fshift[i_shift_offset+XX] += tx;
572 fshift[i_shift_offset+YY] += ty;
573 fshift[i_shift_offset+ZZ] += tz;
576 /* Update potential energies */
577 kernel_data->energygrp_elec[ggid] += velecsum;
578 kernel_data->energygrp_vdw[ggid] += vvdwsum;
580 /* Increment number of inner iterations */
581 inneriter += j_index_end - j_index_start;
583 /* Outer loop uses 32 flops */
586 /* Increment number of outer iterations */
589 /* Update outer/inner flops */
591 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_VF,outeriter*32 + inneriter*349);
594 * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwBhamSh_GeomW3W3_F_c
595 * Electrostatics interaction: ReactionField
596 * VdW interaction: Buckingham
597 * Geometry: Water3-Water3
598 * Calculate force/pot: Force
601 nb_kernel_ElecRFCut_VdwBhamSh_GeomW3W3_F_c
602 (t_nblist * gmx_restrict nlist,
603 rvec * gmx_restrict xx,
604 rvec * gmx_restrict ff,
605 t_forcerec * gmx_restrict fr,
606 t_mdatoms * gmx_restrict mdatoms,
607 nb_kernel_data_t * gmx_restrict kernel_data,
608 t_nrnb * gmx_restrict nrnb)
610 int i_shift_offset,i_coord_offset,j_coord_offset;
611 int j_index_start,j_index_end;
612 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
613 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
614 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
615 real *shiftvec,*fshift,*x,*f;
617 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
619 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
621 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
623 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
625 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
627 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
628 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
629 real dx01,dy01,dz01,rsq01,rinv01,rinvsq01,r01,qq01,c6_01,c12_01,cexp1_01,cexp2_01;
630 real dx02,dy02,dz02,rsq02,rinv02,rinvsq02,r02,qq02,c6_02,c12_02,cexp1_02,cexp2_02;
631 real dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10,cexp1_10,cexp2_10;
632 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
633 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
634 real dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20,cexp1_20,cexp2_20;
635 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
636 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
637 real velec,felec,velecsum,facel,crf,krf,krf2;
640 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
649 jindex = nlist->jindex;
651 shiftidx = nlist->shift;
653 shiftvec = fr->shift_vec[0];
654 fshift = fr->fshift[0];
656 charge = mdatoms->chargeA;
660 nvdwtype = fr->ntype;
662 vdwtype = mdatoms->typeA;
664 /* Setup water-specific parameters */
665 inr = nlist->iinr[0];
666 iq0 = facel*charge[inr+0];
667 iq1 = facel*charge[inr+1];
668 iq2 = facel*charge[inr+2];
669 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
674 vdwjidx0 = 3*vdwtype[inr+0];
676 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
677 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
678 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
688 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
689 rcutoff = fr->rcoulomb;
690 rcutoff2 = rcutoff*rcutoff;
692 sh_vdw_invrcut6 = fr->ic->sh_invrc6;
698 /* Start outer loop over neighborlists */
699 for(iidx=0; iidx<nri; iidx++)
701 /* Load shift vector for this list */
702 i_shift_offset = DIM*shiftidx[iidx];
703 shX = shiftvec[i_shift_offset+XX];
704 shY = shiftvec[i_shift_offset+YY];
705 shZ = shiftvec[i_shift_offset+ZZ];
707 /* Load limits for loop over neighbors */
708 j_index_start = jindex[iidx];
709 j_index_end = jindex[iidx+1];
711 /* Get outer coordinate index */
713 i_coord_offset = DIM*inr;
715 /* Load i particle coords and add shift vector */
716 ix0 = shX + x[i_coord_offset+DIM*0+XX];
717 iy0 = shY + x[i_coord_offset+DIM*0+YY];
718 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
719 ix1 = shX + x[i_coord_offset+DIM*1+XX];
720 iy1 = shY + x[i_coord_offset+DIM*1+YY];
721 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
722 ix2 = shX + x[i_coord_offset+DIM*2+XX];
723 iy2 = shY + x[i_coord_offset+DIM*2+YY];
724 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
736 /* Start inner kernel loop */
737 for(jidx=j_index_start; jidx<j_index_end; jidx++)
739 /* Get j neighbor index, and coordinate index */
741 j_coord_offset = DIM*jnr;
743 /* load j atom coordinates */
744 jx0 = x[j_coord_offset+DIM*0+XX];
745 jy0 = x[j_coord_offset+DIM*0+YY];
746 jz0 = x[j_coord_offset+DIM*0+ZZ];
747 jx1 = x[j_coord_offset+DIM*1+XX];
748 jy1 = x[j_coord_offset+DIM*1+YY];
749 jz1 = x[j_coord_offset+DIM*1+ZZ];
750 jx2 = x[j_coord_offset+DIM*2+XX];
751 jy2 = x[j_coord_offset+DIM*2+YY];
752 jz2 = x[j_coord_offset+DIM*2+ZZ];
754 /* Calculate displacement vector */
783 /* Calculate squared distance and things based on it */
784 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
785 rsq01 = dx01*dx01+dy01*dy01+dz01*dz01;
786 rsq02 = dx02*dx02+dy02*dy02+dz02*dz02;
787 rsq10 = dx10*dx10+dy10*dy10+dz10*dz10;
788 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
789 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
790 rsq20 = dx20*dx20+dy20*dy20+dz20*dz20;
791 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
792 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
794 rinv00 = gmx_invsqrt(rsq00);
795 rinv01 = gmx_invsqrt(rsq01);
796 rinv02 = gmx_invsqrt(rsq02);
797 rinv10 = gmx_invsqrt(rsq10);
798 rinv11 = gmx_invsqrt(rsq11);
799 rinv12 = gmx_invsqrt(rsq12);
800 rinv20 = gmx_invsqrt(rsq20);
801 rinv21 = gmx_invsqrt(rsq21);
802 rinv22 = gmx_invsqrt(rsq22);
804 rinvsq00 = rinv00*rinv00;
805 rinvsq01 = rinv01*rinv01;
806 rinvsq02 = rinv02*rinv02;
807 rinvsq10 = rinv10*rinv10;
808 rinvsq11 = rinv11*rinv11;
809 rinvsq12 = rinv12*rinv12;
810 rinvsq20 = rinv20*rinv20;
811 rinvsq21 = rinv21*rinv21;
812 rinvsq22 = rinv22*rinv22;
814 /**************************
815 * CALCULATE INTERACTIONS *
816 **************************/
823 /* REACTION-FIELD ELECTROSTATICS */
824 felec = qq00*(rinv00*rinvsq00-krf2);
826 /* BUCKINGHAM DISPERSION/REPULSION */
827 rinvsix = rinvsq00*rinvsq00*rinvsq00;
828 vvdw6 = c6_00*rinvsix;
830 vvdwexp = cexp1_00*exp(-br);
831 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
835 /* Calculate temporary vectorial force */
840 /* Update vectorial force */
844 f[j_coord_offset+DIM*0+XX] -= tx;
845 f[j_coord_offset+DIM*0+YY] -= ty;
846 f[j_coord_offset+DIM*0+ZZ] -= tz;
850 /**************************
851 * CALCULATE INTERACTIONS *
852 **************************/
857 /* REACTION-FIELD ELECTROSTATICS */
858 felec = qq01*(rinv01*rinvsq01-krf2);
862 /* Calculate temporary vectorial force */
867 /* Update vectorial force */
871 f[j_coord_offset+DIM*1+XX] -= tx;
872 f[j_coord_offset+DIM*1+YY] -= ty;
873 f[j_coord_offset+DIM*1+ZZ] -= tz;
877 /**************************
878 * CALCULATE INTERACTIONS *
879 **************************/
884 /* REACTION-FIELD ELECTROSTATICS */
885 felec = qq02*(rinv02*rinvsq02-krf2);
889 /* Calculate temporary vectorial force */
894 /* Update vectorial force */
898 f[j_coord_offset+DIM*2+XX] -= tx;
899 f[j_coord_offset+DIM*2+YY] -= ty;
900 f[j_coord_offset+DIM*2+ZZ] -= tz;
904 /**************************
905 * CALCULATE INTERACTIONS *
906 **************************/
911 /* REACTION-FIELD ELECTROSTATICS */
912 felec = qq10*(rinv10*rinvsq10-krf2);
916 /* Calculate temporary vectorial force */
921 /* Update vectorial force */
925 f[j_coord_offset+DIM*0+XX] -= tx;
926 f[j_coord_offset+DIM*0+YY] -= ty;
927 f[j_coord_offset+DIM*0+ZZ] -= tz;
931 /**************************
932 * CALCULATE INTERACTIONS *
933 **************************/
938 /* REACTION-FIELD ELECTROSTATICS */
939 felec = qq11*(rinv11*rinvsq11-krf2);
943 /* Calculate temporary vectorial force */
948 /* Update vectorial force */
952 f[j_coord_offset+DIM*1+XX] -= tx;
953 f[j_coord_offset+DIM*1+YY] -= ty;
954 f[j_coord_offset+DIM*1+ZZ] -= tz;
958 /**************************
959 * CALCULATE INTERACTIONS *
960 **************************/
965 /* REACTION-FIELD ELECTROSTATICS */
966 felec = qq12*(rinv12*rinvsq12-krf2);
970 /* Calculate temporary vectorial force */
975 /* Update vectorial force */
979 f[j_coord_offset+DIM*2+XX] -= tx;
980 f[j_coord_offset+DIM*2+YY] -= ty;
981 f[j_coord_offset+DIM*2+ZZ] -= tz;
985 /**************************
986 * CALCULATE INTERACTIONS *
987 **************************/
992 /* REACTION-FIELD ELECTROSTATICS */
993 felec = qq20*(rinv20*rinvsq20-krf2);
997 /* Calculate temporary vectorial force */
1002 /* Update vectorial force */
1006 f[j_coord_offset+DIM*0+XX] -= tx;
1007 f[j_coord_offset+DIM*0+YY] -= ty;
1008 f[j_coord_offset+DIM*0+ZZ] -= tz;
1012 /**************************
1013 * CALCULATE INTERACTIONS *
1014 **************************/
1019 /* REACTION-FIELD ELECTROSTATICS */
1020 felec = qq21*(rinv21*rinvsq21-krf2);
1024 /* Calculate temporary vectorial force */
1029 /* Update vectorial force */
1033 f[j_coord_offset+DIM*1+XX] -= tx;
1034 f[j_coord_offset+DIM*1+YY] -= ty;
1035 f[j_coord_offset+DIM*1+ZZ] -= tz;
1039 /**************************
1040 * CALCULATE INTERACTIONS *
1041 **************************/
1046 /* REACTION-FIELD ELECTROSTATICS */
1047 felec = qq22*(rinv22*rinvsq22-krf2);
1051 /* Calculate temporary vectorial force */
1056 /* Update vectorial force */
1060 f[j_coord_offset+DIM*2+XX] -= tx;
1061 f[j_coord_offset+DIM*2+YY] -= ty;
1062 f[j_coord_offset+DIM*2+ZZ] -= tz;
1066 /* Inner loop uses 270 flops */
1068 /* End of innermost loop */
1071 f[i_coord_offset+DIM*0+XX] += fix0;
1072 f[i_coord_offset+DIM*0+YY] += fiy0;
1073 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1077 f[i_coord_offset+DIM*1+XX] += fix1;
1078 f[i_coord_offset+DIM*1+YY] += fiy1;
1079 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1083 f[i_coord_offset+DIM*2+XX] += fix2;
1084 f[i_coord_offset+DIM*2+YY] += fiy2;
1085 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1089 fshift[i_shift_offset+XX] += tx;
1090 fshift[i_shift_offset+YY] += ty;
1091 fshift[i_shift_offset+ZZ] += tz;
1093 /* Increment number of inner iterations */
1094 inneriter += j_index_end - j_index_start;
1096 /* Outer loop uses 30 flops */
1099 /* Increment number of outer iterations */
1102 /* Update outer/inner flops */
1104 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3W3_F,outeriter*30 + inneriter*270);