2 * Copyright (c) Erik Lindahl, David van der Spoel 2003
4 * This file is generated automatically at compile time
5 * by the program mknb in the Gromacs distribution.
7 * Options used when generation this file:
11 * Software invsqrt: no
20 #ifdef GMX_THREAD_SHM_FDECOMP
21 #include<thread_mpi.h>
23 #define ALMOST_ZERO 1e-30
24 #define ALMOST_ONE 1-(1e-30)
27 #include "nb_kernel300_adress.h"
32 * Gromacs nonbonded kernel nb_kernel300_adress_cg
33 * Coulomb interaction: Tabulated
34 * VdW interaction: Not calculated
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel300_adress_cg(
72 int nri,ntype,nthreads;
73 real facel,krf,crf,tabscale,gbtabscale;
74 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
75 int nn0,nn1,nouter,ninner;
82 real Y,F,Geps,Heps2,Fp,VV;
85 real ix1,iy1,iz1,fix1,fiy1,fiz1;
87 real dx11,dy11,dz11,rsq11,rinv11;
88 real weight_cg1, weight_cg2, weight_product;
93 nthreads = *p_nthreads;
97 tabscale = *p_tabscale;
103 #ifdef GMX_THREAD_SHM_FDECOMP
104 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
106 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
108 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
115 for(n=nn0; (n<nn1); n++)
119 shY = shiftvec[is3+1];
120 shZ = shiftvec[is3+2];
125 ix1 = shX + pos[ii3+0];
126 iy1 = shY + pos[ii3+1];
127 iz1 = shZ + pos[ii3+2];
128 iq = facel*charge[ii];
135 for(k=nj0; (k<nj1); k++)
138 weight_cg2 = wf[jnr];
139 weight_product = weight_cg1*weight_cg2;
140 if (weight_product < ALMOST_ZERO) {
143 else if (weight_product >= ALMOST_ONE)
145 /* force is zero, skip this molecule */
150 hybscal = 1.0 - weight_product;
159 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
160 rinv11 = 1.0/sqrt(rsq11);
170 Geps = eps*VFtab[nnn+2];
171 Heps2 = eps2*VFtab[nnn+3];
174 FF = Fp+Geps+2.0*Heps2;
177 vctot = vctot + vcoul;
178 fscal = -((fijC)*tabscale)*rinv11;
186 faction[j3+0] = faction[j3+0] - tx;
187 faction[j3+1] = faction[j3+1] - ty;
188 faction[j3+2] = faction[j3+2] - tz;
191 faction[ii3+0] = faction[ii3+0] + fix1;
192 faction[ii3+1] = faction[ii3+1] + fiy1;
193 faction[ii3+2] = faction[ii3+2] + fiz1;
194 fshift[is3] = fshift[is3]+fix1;
195 fshift[is3+1] = fshift[is3+1]+fiy1;
196 fshift[is3+2] = fshift[is3+2]+fiz1;
198 Vc[ggid] = Vc[ggid] + vctot;
199 ninner = ninner + nj1 - nj0;
202 nouter = nouter + nn1 - nn0;
215 * Gromacs nonbonded kernel nb_kernel300_adress_ex
216 * Coulomb interaction: Tabulated
217 * VdW interaction: Not calculated
218 * water optimization: No
219 * Calculate forces: yes
221 void nb_kernel300_adress_ex(
255 int nri,ntype,nthreads;
256 real facel,krf,crf,tabscale,gbtabscale;
257 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
258 int nn0,nn1,nouter,ninner;
265 real Y,F,Geps,Heps2,Fp,VV;
268 real ix1,iy1,iz1,fix1,fiy1,fiz1;
270 real dx11,dy11,dz11,rsq11,rinv11;
271 real weight_cg1, weight_cg2, weight_product;
276 nthreads = *p_nthreads;
280 tabscale = *p_tabscale;
286 #ifdef GMX_THREAD_SHM_FDECOMP
287 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
289 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
291 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
298 for(n=nn0; (n<nn1); n++)
302 shY = shiftvec[is3+1];
303 shZ = shiftvec[is3+2];
308 ix1 = shX + pos[ii3+0];
309 iy1 = shY + pos[ii3+1];
310 iz1 = shZ + pos[ii3+2];
311 iq = facel*charge[ii];
318 for(k=nj0; (k<nj1); k++)
321 weight_cg2 = wf[jnr];
322 weight_product = weight_cg1*weight_cg2;
323 if (weight_product < ALMOST_ZERO) {
324 /* force is zero, skip this molecule */
327 else if (weight_product >= ALMOST_ONE)
333 hybscal = weight_product;
342 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
343 rinv11 = 1.0/sqrt(rsq11);
353 Geps = eps*VFtab[nnn+2];
354 Heps2 = eps2*VFtab[nnn+3];
357 FF = Fp+Geps+2.0*Heps2;
360 vctot = vctot + vcoul;
361 fscal = -((fijC)*tabscale)*rinv11;
369 faction[j3+0] = faction[j3+0] - tx;
370 faction[j3+1] = faction[j3+1] - ty;
371 faction[j3+2] = faction[j3+2] - tz;
374 faction[ii3+0] = faction[ii3+0] + fix1;
375 faction[ii3+1] = faction[ii3+1] + fiy1;
376 faction[ii3+2] = faction[ii3+2] + fiz1;
377 fshift[is3] = fshift[is3]+fix1;
378 fshift[is3+1] = fshift[is3+1]+fiy1;
379 fshift[is3+2] = fshift[is3+2]+fiz1;
381 Vc[ggid] = Vc[ggid] + vctot;
382 ninner = ninner + nj1 - nj0;
385 nouter = nouter + nn1 - nn0;