• 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

Revisionbedf6dbad2227b67f28075d37e03ca263c83eab6 (tree)
Time2012-11-27 17:17:32
AuthorKatsuhiko Nishimra <ktns.87@gmai...>
CommiterKatsuhiko Nishimra

Log Message

Merge trunk into branch gdiis. #28915

git-svn-id: https://svn.sourceforge.jp/svnroot/molds/branches/gdiis@1141 1136aad2-a195-0410-b898-f5ea1d11b9d8

Change Summary

Incremental Difference

--- a/src/optimization/BFGS.cpp
+++ b/src/optimization/BFGS.cpp
@@ -66,7 +66,36 @@ void BFGS::SetMessages(){
6666 = "Error in optimization::BFGS::Optimize: Optimization did not met convergence criterion.\n";
6767 this->errorMessageNaNInRFOStep
6868 = "Error in optimization::BFGS::Optimize: RFO step has gone NaN. (lambda * s[%d] = %e, lambda = %e, alpha = %e)\n";
69- this->messageStartBFGSStep = "\n========== START: BFGS step ";
69+
70+ this->messageStartBFGSStep
71+ = "\n========== START: BFGS step ";
72+ this->messageHillClimbing =
73+ "Detected hill climbing.\n"
74+ "Rolling back molecular geometry.\n";
75+ this->messageRecalculateRFOStep
76+ = "Recalculating RFO step...\n";
77+ this->messageRawHessianEigenvalues
78+ = "Eigenvalues of the raw Hessian:";
79+ this->messageShiftedHessianEigenvalues
80+ = "Eigenvalues of the level shifted hessian:";
81+
82+ this->formatEnergyChangeComparison =
83+ "\n"
84+ "actual energy change = %e\n"
85+ "expected energy change = %e\n"
86+ "actual/expected energy change = %f\n";
87+ this->formatLowestHessianEigenvalue
88+ = "Lowest eigenvalue of the augmented Hessian = %f\n";
89+ this->format2ndLowestHessianEigenvalue
90+ = "2nd lowest eigenvalue of the augmented Hessian = %f\n";
91+ this->format3rdLowestHessianEigenvalue
92+ = "3rd lowest eigenvalue of the augmented Hessian = %f\n";
93+ this->formatRFOStepSize
94+ = "Calculated RFO step size = %f\n";
95+ this->formatTrustRadiusIs
96+ = "Trust radius is %f\n";
97+ this->formatIncreaseScalingFactor
98+ = "Scaling factor is increased to %e.\n";
7099 }
71100
72101 void BFGS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStructure,
@@ -190,12 +219,8 @@ void BFGS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStruct
190219 bool aproxcheckCanOutputLogs = true;
191220 tempCanOutputLogs = molecule.CanOutputLogs();
192221 molecule.SetCanOutputLogs(aproxcheckCanOutputLogs);
193- this->OutputLog((boost::format("\n"
194- "actual energy change = %e\n"
195- "expected energy change = %e\n"
196- "actual/expected energy change = %f\n")
197- % (lineSearchCurrentEnergy-referenceEnergy)
198- % approximateChange % r));
222+ this->OutputLog(boost::format(this->formatEnergyChangeComparison)
223+ % (lineSearchCurrentEnergy-lineSearchInitialEnergy) % approximateChange % r);
199224 molecule.SetCanOutputLogs(tempCanOutputLogs);
200225
201226 // check convergence
@@ -216,8 +241,7 @@ void BFGS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStruct
216241 bool tempCanOutputLogs = molecule.CanOutputLogs();
217242 bool rollbackCanOutputLogs = true;
218243 molecule.SetCanOutputLogs(rollbackCanOutputLogs);
219- this->OutputLog("Detected hill climbing.\n"
220- "Rolling back molecular geometry.\n");
244+ this->OutputLog(this->messageHillClimbing);
221245 for(int i=0;i<molecule.GetNumberAtoms();i++){
222246 const Atom* atom = molecule.GetAtom(i);
223247 double* xyz = atom->GetXyz();
@@ -335,17 +359,17 @@ void BFGS::CalcRFOStep(double* vectorStep,
335359 }
336360 normStep = sqrt(normStep);
337361
338- this->OutputLog(boost::format("Lowest eigenvalue of the augmented Hessian = %f\n") % vectorEigenValues[0]);
339- this->OutputLog(boost::format("2nd lowest eigenvalue of the augmented Hessian = %f\n") % vectorEigenValues[1]);
340- this->OutputLog(boost::format("3rd lowest eigenvalue of the augmented Hessian = %f\n") % vectorEigenValues[2]);
341- this->OutputLog(boost::format("Calculated RFO step size = %f\n") % normStep);
362+ this->OutputLog(boost::format(this->formatLowestHessianEigenvalue) % vectorEigenValues[0]);
363+ this->OutputLog(boost::format(this->format2ndLowestHessianEigenvalue) % vectorEigenValues[1]);
364+ this->OutputLog(boost::format(this->format3rdLowestHessianEigenvalue) % vectorEigenValues[2]);
365+ this->OutputLog(boost::format(this->formatRFOStepSize) % normStep);
366+ this->OutputLog(boost::format(this->formatTrustRadiusIs) % trustRadius);
342367
343- this->OutputLog(boost::format("Trust radius is %f\n") % trustRadius);
344368 // Limit the step size to trustRadius
345369 if(normStep > trustRadius){
346370 alpha *= normStep / trustRadius * 1.1; // 1.1 is speed up factor
347- this->OutputLog(boost::format("Scaling factor is increased to %e.\n") % alpha);
348- this->OutputLog("Recalculating RFO step...\n");
371+ this->OutputLog(boost::format(this->formatTrustRadiusIs) % alpha);
372+ this->OutputLog(this->messageRecalculateRFOStep);
349373 }
350374 }while(normStep > trustRadius);
351375 }
@@ -506,7 +530,7 @@ void BFGS::ShiftHessianRedundantMode(double** matrixHessian,
506530 calcEigenVectors);
507531
508532 // Output eigenvalues of the raw Hessianto the log
509- this->OutputLog("Eigenvalues of the raw Hessian:");
533+ this->OutputLog(this->messageRawHessianEigenvalues);
510534 for(int i=0;i<dimension;i++){
511535 if((i%6) == 0){
512536 this->OutputLog(boost::format("\n%e")%vectorHessianEigenValues[i]);
@@ -557,7 +581,7 @@ void BFGS::ShiftHessianRedundantMode(double** matrixHessian,
557581 }
558582
559583 // Output eigenvalues of the raw Hessianto the log
560- this->OutputLog("Eigenvalues of the level shifted hessian:");
584+ this->OutputLog(this->messageShiftedHessianEigenvalues);
561585 for(int i=0;i<dimension;i++){
562586 if((i%6) == 0){
563587 this->OutputLog(boost::format("\n%e")%vectorHessianEigenValues[i]);
--- a/src/optimization/BFGS.h
+++ b/src/optimization/BFGS.h
@@ -29,7 +29,21 @@ protected:
2929 void SetMessages();
3030 private:
3131 std::string errorMessageNaNInRFOStep;
32+
3233 std::string messageStartBFGSStep;
34+ std::string messageHillClimbing;
35+ std::string messageRecalculateRFOStep;
36+ std::string messageRawHessianEigenvalues;
37+ std::string messageShiftedHessianEigenvalues;
38+
39+ std::string formatEnergyChangeComparison;
40+ std::string formatLowestHessianEigenvalue;
41+ std::string format2ndLowestHessianEigenvalue;
42+ std::string format3rdLowestHessianEigenvalue;
43+ std::string formatRFOStepSize;
44+ std::string formatTrustRadiusIs;
45+ std::string formatIncreaseScalingFactor;
46+
3347 virtual void SearchMinimum(boost::shared_ptr<MolDS_base::ElectronicStructure> electronicStructure,
3448 MolDS_base::Molecule& molecule,
3549 double* lineSearchedEnergy,