• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Révision704481b6b72da1f7244469e4b191fb509359ea54 (tree)
l'heure2012-07-02 15:47:44
AuteurKatsuhiko Nishimra <ktns.87@gmai...>
CommiterKatsuhiko Nishimra

Message de Log

Implemented input parsing routine for BFGS method. #28764

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

Change Summary

Modification

--- a/src/base/Enums.h
+++ b/src/base/Enums.h
@@ -53,6 +53,7 @@ RENUMSTR_END()
5353 RENUMSTR_BEGIN( OptimizationMethodType, OptimizationMethodTypeStr )
5454 RENUMSTR( ConjugateGradientMethod, "Conjugate gradient" )
5555 RENUMSTR( SteepestDescentMethod, "Steepest descent" )
56+ RENUMSTR( BFGSMethod, "BFGS" )
5657 RENUMSTR( OptimizationMethodType_end, "OptimizationMethodType_end" )
5758 RENUMSTR_END()
5859
--- a/src/base/InputParser.cpp
+++ b/src/base/InputParser.cpp
@@ -312,6 +312,7 @@ void InputParser::SetMessages(){
312312 this->stringOptimization = "optimization";
313313 this->stringOptimizationEnd = "optimization_end";
314314 this->stringOptimizationMethod = "method";
315+ this->stringOptimizationBFGS = "bfgs";
315316 this->stringOptimizationConjugateGradient = "conjugate_gradient";
316317 this->stringOptimizationSteepestDescent = "steepest_descent";
317318 this->stringOptimizationTotalSteps = "total_steps";
@@ -865,6 +866,9 @@ int InputParser::ParseConditionsOptimization(vector<string>* inputTerms, int par
865866 else if((*inputTerms)[parseIndex+1].compare(this->stringOptimizationSteepestDescent) == 0){
866867 Parameters::GetInstance()->SetMethodOptimization(SteepestDescentMethod);
867868 }
869+ else if((*inputTerms)[parseIndex+1].compare(this->stringOptimizationBFGS) == 0){
870+ Parameters::GetInstance()->SetMethodOptimization(BFGSMethod);
871+ }
868872 else{
869873 }
870874 parseIndex++;
@@ -1430,9 +1434,17 @@ void InputParser::OutputOptimizationConditions() const{
14301434 % Parameters::GetInstance()->GetMaxGradientOptimization()).str());
14311435 this->OutputLog((boost::format("%s%lf\n") % this->messageOptimizationRmsGradient.c_str()
14321436 % Parameters::GetInstance()->GetRmsGradientOptimization()).str());
1433- this->OutputLog((boost::format("%s%lf%s\n") % this->messageOptimizationTimeWidth.c_str()
1434- % (Parameters::GetInstance()->GetTimeWidthOptimization()/Parameters::GetInstance()->GetFs2AU())
1435- % this->messageFs.c_str()).str());
1437+
1438+ switch(Parameters::GetInstance()->GetMethodOptimization()){
1439+ case ConjugateGradientMethod:
1440+ case SteepestDescentMethod:
1441+ this->OutputLog((boost::format("%s%lf%s\n") % this->messageOptimizationTimeWidth.c_str()
1442+ % (Parameters::GetInstance()->GetTimeWidthOptimization()/Parameters::GetInstance()->GetFs2AU())
1443+ % this->messageFs.c_str()).str());
1444+ break;
1445+ default:
1446+ break;
1447+ }
14361448
14371449 this->OutputLog("\n");
14381450 }
--- a/src/base/InputParser.h
+++ b/src/base/InputParser.h
@@ -241,6 +241,7 @@ private:
241241 std::string stringOptimization;
242242 std::string stringOptimizationEnd;
243243 std::string stringOptimizationMethod;
244+ std::string stringOptimizationBFGS;
244245 std::string stringOptimizationConjugateGradient;
245246 std::string stringOptimizationSteepestDescent;
246247 std::string stringOptimizationTotalSteps;
--- a/src/base/factories/OptimizerFactory.cpp
+++ b/src/base/factories/OptimizerFactory.cpp
@@ -35,6 +35,7 @@
3535 #include"../ElectronicStructure.h"
3636 #include"../../optimization/Optimizer.h"
3737 #include"../../optimization/ConjugateGradient.h"
38+#include"../../optimization/BFGS.h"
3839 #include"../../optimization/SteepestDescent.h"
3940 #include"OptimizerFactory.h"
4041 using namespace std;
@@ -49,6 +50,9 @@ MolDS_optimization::Optimizer* OptimizerFactory::Create(OptimizationMethodType m
4950 if(methodType == ConjugateGradientMethod ){
5051 optimizer = new MolDS_optimization::ConjugateGradient();
5152 }
53+ else if(methodType == BFGSMethod ){
54+ optimizer = new MolDS_optimization::BFGS();
55+ }
5256 else if(methodType == SteepestDescentMethod ){
5357 optimizer = new MolDS_optimization::SteepestDescent();
5458 }