• 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

Revisionbfd0f98715a0777243b2fb7568a89755025eccb5 (tree)
Time2012-11-26 20:41:54
AuthorKatsuhiko Nishimra <ktns.87@gmai...>
CommiterKatsuhiko Nishimra

Log Message

Read initial trust radius and maximum step size from input file. #28764

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

Change Summary

Incremental Difference

--- a/src/base/InputParser.cpp
+++ b/src/base/InputParser.cpp
@@ -178,6 +178,8 @@ void InputParser::SetMessages(){
178178 this->messageOptimizationMaxGradient = "\t\tMax gradient: ";
179179 this->messageOptimizationRmsGradient = "\t\tRms gradient: ";
180180 this->messageOptimizationTimeWidth = "\t\tFictious time width: ";
181+ this->messageOptimizationInitialTrustRadius = "\t\tInitial trust radius: ";
182+ this->messageOptimizationMaxNormStep = "\t\tMax size of the optimization step: ";
181183
182184 // Frequencies (Normal modes)
183185 this->messageFrequenciesConditions = "\tFrequencies (Normal modes) analysis conditions:\n";
@@ -360,6 +362,8 @@ void InputParser::SetMessages(){
360362 this->stringOptimizationMaxGradient = "max_gradient";
361363 this->stringOptimizationRmsGradient = "rms_gradient";
362364 this->stringOptimizationTimeWidth = "dt";
365+ this->stringOptimizationInitialTrustRadius = "initialtrustradius";
366+ this->stringOptimizationMaxNormStep = "maxnormstep";
363367
364368 // Frequencies (Normal modes)
365369 this->stringFrequencies = "frequencies";
@@ -1017,6 +1021,18 @@ int InputParser::ParseConditionsOptimization(vector<string>* inputTerms, int par
10171021 Parameters::GetInstance()->SetRmsGradientOptimization(rmsGradient);
10181022 parseIndex++;
10191023 }
1024+ // Initial trust radius.
1025+ if((*inputTerms)[parseIndex].compare(this->stringOptimizationInitialTrustRadius) == 0){
1026+ double initialTrustRadius = atof((*inputTerms)[parseIndex+1].c_str());
1027+ Parameters::GetInstance()->SetInitialTrustRadiusOptimization(initialTrustRadius);
1028+ parseIndex++;
1029+ }
1030+ // Max size of optimization step.
1031+ if((*inputTerms)[parseIndex].compare(this->stringOptimizationMaxNormStep) == 0){
1032+ double maxNormStep = atof((*inputTerms)[parseIndex+1].c_str());
1033+ Parameters::GetInstance()->SetMaxNormStepOptimization(maxNormStep);
1034+ parseIndex++;
1035+ }
10201036 parseIndex++;
10211037 }
10221038 return parseIndex;
@@ -1667,6 +1683,11 @@ void InputParser::OutputOptimizationConditions() const{
16671683 % (Parameters::GetInstance()->GetTimeWidthOptimization()/Parameters::GetInstance()->GetFs2AU())
16681684 % this->messageFs.c_str());
16691685 break;
1686+ case BFGSMethod:
1687+ this->OutputLog(boost::format("%s%lf\n") % this->messageOptimizationInitialTrustRadius.c_str()
1688+ % Parameters::GetInstance()->GetInitialTrustRadiusOptimization());
1689+ this->OutputLog(boost::format("%s%lf\n") % this->messageOptimizationMaxNormStep.c_str()
1690+ % Parameters::GetInstance()->GetMaxNormStepOptimization());
16701691 default:
16711692 break;
16721693 }
--- a/src/base/InputParser.h
+++ b/src/base/InputParser.h
@@ -118,6 +118,8 @@ private:
118118 std::string messageOptimizationTimeWidth;
119119 std::string messageOptimizationRmsGradient;
120120 std::string messageOptimizationMaxGradient;
121+ std::string messageOptimizationInitialTrustRadius;
122+ std::string messageOptimizationMaxNormStep;
121123 // Frequencies (Normal modes)
122124 std::string messageFrequenciesConditions;
123125 std::string messageFrequenciesElecState;
@@ -279,6 +281,8 @@ private:
279281 std::string stringOptimizationMaxGradient;
280282 std::string stringOptimizationRmsGradient;
281283 std::string stringOptimizationTimeWidth;
284+ std::string stringOptimizationInitialTrustRadius;
285+ std::string stringOptimizationMaxNormStep;
282286 // Frequencies (Normal modes)
283287 std::string stringFrequencies;
284288 std::string stringFrequenciesEnd;
--- a/src/base/Parameters.cpp
+++ b/src/base/Parameters.cpp
@@ -197,6 +197,8 @@ void Parameters::SetDefaultValues(){
197197 this->maxGradientOptimization = 0.00045;
198198 this->rmsGradientOptimization = 0.00030;
199199 this->timeWidthOptimization = 50.0*this->fs2AU;
200+ this->initialTrustRadiusOptimization = 0.3;
201+ this->maxNormStepOptimization = 0.3;
200202 // Frequencies
201203 this->requiresFrequencies = false;
202204 this->electronicStateIndexFrequencies = 0;
@@ -887,6 +889,22 @@ void Parameters::SetRmsGradientOptimization(double rmsGradient){
887889 this->rmsGradientOptimization = rmsGradient;
888890 }
889891
892+double Parameters::GetInitialTrustRadiusOptimization() const{
893+ return this->initialTrustRadiusOptimization;
894+}
895+
896+void Parameters::SetInitialTrustRadiusOptimization(double initialTrustRadius){
897+ this->initialTrustRadiusOptimization = initialTrustRadius;
898+}
899+
900+double Parameters::GetMaxNormStepOptimization() const{
901+ return this->maxNormStepOptimization;
902+}
903+
904+void Parameters::SetMaxNormStepOptimization(double maxNormStep){
905+ this->maxNormStepOptimization = maxNormStep;
906+}
907+
890908 double Parameters::GetTimeWidthOptimization() const{
891909 return this->timeWidthOptimization;
892910 }
--- a/src/base/Parameters.h
+++ b/src/base/Parameters.h
@@ -197,6 +197,10 @@ public:
197197 void SetRmsGradientOptimization(double rmsGradient);
198198 double GetTimeWidthOptimization() const;
199199 void SetTimeWidthOptimization(double timeWidth);
200+ double GetInitialTrustRadiusOptimization() const;
201+ void SetInitialTrustRadiusOptimization(double initialTrustRadius);
202+ double GetMaxNormStepOptimization() const;
203+ void SetMaxNormStepOptimization(double maxNormStep);
200204 // Frequencies
201205 bool RequiresFrequencies() const;
202206 void SetRequiresFrequencies(bool requiresFrequencies);
@@ -308,6 +312,8 @@ private:
308312 double maxGradientOptimization;
309313 double rmsGradientOptimization;
310314 double timeWidthOptimization;
315+ double initialTrustRadiusOptimization;
316+ double maxNormStepOptimization;
311317 // Frequencies
312318 bool requiresFrequencies;
313319 int electronicStateIndexFrequencies;
--- a/src/optimization/BFGS.cpp
+++ b/src/optimization/BFGS.cpp
@@ -88,8 +88,8 @@ void BFGS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStruct
8888 double** matrixOldCoordinates = NULL;
8989 double* vectorOldCoordinates = NULL;
9090 double** matrixDisplacement = NULL;
91- double trustRadius = 0.3;
92- const double maxNormStep = 0.3;
91+ double trustRadius = Parameters::GetInstance()->GetInitialTrustRadiusOptimization();
92+ const double maxNormStep = Parameters::GetInstance()->GetMaxNormStepOptimization();
9393
9494 try{
9595 // initialize Hessian with unit matrix