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_kernel310_adress.h"
32 * Gromacs nonbonded kernel nb_kernel310_adress_cg
33 * Coulomb interaction: Tabulated
34 * VdW interaction: Lennard-Jones
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel310_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;
88 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 = 2*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+2*type[jnr];
173 c12 = vdwparam[tj+1];
174 rinvsq = rinv11*rinv11;
183 Geps = eps*VFtab[nnn+2];
184 Heps2 = eps2*VFtab[nnn+3];
187 FF = Fp+Geps+2.0*Heps2;
190 vctot = vctot + vcoul;
191 rinvsix = rinvsq*rinvsq*rinvsq;
193 Vvdw12 = c12*rinvsix*rinvsix;
194 Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
195 fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
203 faction[j3+0] = faction[j3+0] - tx;
204 faction[j3+1] = faction[j3+1] - ty;
205 faction[j3+2] = faction[j3+2] - tz;
208 faction[ii3+0] = faction[ii3+0] + fix1;
209 faction[ii3+1] = faction[ii3+1] + fiy1;
210 faction[ii3+2] = faction[ii3+2] + fiz1;
211 fshift[is3] = fshift[is3]+fix1;
212 fshift[is3+1] = fshift[is3+1]+fiy1;
213 fshift[is3+2] = fshift[is3+2]+fiz1;
215 Vc[ggid] = Vc[ggid] + vctot;
216 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
217 ninner = ninner + nj1 - nj0;
220 nouter = nouter + nn1 - nn0;
233 * Gromacs nonbonded kernel nb_kernel310_adress_ex
234 * Coulomb interaction: Tabulated
235 * VdW interaction: Lennard-Jones
236 * water optimization: No
237 * Calculate forces: yes
239 void nb_kernel310_adress_ex(
273 int nri,ntype,nthreads;
274 real facel,krf,crf,tabscale,gbtabscale;
275 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
276 int nn0,nn1,nouter,ninner;
289 real Y,F,Geps,Heps2,Fp,VV;
292 real ix1,iy1,iz1,fix1,fiy1,fiz1;
294 real dx11,dy11,dz11,rsq11,rinv11;
296 real weight_cg1, weight_cg2, weight_product;
301 nthreads = *p_nthreads;
305 tabscale = *p_tabscale;
311 #ifdef GMX_THREAD_SHM_FDECOMP
312 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
314 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
316 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
323 for(n=nn0; (n<nn1); n++)
327 shY = shiftvec[is3+1];
328 shZ = shiftvec[is3+2];
333 ix1 = shX + pos[ii3+0];
334 iy1 = shY + pos[ii3+1];
335 iz1 = shZ + pos[ii3+2];
336 iq = facel*charge[ii];
337 nti = 2*ntype*type[ii];
345 for(k=nj0; (k<nj1); k++)
348 weight_cg2 = wf[jnr];
349 weight_product = weight_cg1*weight_cg2;
350 if (weight_product < ALMOST_ZERO) {
351 /* force is zero, skip this molecule */
354 else if (weight_product >= ALMOST_ONE)
360 hybscal = weight_product;
369 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
370 rinv11 = 1.0/sqrt(rsq11);
372 tj = nti+2*type[jnr];
374 c12 = vdwparam[tj+1];
375 rinvsq = rinv11*rinv11;
384 Geps = eps*VFtab[nnn+2];
385 Heps2 = eps2*VFtab[nnn+3];
388 FF = Fp+Geps+2.0*Heps2;
391 vctot = vctot + vcoul;
392 rinvsix = rinvsq*rinvsq*rinvsq;
394 Vvdw12 = c12*rinvsix*rinvsix;
395 Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
396 fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
398 if(force_cap>0 && (fabs(fscal)> force_cap)){
399 fscal=force_cap*fscal/fabs(fscal);
407 faction[j3+0] = faction[j3+0] - tx;
408 faction[j3+1] = faction[j3+1] - ty;
409 faction[j3+2] = faction[j3+2] - tz;
412 faction[ii3+0] = faction[ii3+0] + fix1;
413 faction[ii3+1] = faction[ii3+1] + fiy1;
414 faction[ii3+2] = faction[ii3+2] + fiz1;
415 fshift[is3] = fshift[is3]+fix1;
416 fshift[is3+1] = fshift[is3+1]+fiy1;
417 fshift[is3+2] = fshift[is3+2]+fiz1;
419 Vc[ggid] = Vc[ggid] + vctot;
420 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
421 ninner = ninner + nj1 - nj0;
424 nouter = nouter + nn1 - nn0;