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_kernel020_adress.h"
32 * Gromacs nonbonded kernel nb_kernel020_adress_cg
33 * Coulomb interaction: Not calculated
34 * VdW interaction: Buckingham
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel020_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 ix1,iy1,iz1,fix1,fiy1,fiz1;
86 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 nti = 3*ntype*type[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);
161 tj = nti+3*type[jnr];
163 cexp1 = vdwparam[tj+1];
164 cexp2 = vdwparam[tj+2];
165 rinvsq = rinv11*rinv11;
166 rinvsix = rinvsq*rinvsq*rinvsq;
168 br = cexp2*rsq11*rinv11;
169 Vvdwexp = cexp1*exp(-br);
170 Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
171 fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
179 faction[j3+0] = faction[j3+0] - tx;
180 faction[j3+1] = faction[j3+1] - ty;
181 faction[j3+2] = faction[j3+2] - tz;
184 faction[ii3+0] = faction[ii3+0] + fix1;
185 faction[ii3+1] = faction[ii3+1] + fiy1;
186 faction[ii3+2] = faction[ii3+2] + fiz1;
187 fshift[is3] = fshift[is3]+fix1;
188 fshift[is3+1] = fshift[is3+1]+fiy1;
189 fshift[is3+2] = fshift[is3+2]+fiz1;
191 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
192 ninner = ninner + nj1 - nj0;
195 nouter = nouter + nn1 - nn0;
208 * Gromacs nonbonded kernel nb_kernel020_adress_ex
209 * Coulomb interaction: Not calculated
210 * VdW interaction: Buckingham
211 * water optimization: No
212 * Calculate forces: yes
214 void nb_kernel020_adress_ex(
248 int nri,ntype,nthreads;
249 real facel,krf,crf,tabscale,gbtabscale;
250 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
251 int nn0,nn1,nouter,ninner;
260 real ix1,iy1,iz1,fix1,fiy1,fiz1;
262 real dx11,dy11,dz11,rsq11,rinv11;
264 real weight_cg1, weight_cg2, weight_product;
269 nthreads = *p_nthreads;
273 tabscale = *p_tabscale;
279 #ifdef GMX_THREAD_SHM_FDECOMP
280 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
282 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
284 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
291 for(n=nn0; (n<nn1); n++)
295 shY = shiftvec[is3+1];
296 shZ = shiftvec[is3+2];
301 ix1 = shX + pos[ii3+0];
302 iy1 = shY + pos[ii3+1];
303 iz1 = shZ + pos[ii3+2];
304 nti = 3*ntype*type[ii];
311 for(k=nj0; (k<nj1); k++)
314 weight_cg2 = wf[jnr];
315 weight_product = weight_cg1*weight_cg2;
316 if (weight_product < ALMOST_ZERO) {
317 /* force is zero, skip this molecule */
320 else if (weight_product >= ALMOST_ONE)
326 hybscal = weight_product;
335 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
336 rinv11 = 1.0/sqrt(rsq11);
337 tj = nti+3*type[jnr];
339 cexp1 = vdwparam[tj+1];
340 cexp2 = vdwparam[tj+2];
341 rinvsq = rinv11*rinv11;
342 rinvsix = rinvsq*rinvsq*rinvsq;
344 br = cexp2*rsq11*rinv11;
345 Vvdwexp = cexp1*exp(-br);
346 Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
347 fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
349 if(force_cap>0 && (fabs(fscal)> force_cap)){
350 fscal=force_cap*fscal/fabs(fscal);
358 faction[j3+0] = faction[j3+0] - tx;
359 faction[j3+1] = faction[j3+1] - ty;
360 faction[j3+2] = faction[j3+2] - tz;
363 faction[ii3+0] = faction[ii3+0] + fix1;
364 faction[ii3+1] = faction[ii3+1] + fiy1;
365 faction[ii3+2] = faction[ii3+2] + fiz1;
366 fshift[is3] = fshift[is3]+fix1;
367 fshift[is3+1] = fshift[is3+1]+fiy1;
368 fshift[is3+2] = fshift[is3+2]+fiz1;
370 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
371 ninner = ninner + nj1 - nj0;
374 nouter = nouter + nn1 - nn0;