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_kernel030_adress.h"
32 * Gromacs nonbonded kernel nb_kernel030_adress_cg
33 * Coulomb interaction: Not calculated
34 * VdW interaction: Tabulated
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel030_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;
84 real Y,F,Geps,Heps2,Fp,VV;
87 real ix1,iy1,iz1,fix1,fiy1,fiz1;
89 real dx11,dy11,dz11,rsq11,rinv11;
91 real weight_cg1, weight_cg2, weight_product;
96 nthreads = *p_nthreads;
100 tabscale = *p_tabscale;
106 #ifdef GMX_THREAD_SHM_FDECOMP
107 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
109 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
111 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
118 for(n=nn0; (n<nn1); n++)
122 shY = shiftvec[is3+1];
123 shZ = shiftvec[is3+2];
128 ix1 = shX + pos[ii3+0];
129 iy1 = shY + pos[ii3+1];
130 iz1 = shZ + pos[ii3+2];
131 nti = 2*ntype*type[ii];
138 for(k=nj0; (k<nj1); k++)
141 weight_cg2 = wf[jnr];
142 weight_product = weight_cg1*weight_cg2;
143 if (weight_product < ALMOST_ZERO) {
146 else if (weight_product >= ALMOST_ONE)
148 /* force is zero, skip this molecule */
153 hybscal = 1.0 - weight_product;
162 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
163 rinv11 = 1.0/sqrt(rsq11);
164 tj = nti+2*type[jnr];
166 c12 = vdwparam[tj+1];
175 Geps = eps*VFtab[nnn+2];
176 Heps2 = eps2*VFtab[nnn+3];
179 FF = Fp+Geps+2.0*Heps2;
185 Geps = eps*VFtab[nnn+2];
186 Heps2 = eps2*VFtab[nnn+3];
189 FF = Fp+Geps+2.0*Heps2;
192 Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
193 fscal = -((fijD+fijR)*tabscale)*rinv11;
201 faction[j3+0] = faction[j3+0] - tx;
202 faction[j3+1] = faction[j3+1] - ty;
203 faction[j3+2] = faction[j3+2] - tz;
206 faction[ii3+0] = faction[ii3+0] + fix1;
207 faction[ii3+1] = faction[ii3+1] + fiy1;
208 faction[ii3+2] = faction[ii3+2] + fiz1;
209 fshift[is3] = fshift[is3]+fix1;
210 fshift[is3+1] = fshift[is3+1]+fiy1;
211 fshift[is3+2] = fshift[is3+2]+fiz1;
213 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
214 ninner = ninner + nj1 - nj0;
217 nouter = nouter + nn1 - nn0;
230 * Gromacs nonbonded kernel nb_kernel030_adress_ex
231 * Coulomb interaction: Not calculated
232 * VdW interaction: Tabulated
233 * water optimization: No
234 * Calculate forces: yes
236 void nb_kernel030_adress_ex(
270 int nri,ntype,nthreads;
271 real facel,krf,crf,tabscale,gbtabscale;
272 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
273 int nn0,nn1,nouter,ninner;
282 real Y,F,Geps,Heps2,Fp,VV;
285 real ix1,iy1,iz1,fix1,fiy1,fiz1;
287 real dx11,dy11,dz11,rsq11,rinv11;
289 real weight_cg1, weight_cg2, weight_product;
294 nthreads = *p_nthreads;
298 tabscale = *p_tabscale;
304 #ifdef GMX_THREAD_SHM_FDECOMP
305 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
307 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
309 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
316 for(n=nn0; (n<nn1); n++)
320 shY = shiftvec[is3+1];
321 shZ = shiftvec[is3+2];
326 ix1 = shX + pos[ii3+0];
327 iy1 = shY + pos[ii3+1];
328 iz1 = shZ + pos[ii3+2];
329 nti = 2*ntype*type[ii];
336 for(k=nj0; (k<nj1); k++)
339 weight_cg2 = wf[jnr];
340 weight_product = weight_cg1*weight_cg2;
341 if (weight_product < ALMOST_ZERO) {
342 /* force is zero, skip this molecule */
345 else if (weight_product >= ALMOST_ONE)
351 hybscal = weight_product;
360 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
361 rinv11 = 1.0/sqrt(rsq11);
362 tj = nti+2*type[jnr];
364 c12 = vdwparam[tj+1];
373 Geps = eps*VFtab[nnn+2];
374 Heps2 = eps2*VFtab[nnn+3];
377 FF = Fp+Geps+2.0*Heps2;
383 Geps = eps*VFtab[nnn+2];
384 Heps2 = eps2*VFtab[nnn+3];
387 FF = Fp+Geps+2.0*Heps2;
390 Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
391 fscal = -((fijD+fijR)*tabscale)*rinv11;
393 if(force_cap>0 && (fabs(fscal)> force_cap)){
394 fscal=force_cap*fscal/fabs(fscal);
402 faction[j3+0] = faction[j3+0] - tx;
403 faction[j3+1] = faction[j3+1] - ty;
404 faction[j3+2] = faction[j3+2] - tz;
407 faction[ii3+0] = faction[ii3+0] + fix1;
408 faction[ii3+1] = faction[ii3+1] + fiy1;
409 faction[ii3+2] = faction[ii3+2] + fiz1;
410 fshift[is3] = fshift[is3]+fix1;
411 fshift[is3+1] = fshift[is3+1]+fiy1;
412 fshift[is3+2] = fshift[is3+2]+fiz1;
414 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
415 ninner = ninner + nj1 - nj0;
418 nouter = nouter + nn1 - nn0;