• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision9c980fd6303f5789429394571133f343810a30bd (tree)
Time2012-11-08 12:22:03
AuthorKatsuhiko Nishimra <ktns.87@gmai...>
CommiterKatsuhiko Nishimra

Log Message

Throw exception if RFO step goes NaN. #28764

git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1107 1136aad2-a195-0410-b898-f5ea1d11b9d8

Change Summary

Incremental Difference

--- a/src/optimization/BFGS.cpp
+++ b/src/optimization/BFGS.cpp
@@ -62,6 +62,8 @@ void BFGS::SetMessages(){
6262 = "Error in optimization::BFGS::CheckEnableTheoryType: Non available theory is set.\n";
6363 this->errorMessageGeometyrOptimizationNotConverged
6464 = "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";
6567 this->messageStartBFGSStep = "\n========== START: BFGS step ";
6668 }
6769
@@ -302,6 +304,9 @@ void BFGS::CalcRFOStep(double* vectorStep,
302304 // [vectorStep, 1] is the eigenvector of augmented Hessian.
303305 // See Eq. (4) in [EPW_1997].
304306 vectorStep[i] = matrixAugmentedHessian[0][i] / matrixAugmentedHessian[0][dimension] / alpha;
307+ if(isnan(vectorStep[i])){
308+ throw MolDSException(this->errorMessageNaNInRFOStep);
309+ }
305310 }
306311 //
307312 // Calculate size of the RFO step
--- a/src/optimization/BFGS.h
+++ b/src/optimization/BFGS.h
@@ -28,6 +28,7 @@ public:
2828 protected:
2929 void SetMessages();
3030 private:
31+ std::string errorMessageNaNInRFOStep;
3132 std::string messageStartBFGSStep;
3233 virtual void SearchMinimum(boost::shared_ptr<MolDS_base::ElectronicStructure> electronicStructure,
3334 MolDS_base::Molecule& molecule,