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_ElecNone_VdwCSTab_GeomP1P1_VF_c
35 * Electrostatics interaction: None
36 * VdW interaction: CubicSplineTable
37 * Geometry: Particle-Particle
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecNone_VdwCSTab_GeomP1P1_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 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
60 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
62 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
66 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
74 jindex = nlist->jindex;
76 shiftidx = nlist->shift;
78 shiftvec = fr->shift_vec[0];
79 fshift = fr->fshift[0];
82 vdwtype = mdatoms->typeA;
84 vftab = kernel_data->table_vdw->data;
85 vftabscale = kernel_data->table_vdw->scale;
90 /* Start outer loop over neighborlists */
91 for(iidx=0; iidx<nri; iidx++)
93 /* Load shift vector for this list */
94 i_shift_offset = DIM*shiftidx[iidx];
95 shX = shiftvec[i_shift_offset+XX];
96 shY = shiftvec[i_shift_offset+YY];
97 shZ = shiftvec[i_shift_offset+ZZ];
99 /* Load limits for loop over neighbors */
100 j_index_start = jindex[iidx];
101 j_index_end = jindex[iidx+1];
103 /* Get outer coordinate index */
105 i_coord_offset = DIM*inr;
107 /* Load i particle coords and add shift vector */
108 ix0 = shX + x[i_coord_offset+DIM*0+XX];
109 iy0 = shY + x[i_coord_offset+DIM*0+YY];
110 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
116 /* Load parameters for i particles */
117 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
119 /* Reset potential sums */
122 /* Start inner kernel loop */
123 for(jidx=j_index_start; jidx<j_index_end; jidx++)
125 /* Get j neighbor index, and coordinate index */
127 j_coord_offset = DIM*jnr;
129 /* load j atom coordinates */
130 jx0 = x[j_coord_offset+DIM*0+XX];
131 jy0 = x[j_coord_offset+DIM*0+YY];
132 jz0 = x[j_coord_offset+DIM*0+ZZ];
134 /* Calculate displacement vector */
139 /* Calculate squared distance and things based on it */
140 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
142 rinv00 = gmx_invsqrt(rsq00);
144 /* Load parameters for j particles */
145 vdwjidx0 = 2*vdwtype[jnr+0];
147 /**************************
148 * CALCULATE INTERACTIONS *
149 **************************/
153 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
154 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
156 /* Calculate table index by multiplying r with table scale and truncate to integer */
162 /* CUBIC SPLINE TABLE DISPERSION */
166 Geps = vfeps*vftab[vfitab+2];
167 Heps2 = vfeps*vfeps*vftab[vfitab+3];
171 FF = Fp+Geps+2.0*Heps2;
174 /* CUBIC SPLINE TABLE REPULSION */
177 Geps = vfeps*vftab[vfitab+6];
178 Heps2 = vfeps*vfeps*vftab[vfitab+7];
182 FF = Fp+Geps+2.0*Heps2;
185 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
187 /* Update potential sums from outer loop */
192 /* Calculate temporary vectorial force */
197 /* Update vectorial force */
201 f[j_coord_offset+DIM*0+XX] -= tx;
202 f[j_coord_offset+DIM*0+YY] -= ty;
203 f[j_coord_offset+DIM*0+ZZ] -= tz;
205 /* Inner loop uses 55 flops */
207 /* End of innermost loop */
210 f[i_coord_offset+DIM*0+XX] += fix0;
211 f[i_coord_offset+DIM*0+YY] += fiy0;
212 f[i_coord_offset+DIM*0+ZZ] += fiz0;
216 fshift[i_shift_offset+XX] += tx;
217 fshift[i_shift_offset+YY] += ty;
218 fshift[i_shift_offset+ZZ] += tz;
221 /* Update potential energies */
222 kernel_data->energygrp_vdw[ggid] += vvdwsum;
224 /* Increment number of inner iterations */
225 inneriter += j_index_end - j_index_start;
227 /* Outer loop uses 13 flops */
230 /* Increment number of outer iterations */
233 /* Update outer/inner flops */
235 inc_nrnb(nrnb,eNR_NBKERNEL_VDW_VF,outeriter*13 + inneriter*55);
238 * Gromacs nonbonded kernel: nb_kernel_ElecNone_VdwCSTab_GeomP1P1_F_c
239 * Electrostatics interaction: None
240 * VdW interaction: CubicSplineTable
241 * Geometry: Particle-Particle
242 * Calculate force/pot: Force
245 nb_kernel_ElecNone_VdwCSTab_GeomP1P1_F_c
246 (t_nblist * gmx_restrict nlist,
247 rvec * gmx_restrict xx,
248 rvec * gmx_restrict ff,
249 t_forcerec * gmx_restrict fr,
250 t_mdatoms * gmx_restrict mdatoms,
251 nb_kernel_data_t * gmx_restrict kernel_data,
252 t_nrnb * gmx_restrict nrnb)
254 int i_shift_offset,i_coord_offset,j_coord_offset;
255 int j_index_start,j_index_end;
256 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
257 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
258 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
259 real *shiftvec,*fshift,*x,*f;
261 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
263 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
264 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
266 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
270 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
278 jindex = nlist->jindex;
280 shiftidx = nlist->shift;
282 shiftvec = fr->shift_vec[0];
283 fshift = fr->fshift[0];
284 nvdwtype = fr->ntype;
286 vdwtype = mdatoms->typeA;
288 vftab = kernel_data->table_vdw->data;
289 vftabscale = kernel_data->table_vdw->scale;
294 /* Start outer loop over neighborlists */
295 for(iidx=0; iidx<nri; iidx++)
297 /* Load shift vector for this list */
298 i_shift_offset = DIM*shiftidx[iidx];
299 shX = shiftvec[i_shift_offset+XX];
300 shY = shiftvec[i_shift_offset+YY];
301 shZ = shiftvec[i_shift_offset+ZZ];
303 /* Load limits for loop over neighbors */
304 j_index_start = jindex[iidx];
305 j_index_end = jindex[iidx+1];
307 /* Get outer coordinate index */
309 i_coord_offset = DIM*inr;
311 /* Load i particle coords and add shift vector */
312 ix0 = shX + x[i_coord_offset+DIM*0+XX];
313 iy0 = shY + x[i_coord_offset+DIM*0+YY];
314 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
320 /* Load parameters for i particles */
321 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
323 /* Start inner kernel loop */
324 for(jidx=j_index_start; jidx<j_index_end; jidx++)
326 /* Get j neighbor index, and coordinate index */
328 j_coord_offset = DIM*jnr;
330 /* load j atom coordinates */
331 jx0 = x[j_coord_offset+DIM*0+XX];
332 jy0 = x[j_coord_offset+DIM*0+YY];
333 jz0 = x[j_coord_offset+DIM*0+ZZ];
335 /* Calculate displacement vector */
340 /* Calculate squared distance and things based on it */
341 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
343 rinv00 = gmx_invsqrt(rsq00);
345 /* Load parameters for j particles */
346 vdwjidx0 = 2*vdwtype[jnr+0];
348 /**************************
349 * CALCULATE INTERACTIONS *
350 **************************/
354 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
355 c12_00 = vdwparam[vdwioffset0+vdwjidx0+1];
357 /* Calculate table index by multiplying r with table scale and truncate to integer */
363 /* CUBIC SPLINE TABLE DISPERSION */
366 Geps = vfeps*vftab[vfitab+2];
367 Heps2 = vfeps*vfeps*vftab[vfitab+3];
369 FF = Fp+Geps+2.0*Heps2;
372 /* CUBIC SPLINE TABLE REPULSION */
374 Geps = vfeps*vftab[vfitab+6];
375 Heps2 = vfeps*vfeps*vftab[vfitab+7];
377 FF = Fp+Geps+2.0*Heps2;
379 fvdw = -(fvdw6+fvdw12)*vftabscale*rinv00;
383 /* Calculate temporary vectorial force */
388 /* Update vectorial force */
392 f[j_coord_offset+DIM*0+XX] -= tx;
393 f[j_coord_offset+DIM*0+YY] -= ty;
394 f[j_coord_offset+DIM*0+ZZ] -= tz;
396 /* Inner loop uses 47 flops */
398 /* End of innermost loop */
401 f[i_coord_offset+DIM*0+XX] += fix0;
402 f[i_coord_offset+DIM*0+YY] += fiy0;
403 f[i_coord_offset+DIM*0+ZZ] += fiz0;
407 fshift[i_shift_offset+XX] += tx;
408 fshift[i_shift_offset+YY] += ty;
409 fshift[i_shift_offset+ZZ] += tz;
411 /* Increment number of inner iterations */
412 inneriter += j_index_end - j_index_start;
414 /* Outer loop uses 12 flops */
417 /* Increment number of outer iterations */
420 /* Update outer/inner flops */
422 inc_nrnb(nrnb,eNR_NBKERNEL_VDW_F,outeriter*12 + inneriter*47);