ComputeGBIS.inl

Go to the documentation of this file.
00001 
00007 /*******************************************************************************
00008   These are inline functions which define all the atom-pair calculations
00009   included in ComputeGBIS.C and ComputeGBISCUDAKernal.h
00010 *******************************************************************************/
00011 
00012 #ifndef COMPUTEGBIS_INL
00013 #define COMPUTEGBIS_INL
00014 
00015 /* Should psiSum and dEdaSum reductions be performed with doubles? */
00016 //this value is now defined in NamdTypes
00017 typedef float GBReal;
00018 
00019 //copied from NamdTypes.h
00020 typedef float Mass;
00021 
00022 
00023 #ifndef FS_MAX
00024 #define FS_MAX 1.728f /*maximum screened radius*/
00025 #endif
00026 
00027 #ifndef COULOMB
00028 #define COULOMB 332.0636f /* ke [kcal*Ang/e^2] common.h */
00029 #endif
00030 
00031 #ifndef TA
00032 #define TA 0.333333333333333f // 1/3
00033 #define TB 0.4f               // 2/5
00034 #define TC 0.428571428571428f // 3/7
00035 #define TD 0.444444444444444f // 4/9
00036 #define TE 0.454545454545454f // 5/11
00037 #define DA 1.333333333333333f // 4* 1/3
00038 #define DB 2.4f               // 6* 2/5
00039 #define DC 3.428571428571428f // 8* 3/7
00040 #define DD 4.444444444444444f // 10*4/9
00041 #define DE 5.454545454545454f // 12*5/11
00042 #endif
00043 
00044 static inline float FastTanH( float x ) {
00045   float a = 2.f*x+0.02f;;
00046   a *= (6.f + a*(3.f + a));
00047   return (a)/(a+12.f);
00048 }
00049 
00050 /******************************************************************************
00051  * use mass to determine element
00052  * return Bondi radius
00053  * returns the radius of i, depends on j though
00054  ******************************************************************************/
00055 static inline float MassToRadius(Mass mi) {//, Mass mj) {
00056 return
00057   (mi <   2.50f ) ? 1.20f : // AtmNum = 1;  Elem =  H ; Mass =   1.00
00058   (mi <   5.47f ) ? 1.40f : // AtmNum = 2;  Elem =  He; Mass =   4.00
00059   (mi <   7.98f ) ? 1.82f : // AtmNum = 3;  Elem =  Li; Mass =   6.94
00060   (mi <   9.91f ) ? 2.13f : // AtmNum = 4;  Elem =  Be; Mass =   9.01
00061   (mi <  11.41f ) ? 2.13f : // AtmNum = 5;  Elem =  B ; Mass =  10.81
00062   (mi <  13.01f ) ? 1.70f : // AtmNum = 6;  Elem =  C ; Mass =  12.01
00063   (mi <  15.00f ) ? 1.55f : // AtmNum = 7;  Elem =  N ; Mass =  14.00
00064   (mi <  17.49f ) ? 1.50f : // AtmNum = 8;  Elem =  O ; Mass =  15.99
00065   (mi <  19.58f ) ? 1.50f : // AtmNum = 9;  Elem =  F ; Mass =  18.99
00066   (mi <  21.58f ) ? 1.54f : // AtmNum = 10; Elem =  Ne; Mass =  20.17
00067   (mi <  23.64f ) ? 2.27f : // AtmNum = 11; Elem =  Na; Mass =  22.98
00068   (mi <  25.64f ) ? 1.73f : // AtmNum = 12; Elem =  Mg; Mass =  24.30
00069   (mi <  27.53f ) ? 2.51f : // AtmNum = 13; Elem =  Al; Mass =  26.98
00070   (mi <  29.53f ) ? 2.10f : // AtmNum = 14; Elem =  Si; Mass =  28.08
00071   (mi <  31.52f ) ? 1.85f : // AtmNum = 15; Elem =  P ; Mass =  30.97
00072   (mi <  33.76f ) ? 1.80f : // AtmNum = 16; Elem =  S ; Mass =  32.06
00073   (mi <  37.28f ) ? 1.70f : // AtmNum = 17; Elem =  Cl; Mass =  35.45
00074   (mi <  39.29f ) ? 2.75f : // AtmNum = 19; Elem =  K ; Mass =  39.10
00075   (mi <  49.09f ) ? 1.88f : // AtmNum = 18; Elem =  Ar; Mass =  39.48
00076   (mi <  61.12f ) ? 1.63f : // AtmNum = 28; Elem =  Ni; Mass =  58.69
00077   (mi <  64.46f ) ? 1.40f : // AtmNum = 29; Elem =  Cu; Mass =  63.54
00078   (mi <  67.55f ) ? 1.39f : // AtmNum = 30; Elem =  Zn; Mass =  65.38
00079   (mi <  71.18f ) ? 1.87f : // AtmNum = 31; Elem =  Ga; Mass =  69.72
00080   (mi <  73.78f ) ? 2.19f : // AtmNum = 32; Elem =  Ge; Mass =  72.64
00081   (mi <  76.94f ) ? 1.85f : // AtmNum = 33; Elem =  As; Mass =  74.92
00082   (mi <  79.43f ) ? 1.90f : // AtmNum = 34; Elem =  Se; Mass =  78.96
00083   (mi <  81.85f ) ? 1.85f : // AtmNum = 35; Elem =  Br; Mass =  79.90
00084   (mi <  95.11f ) ? 2.02f : // AtmNum = 36; Elem =  Kr; Mass =  83.79
00085   (mi < 107.14f ) ? 1.63f : // AtmNum = 46; Elem =  Pd; Mass = 106.42
00086   (mi < 110.14f ) ? 1.72f : // AtmNum = 47; Elem =  Ag; Mass = 107.86
00087   (mi < 113.61f ) ? 1.58f : // AtmNum = 48; Elem =  Cd; Mass = 112.41
00088   (mi < 116.76f ) ? 1.93f : // AtmNum = 49; Elem =  In; Mass = 114.81
00089   (mi < 120.24f ) ? 2.17f : // AtmNum = 50; Elem =  Sn; Mass = 118.71
00090   (mi < 124.33f ) ? 2.09f : // AtmNum = 51; Elem =  Sb; Mass = 121.76
00091   (mi < 127.25f ) ? 1.98f : // AtmNum = 53; Elem =  I ; Mass = 126.90
00092   (mi < 129.45f ) ? 2.06f : // AtmNum = 52; Elem =  Te; Mass = 127.60
00093   (mi < 163.19f ) ? 2.16f : // AtmNum = 54; Elem =  Xe; Mass = 131.29
00094   (mi < 196.02f ) ? 1.75f : // AtmNum = 78; Elem =  Pt; Mass = 195.08
00095   (mi < 198.78f ) ? 1.66f : // AtmNum = 79; Elem =  Au; Mass = 196.96
00096   (mi < 202.49f ) ? 1.55f : // AtmNum = 80; Elem =  Hg; Mass = 200.59
00097   (mi < 205.79f ) ? 1.96f : // AtmNum = 81; Elem =  Tl; Mass = 204.38
00098   (mi < 222.61f ) ? 2.02f : // AtmNum = 82; Elem =  Pb; Mass = 207.20
00099   (mi < 119.01f ) ? 1.86f : // AtmNum = 92; Elem =  U ; Mass = 238.02
00100                    1.50f ;   // Unknown
00101 }
00102 
00103 /******************************************************************************
00104  * Screen radii
00105  * use masses to determine elements
00106  * use elements to lookup Sij
00107  * to scale the coulomb radius
00108  * from Hawkins, Cramer, Truhlar; 1996
00109  * mi is descreened atom - calculating it's alpha (outer loop index)
00110  * mj is descreening atom - contributor (inner loop index)
00111  ******************************************************************************/
00112 static inline float MassToScreen(Mass mi) {//, Mass mj) {
00113     return
00114       (mi <   1.500f) ? 0.85f : //H
00115       (mi <  12.500f) ? 0.72f : //C
00116       (mi <  14.500f) ? 0.79f : //N
00117       (mi <  16.500f) ? 0.85f : //O
00118       (mi <  19.500f) ? 0.88f : //F
00119       (mi <  31.500f) ? 0.86f : //P
00120       (mi <  32.500f) ? 0.96f : //S
00121                         0.8f ; //all others
00122 }
00123 
00124 
00125 /******************************************************************************
00126   Piecewise screening functions Hij dHij/drij
00127   r   distance
00128   r2  square distance
00129   ri  inverse distance
00130   rc  cutoff
00131   r0  descreened atom radius
00132   rs  descreening atom radius
00133   h   return value
00134   dh  return value
00135  ******************************************************************************/
00136 #ifdef GBIS_CUDA
00137 __device__ __forceinline__ void h0
00138 #else
00139 static inline void h0
00140 #endif
00141 ( float r, float r2, float ri,//(0)*5.3%
00142     float rc, float r0, float rs, float & h ) {
00143   h = 0.f;
00144 }
00145 #ifdef GBIS_CUDA
00146 __device__ __forceinline__ void dh0
00147 #else
00148 static inline void dh0
00149 #endif
00150 ( float r, float r2, float ri,//(0)*5.3%
00151     float rc, float r0, float rs, float & dh ) {
00152   dh = 0.f;
00153 }
00154 
00155 #ifdef GBIS_CUDA
00156 __device__ __forceinline__ void h1
00157 #else
00158 static inline void h1
00159 #endif
00160 ( float r, float r2, float ri, //(6+ 11* 2/ 1log)*18.4%
00161     float rc, float r0, float rs, float & h ) {
00162 
00163   float rci = 1.f/rc;
00164   float rmrs = r-rs;
00165   float rmrsi = 1.f/rmrs;
00166   //float rmrs2 = rmrs*rmrs;
00167   float rs2 = rs*rs;
00168   float logr = log(rmrs*rci);
00169   float rci2 = rci*rci;
00170   h = 0.125f*ri*(1.f + 2.f*r*rmrsi + rci2*(r2 - 4.f*rc*r - rs2) + 2.f*logr);
00171 }
00172 #ifdef GBIS_CUDA
00173 __device__ __forceinline__ void dh1
00174 #else
00175 static inline void dh1
00176 #endif
00177 ( float r, float r2, float ri, //(4+ 13* 2/ 1log)*18.4%
00178     float rc, float r0, float rs, float & dh ) {
00179 
00180   float rci = 1.f/rc;
00181   float rmrs = r-rs;// 4 times
00182   float rmrsi = 1.f/rmrs;
00183   float rmrs2 = rmrs*rmrs;
00184   float rs2 = rs*rs;
00185   float logr = log(rmrs*rci);
00186   float rci2 = rci*rci;
00187   dh = ri*ri*(-0.25f*logr - (rc*rc - rmrs2)*(rs2 + r2)*0.125f*rci2*rmrsi*rmrsi);
00188 }
00189 
00190 #ifdef GBIS_CUDA
00191 __device__ __forceinline__ void h2
00192 #else
00193 static inline void h2
00194 #endif
00195 ( float r, float r2, float ri,//(4+ 10* )*74.5%
00196 float rc, float r0, float rs, float & h ) {
00197 
00198     float k = rs*ri; k*=k;//k=(rs/r)^2
00199     h = rs*ri*ri*k*(TA+k*(TB+k*(TC+k*(TD+k*TE))));
00200 }
00201 #ifdef GBIS_CUDA
00202 __device__ __forceinline__ void dh2
00203 #else
00204 static inline void dh2
00205 #endif
00206 ( float r, float r2, float ri,//(4+ 11* )*74.5%
00207 float rc, float r0, float rs, float & dh ) {
00208 
00209     float k = rs*ri; k*=k;//k=(rs/r)^2
00210     dh = -rs*ri*ri*ri*k*(DA+k*(DB+k*(DC+k*(DD+k*DE))));
00211 }
00212 
00213 #ifdef GBIS_CUDA
00214 __device__ __forceinline__ void h3
00215 #else
00216 static inline void h3
00217 #endif
00218 ( float r, float r2, float ri,//(3+ 5* 2/ 1log) 1.4%
00219 float rc, float r0, float rs, float & h ) {
00220     float r2mrs2i = 1.f/(r2-rs*rs);
00221     h = 0.5f * ( rs*r2mrs2i + 0.5f * log((r-rs)/(r+rs))*ri );
00222 }
00223 #ifdef GBIS_CUDA
00224 __device__ __forceinline__ void dh3
00225 #else
00226 static inline void dh3
00227 #endif
00228 ( float r, float r2, float ri,//(5+ 8* 2/ 1log)*1.4%
00229 float rc, float r0, float rs, float & dh ) {
00230     float rs2 = rs*rs;
00231     float r2mrs2i = 1.f/(r2-rs2);
00232     dh = -0.25f*ri*(2.f*(r2+rs2)*rs*r2mrs2i*r2mrs2i + ri*log((r-rs)/(r+rs)));
00233 }
00234 
00235 #ifdef GBIS_CUDA
00236 __device__ __forceinline__ void h4
00237 #else
00238 static inline void h4
00239 #endif
00240 ( float r, float r2, float ri,//(6+ 9* 2/ 1log)*0.4%
00241 float rc, float r0, float rs, float & h ) {
00242     //float ri2 = ri*ri;
00243     float r02 = r0*r0;
00244     float rs2 = rs*rs;
00245     float r0i = 1.f/r0;
00246     float rspri = 1.f/(r+rs);
00247     float logr = log(r0*rspri);
00248     //float r02mrs2 = r02-rs2;
00249     float rilogr = ri*logr;
00250     h = 0.25f*( r0i*(2.f- 0.5f*(r0i*ri*(r2 + r02 - rs2))) - rspri + rilogr );
00251 }
00252 #ifdef GBIS_CUDA
00253 __device__ __forceinline__ void dh4
00254 #else
00255 static inline void dh4
00256 #endif
00257 ( float r, float r2, float ri,//(6+ 18* 2/ 1log)*0.4%
00258 float rc, float r0, float rs, float & dh ) {
00259     float ri2 = ri*ri;
00260     float r02 = r0*r0;
00261     float rs2 = rs*rs;
00262     float r0i = 1.f/r0;
00263     float rspri = 1.f/(r+rs);
00264     float logr = log(r0*rspri);
00265     float r02mrs2 = r02-rs2;
00266     float rilogr = ri*logr;
00267     dh = 0.25f*( (- 0.5f +(r2*r02mrs2 - 2.f*r*rs*rs2+rs2*r02mrs2)
00268         * 0.5f *ri2*rspri*rspri)*r0i*r0i - ri*rilogr );
00269 }
00270 
00271 #ifdef GBIS_CUDA
00272 __device__ __forceinline__ void h5
00273 #else
00274 static inline void h5
00275 #endif
00276 ( float r, float r2, float ri,//(6+ 5* 3/ 1log)*0%, r<0.7Ang
00277 float rc, float r0, float rs, float & h ) {
00278     float rs2 = rs*rs;
00279     float r2mrs2i = 1.f/(r2-rs2);
00280     float rsr2mrs2i = rs*r2mrs2i;
00281     float rprs = r+rs;
00282     float rmrs = r-rs;
00283     float logr = 0.5f*ri*log(-rmrs/rprs);
00284     h = 0.5f*( rsr2mrs2i + 2.f/r0 + logr );
00285 }
00286 #ifdef GBIS_CUDA
00287 __device__ __forceinline__ void dh5
00288 #else
00289 static inline void dh5
00290 #endif
00291 ( float r, float r2, float ri,//(5+ 8* 2/ 1log)*0%, r<0.7Ang
00292 float rc, float r0, float rs, float & dh ) {
00293     float rs2 = rs*rs;
00294     float r2mrs2i = 1.f/(r2-rs2);
00295     float rsr2mrs2i = rs*r2mrs2i;
00296     float rprs = r+rs;
00297     float rmrs = r-rs;
00298     float logr = 0.5f*ri*log(-rmrs/rprs);
00299     dh = -0.5f*ri*((rs2+r2)*rsr2mrs2i*r2mrs2i+logr );
00300 }
00301 
00302 #ifdef GBIS_CUDA
00303 __device__ __forceinline__ void h6
00304 #else
00305 static inline void h6
00306 #endif
00307 ( float r, float r2, float ri,//0%, one atom within other
00308 float rc, float r0, float rs, float & h ) {
00309   h = 0;
00310 }
00311 #ifdef GBIS_CUDA
00312 __device__ __forceinline__ void dh6
00313 #else
00314 static inline void dh6
00315 #endif
00316 ( float r, float r2, float ri,//0%, one atom within other
00317 float rc, float r0, float rs, float & dh ) {
00318   dh = 0;
00319 }
00320 
00321 #ifdef GBIS_CUDA
00322 __device__ __forceinline__ void CalcH 
00323 #else
00324 static inline void CalcH 
00325 #endif
00326 ( float r, float r2, float ri,
00327 float rc, float r0, float rs, float & h, int & d) {
00328 
00329 /*
00330 r - distance
00331 rc - alpha cutoff
00332 rs - screened radius
00333 */
00334 
00335 if (r > 4*rs) { //change this to 1/4 r > rs
00336   if( r < rc - rs) {//II            68%
00337     h2(r,r2,ri,rc,r0,rs,h); d = 2;
00338   } else if (r < rc + rs) {//I      23%
00339     h1(r,r2,ri,rc,r0,rs,h); d = 1;
00340   } else /*if (r > rc + rs)*/ {//0  7%
00341     h0(r,r2,ri,rc,r0,rs,h); d = 0;
00342   } 
00343 } else {
00344   if( r > r0 + rs ) {//III          1%
00345     h3(r,r2,ri,rc,r0,rs,h); d = 3;
00346   } else if ( r > (r0>rs?r0-rs:rs-r0) ) {//IV 0%
00347     h4(r,r2,ri,rc,r0,rs,h); d = 4;
00348   } else if (r0 < rs ) {//V         0%
00349     h5(r,r2,ri,rc,r0,rs,h); d = 5;
00350   } else {//VI                      0%
00351     h6(r,r2,ri,rc,r0,rs,h); d = 6;
00352   }
00353 }
00354 }
00355 #ifdef GBIS_CUDA
00356 __device__ __forceinline__ void CalcDH
00357 #else
00358 static inline void CalcDH
00359 #endif
00360 ( float r, float r2, float ri,
00361 float rc, float r0, float rs, float & dh, int & d) {
00362 if (r > 4*rs) {
00363   if( r < rc - rs) {//II
00364     dh2(r,r2,ri,rc,r0,rs,dh); d = 2;
00365   } else if (r < rc + rs) {//I
00366     dh1(r,r2,ri,rc,r0,rs,dh); d = 1;
00367   } else /*if (r > rc + rs)*/ {//0
00368     dh0(r,r2,ri,rc,r0,rs,dh); d = 0;
00369   }
00370 } else {
00371   if( r > r0 + rs ) {//III
00372     dh3(r,r2,ri,rc,r0,rs,dh); d = 3;
00373   } else if (r > (r0>rs?r0-rs:rs-r0) ) {//IV
00374     dh4(r,r2,ri,rc,r0,rs,dh); d = 4;
00375   } else if (r0 < rs ) {//V
00376     dh5(r,r2,ri,rc,r0,rs,dh); d = 5;
00377   } else {//VI
00378     dh6(r,r2,ri,rc,r0,rs,dh); d = 6;
00379   }
00380 }
00381 }
00382 #ifdef GBIS_CUDA
00383 __device__  __forceinline__ void CalcHPair
00384 #else
00385 static inline void CalcHPair
00386 #endif
00387 (
00388   float r,//distance
00389   float r2,//distance squared
00390   float ri,//inverse distance
00391   float rc,//cutoff
00392   float ri0,
00393   float rjs,
00394   float rj0,
00395   float ris,
00396   int & dij,//domain 1
00397   int & dji,//domain 2
00398   float & hij,//output
00399   float & hji//output
00400 ) {
00401   CalcH(r,r2,ri,rc,ri0,rjs,hij,dij);//hij
00402   CalcH(r,r2,ri,rc,rj0,ris,hji,dji);//hji
00403 }
00404 #ifdef GBIS_CUDA
00405 __device__ __forceinline__ void CalcDHPair
00406 #else
00407 static inline void CalcDHPair
00408 #endif
00409 ( float r,//distance
00410   float r2,
00411   float ri,
00412   float rc,//cutoff
00413   float ri0,
00414   float rjs,
00415   float rj0,
00416   float ris,
00417   int & dij,//domain 1
00418   int & dji,//domain 2
00419   float & dhij,
00420   float & dhji
00421 ) {
00422 //                  swapped
00423   CalcDH(r,r2,ri,rc,ri0,rjs,dhij,dij);//hij
00424   CalcDH(r,r2,ri,rc,rj0,ris,dhji,dji);//hji
00425 }
00426 
00427 /*
00428  * Calculate GB Energy, GB dEdr force
00429  * also output intermediate values used in dEda
00430  */
00431 #ifdef GBIS_CUDA
00432 __device__ __forceinline__ void Calc_dEdr_Pair
00433 #else
00434 static inline void Calc_dEdr_Pair
00435 #endif
00436 (//no longer does i==j
00437   const float & r,
00438   const float & r2,
00439   const float & qiqj,
00440   const float & ai,
00441   const float & aj,
00442   const float & kappa,
00443   const float & epsilon_p_i,
00444   const float & epsilon_s_i,
00445   float & aiaj,
00446   float & expr2aiaj4,
00447   float & fij,
00448   float & f_i,
00449   float & expkappa,
00450   float & Dij,
00451   float & gbE,   //return
00452   float & ddrGbE //return
00453 ) {
00454   //allocate local variables
00455   float aiaj4,ddrDij,ddrf_i,ddrfij;
00456 
00457   //calculate GB energy
00458   aiaj = ai*aj;
00459   aiaj4 = 4.f*aiaj;
00460   //printf("exp(%e)\n",(-r2/aiaj4));
00461   expr2aiaj4 = exp(-r2/aiaj4);
00462   fij = sqrt(r2+aiaj*expr2aiaj4);
00463   f_i = 1/fij;
00464   expkappa = (kappa > 0.f) ? exp(-kappa*fij) : 1.f;
00465   Dij = epsilon_p_i - expkappa*epsilon_s_i;
00466   //gbE = -COULOMB*qiqj*Dij*f_i;
00467   gbE = qiqj*Dij*f_i;
00468 
00469   //calculate energy derivatives
00470   ddrfij = r*f_i*(1.f - 0.25f*expr2aiaj4);
00471   ddrf_i = -ddrfij*f_i*f_i;
00472   ddrDij = kappa*expkappa*ddrfij*epsilon_s_i;
00473   //ddrGbE = -COULOMB*qiqj*(ddrDij*f_i+Dij*ddrf_i);
00474   ddrGbE = qiqj*(ddrDij*f_i+Dij*ddrf_i);
00475 }
00476 
00477 /*
00478  * Calculate summation element of dEda array
00479  * must calculate dEdr previously to retreive intermediate values
00480  */
00481 #ifdef GBIS_CUDA
00482 __device__ __forceinline__ void Calc_dEda_Pair
00483 #else
00484 static inline void Calc_dEda_Pair
00485 #endif
00486 ( const float & r2,
00487   const float & ai,
00488   const float & aj,
00489   const float & qiqj,
00490   const float & kappa,
00491   const float & aiaj,
00492   const float & expkappa,
00493   const float & expr2aiaj4,
00494   const float & fij,
00495   const float & f_i,
00496   const float & Dij,
00497   const float & epsilon_s_i,
00498   float & dEdai,//return
00499   float & dEdaj //return
00500 ) {
00501 
00502   //float tmp_dEda = -0.5*COULOMB*qiqj*f_i*f_i
00503   float tmp_dEda = 0.5f*qiqj*f_i*f_i
00504                       *(kappa*epsilon_s_i*expkappa-Dij*f_i)
00505                       *(aiaj+0.25f*r2)*expr2aiaj4;//0
00506   dEdai = tmp_dEda/ai;
00507   dEdaj = tmp_dEda/aj;
00508 }
00509 
00510 /*
00511  * Calculate Coulomb and GB interaction and dEda element
00512  * for a pair of atoms
00513  */
00514 #ifdef GBIS_CUDA
00515 __device__ __forceinline__ void Phase2_Pair
00516 #else
00517 static inline void Phase2_Pair
00518 #endif
00519 (//doesn't do self energies
00520 
00521 //input values
00522   const float & r,
00523   const float & r2,
00524   const float & r_i,
00525   const float & qiqj,
00526   const float & ai,
00527   const float & aj,
00528   const float & epsilon_p_i,
00529   const float & epsilon_s_i,
00530   const float & kappa,
00531   const int & doFullElect,
00532 
00533 //return values
00534   float & gbEij,
00535   float & ddrGbEij,
00536   float & dEdai,
00537   float & dEdaj
00538 ) {
00539 
00540   //calculate GB energy and force
00541   float aiaj,expr2aiaj4,fij,f_i,expkappa,Dij;
00542   Calc_dEdr_Pair(r,r2,qiqj,ai,aj,
00543       kappa,epsilon_p_i,epsilon_s_i,
00544       aiaj,expr2aiaj4,fij,f_i,expkappa,
00545       Dij,gbEij,ddrGbEij);
00546 
00547   //calculate dEda
00548   if (doFullElect) {
00549     Calc_dEda_Pair(r2,ai,aj,qiqj,kappa,
00550               aiaj,expkappa,expr2aiaj4,
00551               fij,f_i,Dij,epsilon_s_i,dEdai,dEdaj);
00552   } else {
00553     dEdai = 0.f;
00554     dEdaj = 0.f;
00555   }
00556 }
00557 
00558 #if 0
00559 static inline void init_gbisTable (
00560 float **tablePtr,
00561 float kappa,
00562 float maxX,
00563 int numEntriesPerX
00564 ) {
00565   float *table = *tablePtr;//dereference
00566   float minX = 0;
00567   int numPts = (maxX-minX) * numEntriesPerX;
00568   int numVals = 3;
00569   /*
00570   table = (float*) malloc(numVals*numPts*sizeof(float));
00571   for (int i = 0; i < numPts; i++) {
00572     float x = (1.0*i) / numEntriesPerX + minX; 
00573       bornRadJ = gbisParams->bornRad[1][j];
00574       aiaj = bornRadI * bornRadJ;
00575       aiaj4 = 4.0 * aiaj;
00576       expr2aiaj4 = exp(-r2/aiaj4);
00577       fij = sqrt(r2+aiaj*expr2aiaj4);
00578       f_i = 1.0/fij;
00579       expkappa = (kappa > 0.0) ? exp(-kappa*fij) : 1.0;
00580   }
00581 */
00582 }
00583 #endif
00584 
00585 //include once
00586 #endif

Generated on Thu Nov 23 01:17:10 2017 for NAMD by  doxygen 1.4.7