Revision | a06f6a703c951e409bb7e0faa5a177224765cf83 (tree) |
---|---|
Time | 2013-02-28 14:40:47 |
Author | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
0-divide is avoided in mathematically exact way.#30045
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1305 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -5136,6 +5136,10 @@ void Cndo2::CalcRotatingMatrix1stDerivatives(double*** rotMat1stDerivatives, | ||
5136 | 5136 | double r = sqrt( pow(x,2.0) + pow(y,2.0) ); |
5137 | 5137 | double R = sqrt( pow(x,2.0) + pow(y,2.0) + pow(z,2.0) ); |
5138 | 5138 | |
5139 | + if(r==0e0){ | |
5140 | + return; | |
5141 | + } | |
5142 | + | |
5139 | 5143 | // for s-function |
5140 | 5144 | rotMat1stDerivatives[s][s][XAxis] = 0.0; |
5141 | 5145 | rotMat1stDerivatives[s][s][YAxis] = 0.0; |
@@ -5206,6 +5210,11 @@ void Cndo2::CalcRotatingMatrix2ndDerivatives(double**** rotMat2ndDerivatives, | ||
5206 | 5210 | double z = atomB.GetXyz()[2] - atomA.GetXyz()[2]; |
5207 | 5211 | double r = sqrt( pow(x,2.0) + pow(y,2.0) ); |
5208 | 5212 | double R = sqrt( pow(x,2.0) + pow(y,2.0) + pow(z,2.0) ); |
5213 | + | |
5214 | + if(r==0e0){ | |
5215 | + return; | |
5216 | + } | |
5217 | + | |
5209 | 5218 | double temp1 = 1.0/(pow(r,3.0)*R) + 1.0/(r*pow(R,3.0)); |
5210 | 5219 | double temp2 = 2.0*pow(r*R,-3.0) + 3.0/(pow(r,5.0)*R) + 3.0/(r*pow(R,5.0)); |
5211 | 5220 | double temp3 = pow(r*R,-3.0) + 3.0/(r*pow(R,5.0)); |