2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014, 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.
42 #include "../nb_kernel.h"
43 #include "types/simple.h"
44 #include "gromacs/math/vec.h"
48 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwBham_GeomW4W4_VF_c
49 * Electrostatics interaction: CubicSplineTable
50 * VdW interaction: Buckingham
51 * Geometry: Water4-Water4
52 * Calculate force/pot: PotentialAndForce
55 nb_kernel_ElecCSTab_VdwBham_GeomW4W4_VF_c
56 (t_nblist * gmx_restrict nlist,
57 rvec * gmx_restrict xx,
58 rvec * gmx_restrict ff,
59 t_forcerec * gmx_restrict fr,
60 t_mdatoms * gmx_restrict mdatoms,
61 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
62 t_nrnb * gmx_restrict nrnb)
64 int i_shift_offset,i_coord_offset,j_coord_offset;
65 int j_index_start,j_index_end;
66 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
67 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
68 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
69 real *shiftvec,*fshift,*x,*f;
71 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
73 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
75 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
77 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
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;
85 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
86 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
87 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
88 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
89 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
90 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
91 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
92 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
93 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
94 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
95 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
96 real velec,felec,velecsum,facel,crf,krf,krf2;
99 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
103 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
111 jindex = nlist->jindex;
113 shiftidx = nlist->shift;
115 shiftvec = fr->shift_vec[0];
116 fshift = fr->fshift[0];
118 charge = mdatoms->chargeA;
119 nvdwtype = fr->ntype;
121 vdwtype = mdatoms->typeA;
123 vftab = kernel_data->table_elec->data;
124 vftabscale = kernel_data->table_elec->scale;
126 /* Setup water-specific parameters */
127 inr = nlist->iinr[0];
128 iq1 = facel*charge[inr+1];
129 iq2 = facel*charge[inr+2];
130 iq3 = facel*charge[inr+3];
131 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
136 vdwjidx0 = 3*vdwtype[inr+0];
137 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
138 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
139 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
153 /* Start outer loop over neighborlists */
154 for(iidx=0; iidx<nri; iidx++)
156 /* Load shift vector for this list */
157 i_shift_offset = DIM*shiftidx[iidx];
158 shX = shiftvec[i_shift_offset+XX];
159 shY = shiftvec[i_shift_offset+YY];
160 shZ = shiftvec[i_shift_offset+ZZ];
162 /* Load limits for loop over neighbors */
163 j_index_start = jindex[iidx];
164 j_index_end = jindex[iidx+1];
166 /* Get outer coordinate index */
168 i_coord_offset = DIM*inr;
170 /* Load i particle coords and add shift vector */
171 ix0 = shX + x[i_coord_offset+DIM*0+XX];
172 iy0 = shY + x[i_coord_offset+DIM*0+YY];
173 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
174 ix1 = shX + x[i_coord_offset+DIM*1+XX];
175 iy1 = shY + x[i_coord_offset+DIM*1+YY];
176 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
177 ix2 = shX + x[i_coord_offset+DIM*2+XX];
178 iy2 = shY + x[i_coord_offset+DIM*2+YY];
179 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
180 ix3 = shX + x[i_coord_offset+DIM*3+XX];
181 iy3 = shY + x[i_coord_offset+DIM*3+YY];
182 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
197 /* Reset potential sums */
201 /* Start inner kernel loop */
202 for(jidx=j_index_start; jidx<j_index_end; jidx++)
204 /* Get j neighbor index, and coordinate index */
206 j_coord_offset = DIM*jnr;
208 /* load j atom coordinates */
209 jx0 = x[j_coord_offset+DIM*0+XX];
210 jy0 = x[j_coord_offset+DIM*0+YY];
211 jz0 = x[j_coord_offset+DIM*0+ZZ];
212 jx1 = x[j_coord_offset+DIM*1+XX];
213 jy1 = x[j_coord_offset+DIM*1+YY];
214 jz1 = x[j_coord_offset+DIM*1+ZZ];
215 jx2 = x[j_coord_offset+DIM*2+XX];
216 jy2 = x[j_coord_offset+DIM*2+YY];
217 jz2 = x[j_coord_offset+DIM*2+ZZ];
218 jx3 = x[j_coord_offset+DIM*3+XX];
219 jy3 = x[j_coord_offset+DIM*3+YY];
220 jz3 = x[j_coord_offset+DIM*3+ZZ];
222 /* Calculate displacement vector */
254 /* Calculate squared distance and things based on it */
255 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
256 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
257 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
258 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
259 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
260 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
261 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
262 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
263 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
264 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
266 rinv00 = gmx_invsqrt(rsq00);
267 rinv11 = gmx_invsqrt(rsq11);
268 rinv12 = gmx_invsqrt(rsq12);
269 rinv13 = gmx_invsqrt(rsq13);
270 rinv21 = gmx_invsqrt(rsq21);
271 rinv22 = gmx_invsqrt(rsq22);
272 rinv23 = gmx_invsqrt(rsq23);
273 rinv31 = gmx_invsqrt(rsq31);
274 rinv32 = gmx_invsqrt(rsq32);
275 rinv33 = gmx_invsqrt(rsq33);
277 rinvsq00 = rinv00*rinv00;
279 /**************************
280 * CALCULATE INTERACTIONS *
281 **************************/
285 /* BUCKINGHAM DISPERSION/REPULSION */
286 rinvsix = rinvsq00*rinvsq00*rinvsq00;
287 vvdw6 = c6_00*rinvsix;
289 vvdwexp = cexp1_00*exp(-br);
290 vvdw = vvdwexp - vvdw6*(1.0/6.0);
291 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
293 /* Update potential sums from outer loop */
298 /* Calculate temporary vectorial force */
303 /* Update vectorial force */
307 f[j_coord_offset+DIM*0+XX] -= tx;
308 f[j_coord_offset+DIM*0+YY] -= ty;
309 f[j_coord_offset+DIM*0+ZZ] -= tz;
311 /**************************
312 * CALCULATE INTERACTIONS *
313 **************************/
317 /* Calculate table index by multiplying r with table scale and truncate to integer */
323 /* CUBIC SPLINE TABLE ELECTROSTATICS */
326 Geps = vfeps*vftab[vfitab+2];
327 Heps2 = vfeps*vfeps*vftab[vfitab+3];
331 FF = Fp+Geps+2.0*Heps2;
332 felec = -qq11*FF*vftabscale*rinv11;
334 /* Update potential sums from outer loop */
339 /* Calculate temporary vectorial force */
344 /* Update vectorial force */
348 f[j_coord_offset+DIM*1+XX] -= tx;
349 f[j_coord_offset+DIM*1+YY] -= ty;
350 f[j_coord_offset+DIM*1+ZZ] -= tz;
352 /**************************
353 * CALCULATE INTERACTIONS *
354 **************************/
358 /* Calculate table index by multiplying r with table scale and truncate to integer */
364 /* CUBIC SPLINE TABLE ELECTROSTATICS */
367 Geps = vfeps*vftab[vfitab+2];
368 Heps2 = vfeps*vfeps*vftab[vfitab+3];
372 FF = Fp+Geps+2.0*Heps2;
373 felec = -qq12*FF*vftabscale*rinv12;
375 /* Update potential sums from outer loop */
380 /* Calculate temporary vectorial force */
385 /* Update vectorial force */
389 f[j_coord_offset+DIM*2+XX] -= tx;
390 f[j_coord_offset+DIM*2+YY] -= ty;
391 f[j_coord_offset+DIM*2+ZZ] -= tz;
393 /**************************
394 * CALCULATE INTERACTIONS *
395 **************************/
399 /* Calculate table index by multiplying r with table scale and truncate to integer */
405 /* CUBIC SPLINE TABLE ELECTROSTATICS */
408 Geps = vfeps*vftab[vfitab+2];
409 Heps2 = vfeps*vfeps*vftab[vfitab+3];
413 FF = Fp+Geps+2.0*Heps2;
414 felec = -qq13*FF*vftabscale*rinv13;
416 /* Update potential sums from outer loop */
421 /* Calculate temporary vectorial force */
426 /* Update vectorial force */
430 f[j_coord_offset+DIM*3+XX] -= tx;
431 f[j_coord_offset+DIM*3+YY] -= ty;
432 f[j_coord_offset+DIM*3+ZZ] -= tz;
434 /**************************
435 * CALCULATE INTERACTIONS *
436 **************************/
440 /* Calculate table index by multiplying r with table scale and truncate to integer */
446 /* CUBIC SPLINE TABLE ELECTROSTATICS */
449 Geps = vfeps*vftab[vfitab+2];
450 Heps2 = vfeps*vfeps*vftab[vfitab+3];
454 FF = Fp+Geps+2.0*Heps2;
455 felec = -qq21*FF*vftabscale*rinv21;
457 /* Update potential sums from outer loop */
462 /* Calculate temporary vectorial force */
467 /* Update vectorial force */
471 f[j_coord_offset+DIM*1+XX] -= tx;
472 f[j_coord_offset+DIM*1+YY] -= ty;
473 f[j_coord_offset+DIM*1+ZZ] -= tz;
475 /**************************
476 * CALCULATE INTERACTIONS *
477 **************************/
481 /* Calculate table index by multiplying r with table scale and truncate to integer */
487 /* CUBIC SPLINE TABLE ELECTROSTATICS */
490 Geps = vfeps*vftab[vfitab+2];
491 Heps2 = vfeps*vfeps*vftab[vfitab+3];
495 FF = Fp+Geps+2.0*Heps2;
496 felec = -qq22*FF*vftabscale*rinv22;
498 /* Update potential sums from outer loop */
503 /* Calculate temporary vectorial force */
508 /* Update vectorial force */
512 f[j_coord_offset+DIM*2+XX] -= tx;
513 f[j_coord_offset+DIM*2+YY] -= ty;
514 f[j_coord_offset+DIM*2+ZZ] -= tz;
516 /**************************
517 * CALCULATE INTERACTIONS *
518 **************************/
522 /* Calculate table index by multiplying r with table scale and truncate to integer */
528 /* CUBIC SPLINE TABLE ELECTROSTATICS */
531 Geps = vfeps*vftab[vfitab+2];
532 Heps2 = vfeps*vfeps*vftab[vfitab+3];
536 FF = Fp+Geps+2.0*Heps2;
537 felec = -qq23*FF*vftabscale*rinv23;
539 /* Update potential sums from outer loop */
544 /* Calculate temporary vectorial force */
549 /* Update vectorial force */
553 f[j_coord_offset+DIM*3+XX] -= tx;
554 f[j_coord_offset+DIM*3+YY] -= ty;
555 f[j_coord_offset+DIM*3+ZZ] -= tz;
557 /**************************
558 * CALCULATE INTERACTIONS *
559 **************************/
563 /* Calculate table index by multiplying r with table scale and truncate to integer */
569 /* CUBIC SPLINE TABLE ELECTROSTATICS */
572 Geps = vfeps*vftab[vfitab+2];
573 Heps2 = vfeps*vfeps*vftab[vfitab+3];
577 FF = Fp+Geps+2.0*Heps2;
578 felec = -qq31*FF*vftabscale*rinv31;
580 /* Update potential sums from outer loop */
585 /* Calculate temporary vectorial force */
590 /* Update vectorial force */
594 f[j_coord_offset+DIM*1+XX] -= tx;
595 f[j_coord_offset+DIM*1+YY] -= ty;
596 f[j_coord_offset+DIM*1+ZZ] -= tz;
598 /**************************
599 * CALCULATE INTERACTIONS *
600 **************************/
604 /* Calculate table index by multiplying r with table scale and truncate to integer */
610 /* CUBIC SPLINE TABLE ELECTROSTATICS */
613 Geps = vfeps*vftab[vfitab+2];
614 Heps2 = vfeps*vfeps*vftab[vfitab+3];
618 FF = Fp+Geps+2.0*Heps2;
619 felec = -qq32*FF*vftabscale*rinv32;
621 /* Update potential sums from outer loop */
626 /* Calculate temporary vectorial force */
631 /* Update vectorial force */
635 f[j_coord_offset+DIM*2+XX] -= tx;
636 f[j_coord_offset+DIM*2+YY] -= ty;
637 f[j_coord_offset+DIM*2+ZZ] -= tz;
639 /**************************
640 * CALCULATE INTERACTIONS *
641 **************************/
645 /* Calculate table index by multiplying r with table scale and truncate to integer */
651 /* CUBIC SPLINE TABLE ELECTROSTATICS */
654 Geps = vfeps*vftab[vfitab+2];
655 Heps2 = vfeps*vfeps*vftab[vfitab+3];
659 FF = Fp+Geps+2.0*Heps2;
660 felec = -qq33*FF*vftabscale*rinv33;
662 /* Update potential sums from outer loop */
667 /* Calculate temporary vectorial force */
672 /* Update vectorial force */
676 f[j_coord_offset+DIM*3+XX] -= tx;
677 f[j_coord_offset+DIM*3+YY] -= ty;
678 f[j_coord_offset+DIM*3+ZZ] -= tz;
680 /* Inner loop uses 430 flops */
682 /* End of innermost loop */
685 f[i_coord_offset+DIM*0+XX] += fix0;
686 f[i_coord_offset+DIM*0+YY] += fiy0;
687 f[i_coord_offset+DIM*0+ZZ] += fiz0;
691 f[i_coord_offset+DIM*1+XX] += fix1;
692 f[i_coord_offset+DIM*1+YY] += fiy1;
693 f[i_coord_offset+DIM*1+ZZ] += fiz1;
697 f[i_coord_offset+DIM*2+XX] += fix2;
698 f[i_coord_offset+DIM*2+YY] += fiy2;
699 f[i_coord_offset+DIM*2+ZZ] += fiz2;
703 f[i_coord_offset+DIM*3+XX] += fix3;
704 f[i_coord_offset+DIM*3+YY] += fiy3;
705 f[i_coord_offset+DIM*3+ZZ] += fiz3;
709 fshift[i_shift_offset+XX] += tx;
710 fshift[i_shift_offset+YY] += ty;
711 fshift[i_shift_offset+ZZ] += tz;
714 /* Update potential energies */
715 kernel_data->energygrp_elec[ggid] += velecsum;
716 kernel_data->energygrp_vdw[ggid] += vvdwsum;
718 /* Increment number of inner iterations */
719 inneriter += j_index_end - j_index_start;
721 /* Outer loop uses 41 flops */
724 /* Increment number of outer iterations */
727 /* Update outer/inner flops */
729 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*41 + inneriter*430);
732 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwBham_GeomW4W4_F_c
733 * Electrostatics interaction: CubicSplineTable
734 * VdW interaction: Buckingham
735 * Geometry: Water4-Water4
736 * Calculate force/pot: Force
739 nb_kernel_ElecCSTab_VdwBham_GeomW4W4_F_c
740 (t_nblist * gmx_restrict nlist,
741 rvec * gmx_restrict xx,
742 rvec * gmx_restrict ff,
743 t_forcerec * gmx_restrict fr,
744 t_mdatoms * gmx_restrict mdatoms,
745 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
746 t_nrnb * gmx_restrict nrnb)
748 int i_shift_offset,i_coord_offset,j_coord_offset;
749 int j_index_start,j_index_end;
750 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
751 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
752 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
753 real *shiftvec,*fshift,*x,*f;
755 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
757 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
759 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
761 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
763 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
765 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
767 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
769 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
770 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
771 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
772 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
773 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
774 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
775 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
776 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
777 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
778 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
779 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
780 real velec,felec,velecsum,facel,crf,krf,krf2;
783 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
787 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
795 jindex = nlist->jindex;
797 shiftidx = nlist->shift;
799 shiftvec = fr->shift_vec[0];
800 fshift = fr->fshift[0];
802 charge = mdatoms->chargeA;
803 nvdwtype = fr->ntype;
805 vdwtype = mdatoms->typeA;
807 vftab = kernel_data->table_elec->data;
808 vftabscale = kernel_data->table_elec->scale;
810 /* Setup water-specific parameters */
811 inr = nlist->iinr[0];
812 iq1 = facel*charge[inr+1];
813 iq2 = facel*charge[inr+2];
814 iq3 = facel*charge[inr+3];
815 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
820 vdwjidx0 = 3*vdwtype[inr+0];
821 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
822 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
823 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
837 /* Start outer loop over neighborlists */
838 for(iidx=0; iidx<nri; iidx++)
840 /* Load shift vector for this list */
841 i_shift_offset = DIM*shiftidx[iidx];
842 shX = shiftvec[i_shift_offset+XX];
843 shY = shiftvec[i_shift_offset+YY];
844 shZ = shiftvec[i_shift_offset+ZZ];
846 /* Load limits for loop over neighbors */
847 j_index_start = jindex[iidx];
848 j_index_end = jindex[iidx+1];
850 /* Get outer coordinate index */
852 i_coord_offset = DIM*inr;
854 /* Load i particle coords and add shift vector */
855 ix0 = shX + x[i_coord_offset+DIM*0+XX];
856 iy0 = shY + x[i_coord_offset+DIM*0+YY];
857 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
858 ix1 = shX + x[i_coord_offset+DIM*1+XX];
859 iy1 = shY + x[i_coord_offset+DIM*1+YY];
860 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
861 ix2 = shX + x[i_coord_offset+DIM*2+XX];
862 iy2 = shY + x[i_coord_offset+DIM*2+YY];
863 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
864 ix3 = shX + x[i_coord_offset+DIM*3+XX];
865 iy3 = shY + x[i_coord_offset+DIM*3+YY];
866 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
881 /* Start inner kernel loop */
882 for(jidx=j_index_start; jidx<j_index_end; jidx++)
884 /* Get j neighbor index, and coordinate index */
886 j_coord_offset = DIM*jnr;
888 /* load j atom coordinates */
889 jx0 = x[j_coord_offset+DIM*0+XX];
890 jy0 = x[j_coord_offset+DIM*0+YY];
891 jz0 = x[j_coord_offset+DIM*0+ZZ];
892 jx1 = x[j_coord_offset+DIM*1+XX];
893 jy1 = x[j_coord_offset+DIM*1+YY];
894 jz1 = x[j_coord_offset+DIM*1+ZZ];
895 jx2 = x[j_coord_offset+DIM*2+XX];
896 jy2 = x[j_coord_offset+DIM*2+YY];
897 jz2 = x[j_coord_offset+DIM*2+ZZ];
898 jx3 = x[j_coord_offset+DIM*3+XX];
899 jy3 = x[j_coord_offset+DIM*3+YY];
900 jz3 = x[j_coord_offset+DIM*3+ZZ];
902 /* Calculate displacement vector */
934 /* Calculate squared distance and things based on it */
935 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
936 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
937 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
938 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
939 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
940 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
941 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
942 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
943 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
944 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
946 rinv00 = gmx_invsqrt(rsq00);
947 rinv11 = gmx_invsqrt(rsq11);
948 rinv12 = gmx_invsqrt(rsq12);
949 rinv13 = gmx_invsqrt(rsq13);
950 rinv21 = gmx_invsqrt(rsq21);
951 rinv22 = gmx_invsqrt(rsq22);
952 rinv23 = gmx_invsqrt(rsq23);
953 rinv31 = gmx_invsqrt(rsq31);
954 rinv32 = gmx_invsqrt(rsq32);
955 rinv33 = gmx_invsqrt(rsq33);
957 rinvsq00 = rinv00*rinv00;
959 /**************************
960 * CALCULATE INTERACTIONS *
961 **************************/
965 /* BUCKINGHAM DISPERSION/REPULSION */
966 rinvsix = rinvsq00*rinvsq00*rinvsq00;
967 vvdw6 = c6_00*rinvsix;
969 vvdwexp = cexp1_00*exp(-br);
970 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
974 /* Calculate temporary vectorial force */
979 /* Update vectorial force */
983 f[j_coord_offset+DIM*0+XX] -= tx;
984 f[j_coord_offset+DIM*0+YY] -= ty;
985 f[j_coord_offset+DIM*0+ZZ] -= tz;
987 /**************************
988 * CALCULATE INTERACTIONS *
989 **************************/
993 /* Calculate table index by multiplying r with table scale and truncate to integer */
999 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1000 F = vftab[vfitab+1];
1001 Geps = vfeps*vftab[vfitab+2];
1002 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1004 FF = Fp+Geps+2.0*Heps2;
1005 felec = -qq11*FF*vftabscale*rinv11;
1009 /* Calculate temporary vectorial force */
1014 /* Update vectorial force */
1018 f[j_coord_offset+DIM*1+XX] -= tx;
1019 f[j_coord_offset+DIM*1+YY] -= ty;
1020 f[j_coord_offset+DIM*1+ZZ] -= tz;
1022 /**************************
1023 * CALCULATE INTERACTIONS *
1024 **************************/
1028 /* Calculate table index by multiplying r with table scale and truncate to integer */
1029 rt = r12*vftabscale;
1032 vfitab = 1*4*vfitab;
1034 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1035 F = vftab[vfitab+1];
1036 Geps = vfeps*vftab[vfitab+2];
1037 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1039 FF = Fp+Geps+2.0*Heps2;
1040 felec = -qq12*FF*vftabscale*rinv12;
1044 /* Calculate temporary vectorial force */
1049 /* Update vectorial force */
1053 f[j_coord_offset+DIM*2+XX] -= tx;
1054 f[j_coord_offset+DIM*2+YY] -= ty;
1055 f[j_coord_offset+DIM*2+ZZ] -= tz;
1057 /**************************
1058 * CALCULATE INTERACTIONS *
1059 **************************/
1063 /* Calculate table index by multiplying r with table scale and truncate to integer */
1064 rt = r13*vftabscale;
1067 vfitab = 1*4*vfitab;
1069 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1070 F = vftab[vfitab+1];
1071 Geps = vfeps*vftab[vfitab+2];
1072 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1074 FF = Fp+Geps+2.0*Heps2;
1075 felec = -qq13*FF*vftabscale*rinv13;
1079 /* Calculate temporary vectorial force */
1084 /* Update vectorial force */
1088 f[j_coord_offset+DIM*3+XX] -= tx;
1089 f[j_coord_offset+DIM*3+YY] -= ty;
1090 f[j_coord_offset+DIM*3+ZZ] -= tz;
1092 /**************************
1093 * CALCULATE INTERACTIONS *
1094 **************************/
1098 /* Calculate table index by multiplying r with table scale and truncate to integer */
1099 rt = r21*vftabscale;
1102 vfitab = 1*4*vfitab;
1104 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1105 F = vftab[vfitab+1];
1106 Geps = vfeps*vftab[vfitab+2];
1107 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1109 FF = Fp+Geps+2.0*Heps2;
1110 felec = -qq21*FF*vftabscale*rinv21;
1114 /* Calculate temporary vectorial force */
1119 /* Update vectorial force */
1123 f[j_coord_offset+DIM*1+XX] -= tx;
1124 f[j_coord_offset+DIM*1+YY] -= ty;
1125 f[j_coord_offset+DIM*1+ZZ] -= tz;
1127 /**************************
1128 * CALCULATE INTERACTIONS *
1129 **************************/
1133 /* Calculate table index by multiplying r with table scale and truncate to integer */
1134 rt = r22*vftabscale;
1137 vfitab = 1*4*vfitab;
1139 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1140 F = vftab[vfitab+1];
1141 Geps = vfeps*vftab[vfitab+2];
1142 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1144 FF = Fp+Geps+2.0*Heps2;
1145 felec = -qq22*FF*vftabscale*rinv22;
1149 /* Calculate temporary vectorial force */
1154 /* Update vectorial force */
1158 f[j_coord_offset+DIM*2+XX] -= tx;
1159 f[j_coord_offset+DIM*2+YY] -= ty;
1160 f[j_coord_offset+DIM*2+ZZ] -= tz;
1162 /**************************
1163 * CALCULATE INTERACTIONS *
1164 **************************/
1168 /* Calculate table index by multiplying r with table scale and truncate to integer */
1169 rt = r23*vftabscale;
1172 vfitab = 1*4*vfitab;
1174 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1175 F = vftab[vfitab+1];
1176 Geps = vfeps*vftab[vfitab+2];
1177 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1179 FF = Fp+Geps+2.0*Heps2;
1180 felec = -qq23*FF*vftabscale*rinv23;
1184 /* Calculate temporary vectorial force */
1189 /* Update vectorial force */
1193 f[j_coord_offset+DIM*3+XX] -= tx;
1194 f[j_coord_offset+DIM*3+YY] -= ty;
1195 f[j_coord_offset+DIM*3+ZZ] -= tz;
1197 /**************************
1198 * CALCULATE INTERACTIONS *
1199 **************************/
1203 /* Calculate table index by multiplying r with table scale and truncate to integer */
1204 rt = r31*vftabscale;
1207 vfitab = 1*4*vfitab;
1209 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1210 F = vftab[vfitab+1];
1211 Geps = vfeps*vftab[vfitab+2];
1212 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1214 FF = Fp+Geps+2.0*Heps2;
1215 felec = -qq31*FF*vftabscale*rinv31;
1219 /* Calculate temporary vectorial force */
1224 /* Update vectorial force */
1228 f[j_coord_offset+DIM*1+XX] -= tx;
1229 f[j_coord_offset+DIM*1+YY] -= ty;
1230 f[j_coord_offset+DIM*1+ZZ] -= tz;
1232 /**************************
1233 * CALCULATE INTERACTIONS *
1234 **************************/
1238 /* Calculate table index by multiplying r with table scale and truncate to integer */
1239 rt = r32*vftabscale;
1242 vfitab = 1*4*vfitab;
1244 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1245 F = vftab[vfitab+1];
1246 Geps = vfeps*vftab[vfitab+2];
1247 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1249 FF = Fp+Geps+2.0*Heps2;
1250 felec = -qq32*FF*vftabscale*rinv32;
1254 /* Calculate temporary vectorial force */
1259 /* Update vectorial force */
1263 f[j_coord_offset+DIM*2+XX] -= tx;
1264 f[j_coord_offset+DIM*2+YY] -= ty;
1265 f[j_coord_offset+DIM*2+ZZ] -= tz;
1267 /**************************
1268 * CALCULATE INTERACTIONS *
1269 **************************/
1273 /* Calculate table index by multiplying r with table scale and truncate to integer */
1274 rt = r33*vftabscale;
1277 vfitab = 1*4*vfitab;
1279 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1280 F = vftab[vfitab+1];
1281 Geps = vfeps*vftab[vfitab+2];
1282 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1284 FF = Fp+Geps+2.0*Heps2;
1285 felec = -qq33*FF*vftabscale*rinv33;
1289 /* Calculate temporary vectorial force */
1294 /* Update vectorial force */
1298 f[j_coord_offset+DIM*3+XX] -= tx;
1299 f[j_coord_offset+DIM*3+YY] -= ty;
1300 f[j_coord_offset+DIM*3+ZZ] -= tz;
1302 /* Inner loop uses 391 flops */
1304 /* End of innermost loop */
1307 f[i_coord_offset+DIM*0+XX] += fix0;
1308 f[i_coord_offset+DIM*0+YY] += fiy0;
1309 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1313 f[i_coord_offset+DIM*1+XX] += fix1;
1314 f[i_coord_offset+DIM*1+YY] += fiy1;
1315 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1319 f[i_coord_offset+DIM*2+XX] += fix2;
1320 f[i_coord_offset+DIM*2+YY] += fiy2;
1321 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1325 f[i_coord_offset+DIM*3+XX] += fix3;
1326 f[i_coord_offset+DIM*3+YY] += fiy3;
1327 f[i_coord_offset+DIM*3+ZZ] += fiz3;
1331 fshift[i_shift_offset+XX] += tx;
1332 fshift[i_shift_offset+YY] += ty;
1333 fshift[i_shift_offset+ZZ] += tz;
1335 /* Increment number of inner iterations */
1336 inneriter += j_index_end - j_index_start;
1338 /* Outer loop uses 39 flops */
1341 /* Increment number of outer iterations */
1344 /* Update outer/inner flops */
1346 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*39 + inneriter*391);