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_VdwBham_GeomP1P1_VF_c
35 * Electrostatics interaction: None
36 * VdW interaction: Buckingham
37 * Geometry: Particle-Particle
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecNone_VdwBham_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;
84 /* Start outer loop over neighborlists */
85 for(iidx=0; iidx<nri; iidx++)
87 /* Load shift vector for this list */
88 i_shift_offset = DIM*shiftidx[iidx];
89 shX = shiftvec[i_shift_offset+XX];
90 shY = shiftvec[i_shift_offset+YY];
91 shZ = shiftvec[i_shift_offset+ZZ];
93 /* Load limits for loop over neighbors */
94 j_index_start = jindex[iidx];
95 j_index_end = jindex[iidx+1];
97 /* Get outer coordinate index */
99 i_coord_offset = DIM*inr;
101 /* Load i particle coords and add shift vector */
102 ix0 = shX + x[i_coord_offset+DIM*0+XX];
103 iy0 = shY + x[i_coord_offset+DIM*0+YY];
104 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
110 /* Load parameters for i particles */
111 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
113 /* Reset potential sums */
116 /* Start inner kernel loop */
117 for(jidx=j_index_start; jidx<j_index_end; jidx++)
119 /* Get j neighbor index, and coordinate index */
121 j_coord_offset = DIM*jnr;
123 /* load j atom coordinates */
124 jx0 = x[j_coord_offset+DIM*0+XX];
125 jy0 = x[j_coord_offset+DIM*0+YY];
126 jz0 = x[j_coord_offset+DIM*0+ZZ];
128 /* Calculate displacement vector */
133 /* Calculate squared distance and things based on it */
134 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
136 rinv00 = gmx_invsqrt(rsq00);
138 rinvsq00 = rinv00*rinv00;
140 /* Load parameters for j particles */
141 vdwjidx0 = 3*vdwtype[jnr+0];
143 /**************************
144 * CALCULATE INTERACTIONS *
145 **************************/
149 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
150 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
151 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
153 /* BUCKINGHAM DISPERSION/REPULSION */
154 rinvsix = rinvsq00*rinvsq00*rinvsq00;
155 vvdw6 = c6_00*rinvsix;
157 vvdwexp = cexp1_00*exp(-br);
158 vvdw = vvdwexp - vvdw6*(1.0/6.0);
159 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
161 /* Update potential sums from outer loop */
166 /* Calculate temporary vectorial force */
171 /* Update vectorial force */
175 f[j_coord_offset+DIM*0+XX] -= tx;
176 f[j_coord_offset+DIM*0+YY] -= ty;
177 f[j_coord_offset+DIM*0+ZZ] -= tz;
179 /* Inner loop uses 61 flops */
181 /* End of innermost loop */
184 f[i_coord_offset+DIM*0+XX] += fix0;
185 f[i_coord_offset+DIM*0+YY] += fiy0;
186 f[i_coord_offset+DIM*0+ZZ] += fiz0;
190 fshift[i_shift_offset+XX] += tx;
191 fshift[i_shift_offset+YY] += ty;
192 fshift[i_shift_offset+ZZ] += tz;
195 /* Update potential energies */
196 kernel_data->energygrp_vdw[ggid] += vvdwsum;
198 /* Increment number of inner iterations */
199 inneriter += j_index_end - j_index_start;
201 /* Outer loop uses 13 flops */
204 /* Increment number of outer iterations */
207 /* Update outer/inner flops */
209 inc_nrnb(nrnb,eNR_NBKERNEL_VDW_VF,outeriter*13 + inneriter*61);
212 * Gromacs nonbonded kernel: nb_kernel_ElecNone_VdwBham_GeomP1P1_F_c
213 * Electrostatics interaction: None
214 * VdW interaction: Buckingham
215 * Geometry: Particle-Particle
216 * Calculate force/pot: Force
219 nb_kernel_ElecNone_VdwBham_GeomP1P1_F_c
220 (t_nblist * gmx_restrict nlist,
221 rvec * gmx_restrict xx,
222 rvec * gmx_restrict ff,
223 t_forcerec * gmx_restrict fr,
224 t_mdatoms * gmx_restrict mdatoms,
225 nb_kernel_data_t * gmx_restrict kernel_data,
226 t_nrnb * gmx_restrict nrnb)
228 int i_shift_offset,i_coord_offset,j_coord_offset;
229 int j_index_start,j_index_end;
230 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
231 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
232 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
233 real *shiftvec,*fshift,*x,*f;
235 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
237 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
238 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
240 real rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,br,vvdwexp,sh_vdw_invrcut6;
249 jindex = nlist->jindex;
251 shiftidx = nlist->shift;
253 shiftvec = fr->shift_vec[0];
254 fshift = fr->fshift[0];
255 nvdwtype = fr->ntype;
257 vdwtype = mdatoms->typeA;
262 /* Start outer loop over neighborlists */
263 for(iidx=0; iidx<nri; iidx++)
265 /* Load shift vector for this list */
266 i_shift_offset = DIM*shiftidx[iidx];
267 shX = shiftvec[i_shift_offset+XX];
268 shY = shiftvec[i_shift_offset+YY];
269 shZ = shiftvec[i_shift_offset+ZZ];
271 /* Load limits for loop over neighbors */
272 j_index_start = jindex[iidx];
273 j_index_end = jindex[iidx+1];
275 /* Get outer coordinate index */
277 i_coord_offset = DIM*inr;
279 /* Load i particle coords and add shift vector */
280 ix0 = shX + x[i_coord_offset+DIM*0+XX];
281 iy0 = shY + x[i_coord_offset+DIM*0+YY];
282 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
288 /* Load parameters for i particles */
289 vdwioffset0 = 3*nvdwtype*vdwtype[inr+0];
291 /* Start inner kernel loop */
292 for(jidx=j_index_start; jidx<j_index_end; jidx++)
294 /* Get j neighbor index, and coordinate index */
296 j_coord_offset = DIM*jnr;
298 /* load j atom coordinates */
299 jx0 = x[j_coord_offset+DIM*0+XX];
300 jy0 = x[j_coord_offset+DIM*0+YY];
301 jz0 = x[j_coord_offset+DIM*0+ZZ];
303 /* Calculate displacement vector */
308 /* Calculate squared distance and things based on it */
309 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
311 rinv00 = gmx_invsqrt(rsq00);
313 rinvsq00 = rinv00*rinv00;
315 /* Load parameters for j particles */
316 vdwjidx0 = 3*vdwtype[jnr+0];
318 /**************************
319 * CALCULATE INTERACTIONS *
320 **************************/
324 c6_00 = vdwparam[vdwioffset0+vdwjidx0];
325 cexp1_00 = vdwparam[vdwioffset0+vdwjidx0+1];
326 cexp2_00 = vdwparam[vdwioffset0+vdwjidx0+2];
328 /* BUCKINGHAM DISPERSION/REPULSION */
329 rinvsix = rinvsq00*rinvsq00*rinvsq00;
330 vvdw6 = c6_00*rinvsix;
332 vvdwexp = cexp1_00*exp(-br);
333 fvdw = (br*vvdwexp-vvdw6)*rinvsq00;
337 /* Calculate temporary vectorial force */
342 /* Update vectorial force */
346 f[j_coord_offset+DIM*0+XX] -= tx;
347 f[j_coord_offset+DIM*0+YY] -= ty;
348 f[j_coord_offset+DIM*0+ZZ] -= tz;
350 /* Inner loop uses 58 flops */
352 /* End of innermost loop */
355 f[i_coord_offset+DIM*0+XX] += fix0;
356 f[i_coord_offset+DIM*0+YY] += fiy0;
357 f[i_coord_offset+DIM*0+ZZ] += fiz0;
361 fshift[i_shift_offset+XX] += tx;
362 fshift[i_shift_offset+YY] += ty;
363 fshift[i_shift_offset+ZZ] += tz;
365 /* Increment number of inner iterations */
366 inneriter += j_index_end - j_index_start;
368 /* Outer loop uses 12 flops */
371 /* Increment number of outer iterations */
374 /* Update outer/inner flops */
376 inc_nrnb(nrnb,eNR_NBKERNEL_VDW_F,outeriter*12 + inneriter*58);