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_kernel320_adress.h"
32 * Gromacs nonbonded kernel nb_kernel320_adress_cg
33 * Coulomb interaction: Tabulated
34 * VdW interaction: Buckingham
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel320_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;
87 real Y,F,Geps,Heps2,Fp,VV;
91 real ix1,iy1,iz1,fix1,fiy1,fiz1;
93 real dx11,dy11,dz11,rsq11,rinv11;
95 real weight_cg1, weight_cg2, weight_product;
100 nthreads = *p_nthreads;
104 tabscale = *p_tabscale;
110 #ifdef GMX_THREAD_SHM_FDECOMP
111 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
113 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
115 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
122 for(n=nn0; (n<nn1); n++)
126 shY = shiftvec[is3+1];
127 shZ = shiftvec[is3+2];
132 ix1 = shX + pos[ii3+0];
133 iy1 = shY + pos[ii3+1];
134 iz1 = shZ + pos[ii3+2];
135 iq = facel*charge[ii];
136 nti = 3*ntype*type[ii];
144 for(k=nj0; (k<nj1); k++)
147 weight_cg2 = wf[jnr];
148 weight_product = weight_cg1*weight_cg2;
149 if (weight_product < ALMOST_ZERO) {
152 else if (weight_product >= ALMOST_ONE)
154 /* force is zero, skip this molecule */
159 hybscal = 1.0 - weight_product;
168 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
169 rinv11 = 1.0/sqrt(rsq11);
171 tj = nti+3*type[jnr];
173 cexp1 = vdwparam[tj+1];
174 cexp2 = vdwparam[tj+2];
175 rinvsq = rinv11*rinv11;
184 Geps = eps*VFtab[nnn+2];
185 Heps2 = eps2*VFtab[nnn+3];
188 FF = Fp+Geps+2.0*Heps2;
191 vctot = vctot + vcoul;
192 rinvsix = rinvsq*rinvsq*rinvsq;
194 br = cexp2*rsq11*rinv11;
195 Vvdwexp = cexp1*exp(-br);
196 Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
197 fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
205 faction[j3+0] = faction[j3+0] - tx;
206 faction[j3+1] = faction[j3+1] - ty;
207 faction[j3+2] = faction[j3+2] - tz;
210 faction[ii3+0] = faction[ii3+0] + fix1;
211 faction[ii3+1] = faction[ii3+1] + fiy1;
212 faction[ii3+2] = faction[ii3+2] + fiz1;
213 fshift[is3] = fshift[is3]+fix1;
214 fshift[is3+1] = fshift[is3+1]+fiy1;
215 fshift[is3+2] = fshift[is3+2]+fiz1;
217 Vc[ggid] = Vc[ggid] + vctot;
218 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
219 ninner = ninner + nj1 - nj0;
222 nouter = nouter + nn1 - nn0;
235 * Gromacs nonbonded kernel nb_kernel320_adress_ex
236 * Coulomb interaction: Tabulated
237 * VdW interaction: Buckingham
238 * water optimization: No
239 * Calculate forces: yes
241 void nb_kernel320_adress_ex(
275 int nri,ntype,nthreads;
276 real facel,krf,crf,tabscale,gbtabscale;
277 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
278 int nn0,nn1,nouter,ninner;
290 real Y,F,Geps,Heps2,Fp,VV;
294 real ix1,iy1,iz1,fix1,fiy1,fiz1;
296 real dx11,dy11,dz11,rsq11,rinv11;
298 real weight_cg1, weight_cg2, weight_product;
303 nthreads = *p_nthreads;
307 tabscale = *p_tabscale;
313 #ifdef GMX_THREAD_SHM_FDECOMP
314 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
316 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
318 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
325 for(n=nn0; (n<nn1); n++)
329 shY = shiftvec[is3+1];
330 shZ = shiftvec[is3+2];
335 ix1 = shX + pos[ii3+0];
336 iy1 = shY + pos[ii3+1];
337 iz1 = shZ + pos[ii3+2];
338 iq = facel*charge[ii];
339 nti = 3*ntype*type[ii];
347 for(k=nj0; (k<nj1); k++)
350 weight_cg2 = wf[jnr];
351 weight_product = weight_cg1*weight_cg2;
352 if (weight_product < ALMOST_ZERO) {
353 /* force is zero, skip this molecule */
356 else if (weight_product >= ALMOST_ONE)
362 hybscal = weight_product;
371 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
372 rinv11 = 1.0/sqrt(rsq11);
374 tj = nti+3*type[jnr];
376 cexp1 = vdwparam[tj+1];
377 cexp2 = vdwparam[tj+2];
378 rinvsq = rinv11*rinv11;
387 Geps = eps*VFtab[nnn+2];
388 Heps2 = eps2*VFtab[nnn+3];
391 FF = Fp+Geps+2.0*Heps2;
394 vctot = vctot + vcoul;
395 rinvsix = rinvsq*rinvsq*rinvsq;
397 br = cexp2*rsq11*rinv11;
398 Vvdwexp = cexp1*exp(-br);
399 Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
400 fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
402 if(force_cap>0 && (fabs(fscal)> force_cap)){
403 fscal=force_cap*fscal/fabs(fscal);
411 faction[j3+0] = faction[j3+0] - tx;
412 faction[j3+1] = faction[j3+1] - ty;
413 faction[j3+2] = faction[j3+2] - tz;
416 faction[ii3+0] = faction[ii3+0] + fix1;
417 faction[ii3+1] = faction[ii3+1] + fiy1;
418 faction[ii3+2] = faction[ii3+2] + fiz1;
419 fshift[is3] = fshift[is3]+fix1;
420 fshift[is3+1] = fshift[is3+1]+fiy1;
421 fshift[is3+2] = fshift[is3+2]+fiz1;
423 Vc[ggid] = Vc[ggid] + vctot;
424 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
425 ninner = ninner + nj1 - nj0;
428 nouter = nouter + nn1 - nn0;