修訂 | 9c980fd6303f5789429394571133f343810a30bd (tree) |
---|---|
時間 | 2012-11-08 12:22:03 |
作者 | Katsuhiko Nishimra <ktns.87@gmai...> |
Commiter | Katsuhiko Nishimra |
Throw exception if RFO step goes NaN. #28764
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1107 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -62,6 +62,8 @@ void BFGS::SetMessages(){ | ||
62 | 62 | = "Error in optimization::BFGS::CheckEnableTheoryType: Non available theory is set.\n"; |
63 | 63 | this->errorMessageGeometyrOptimizationNotConverged |
64 | 64 | = "Error in optimization::BFGS::Optimize: Optimization did not met convergence criterion.\n"; |
65 | + this->errorMessageNaNInRFOStep | |
66 | + = "Error in optimization::BFGS::Optimize: RFO step has gone NaN.\n"; | |
65 | 67 | this->messageStartBFGSStep = "\n========== START: BFGS step "; |
66 | 68 | } |
67 | 69 |
@@ -302,6 +304,9 @@ void BFGS::CalcRFOStep(double* vectorStep, | ||
302 | 304 | // [vectorStep, 1] is the eigenvector of augmented Hessian. |
303 | 305 | // See Eq. (4) in [EPW_1997]. |
304 | 306 | vectorStep[i] = matrixAugmentedHessian[0][i] / matrixAugmentedHessian[0][dimension] / alpha; |
307 | + if(isnan(vectorStep[i])){ | |
308 | + throw MolDSException(this->errorMessageNaNInRFOStep); | |
309 | + } | |
305 | 310 | } |
306 | 311 | // |
307 | 312 | // Calculate size of the RFO step |
@@ -28,6 +28,7 @@ public: | ||
28 | 28 | protected: |
29 | 29 | void SetMessages(); |
30 | 30 | private: |
31 | + std::string errorMessageNaNInRFOStep; | |
31 | 32 | std::string messageStartBFGSStep; |
32 | 33 | virtual void SearchMinimum(boost::shared_ptr<MolDS_base::ElectronicStructure> electronicStructure, |
33 | 34 | MolDS_base::Molecule& molecule, |