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_ElecCSTab_VdwNone_GeomP1P1_VF_c
35 * Electrostatics interaction: CubicSplineTable
36 * VdW interaction: None
37 * Geometry: Particle-Particle
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecCSTab_VdwNone_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;
61 real velec,felec,velecsum,facel,crf,krf,krf2;
64 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
72 jindex = nlist->jindex;
74 shiftidx = nlist->shift;
76 shiftvec = fr->shift_vec[0];
77 fshift = fr->fshift[0];
79 charge = mdatoms->chargeA;
81 vftab = kernel_data->table_elec->data;
82 vftabscale = kernel_data->table_elec->scale;
87 /* Start outer loop over neighborlists */
88 for(iidx=0; iidx<nri; iidx++)
90 /* Load shift vector for this list */
91 i_shift_offset = DIM*shiftidx[iidx];
92 shX = shiftvec[i_shift_offset+XX];
93 shY = shiftvec[i_shift_offset+YY];
94 shZ = shiftvec[i_shift_offset+ZZ];
96 /* Load limits for loop over neighbors */
97 j_index_start = jindex[iidx];
98 j_index_end = jindex[iidx+1];
100 /* Get outer coordinate index */
102 i_coord_offset = DIM*inr;
104 /* Load i particle coords and add shift vector */
105 ix0 = shX + x[i_coord_offset+DIM*0+XX];
106 iy0 = shY + x[i_coord_offset+DIM*0+YY];
107 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
113 /* Load parameters for i particles */
114 iq0 = facel*charge[inr+0];
116 /* Reset potential sums */
119 /* Start inner kernel loop */
120 for(jidx=j_index_start; jidx<j_index_end; jidx++)
122 /* Get j neighbor index, and coordinate index */
124 j_coord_offset = DIM*jnr;
126 /* load j atom coordinates */
127 jx0 = x[j_coord_offset+DIM*0+XX];
128 jy0 = x[j_coord_offset+DIM*0+YY];
129 jz0 = x[j_coord_offset+DIM*0+ZZ];
131 /* Calculate displacement vector */
136 /* Calculate squared distance and things based on it */
137 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
139 rinv00 = gmx_invsqrt(rsq00);
141 /* Load parameters for j particles */
144 /**************************
145 * CALCULATE INTERACTIONS *
146 **************************/
152 /* Calculate table index by multiplying r with table scale and truncate to integer */
158 /* CUBIC SPLINE TABLE ELECTROSTATICS */
161 Geps = vfeps*vftab[vfitab+2];
162 Heps2 = vfeps*vfeps*vftab[vfitab+3];
166 FF = Fp+Geps+2.0*Heps2;
167 felec = -qq00*FF*vftabscale*rinv00;
169 /* Update potential sums from outer loop */
174 /* Calculate temporary vectorial force */
179 /* Update vectorial force */
183 f[j_coord_offset+DIM*0+XX] -= tx;
184 f[j_coord_offset+DIM*0+YY] -= ty;
185 f[j_coord_offset+DIM*0+ZZ] -= tz;
187 /* Inner loop uses 42 flops */
189 /* End of innermost loop */
192 f[i_coord_offset+DIM*0+XX] += fix0;
193 f[i_coord_offset+DIM*0+YY] += fiy0;
194 f[i_coord_offset+DIM*0+ZZ] += fiz0;
198 fshift[i_shift_offset+XX] += tx;
199 fshift[i_shift_offset+YY] += ty;
200 fshift[i_shift_offset+ZZ] += tz;
203 /* Update potential energies */
204 kernel_data->energygrp_elec[ggid] += velecsum;
206 /* Increment number of inner iterations */
207 inneriter += j_index_end - j_index_start;
209 /* Outer loop uses 14 flops */
212 /* Increment number of outer iterations */
215 /* Update outer/inner flops */
217 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*14 + inneriter*42);
220 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwNone_GeomP1P1_F_c
221 * Electrostatics interaction: CubicSplineTable
222 * VdW interaction: None
223 * Geometry: Particle-Particle
224 * Calculate force/pot: Force
227 nb_kernel_ElecCSTab_VdwNone_GeomP1P1_F_c
228 (t_nblist * gmx_restrict nlist,
229 rvec * gmx_restrict xx,
230 rvec * gmx_restrict ff,
231 t_forcerec * gmx_restrict fr,
232 t_mdatoms * gmx_restrict mdatoms,
233 nb_kernel_data_t * gmx_restrict kernel_data,
234 t_nrnb * gmx_restrict nrnb)
236 int i_shift_offset,i_coord_offset,j_coord_offset;
237 int j_index_start,j_index_end;
238 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
239 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
240 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
241 real *shiftvec,*fshift,*x,*f;
243 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
245 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
246 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
247 real velec,felec,velecsum,facel,crf,krf,krf2;
250 real rt,vfeps,vftabscale,Y,F,Geps,Heps2,Fp,VV,FF;
258 jindex = nlist->jindex;
260 shiftidx = nlist->shift;
262 shiftvec = fr->shift_vec[0];
263 fshift = fr->fshift[0];
265 charge = mdatoms->chargeA;
267 vftab = kernel_data->table_elec->data;
268 vftabscale = kernel_data->table_elec->scale;
273 /* Start outer loop over neighborlists */
274 for(iidx=0; iidx<nri; iidx++)
276 /* Load shift vector for this list */
277 i_shift_offset = DIM*shiftidx[iidx];
278 shX = shiftvec[i_shift_offset+XX];
279 shY = shiftvec[i_shift_offset+YY];
280 shZ = shiftvec[i_shift_offset+ZZ];
282 /* Load limits for loop over neighbors */
283 j_index_start = jindex[iidx];
284 j_index_end = jindex[iidx+1];
286 /* Get outer coordinate index */
288 i_coord_offset = DIM*inr;
290 /* Load i particle coords and add shift vector */
291 ix0 = shX + x[i_coord_offset+DIM*0+XX];
292 iy0 = shY + x[i_coord_offset+DIM*0+YY];
293 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
299 /* Load parameters for i particles */
300 iq0 = facel*charge[inr+0];
302 /* Start inner kernel loop */
303 for(jidx=j_index_start; jidx<j_index_end; jidx++)
305 /* Get j neighbor index, and coordinate index */
307 j_coord_offset = DIM*jnr;
309 /* load j atom coordinates */
310 jx0 = x[j_coord_offset+DIM*0+XX];
311 jy0 = x[j_coord_offset+DIM*0+YY];
312 jz0 = x[j_coord_offset+DIM*0+ZZ];
314 /* Calculate displacement vector */
319 /* Calculate squared distance and things based on it */
320 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
322 rinv00 = gmx_invsqrt(rsq00);
324 /* Load parameters for j particles */
327 /**************************
328 * CALCULATE INTERACTIONS *
329 **************************/
335 /* Calculate table index by multiplying r with table scale and truncate to integer */
341 /* CUBIC SPLINE TABLE ELECTROSTATICS */
343 Geps = vfeps*vftab[vfitab+2];
344 Heps2 = vfeps*vfeps*vftab[vfitab+3];
346 FF = Fp+Geps+2.0*Heps2;
347 felec = -qq00*FF*vftabscale*rinv00;
351 /* Calculate temporary vectorial force */
356 /* Update vectorial force */
360 f[j_coord_offset+DIM*0+XX] -= tx;
361 f[j_coord_offset+DIM*0+YY] -= ty;
362 f[j_coord_offset+DIM*0+ZZ] -= tz;
364 /* Inner loop uses 38 flops */
366 /* End of innermost loop */
369 f[i_coord_offset+DIM*0+XX] += fix0;
370 f[i_coord_offset+DIM*0+YY] += fiy0;
371 f[i_coord_offset+DIM*0+ZZ] += fiz0;
375 fshift[i_shift_offset+XX] += tx;
376 fshift[i_shift_offset+YY] += ty;
377 fshift[i_shift_offset+ZZ] += tz;
379 /* Increment number of inner iterations */
380 inneriter += j_index_end - j_index_start;
382 /* Outer loop uses 13 flops */
385 /* Increment number of outer iterations */
388 /* Update outer/inner flops */
390 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*13 + inneriter*38);