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_ElecCoul_VdwNone_GeomP1P1_VF_c
35 * Electrostatics interaction: Coulomb
36 * VdW interaction: None
37 * Geometry: Particle-Particle
38 * Calculate force/pot: PotentialAndForce
41 nb_kernel_ElecCoul_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;
69 jindex = nlist->jindex;
71 shiftidx = nlist->shift;
73 shiftvec = fr->shift_vec[0];
74 fshift = fr->fshift[0];
76 charge = mdatoms->chargeA;
81 /* Start outer loop over neighborlists */
82 for(iidx=0; iidx<nri; iidx++)
84 /* Load shift vector for this list */
85 i_shift_offset = DIM*shiftidx[iidx];
86 shX = shiftvec[i_shift_offset+XX];
87 shY = shiftvec[i_shift_offset+YY];
88 shZ = shiftvec[i_shift_offset+ZZ];
90 /* Load limits for loop over neighbors */
91 j_index_start = jindex[iidx];
92 j_index_end = jindex[iidx+1];
94 /* Get outer coordinate index */
96 i_coord_offset = DIM*inr;
98 /* Load i particle coords and add shift vector */
99 ix0 = shX + x[i_coord_offset+DIM*0+XX];
100 iy0 = shY + x[i_coord_offset+DIM*0+YY];
101 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
107 /* Load parameters for i particles */
108 iq0 = facel*charge[inr+0];
110 /* Reset potential sums */
113 /* Start inner kernel loop */
114 for(jidx=j_index_start; jidx<j_index_end; jidx++)
116 /* Get j neighbor index, and coordinate index */
118 j_coord_offset = DIM*jnr;
120 /* load j atom coordinates */
121 jx0 = x[j_coord_offset+DIM*0+XX];
122 jy0 = x[j_coord_offset+DIM*0+YY];
123 jz0 = x[j_coord_offset+DIM*0+ZZ];
125 /* Calculate displacement vector */
130 /* Calculate squared distance and things based on it */
131 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
133 rinv00 = gmx_invsqrt(rsq00);
135 rinvsq00 = rinv00*rinv00;
137 /* Load parameters for j particles */
140 /**************************
141 * CALCULATE INTERACTIONS *
142 **************************/
146 /* COULOMB ELECTROSTATICS */
148 felec = velec*rinvsq00;
150 /* Update potential sums from outer loop */
155 /* Calculate temporary vectorial force */
160 /* Update vectorial force */
164 f[j_coord_offset+DIM*0+XX] -= tx;
165 f[j_coord_offset+DIM*0+YY] -= ty;
166 f[j_coord_offset+DIM*0+ZZ] -= tz;
168 /* Inner loop uses 28 flops */
170 /* End of innermost loop */
173 f[i_coord_offset+DIM*0+XX] += fix0;
174 f[i_coord_offset+DIM*0+YY] += fiy0;
175 f[i_coord_offset+DIM*0+ZZ] += fiz0;
179 fshift[i_shift_offset+XX] += tx;
180 fshift[i_shift_offset+YY] += ty;
181 fshift[i_shift_offset+ZZ] += tz;
184 /* Update potential energies */
185 kernel_data->energygrp_elec[ggid] += velecsum;
187 /* Increment number of inner iterations */
188 inneriter += j_index_end - j_index_start;
190 /* Outer loop uses 14 flops */
193 /* Increment number of outer iterations */
196 /* Update outer/inner flops */
198 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*14 + inneriter*28);
201 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwNone_GeomP1P1_F_c
202 * Electrostatics interaction: Coulomb
203 * VdW interaction: None
204 * Geometry: Particle-Particle
205 * Calculate force/pot: Force
208 nb_kernel_ElecCoul_VdwNone_GeomP1P1_F_c
209 (t_nblist * gmx_restrict nlist,
210 rvec * gmx_restrict xx,
211 rvec * gmx_restrict ff,
212 t_forcerec * gmx_restrict fr,
213 t_mdatoms * gmx_restrict mdatoms,
214 nb_kernel_data_t * gmx_restrict kernel_data,
215 t_nrnb * gmx_restrict nrnb)
217 int i_shift_offset,i_coord_offset,j_coord_offset;
218 int j_index_start,j_index_end;
219 int nri,inr,ggid,iidx,jidx,jnr,outeriter,inneriter;
220 real shX,shY,shZ,tx,ty,tz,fscal,rcutoff,rcutoff2;
221 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
222 real *shiftvec,*fshift,*x,*f;
224 real ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
226 real jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
227 real dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00,cexp1_00,cexp2_00;
228 real velec,felec,velecsum,facel,crf,krf,krf2;
236 jindex = nlist->jindex;
238 shiftidx = nlist->shift;
240 shiftvec = fr->shift_vec[0];
241 fshift = fr->fshift[0];
243 charge = mdatoms->chargeA;
248 /* Start outer loop over neighborlists */
249 for(iidx=0; iidx<nri; iidx++)
251 /* Load shift vector for this list */
252 i_shift_offset = DIM*shiftidx[iidx];
253 shX = shiftvec[i_shift_offset+XX];
254 shY = shiftvec[i_shift_offset+YY];
255 shZ = shiftvec[i_shift_offset+ZZ];
257 /* Load limits for loop over neighbors */
258 j_index_start = jindex[iidx];
259 j_index_end = jindex[iidx+1];
261 /* Get outer coordinate index */
263 i_coord_offset = DIM*inr;
265 /* Load i particle coords and add shift vector */
266 ix0 = shX + x[i_coord_offset+DIM*0+XX];
267 iy0 = shY + x[i_coord_offset+DIM*0+YY];
268 iz0 = shZ + x[i_coord_offset+DIM*0+ZZ];
274 /* Load parameters for i particles */
275 iq0 = facel*charge[inr+0];
277 /* Start inner kernel loop */
278 for(jidx=j_index_start; jidx<j_index_end; jidx++)
280 /* Get j neighbor index, and coordinate index */
282 j_coord_offset = DIM*jnr;
284 /* load j atom coordinates */
285 jx0 = x[j_coord_offset+DIM*0+XX];
286 jy0 = x[j_coord_offset+DIM*0+YY];
287 jz0 = x[j_coord_offset+DIM*0+ZZ];
289 /* Calculate displacement vector */
294 /* Calculate squared distance and things based on it */
295 rsq00 = dx00*dx00+dy00*dy00+dz00*dz00;
297 rinv00 = gmx_invsqrt(rsq00);
299 rinvsq00 = rinv00*rinv00;
301 /* Load parameters for j particles */
304 /**************************
305 * CALCULATE INTERACTIONS *
306 **************************/
310 /* COULOMB ELECTROSTATICS */
312 felec = velec*rinvsq00;
316 /* Calculate temporary vectorial force */
321 /* Update vectorial force */
325 f[j_coord_offset+DIM*0+XX] -= tx;
326 f[j_coord_offset+DIM*0+YY] -= ty;
327 f[j_coord_offset+DIM*0+ZZ] -= tz;
329 /* Inner loop uses 27 flops */
331 /* End of innermost loop */
334 f[i_coord_offset+DIM*0+XX] += fix0;
335 f[i_coord_offset+DIM*0+YY] += fiy0;
336 f[i_coord_offset+DIM*0+ZZ] += fiz0;
340 fshift[i_shift_offset+XX] += tx;
341 fshift[i_shift_offset+YY] += ty;
342 fshift[i_shift_offset+ZZ] += tz;
344 /* Increment number of inner iterations */
345 inneriter += j_index_end - j_index_start;
347 /* Outer loop uses 13 flops */
350 /* Increment number of outer iterations */
353 /* Update outer/inner flops */
355 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*13 + inneriter*27);