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_kernel200_adress.h"
32 * Gromacs nonbonded kernel nb_kernel200_adress_cg
33 * Coulomb interaction: Reaction field
34 * VdW interaction: Not calculated
35 * water optimization: No
36 * Calculate forces: yes
38 void nb_kernel200_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;
82 real ix1,iy1,iz1,fix1,fiy1,fiz1;
84 real dx11,dy11,dz11,rsq11,rinv11;
85 real weight_cg1, weight_cg2, weight_product;
90 nthreads = *p_nthreads;
94 tabscale = *p_tabscale;
100 #ifdef GMX_THREAD_SHM_FDECOMP
101 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
103 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
105 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
112 for(n=nn0; (n<nn1); n++)
116 shY = shiftvec[is3+1];
117 shZ = shiftvec[is3+2];
122 ix1 = shX + pos[ii3+0];
123 iy1 = shY + pos[ii3+1];
124 iz1 = shZ + pos[ii3+2];
125 iq = facel*charge[ii];
132 for(k=nj0; (k<nj1); k++)
135 weight_cg2 = wf[jnr];
136 weight_product = weight_cg1*weight_cg2;
137 if (weight_product < ALMOST_ZERO) {
140 else if (weight_product >= ALMOST_ONE)
142 /* force is zero, skip this molecule */
147 hybscal = 1.0 - weight_product;
156 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
157 rinv11 = 1.0/sqrt(rsq11);
159 rinvsq = rinv11*rinv11;
161 vcoul = qq*(rinv11+krsq-crf);
163 fscal = (qq*(rinv11-2.0*krsq))*rinvsq;
171 faction[j3+0] = faction[j3+0] - tx;
172 faction[j3+1] = faction[j3+1] - ty;
173 faction[j3+2] = faction[j3+2] - tz;
176 faction[ii3+0] = faction[ii3+0] + fix1;
177 faction[ii3+1] = faction[ii3+1] + fiy1;
178 faction[ii3+2] = faction[ii3+2] + fiz1;
179 fshift[is3] = fshift[is3]+fix1;
180 fshift[is3+1] = fshift[is3+1]+fiy1;
181 fshift[is3+2] = fshift[is3+2]+fiz1;
183 Vc[ggid] = Vc[ggid] + vctot;
184 ninner = ninner + nj1 - nj0;
187 nouter = nouter + nn1 - nn0;
200 * Gromacs nonbonded kernel nb_kernel200_adress_ex
201 * Coulomb interaction: Reaction field
202 * VdW interaction: Not calculated
203 * water optimization: No
204 * Calculate forces: yes
206 void nb_kernel200_adress_ex(
240 int nri,ntype,nthreads;
241 real facel,krf,crf,tabscale,gbtabscale;
242 int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
243 int nn0,nn1,nouter,ninner;
250 real ix1,iy1,iz1,fix1,fiy1,fiz1;
252 real dx11,dy11,dz11,rsq11,rinv11;
253 real weight_cg1, weight_cg2, weight_product;
258 nthreads = *p_nthreads;
262 tabscale = *p_tabscale;
268 #ifdef GMX_THREAD_SHM_FDECOMP
269 tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
271 nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
273 tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
280 for(n=nn0; (n<nn1); n++)
284 shY = shiftvec[is3+1];
285 shZ = shiftvec[is3+2];
290 ix1 = shX + pos[ii3+0];
291 iy1 = shY + pos[ii3+1];
292 iz1 = shZ + pos[ii3+2];
293 iq = facel*charge[ii];
300 for(k=nj0; (k<nj1); k++)
303 weight_cg2 = wf[jnr];
304 weight_product = weight_cg1*weight_cg2;
305 if (weight_product < ALMOST_ZERO) {
306 /* force is zero, skip this molecule */
309 else if (weight_product >= ALMOST_ONE)
315 hybscal = weight_product;
324 rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
325 rinv11 = 1.0/sqrt(rsq11);
327 rinvsq = rinv11*rinv11;
329 vcoul = qq*(rinv11+krsq-crf);
331 fscal = (qq*(rinv11-2.0*krsq))*rinvsq;
339 faction[j3+0] = faction[j3+0] - tx;
340 faction[j3+1] = faction[j3+1] - ty;
341 faction[j3+2] = faction[j3+2] - tz;
344 faction[ii3+0] = faction[ii3+0] + fix1;
345 faction[ii3+1] = faction[ii3+1] + fiy1;
346 faction[ii3+2] = faction[ii3+2] + fiz1;
347 fshift[is3] = fshift[is3]+fix1;
348 fshift[is3+1] = fshift[is3+1]+fiy1;
349 fshift[is3+2] = fshift[is3+2]+fiz1;
351 Vc[ggid] = Vc[ggid] + vctot;
352 ninner = ninner + nj1 - nj0;
355 nouter = nouter + nn1 - nn0;