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_kernel010_adress.h"
32 * Gromacs nonbonded kernel nb_kernel010_adress_cg
33 * Coulomb interaction: Not calculated
34 * VdW interaction: Lennard-Jones
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel010_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;
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 = 2*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;
161 tj = nti+2*type[jnr];
163 c12 = vdwparam[tj+1];
164 rinvsix = rinvsq*rinvsq*rinvsq;
166 Vvdw12 = c12*rinvsix*rinvsix;
167 Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
168 fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
176 faction[j3+0] = faction[j3+0] - tx;
177 faction[j3+1] = faction[j3+1] - ty;
178 faction[j3+2] = faction[j3+2] - tz;
181 faction[ii3+0] = faction[ii3+0] + fix1;
182 faction[ii3+1] = faction[ii3+1] + fiy1;
183 faction[ii3+2] = faction[ii3+2] + fiz1;
184 fshift[is3] = fshift[is3]+fix1;
185 fshift[is3+1] = fshift[is3+1]+fiy1;
186 fshift[is3+2] = fshift[is3+2]+fiz1;
188 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
189 ninner = ninner + nj1 - nj0;
192 nouter = nouter + nn1 - nn0;
205 * Gromacs nonbonded kernel nb_kernel010_adress_ex
206 * Coulomb interaction: Not calculated
207 * VdW interaction: Lennard-Jones
208 * water optimization: No
209 * Calculate forces: yes
211 void nb_kernel010_adress_ex(
245 int nri,ntype,nthreads;
246 real facel,krf,crf,tabscale,gbtabscale;
247 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
248 int nn0,nn1,nouter,ninner;
257 real ix1,iy1,iz1,fix1,fiy1,fiz1;
259 real dx11,dy11,dz11,rsq11;
261 real weight_cg1, weight_cg2, weight_product;
266 nthreads = *p_nthreads;
270 tabscale = *p_tabscale;
276 #ifdef GMX_THREAD_SHM_FDECOMP
277 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
279 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
281 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
288 for(n=nn0; (n<nn1); n++)
292 shY = shiftvec[is3+1];
293 shZ = shiftvec[is3+2];
298 ix1 = shX + pos[ii3+0];
299 iy1 = shY + pos[ii3+1];
300 iz1 = shZ + pos[ii3+2];
301 nti = 2*ntype*type[ii];
308 for(k=nj0; (k<nj1); k++)
311 weight_cg2 = wf[jnr];
312 weight_product = weight_cg1*weight_cg2;
313 if (weight_product < ALMOST_ZERO) {
314 /* force is zero, skip this molecule */
317 else if (weight_product >= ALMOST_ONE)
323 hybscal = weight_product;
332 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
334 tj = nti+2*type[jnr];
336 c12 = vdwparam[tj+1];
337 rinvsix = rinvsq*rinvsq*rinvsq;
339 Vvdw12 = c12*rinvsix*rinvsix;
340 Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
341 fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
343 if(force_cap>0 && (fabs(fscal)> force_cap)){
344 fscal=force_cap*fscal/fabs(fscal);
352 faction[j3+0] = faction[j3+0] - tx;
353 faction[j3+1] = faction[j3+1] - ty;
354 faction[j3+2] = faction[j3+2] - tz;
357 faction[ii3+0] = faction[ii3+0] + fix1;
358 faction[ii3+1] = faction[ii3+1] + fiy1;
359 faction[ii3+2] = faction[ii3+2] + fiz1;
360 fshift[is3] = fshift[is3]+fix1;
361 fshift[is3+1] = fshift[is3+1]+fiy1;
362 fshift[is3+2] = fshift[is3+2]+fiz1;
364 Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
365 ninner = ninner + nj1 - nj0;
368 nouter = nouter + nn1 - nn0;