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_kernel110_adress.h"
32 * Gromacs nonbonded kernel nb_kernel110_adress_cg
33 * Coulomb interaction: Normal Coulomb
34 * VdW interaction: Lennard-Jones
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel110_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 ix1,iy1,iz1,fix1,fiy1,fiz1;
88 real dx11,dy11,dz11,rsq11,rinv11;
90 real weight_cg1, weight_cg2, weight_product;
95 nthreads = *p_nthreads;
99 tabscale = *p_tabscale;
105 #ifdef GMX_THREAD_SHM_FDECOMP
106 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
108 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
110 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
117 for(n=nn0; (n<nn1); n++)
121 shY = shiftvec[is3+1];
122 shZ = shiftvec[is3+2];
127 ix1 = shX + pos[ii3+0];
128 iy1 = shY + pos[ii3+1];
129 iz1 = shZ + pos[ii3+2];
130 iq = facel*charge[ii];
131 nti = 2*ntype*type[ii];
139 for(k=nj0; (k<nj1); k++)
142 weight_cg2 = wf[jnr];
143 weight_product = weight_cg1*weight_cg2;
144 if (weight_product < ALMOST_ZERO) {
147 else if (weight_product >= ALMOST_ONE)
149 /* force is zero, skip this molecule */
154 hybscal = 1.0 - weight_product;
163 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
164 rinv11 = 1.0/sqrt(rsq11);
166 tj = nti+2*type[jnr];
168 c12 = vdwparam[tj+1];
169 rinvsq = rinv11*rinv11;
172 rinvsix = rinvsq*rinvsq*rinvsq;
174 Vvdw12 = c12*rinvsix*rinvsix;
175 Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
176 fscal = (vcoul+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
184 faction[j3+0] = faction[j3+0] - tx;
185 faction[j3+1] = faction[j3+1] - ty;
186 faction[j3+2] = faction[j3+2] - tz;
189 faction[ii3+0] = faction[ii3+0] + fix1;
190 faction[ii3+1] = faction[ii3+1] + fiy1;
191 faction[ii3+2] = faction[ii3+2] + fiz1;
192 fshift[is3] = fshift[is3]+fix1;
193 fshift[is3+1] = fshift[is3+1]+fiy1;
194 fshift[is3+2] = fshift[is3+2]+fiz1;
196 Vc[ggid] = Vc[ggid] + vctot;
197 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
198 ninner = ninner + nj1 - nj0;
201 nouter = nouter + nn1 - nn0;
214 * Gromacs nonbonded kernel nb_kernel110_adress_ex
215 * Coulomb interaction: Normal Coulomb
216 * VdW interaction: Lennard-Jones
217 * water optimization: No
218 * Calculate forces: yes
220 void nb_kernel110_adress_ex(
254 int nri,ntype,nthreads;
255 real facel,krf,crf,tabscale,gbtabscale;
256 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
257 int nn0,nn1,nouter,ninner;
268 real ix1,iy1,iz1,fix1,fiy1,fiz1;
270 real dx11,dy11,dz11,rsq11,rinv11;
272 real weight_cg1, weight_cg2, weight_product;
277 nthreads = *p_nthreads;
281 tabscale = *p_tabscale;
287 #ifdef GMX_THREAD_SHM_FDECOMP
288 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
290 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
292 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
299 for(n=nn0; (n<nn1); n++)
303 shY = shiftvec[is3+1];
304 shZ = shiftvec[is3+2];
309 ix1 = shX + pos[ii3+0];
310 iy1 = shY + pos[ii3+1];
311 iz1 = shZ + pos[ii3+2];
312 iq = facel*charge[ii];
313 nti = 2*ntype*type[ii];
321 for(k=nj0; (k<nj1); k++)
324 weight_cg2 = wf[jnr];
325 weight_product = weight_cg1*weight_cg2;
326 if (weight_product < ALMOST_ZERO) {
327 /* force is zero, skip this molecule */
330 else if (weight_product >= ALMOST_ONE)
336 hybscal = weight_product;
345 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
346 rinv11 = 1.0/sqrt(rsq11);
348 tj = nti+2*type[jnr];
350 c12 = vdwparam[tj+1];
351 rinvsq = rinv11*rinv11;
354 rinvsix = rinvsq*rinvsq*rinvsq;
356 Vvdw12 = c12*rinvsix*rinvsix;
357 Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
358 fscal = (vcoul+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
360 if(force_cap>0 && (fabs(fscal)> force_cap)){
361 fscal=force_cap*fscal/fabs(fscal);
369 faction[j3+0] = faction[j3+0] - tx;
370 faction[j3+1] = faction[j3+1] - ty;
371 faction[j3+2] = faction[j3+2] - tz;
374 faction[ii3+0] = faction[ii3+0] + fix1;
375 faction[ii3+1] = faction[ii3+1] + fiy1;
376 faction[ii3+2] = faction[ii3+2] + fiz1;
377 fshift[is3] = fshift[is3]+fix1;
378 fshift[is3+1] = fshift[is3+1]+fiy1;
379 fshift[is3+2] = fshift[is3+2]+fiz1;
381 Vc[ggid] = Vc[ggid] + vctot;
382 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
383 ninner = ninner + nj1 - nj0;
386 nouter = nouter + nn1 - nn0;