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_VdwBhamSh_GeomP1P1_VF_c
35 * Electrostatics interaction: None
36 * VdW interaction: Buckingham
37 * Geometry: Particle-Particle
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecNone_VdwBhamSh_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;
71 jindex = nlist->jindex;
73 shiftidx = nlist->shift;
75 shiftvec = fr->shift_vec[0];
76 fshift = fr->fshift[0];
79 vdwtype = mdatoms->typeA;
82 rcutoff2 = rcutoff*rcutoff;
84 sh_vdw_invrcut6 = fr->ic->sh_invrc6;
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 = 3*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 rinvsq00 = rinv00*rinv00;
146 /* Load parameters for j particles */
147 vdwjidx0 = 3*vdwtype[jnr+0];
149 /**************************
150 * CALCULATE INTERACTIONS *
151 **************************/
158 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
159 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
160 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
162 /* BUCKINGHAM DISPERSION/REPULSION */
163 rinvsix = rinvsq00*rinvsq00*rinvsq00;
164 vvdw6 = c6_00*rinvsix;
166 vvdwexp = cexp1_00*exp(-br);
167 vvdw = (vvdwexp-cexp1_00*exp(-cexp2_00*rvdw)) - (vvdw6 - c6_00*sh_vdw_invrcut6)*(1.0/6.0);
168 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
170 /* Update potential sums from outer loop */
175 /* Calculate temporary vectorial force */
180 /* Update vectorial force */
184 f[j_coord_offset+DIM*0+XX] -= tx;
185 f[j_coord_offset+DIM*0+YY] -= ty;
186 f[j_coord_offset+DIM*0+ZZ] -= tz;
190 /* Inner loop uses 92 flops */
192 /* End of innermost loop */
195 f[i_coord_offset+DIM*0+XX] += fix0;
196 f[i_coord_offset+DIM*0+YY] += fiy0;
197 f[i_coord_offset+DIM*0+ZZ] += fiz0;
201 fshift[i_shift_offset+XX] += tx;
202 fshift[i_shift_offset+YY] += ty;
203 fshift[i_shift_offset+ZZ] += tz;
206 /* Update potential energies */
207 kernel_data->energygrp_vdw[ggid] += vvdwsum;
209 /* Increment number of inner iterations */
210 inneriter += j_index_end - j_index_start;
212 /* Outer loop uses 13 flops */
215 /* Increment number of outer iterations */
218 /* Update outer/inner flops */
220 inc_nrnb(nrnb,eNR_NBKERNEL_VDW_VF,outeriter*13 + inneriter*92);
223 * Gromacs nonbonded kernel: nb_kernel_ElecNone_VdwBhamSh_GeomP1P1_F_c
224 * Electrostatics interaction: None
225 * VdW interaction: Buckingham
226 * Geometry: Particle-Particle
227 * Calculate force/pot: Force
230 nb_kernel_ElecNone_VdwBhamSh_GeomP1P1_F_c
231 (t_nblist * gmx_restrict nlist,
232 rvec * gmx_restrict xx,
233 rvec * gmx_restrict ff,
234 t_forcerec * gmx_restrict fr,
235 t_mdatoms * gmx_restrict mdatoms,
236 nb_kernel_data_t * gmx_restrict kernel_data,
237 t_nrnb * gmx_restrict nrnb)
239 int i_shift_offset,i_coord_offset,j_coord_offset;
240 int j_index_start,j_index_end;
241 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
242 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
243 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
244 real *shiftvec,*fshift,*x,*f;
246 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
248 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
249 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
251 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
260 jindex = nlist->jindex;
262 shiftidx = nlist->shift;
264 shiftvec = fr->shift_vec[0];
265 fshift = fr->fshift[0];
266 nvdwtype = fr->ntype;
268 vdwtype = mdatoms->typeA;
271 rcutoff2 = rcutoff*rcutoff;
273 sh_vdw_invrcut6 = fr->ic->sh_invrc6;
279 /* Start outer loop over neighborlists */
280 for(iidx=0; iidx<nri; iidx++)
282 /* Load shift vector for this list */
283 i_shift_offset = DIM*shiftidx[iidx];
284 shX = shiftvec[i_shift_offset+XX];
285 shY = shiftvec[i_shift_offset+YY];
286 shZ = shiftvec[i_shift_offset+ZZ];
288 /* Load limits for loop over neighbors */
289 j_index_start = jindex[iidx];
290 j_index_end = jindex[iidx+1];
292 /* Get outer coordinate index */
294 i_coord_offset = DIM*inr;
296 /* Load i particle coords and add shift vector */
297 ix0 = shX + x[i_coord_offset+DIM*0+XX];
298 iy0 = shY + x[i_coord_offset+DIM*0+YY];
299 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
305 /* Load parameters for i particles */
306 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
308 /* Start inner kernel loop */
309 for(jidx=j_index_start; jidx<j_index_end; jidx++)
311 /* Get j neighbor index, and coordinate index */
313 j_coord_offset = DIM*jnr;
315 /* load j atom coordinates */
316 jx0 = x[j_coord_offset+DIM*0+XX];
317 jy0 = x[j_coord_offset+DIM*0+YY];
318 jz0 = x[j_coord_offset+DIM*0+ZZ];
320 /* Calculate displacement vector */
325 /* Calculate squared distance and things based on it */
326 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
328 rinv00 = gmx_invsqrt(rsq00);
330 rinvsq00 = rinv00*rinv00;
332 /* Load parameters for j particles */
333 vdwjidx0 = 3*vdwtype[jnr+0];
335 /**************************
336 * CALCULATE INTERACTIONS *
337 **************************/
344 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
345 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
346 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
348 /* BUCKINGHAM DISPERSION/REPULSION */
349 rinvsix = rinvsq00*rinvsq00*rinvsq00;
350 vvdw6 = c6_00*rinvsix;
352 vvdwexp = cexp1_00*exp(-br);
353 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
357 /* Calculate temporary vectorial force */
362 /* Update vectorial force */
366 f[j_coord_offset+DIM*0+XX] -= tx;
367 f[j_coord_offset+DIM*0+YY] -= ty;
368 f[j_coord_offset+DIM*0+ZZ] -= tz;
372 /* Inner loop uses 58 flops */
374 /* End of innermost loop */
377 f[i_coord_offset+DIM*0+XX] += fix0;
378 f[i_coord_offset+DIM*0+YY] += fiy0;
379 f[i_coord_offset+DIM*0+ZZ] += fiz0;
383 fshift[i_shift_offset+XX] += tx;
384 fshift[i_shift_offset+YY] += ty;
385 fshift[i_shift_offset+ZZ] += tz;
387 /* Increment number of inner iterations */
388 inneriter += j_index_end - j_index_start;
390 /* Outer loop uses 12 flops */
393 /* Increment number of outer iterations */
396 /* Update outer/inner flops */
398 inc_nrnb(nrnb,eNR_NBKERNEL_VDW_F,outeriter*12 + inneriter*58);