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_kernel330_adress.h"
32 * Gromacs nonbonded kernel nb_kernel330_adress_cg
33 * Coulomb interaction: Tabulated
34 * VdW interaction: Tabulated
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel330_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;
86 real Y,F,Geps,Heps2,Fp,VV;
90 real ix1,iy1,iz1,fix1,fiy1,fiz1;
92 real dx11,dy11,dz11,rsq11,rinv11;
94 real weight_cg1, weight_cg2, weight_product;
99 nthreads = *p_nthreads;
103 tabscale = *p_tabscale;
109 #ifdef GMX_THREAD_SHM_FDECOMP
110 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
112 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
114 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
121 for(n=nn0; (n<nn1); n++)
125 shY = shiftvec[is3+1];
126 shZ = shiftvec[is3+2];
131 ix1 = shX + pos[ii3+0];
132 iy1 = shY + pos[ii3+1];
133 iz1 = shZ + pos[ii3+2];
134 iq = facel*charge[ii];
135 nti = 2*ntype*type[ii];
143 for(k=nj0; (k<nj1); k++)
146 weight_cg2 = wf[jnr];
147 weight_product = weight_cg1*weight_cg2;
148 if (weight_product < ALMOST_ZERO) {
151 else if (weight_product >= ALMOST_ONE)
153 /* force is zero, skip this molecule */
158 hybscal = 1.0 - weight_product;
167 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
168 rinv11 = 1.0/sqrt(rsq11);
170 tj = nti+2*type[jnr];
172 c12 = vdwparam[tj+1];
181 Geps = eps*VFtab[nnn+2];
182 Heps2 = eps2*VFtab[nnn+3];
185 FF = Fp+Geps+2.0*Heps2;
188 vctot = vctot + vcoul;
192 Geps = eps*VFtab[nnn+2];
193 Heps2 = eps2*VFtab[nnn+3];
196 FF = Fp+Geps+2.0*Heps2;
202 Geps = eps*VFtab[nnn+2];
203 Heps2 = eps2*VFtab[nnn+3];
206 FF = Fp+Geps+2.0*Heps2;
209 Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
210 fscal = -((fijC+fijD+fijR)*tabscale)*rinv11;
218 faction[j3+0] = faction[j3+0] - tx;
219 faction[j3+1] = faction[j3+1] - ty;
220 faction[j3+2] = faction[j3+2] - tz;
223 faction[ii3+0] = faction[ii3+0] + fix1;
224 faction[ii3+1] = faction[ii3+1] + fiy1;
225 faction[ii3+2] = faction[ii3+2] + fiz1;
226 fshift[is3] = fshift[is3]+fix1;
227 fshift[is3+1] = fshift[is3+1]+fiy1;
228 fshift[is3+2] = fshift[is3+2]+fiz1;
230 Vc[ggid] = Vc[ggid] + vctot;
231 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
232 ninner = ninner + nj1 - nj0;
235 nouter = nouter + nn1 - nn0;
248 * Gromacs nonbonded kernel nb_kernel330_adress_ex
249 * Coulomb interaction: Tabulated
250 * VdW interaction: Tabulated
251 * water optimization: No
252 * Calculate forces: yes
254 void nb_kernel330_adress_ex(
288 int nri,ntype,nthreads;
289 real facel,krf,crf,tabscale,gbtabscale;
290 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
291 int nn0,nn1,nouter,ninner;
302 real Y,F,Geps,Heps2,Fp,VV;
306 real ix1,iy1,iz1,fix1,fiy1,fiz1;
308 real dx11,dy11,dz11,rsq11,rinv11;
310 real weight_cg1, weight_cg2, weight_product;
315 nthreads = *p_nthreads;
319 tabscale = *p_tabscale;
325 #ifdef GMX_THREAD_SHM_FDECOMP
326 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
328 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
330 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
337 for(n=nn0; (n<nn1); n++)
341 shY = shiftvec[is3+1];
342 shZ = shiftvec[is3+2];
347 ix1 = shX + pos[ii3+0];
348 iy1 = shY + pos[ii3+1];
349 iz1 = shZ + pos[ii3+2];
350 iq = facel*charge[ii];
351 nti = 2*ntype*type[ii];
359 for(k=nj0; (k<nj1); k++)
362 weight_cg2 = wf[jnr];
363 weight_product = weight_cg1*weight_cg2;
364 if (weight_product < ALMOST_ZERO) {
365 /* force is zero, skip this molecule */
368 else if (weight_product >= ALMOST_ONE)
374 hybscal = weight_product;
383 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
384 rinv11 = 1.0/sqrt(rsq11);
386 tj = nti+2*type[jnr];
388 c12 = vdwparam[tj+1];
397 Geps = eps*VFtab[nnn+2];
398 Heps2 = eps2*VFtab[nnn+3];
401 FF = Fp+Geps+2.0*Heps2;
404 vctot = vctot + vcoul;
408 Geps = eps*VFtab[nnn+2];
409 Heps2 = eps2*VFtab[nnn+3];
412 FF = Fp+Geps+2.0*Heps2;
418 Geps = eps*VFtab[nnn+2];
419 Heps2 = eps2*VFtab[nnn+3];
422 FF = Fp+Geps+2.0*Heps2;
425 Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
426 fscal = -((fijC+fijD+fijR)*tabscale)*rinv11;
428 if(force_cap>0 && (fabs(fscal)> force_cap)){
429 fscal=force_cap*fscal/fabs(fscal);
437 faction[j3+0] = faction[j3+0] - tx;
438 faction[j3+1] = faction[j3+1] - ty;
439 faction[j3+2] = faction[j3+2] - tz;
442 faction[ii3+0] = faction[ii3+0] + fix1;
443 faction[ii3+1] = faction[ii3+1] + fiy1;
444 faction[ii3+2] = faction[ii3+2] + fiz1;
445 fshift[is3] = fshift[is3]+fix1;
446 fshift[is3+1] = fshift[is3+1]+fiy1;
447 fshift[is3+2] = fshift[is3+2]+fiz1;
449 Vc[ggid] = Vc[ggid] + vctot;
450 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
451 ninner = ninner + nj1 - nj0;
454 nouter = nouter + nn1 - nn0;