Revision | c3e727dfef913c7cf49eaca198f3cf2413ec3690 (tree) |
---|---|
Time | 2013-10-17 03:24:45 |
Author | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
Hotspots caused by pow is deleted. #31850
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1549 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -6262,13 +6262,17 @@ double Cndo2::GetReducedOverlapAOs2ndDerivativeAlphaBeta(int na, | ||
6262 | 6262 | // see (B.22) in J. A. Pople book. |
6263 | 6263 | double Cndo2::GetAuxiliaryA(int k, double rho) const{ |
6264 | 6264 | double value = 0.0; |
6265 | - double temp = 0.0; | |
6265 | + double tmp1 = 0.0; | |
6266 | 6266 | |
6267 | 6267 | value = exp(-1.0*rho)*static_cast<double>(Factorial(k)); |
6268 | 6268 | for(int mu=1; mu<=k+1; mu++){ |
6269 | - temp += pow(rho,-1.0*mu)/static_cast<double>(Factorial(k-mu+1)); | |
6269 | + double tmp2=rho; // tmp2 = pow(rho,mu) | |
6270 | + for(int nu=1; nu<mu; nu++){ | |
6271 | + tmp2 *= rho; | |
6272 | + } | |
6273 | + tmp1 += 1.0/(tmp2*static_cast<double>(Factorial(k-mu+1))); | |
6270 | 6274 | } |
6271 | - value *= temp; | |
6275 | + value *= tmp1; | |
6272 | 6276 | |
6273 | 6277 | return value; |
6274 | 6278 | } |
@@ -6288,18 +6292,24 @@ double Cndo2::GetAuxiliaryB(int k, double rho) const{ | ||
6288 | 6292 | double value = 0.0; |
6289 | 6293 | double pre1 = 0.0; |
6290 | 6294 | double pre2 = 0.0; |
6291 | - double temp1 = 0.0; | |
6292 | - double temp2 = 0.0; | |
6295 | + double tmp1 = 0.0; | |
6296 | + double tmp2 = 0.0; | |
6293 | 6297 | |
6294 | 6298 | if(fabs(rho)>0){ |
6295 | 6299 | pre1 = -1.0*exp(-1.0*rho); |
6296 | 6300 | pre2 = -1.0*exp(rho); |
6297 | 6301 | |
6298 | 6302 | for(int mu=1; mu<=k+1; mu++){ |
6299 | - temp1 += pow(rho,-1.0*mu) *static_cast<double>(Factorial(k)/Factorial(k-mu+1)) ; | |
6300 | - temp2 += pow(rho,-1.0*mu) *static_cast<double>(Factorial(k)/Factorial(k-mu+1)) *pow(-1.0,k-mu); | |
6301 | - } | |
6302 | - value = pre1*temp1 + pre2*temp2; | |
6303 | + double tmp3 = rho; // tmp3 = pow(rho,mu) | |
6304 | + for(int nu=1; nu<mu; nu++){ | |
6305 | + tmp3 *= rho; | |
6306 | + } | |
6307 | + double tmp4 = -1.0; // tmp4 = pow(-1.0,k-mu) | |
6308 | + if((k-mu)%2==0){tmp4=1.0;} | |
6309 | + tmp1 += static_cast<double>(Factorial(k)/Factorial(k-mu+1)) /tmp3; | |
6310 | + tmp2 += static_cast<double>(Factorial(k)/Factorial(k-mu+1))*tmp4/tmp3; | |
6311 | + } | |
6312 | + value = pre1*tmp1 + pre2*tmp2; | |
6303 | 6313 | } |
6304 | 6314 | else{ |
6305 | 6315 | if(k%2 == 0){ |