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.
44 #include "../nb_kernel.h"
45 #include "gromacs/legacyheaders/types/simple.h"
46 #include "gromacs/math/vec.h"
47 #include "gromacs/legacyheaders/nrnb.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwBham_GeomW4W4_VF_c
51 * Electrostatics interaction: CubicSplineTable
52 * VdW interaction: Buckingham
53 * Geometry: Water4-Water4
54 * Calculate force/pot: PotentialAndForce
57 nb_kernel_ElecCSTab_VdwBham_GeomW4W4_VF_c
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 int i_shift_offset,i_coord_offset,j_coord_offset;
67 int j_index_start,j_index_end;
68 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
69 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
70 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
71 real *shiftvec,*fshift,*x,*f;
73 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
75 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
77 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
79 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
81 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
83 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
85 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
87 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
88 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
89 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
90 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
91 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
92 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
93 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
94 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
95 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
96 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
97 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
98 real velec,felec,velecsum,facel,crf,krf,krf2;
101 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
105 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
113 jindex = nlist->jindex;
115 shiftidx = nlist->shift;
117 shiftvec = fr->shift_vec[0];
118 fshift = fr->fshift[0];
120 charge = mdatoms->chargeA;
121 nvdwtype = fr->ntype;
123 vdwtype = mdatoms->typeA;
125 vftab = kernel_data->table_elec->data;
126 vftabscale = kernel_data->table_elec->scale;
128 /* Setup water-specific parameters */
129 inr = nlist->iinr[0];
130 iq1 = facel*charge[inr+1];
131 iq2 = facel*charge[inr+2];
132 iq3 = facel*charge[inr+3];
133 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
138 vdwjidx0 = 3*vdwtype[inr+0];
139 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
140 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
141 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
155 /* Start outer loop over neighborlists */
156 for(iidx=0; iidx<nri; iidx++)
158 /* Load shift vector for this list */
159 i_shift_offset = DIM*shiftidx[iidx];
160 shX = shiftvec[i_shift_offset+XX];
161 shY = shiftvec[i_shift_offset+YY];
162 shZ = shiftvec[i_shift_offset+ZZ];
164 /* Load limits for loop over neighbors */
165 j_index_start = jindex[iidx];
166 j_index_end = jindex[iidx+1];
168 /* Get outer coordinate index */
170 i_coord_offset = DIM*inr;
172 /* Load i particle coords and add shift vector */
173 ix0 = shX + x[i_coord_offset+DIM*0+XX];
174 iy0 = shY + x[i_coord_offset+DIM*0+YY];
175 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
176 ix1 = shX + x[i_coord_offset+DIM*1+XX];
177 iy1 = shY + x[i_coord_offset+DIM*1+YY];
178 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
179 ix2 = shX + x[i_coord_offset+DIM*2+XX];
180 iy2 = shY + x[i_coord_offset+DIM*2+YY];
181 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
182 ix3 = shX + x[i_coord_offset+DIM*3+XX];
183 iy3 = shY + x[i_coord_offset+DIM*3+YY];
184 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
199 /* Reset potential sums */
203 /* Start inner kernel loop */
204 for(jidx=j_index_start; jidx<j_index_end; jidx++)
206 /* Get j neighbor index, and coordinate index */
208 j_coord_offset = DIM*jnr;
210 /* load j atom coordinates */
211 jx0 = x[j_coord_offset+DIM*0+XX];
212 jy0 = x[j_coord_offset+DIM*0+YY];
213 jz0 = x[j_coord_offset+DIM*0+ZZ];
214 jx1 = x[j_coord_offset+DIM*1+XX];
215 jy1 = x[j_coord_offset+DIM*1+YY];
216 jz1 = x[j_coord_offset+DIM*1+ZZ];
217 jx2 = x[j_coord_offset+DIM*2+XX];
218 jy2 = x[j_coord_offset+DIM*2+YY];
219 jz2 = x[j_coord_offset+DIM*2+ZZ];
220 jx3 = x[j_coord_offset+DIM*3+XX];
221 jy3 = x[j_coord_offset+DIM*3+YY];
222 jz3 = x[j_coord_offset+DIM*3+ZZ];
224 /* Calculate displacement vector */
256 /* Calculate squared distance and things based on it */
257 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
258 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
259 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
260 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
261 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
262 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
263 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
264 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
265 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
266 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
268 rinv00 = gmx_invsqrt(rsq00);
269 rinv11 = gmx_invsqrt(rsq11);
270 rinv12 = gmx_invsqrt(rsq12);
271 rinv13 = gmx_invsqrt(rsq13);
272 rinv21 = gmx_invsqrt(rsq21);
273 rinv22 = gmx_invsqrt(rsq22);
274 rinv23 = gmx_invsqrt(rsq23);
275 rinv31 = gmx_invsqrt(rsq31);
276 rinv32 = gmx_invsqrt(rsq32);
277 rinv33 = gmx_invsqrt(rsq33);
279 rinvsq00 = rinv00*rinv00;
281 /**************************
282 * CALCULATE INTERACTIONS *
283 **************************/
287 /* BUCKINGHAM DISPERSION/REPULSION */
288 rinvsix = rinvsq00*rinvsq00*rinvsq00;
289 vvdw6 = c6_00*rinvsix;
291 vvdwexp = cexp1_00*exp(-br);
292 vvdw = vvdwexp - vvdw6*(1.0/6.0);
293 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
295 /* Update potential sums from outer loop */
300 /* Calculate temporary vectorial force */
305 /* Update vectorial force */
309 f[j_coord_offset+DIM*0+XX] -= tx;
310 f[j_coord_offset+DIM*0+YY] -= ty;
311 f[j_coord_offset+DIM*0+ZZ] -= tz;
313 /**************************
314 * CALCULATE INTERACTIONS *
315 **************************/
319 /* Calculate table index by multiplying r with table scale and truncate to integer */
325 /* CUBIC SPLINE TABLE ELECTROSTATICS */
328 Geps = vfeps*vftab[vfitab+2];
329 Heps2 = vfeps*vfeps*vftab[vfitab+3];
333 FF = Fp+Geps+2.0*Heps2;
334 felec = -qq11*FF*vftabscale*rinv11;
336 /* Update potential sums from outer loop */
341 /* Calculate temporary vectorial force */
346 /* Update vectorial force */
350 f[j_coord_offset+DIM*1+XX] -= tx;
351 f[j_coord_offset+DIM*1+YY] -= ty;
352 f[j_coord_offset+DIM*1+ZZ] -= tz;
354 /**************************
355 * CALCULATE INTERACTIONS *
356 **************************/
360 /* Calculate table index by multiplying r with table scale and truncate to integer */
366 /* CUBIC SPLINE TABLE ELECTROSTATICS */
369 Geps = vfeps*vftab[vfitab+2];
370 Heps2 = vfeps*vfeps*vftab[vfitab+3];
374 FF = Fp+Geps+2.0*Heps2;
375 felec = -qq12*FF*vftabscale*rinv12;
377 /* Update potential sums from outer loop */
382 /* Calculate temporary vectorial force */
387 /* Update vectorial force */
391 f[j_coord_offset+DIM*2+XX] -= tx;
392 f[j_coord_offset+DIM*2+YY] -= ty;
393 f[j_coord_offset+DIM*2+ZZ] -= tz;
395 /**************************
396 * CALCULATE INTERACTIONS *
397 **************************/
401 /* Calculate table index by multiplying r with table scale and truncate to integer */
407 /* CUBIC SPLINE TABLE ELECTROSTATICS */
410 Geps = vfeps*vftab[vfitab+2];
411 Heps2 = vfeps*vfeps*vftab[vfitab+3];
415 FF = Fp+Geps+2.0*Heps2;
416 felec = -qq13*FF*vftabscale*rinv13;
418 /* Update potential sums from outer loop */
423 /* Calculate temporary vectorial force */
428 /* Update vectorial force */
432 f[j_coord_offset+DIM*3+XX] -= tx;
433 f[j_coord_offset+DIM*3+YY] -= ty;
434 f[j_coord_offset+DIM*3+ZZ] -= tz;
436 /**************************
437 * CALCULATE INTERACTIONS *
438 **************************/
442 /* Calculate table index by multiplying r with table scale and truncate to integer */
448 /* CUBIC SPLINE TABLE ELECTROSTATICS */
451 Geps = vfeps*vftab[vfitab+2];
452 Heps2 = vfeps*vfeps*vftab[vfitab+3];
456 FF = Fp+Geps+2.0*Heps2;
457 felec = -qq21*FF*vftabscale*rinv21;
459 /* Update potential sums from outer loop */
464 /* Calculate temporary vectorial force */
469 /* Update vectorial force */
473 f[j_coord_offset+DIM*1+XX] -= tx;
474 f[j_coord_offset+DIM*1+YY] -= ty;
475 f[j_coord_offset+DIM*1+ZZ] -= tz;
477 /**************************
478 * CALCULATE INTERACTIONS *
479 **************************/
483 /* Calculate table index by multiplying r with table scale and truncate to integer */
489 /* CUBIC SPLINE TABLE ELECTROSTATICS */
492 Geps = vfeps*vftab[vfitab+2];
493 Heps2 = vfeps*vfeps*vftab[vfitab+3];
497 FF = Fp+Geps+2.0*Heps2;
498 felec = -qq22*FF*vftabscale*rinv22;
500 /* Update potential sums from outer loop */
505 /* Calculate temporary vectorial force */
510 /* Update vectorial force */
514 f[j_coord_offset+DIM*2+XX] -= tx;
515 f[j_coord_offset+DIM*2+YY] -= ty;
516 f[j_coord_offset+DIM*2+ZZ] -= tz;
518 /**************************
519 * CALCULATE INTERACTIONS *
520 **************************/
524 /* Calculate table index by multiplying r with table scale and truncate to integer */
530 /* CUBIC SPLINE TABLE ELECTROSTATICS */
533 Geps = vfeps*vftab[vfitab+2];
534 Heps2 = vfeps*vfeps*vftab[vfitab+3];
538 FF = Fp+Geps+2.0*Heps2;
539 felec = -qq23*FF*vftabscale*rinv23;
541 /* Update potential sums from outer loop */
546 /* Calculate temporary vectorial force */
551 /* Update vectorial force */
555 f[j_coord_offset+DIM*3+XX] -= tx;
556 f[j_coord_offset+DIM*3+YY] -= ty;
557 f[j_coord_offset+DIM*3+ZZ] -= tz;
559 /**************************
560 * CALCULATE INTERACTIONS *
561 **************************/
565 /* Calculate table index by multiplying r with table scale and truncate to integer */
571 /* CUBIC SPLINE TABLE ELECTROSTATICS */
574 Geps = vfeps*vftab[vfitab+2];
575 Heps2 = vfeps*vfeps*vftab[vfitab+3];
579 FF = Fp+Geps+2.0*Heps2;
580 felec = -qq31*FF*vftabscale*rinv31;
582 /* Update potential sums from outer loop */
587 /* Calculate temporary vectorial force */
592 /* Update vectorial force */
596 f[j_coord_offset+DIM*1+XX] -= tx;
597 f[j_coord_offset+DIM*1+YY] -= ty;
598 f[j_coord_offset+DIM*1+ZZ] -= tz;
600 /**************************
601 * CALCULATE INTERACTIONS *
602 **************************/
606 /* Calculate table index by multiplying r with table scale and truncate to integer */
612 /* CUBIC SPLINE TABLE ELECTROSTATICS */
615 Geps = vfeps*vftab[vfitab+2];
616 Heps2 = vfeps*vfeps*vftab[vfitab+3];
620 FF = Fp+Geps+2.0*Heps2;
621 felec = -qq32*FF*vftabscale*rinv32;
623 /* Update potential sums from outer loop */
628 /* Calculate temporary vectorial force */
633 /* Update vectorial force */
637 f[j_coord_offset+DIM*2+XX] -= tx;
638 f[j_coord_offset+DIM*2+YY] -= ty;
639 f[j_coord_offset+DIM*2+ZZ] -= tz;
641 /**************************
642 * CALCULATE INTERACTIONS *
643 **************************/
647 /* Calculate table index by multiplying r with table scale and truncate to integer */
653 /* CUBIC SPLINE TABLE ELECTROSTATICS */
656 Geps = vfeps*vftab[vfitab+2];
657 Heps2 = vfeps*vfeps*vftab[vfitab+3];
661 FF = Fp+Geps+2.0*Heps2;
662 felec = -qq33*FF*vftabscale*rinv33;
664 /* Update potential sums from outer loop */
669 /* Calculate temporary vectorial force */
674 /* Update vectorial force */
678 f[j_coord_offset+DIM*3+XX] -= tx;
679 f[j_coord_offset+DIM*3+YY] -= ty;
680 f[j_coord_offset+DIM*3+ZZ] -= tz;
682 /* Inner loop uses 430 flops */
684 /* End of innermost loop */
687 f[i_coord_offset+DIM*0+XX] += fix0;
688 f[i_coord_offset+DIM*0+YY] += fiy0;
689 f[i_coord_offset+DIM*0+ZZ] += fiz0;
693 f[i_coord_offset+DIM*1+XX] += fix1;
694 f[i_coord_offset+DIM*1+YY] += fiy1;
695 f[i_coord_offset+DIM*1+ZZ] += fiz1;
699 f[i_coord_offset+DIM*2+XX] += fix2;
700 f[i_coord_offset+DIM*2+YY] += fiy2;
701 f[i_coord_offset+DIM*2+ZZ] += fiz2;
705 f[i_coord_offset+DIM*3+XX] += fix3;
706 f[i_coord_offset+DIM*3+YY] += fiy3;
707 f[i_coord_offset+DIM*3+ZZ] += fiz3;
711 fshift[i_shift_offset+XX] += tx;
712 fshift[i_shift_offset+YY] += ty;
713 fshift[i_shift_offset+ZZ] += tz;
716 /* Update potential energies */
717 kernel_data->energygrp_elec[ggid] += velecsum;
718 kernel_data->energygrp_vdw[ggid] += vvdwsum;
720 /* Increment number of inner iterations */
721 inneriter += j_index_end - j_index_start;
723 /* Outer loop uses 41 flops */
726 /* Increment number of outer iterations */
729 /* Update outer/inner flops */
731 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_VF,outeriter*41 + inneriter*430);
734 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwBham_GeomW4W4_F_c
735 * Electrostatics interaction: CubicSplineTable
736 * VdW interaction: Buckingham
737 * Geometry: Water4-Water4
738 * Calculate force/pot: Force
741 nb_kernel_ElecCSTab_VdwBham_GeomW4W4_F_c
742 (t_nblist * gmx_restrict nlist,
743 rvec * gmx_restrict xx,
744 rvec * gmx_restrict ff,
745 t_forcerec * gmx_restrict fr,
746 t_mdatoms * gmx_restrict mdatoms,
747 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
748 t_nrnb * gmx_restrict nrnb)
750 int i_shift_offset,i_coord_offset,j_coord_offset;
751 int j_index_start,j_index_end;
752 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
753 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
754 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
755 real *shiftvec,*fshift,*x,*f;
757 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
759 real ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
761 real ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
763 real ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
765 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
767 real jx1,jy1,jz1,fjx1,fjy1,fjz1,jq1,isaj1;
769 real jx2,jy2,jz2,fjx2,fjy2,fjz2,jq2,isaj2;
771 real jx3,jy3,jz3,fjx3,fjy3,fjz3,jq3,isaj3;
772 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
773 real dx11,dy11,dz11,rsq11,rinv11,rinvsq11,r11,qq11,c6_11,c12_11,cexp1_11,cexp2_11;
774 real dx12,dy12,dz12,rsq12,rinv12,rinvsq12,r12,qq12,c6_12,c12_12,cexp1_12,cexp2_12;
775 real dx13,dy13,dz13,rsq13,rinv13,rinvsq13,r13,qq13,c6_13,c12_13,cexp1_13,cexp2_13;
776 real dx21,dy21,dz21,rsq21,rinv21,rinvsq21,r21,qq21,c6_21,c12_21,cexp1_21,cexp2_21;
777 real dx22,dy22,dz22,rsq22,rinv22,rinvsq22,r22,qq22,c6_22,c12_22,cexp1_22,cexp2_22;
778 real dx23,dy23,dz23,rsq23,rinv23,rinvsq23,r23,qq23,c6_23,c12_23,cexp1_23,cexp2_23;
779 real dx31,dy31,dz31,rsq31,rinv31,rinvsq31,r31,qq31,c6_31,c12_31,cexp1_31,cexp2_31;
780 real dx32,dy32,dz32,rsq32,rinv32,rinvsq32,r32,qq32,c6_32,c12_32,cexp1_32,cexp2_32;
781 real dx33,dy33,dz33,rsq33,rinv33,rinvsq33,r33,qq33,c6_33,c12_33,cexp1_33,cexp2_33;
782 real velec,felec,velecsum,facel,crf,krf,krf2;
785 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
789 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
797 jindex = nlist->jindex;
799 shiftidx = nlist->shift;
801 shiftvec = fr->shift_vec[0];
802 fshift = fr->fshift[0];
804 charge = mdatoms->chargeA;
805 nvdwtype = fr->ntype;
807 vdwtype = mdatoms->typeA;
809 vftab = kernel_data->table_elec->data;
810 vftabscale = kernel_data->table_elec->scale;
812 /* Setup water-specific parameters */
813 inr = nlist->iinr[0];
814 iq1 = facel*charge[inr+1];
815 iq2 = facel*charge[inr+2];
816 iq3 = facel*charge[inr+3];
817 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
822 vdwjidx0 = 3*vdwtype[inr+0];
823 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
824 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
825 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
839 /* Start outer loop over neighborlists */
840 for(iidx=0; iidx<nri; iidx++)
842 /* Load shift vector for this list */
843 i_shift_offset = DIM*shiftidx[iidx];
844 shX = shiftvec[i_shift_offset+XX];
845 shY = shiftvec[i_shift_offset+YY];
846 shZ = shiftvec[i_shift_offset+ZZ];
848 /* Load limits for loop over neighbors */
849 j_index_start = jindex[iidx];
850 j_index_end = jindex[iidx+1];
852 /* Get outer coordinate index */
854 i_coord_offset = DIM*inr;
856 /* Load i particle coords and add shift vector */
857 ix0 = shX + x[i_coord_offset+DIM*0+XX];
858 iy0 = shY + x[i_coord_offset+DIM*0+YY];
859 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
860 ix1 = shX + x[i_coord_offset+DIM*1+XX];
861 iy1 = shY + x[i_coord_offset+DIM*1+YY];
862 iz1 = shZ + x[i_coord_offset+DIM*1+ZZ];
863 ix2 = shX + x[i_coord_offset+DIM*2+XX];
864 iy2 = shY + x[i_coord_offset+DIM*2+YY];
865 iz2 = shZ + x[i_coord_offset+DIM*2+ZZ];
866 ix3 = shX + x[i_coord_offset+DIM*3+XX];
867 iy3 = shY + x[i_coord_offset+DIM*3+YY];
868 iz3 = shZ + x[i_coord_offset+DIM*3+ZZ];
883 /* Start inner kernel loop */
884 for(jidx=j_index_start; jidx<j_index_end; jidx++)
886 /* Get j neighbor index, and coordinate index */
888 j_coord_offset = DIM*jnr;
890 /* load j atom coordinates */
891 jx0 = x[j_coord_offset+DIM*0+XX];
892 jy0 = x[j_coord_offset+DIM*0+YY];
893 jz0 = x[j_coord_offset+DIM*0+ZZ];
894 jx1 = x[j_coord_offset+DIM*1+XX];
895 jy1 = x[j_coord_offset+DIM*1+YY];
896 jz1 = x[j_coord_offset+DIM*1+ZZ];
897 jx2 = x[j_coord_offset+DIM*2+XX];
898 jy2 = x[j_coord_offset+DIM*2+YY];
899 jz2 = x[j_coord_offset+DIM*2+ZZ];
900 jx3 = x[j_coord_offset+DIM*3+XX];
901 jy3 = x[j_coord_offset+DIM*3+YY];
902 jz3 = x[j_coord_offset+DIM*3+ZZ];
904 /* Calculate displacement vector */
936 /* Calculate squared distance and things based on it */
937 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
938 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
939 rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
940 rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
941 rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
942 rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
943 rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
944 rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
945 rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
946 rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
948 rinv00 = gmx_invsqrt(rsq00);
949 rinv11 = gmx_invsqrt(rsq11);
950 rinv12 = gmx_invsqrt(rsq12);
951 rinv13 = gmx_invsqrt(rsq13);
952 rinv21 = gmx_invsqrt(rsq21);
953 rinv22 = gmx_invsqrt(rsq22);
954 rinv23 = gmx_invsqrt(rsq23);
955 rinv31 = gmx_invsqrt(rsq31);
956 rinv32 = gmx_invsqrt(rsq32);
957 rinv33 = gmx_invsqrt(rsq33);
959 rinvsq00 = rinv00*rinv00;
961 /**************************
962 * CALCULATE INTERACTIONS *
963 **************************/
967 /* BUCKINGHAM DISPERSION/REPULSION */
968 rinvsix = rinvsq00*rinvsq00*rinvsq00;
969 vvdw6 = c6_00*rinvsix;
971 vvdwexp = cexp1_00*exp(-br);
972 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
976 /* Calculate temporary vectorial force */
981 /* Update vectorial force */
985 f[j_coord_offset+DIM*0+XX] -= tx;
986 f[j_coord_offset+DIM*0+YY] -= ty;
987 f[j_coord_offset+DIM*0+ZZ] -= tz;
989 /**************************
990 * CALCULATE INTERACTIONS *
991 **************************/
995 /* Calculate table index by multiplying r with table scale and truncate to integer */
1001 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1002 F = vftab[vfitab+1];
1003 Geps = vfeps*vftab[vfitab+2];
1004 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1006 FF = Fp+Geps+2.0*Heps2;
1007 felec = -qq11*FF*vftabscale*rinv11;
1011 /* Calculate temporary vectorial force */
1016 /* Update vectorial force */
1020 f[j_coord_offset+DIM*1+XX] -= tx;
1021 f[j_coord_offset+DIM*1+YY] -= ty;
1022 f[j_coord_offset+DIM*1+ZZ] -= tz;
1024 /**************************
1025 * CALCULATE INTERACTIONS *
1026 **************************/
1030 /* Calculate table index by multiplying r with table scale and truncate to integer */
1031 rt = r12*vftabscale;
1034 vfitab = 1*4*vfitab;
1036 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1037 F = vftab[vfitab+1];
1038 Geps = vfeps*vftab[vfitab+2];
1039 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1041 FF = Fp+Geps+2.0*Heps2;
1042 felec = -qq12*FF*vftabscale*rinv12;
1046 /* Calculate temporary vectorial force */
1051 /* Update vectorial force */
1055 f[j_coord_offset+DIM*2+XX] -= tx;
1056 f[j_coord_offset+DIM*2+YY] -= ty;
1057 f[j_coord_offset+DIM*2+ZZ] -= tz;
1059 /**************************
1060 * CALCULATE INTERACTIONS *
1061 **************************/
1065 /* Calculate table index by multiplying r with table scale and truncate to integer */
1066 rt = r13*vftabscale;
1069 vfitab = 1*4*vfitab;
1071 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1072 F = vftab[vfitab+1];
1073 Geps = vfeps*vftab[vfitab+2];
1074 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1076 FF = Fp+Geps+2.0*Heps2;
1077 felec = -qq13*FF*vftabscale*rinv13;
1081 /* Calculate temporary vectorial force */
1086 /* Update vectorial force */
1090 f[j_coord_offset+DIM*3+XX] -= tx;
1091 f[j_coord_offset+DIM*3+YY] -= ty;
1092 f[j_coord_offset+DIM*3+ZZ] -= tz;
1094 /**************************
1095 * CALCULATE INTERACTIONS *
1096 **************************/
1100 /* Calculate table index by multiplying r with table scale and truncate to integer */
1101 rt = r21*vftabscale;
1104 vfitab = 1*4*vfitab;
1106 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1107 F = vftab[vfitab+1];
1108 Geps = vfeps*vftab[vfitab+2];
1109 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1111 FF = Fp+Geps+2.0*Heps2;
1112 felec = -qq21*FF*vftabscale*rinv21;
1116 /* Calculate temporary vectorial force */
1121 /* Update vectorial force */
1125 f[j_coord_offset+DIM*1+XX] -= tx;
1126 f[j_coord_offset+DIM*1+YY] -= ty;
1127 f[j_coord_offset+DIM*1+ZZ] -= tz;
1129 /**************************
1130 * CALCULATE INTERACTIONS *
1131 **************************/
1135 /* Calculate table index by multiplying r with table scale and truncate to integer */
1136 rt = r22*vftabscale;
1139 vfitab = 1*4*vfitab;
1141 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1142 F = vftab[vfitab+1];
1143 Geps = vfeps*vftab[vfitab+2];
1144 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1146 FF = Fp+Geps+2.0*Heps2;
1147 felec = -qq22*FF*vftabscale*rinv22;
1151 /* Calculate temporary vectorial force */
1156 /* Update vectorial force */
1160 f[j_coord_offset+DIM*2+XX] -= tx;
1161 f[j_coord_offset+DIM*2+YY] -= ty;
1162 f[j_coord_offset+DIM*2+ZZ] -= tz;
1164 /**************************
1165 * CALCULATE INTERACTIONS *
1166 **************************/
1170 /* Calculate table index by multiplying r with table scale and truncate to integer */
1171 rt = r23*vftabscale;
1174 vfitab = 1*4*vfitab;
1176 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1177 F = vftab[vfitab+1];
1178 Geps = vfeps*vftab[vfitab+2];
1179 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1181 FF = Fp+Geps+2.0*Heps2;
1182 felec = -qq23*FF*vftabscale*rinv23;
1186 /* Calculate temporary vectorial force */
1191 /* Update vectorial force */
1195 f[j_coord_offset+DIM*3+XX] -= tx;
1196 f[j_coord_offset+DIM*3+YY] -= ty;
1197 f[j_coord_offset+DIM*3+ZZ] -= tz;
1199 /**************************
1200 * CALCULATE INTERACTIONS *
1201 **************************/
1205 /* Calculate table index by multiplying r with table scale and truncate to integer */
1206 rt = r31*vftabscale;
1209 vfitab = 1*4*vfitab;
1211 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1212 F = vftab[vfitab+1];
1213 Geps = vfeps*vftab[vfitab+2];
1214 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1216 FF = Fp+Geps+2.0*Heps2;
1217 felec = -qq31*FF*vftabscale*rinv31;
1221 /* Calculate temporary vectorial force */
1226 /* Update vectorial force */
1230 f[j_coord_offset+DIM*1+XX] -= tx;
1231 f[j_coord_offset+DIM*1+YY] -= ty;
1232 f[j_coord_offset+DIM*1+ZZ] -= tz;
1234 /**************************
1235 * CALCULATE INTERACTIONS *
1236 **************************/
1240 /* Calculate table index by multiplying r with table scale and truncate to integer */
1241 rt = r32*vftabscale;
1244 vfitab = 1*4*vfitab;
1246 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1247 F = vftab[vfitab+1];
1248 Geps = vfeps*vftab[vfitab+2];
1249 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1251 FF = Fp+Geps+2.0*Heps2;
1252 felec = -qq32*FF*vftabscale*rinv32;
1256 /* Calculate temporary vectorial force */
1261 /* Update vectorial force */
1265 f[j_coord_offset+DIM*2+XX] -= tx;
1266 f[j_coord_offset+DIM*2+YY] -= ty;
1267 f[j_coord_offset+DIM*2+ZZ] -= tz;
1269 /**************************
1270 * CALCULATE INTERACTIONS *
1271 **************************/
1275 /* Calculate table index by multiplying r with table scale and truncate to integer */
1276 rt = r33*vftabscale;
1279 vfitab = 1*4*vfitab;
1281 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1282 F = vftab[vfitab+1];
1283 Geps = vfeps*vftab[vfitab+2];
1284 Heps2 = vfeps*vfeps*vftab[vfitab+3];
1286 FF = Fp+Geps+2.0*Heps2;
1287 felec = -qq33*FF*vftabscale*rinv33;
1291 /* Calculate temporary vectorial force */
1296 /* Update vectorial force */
1300 f[j_coord_offset+DIM*3+XX] -= tx;
1301 f[j_coord_offset+DIM*3+YY] -= ty;
1302 f[j_coord_offset+DIM*3+ZZ] -= tz;
1304 /* Inner loop uses 391 flops */
1306 /* End of innermost loop */
1309 f[i_coord_offset+DIM*0+XX] += fix0;
1310 f[i_coord_offset+DIM*0+YY] += fiy0;
1311 f[i_coord_offset+DIM*0+ZZ] += fiz0;
1315 f[i_coord_offset+DIM*1+XX] += fix1;
1316 f[i_coord_offset+DIM*1+YY] += fiy1;
1317 f[i_coord_offset+DIM*1+ZZ] += fiz1;
1321 f[i_coord_offset+DIM*2+XX] += fix2;
1322 f[i_coord_offset+DIM*2+YY] += fiy2;
1323 f[i_coord_offset+DIM*2+ZZ] += fiz2;
1327 f[i_coord_offset+DIM*3+XX] += fix3;
1328 f[i_coord_offset+DIM*3+YY] += fiy3;
1329 f[i_coord_offset+DIM*3+ZZ] += fiz3;
1333 fshift[i_shift_offset+XX] += tx;
1334 fshift[i_shift_offset+YY] += ty;
1335 fshift[i_shift_offset+ZZ] += tz;
1337 /* Increment number of inner iterations */
1338 inneriter += j_index_end - j_index_start;
1340 /* Outer loop uses 39 flops */
1343 /* Increment number of outer iterations */
1346 /* Update outer/inner flops */
1348 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4W4_F,outeriter*39 + inneriter*391);