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_kernel100_adress.h"
32 * Gromacs nonbonded kernel nb_kernel100_adress_cg
33 * Coulomb interaction: Normal Coulomb
34 * VdW interaction: Not calculated
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel100_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;
81 real ix1,iy1,iz1,fix1,fiy1,fiz1;
83 real dx11,dy11,dz11,rsq11,rinv11;
84 real weight_cg1, weight_cg2, weight_product;
89 nthreads = *p_nthreads;
93 tabscale = *p_tabscale;
99 #ifdef GMX_THREAD_SHM_FDECOMP
100 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
102 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
104 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
111 for(n=nn0; (n<nn1); n++)
115 shY = shiftvec[is3+1];
116 shZ = shiftvec[is3+2];
121 ix1 = shX + pos[ii3+0];
122 iy1 = shY + pos[ii3+1];
123 iz1 = shZ + pos[ii3+2];
124 iq = facel*charge[ii];
131 for(k=nj0; (k<nj1); k++)
134 weight_cg2 = wf[jnr];
135 weight_product = weight_cg1*weight_cg2;
136 if (weight_product < ALMOST_ZERO) {
139 else if (weight_product >= ALMOST_ONE)
141 /* force is zero, skip this molecule */
146 hybscal = 1.0 - weight_product;
155 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
156 rinv11 = 1.0/sqrt(rsq11);
158 rinvsq = rinv11*rinv11;
161 fscal = (vcoul)*rinvsq;
169 faction[j3+0] = faction[j3+0] - tx;
170 faction[j3+1] = faction[j3+1] - ty;
171 faction[j3+2] = faction[j3+2] - tz;
174 faction[ii3+0] = faction[ii3+0] + fix1;
175 faction[ii3+1] = faction[ii3+1] + fiy1;
176 faction[ii3+2] = faction[ii3+2] + fiz1;
177 fshift[is3] = fshift[is3]+fix1;
178 fshift[is3+1] = fshift[is3+1]+fiy1;
179 fshift[is3+2] = fshift[is3+2]+fiz1;
181 Vc[ggid] = Vc[ggid] + vctot;
182 ninner = ninner + nj1 - nj0;
185 nouter = nouter + nn1 - nn0;
198 * Gromacs nonbonded kernel nb_kernel100_adress_ex
199 * Coulomb interaction: Normal Coulomb
200 * VdW interaction: Not calculated
201 * water optimization: No
202 * Calculate forces: yes
204 void nb_kernel100_adress_ex(
238 int nri,ntype,nthreads;
239 real facel,krf,crf,tabscale,gbtabscale;
240 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
241 int nn0,nn1,nouter,ninner;
247 real ix1,iy1,iz1,fix1,fiy1,fiz1;
249 real dx11,dy11,dz11,rsq11,rinv11;
250 real weight_cg1, weight_cg2, weight_product;
255 nthreads = *p_nthreads;
259 tabscale = *p_tabscale;
265 #ifdef GMX_THREAD_SHM_FDECOMP
266 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
268 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
270 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
277 for(n=nn0; (n<nn1); n++)
281 shY = shiftvec[is3+1];
282 shZ = shiftvec[is3+2];
287 ix1 = shX + pos[ii3+0];
288 iy1 = shY + pos[ii3+1];
289 iz1 = shZ + pos[ii3+2];
290 iq = facel*charge[ii];
297 for(k=nj0; (k<nj1); k++)
300 weight_cg2 = wf[jnr];
301 weight_product = weight_cg1*weight_cg2;
302 if (weight_product < ALMOST_ZERO) {
303 /* force is zero, skip this molecule */
306 else if (weight_product >= ALMOST_ONE)
312 hybscal = weight_product;
321 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
322 rinv11 = 1.0/sqrt(rsq11);
324 rinvsq = rinv11*rinv11;
327 fscal = (vcoul)*rinvsq;
335 faction[j3+0] = faction[j3+0] - tx;
336 faction[j3+1] = faction[j3+1] - ty;
337 faction[j3+2] = faction[j3+2] - tz;
340 faction[ii3+0] = faction[ii3+0] + fix1;
341 faction[ii3+1] = faction[ii3+1] + fiy1;
342 faction[ii3+2] = faction[ii3+2] + fiz1;
343 fshift[is3] = fshift[is3]+fix1;
344 fshift[is3+1] = fshift[is3+1]+fiy1;
345 fshift[is3+2] = fshift[is3+2]+fiz1;
347 Vc[ggid] = Vc[ggid] + vctot;
348 ninner = ninner + nj1 - nj0;
351 nouter = nouter + nn1 - nn0;