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_kernel230_adress.h"
32 * Gromacs nonbonded kernel nb_kernel230_adress_cg
33 * Coulomb interaction: Reaction field
34 * VdW interaction: Tabulated
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel230_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 = 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;
176 vcoul = qq*(rinv11+krsq-crf);
186 Geps = eps*VFtab[nnn+2];
187 Heps2 = eps2*VFtab[nnn+3];
190 FF = Fp+Geps+2.0*Heps2;
196 Geps = eps*VFtab[nnn+2];
197 Heps2 = eps2*VFtab[nnn+3];
200 FF = Fp+Geps+2.0*Heps2;
203 Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
204 fscal = (qq*(rinv11-2.0*krsq))*rinvsq-((fijD+fijR)*tabscale)*rinv11;
212 faction[j3+0] = faction[j3+0] - tx;
213 faction[j3+1] = faction[j3+1] - ty;
214 faction[j3+2] = faction[j3+2] - tz;
217 faction[ii3+0] = faction[ii3+0] + fix1;
218 faction[ii3+1] = faction[ii3+1] + fiy1;
219 faction[ii3+2] = faction[ii3+2] + fiz1;
220 fshift[is3] = fshift[is3]+fix1;
221 fshift[is3+1] = fshift[is3+1]+fiy1;
222 fshift[is3+2] = fshift[is3+2]+fiz1;
224 Vc[ggid] = Vc[ggid] + vctot;
225 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
226 ninner = ninner + nj1 - nj0;
229 nouter = nouter + nn1 - nn0;
242 * Gromacs nonbonded kernel nb_kernel230_adress_ex
243 * Coulomb interaction: Reaction field
244 * VdW interaction: Tabulated
245 * water optimization: No
246 * Calculate forces: yes
248 void nb_kernel230_adress_ex(
282 int nri,ntype,nthreads;
283 real facel,krf,crf,tabscale,gbtabscale;
284 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
285 int nn0,nn1,nouter,ninner;
297 real Y,F,Geps,Heps2,Fp,VV;
301 real ix1,iy1,iz1,fix1,fiy1,fiz1;
303 real dx11,dy11,dz11,rsq11,rinv11;
305 real weight_cg1, weight_cg2, weight_product;
310 nthreads = *p_nthreads;
314 tabscale = *p_tabscale;
320 #ifdef GMX_THREAD_SHM_FDECOMP
321 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
323 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
325 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
332 for(n=nn0; (n<nn1); n++)
336 shY = shiftvec[is3+1];
337 shZ = shiftvec[is3+2];
342 ix1 = shX + pos[ii3+0];
343 iy1 = shY + pos[ii3+1];
344 iz1 = shZ + pos[ii3+2];
345 iq = facel*charge[ii];
346 nti = 2*ntype*type[ii];
354 for(k=nj0; (k<nj1); k++)
357 weight_cg2 = wf[jnr];
358 weight_product = weight_cg1*weight_cg2;
359 if (weight_product < ALMOST_ZERO) {
360 /* force is zero, skip this molecule */
363 else if (weight_product >= ALMOST_ONE)
369 hybscal = weight_product;
378 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
379 rinv11 = 1.0/sqrt(rsq11);
381 tj = nti+2*type[jnr];
383 c12 = vdwparam[tj+1];
384 rinvsq = rinv11*rinv11;
386 vcoul = qq*(rinv11+krsq-crf);
396 Geps = eps*VFtab[nnn+2];
397 Heps2 = eps2*VFtab[nnn+3];
400 FF = Fp+Geps+2.0*Heps2;
406 Geps = eps*VFtab[nnn+2];
407 Heps2 = eps2*VFtab[nnn+3];
410 FF = Fp+Geps+2.0*Heps2;
413 Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
414 fscal = (qq*(rinv11-2.0*krsq))*rinvsq-((fijD+fijR)*tabscale)*rinv11;
416 if(force_cap>0 && (fabs(fscal)> force_cap)){
417 fscal=force_cap*fscal/fabs(fscal);
425 faction[j3+0] = faction[j3+0] - tx;
426 faction[j3+1] = faction[j3+1] - ty;
427 faction[j3+2] = faction[j3+2] - tz;
430 faction[ii3+0] = faction[ii3+0] + fix1;
431 faction[ii3+1] = faction[ii3+1] + fiy1;
432 faction[ii3+2] = faction[ii3+2] + fiz1;
433 fshift[is3] = fshift[is3]+fix1;
434 fshift[is3+1] = fshift[is3+1]+fiy1;
435 fshift[is3+2] = fshift[is3+2]+fiz1;
437 Vc[ggid] = Vc[ggid] + vctot;
438 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
439 ninner = ninner + nj1 - nj0;
442 nouter = nouter + nn1 - nn0;