Skip to content

Commit 17ab8a1

Browse files
author
Christian Schafmeisterr
committed
Setup minimizer better
1 parent 1da601a commit 17ab8a1

2 files changed

Lines changed: 13 additions & 39 deletions

File tree

include/cando/chem/minimizer.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ struct RestartMinimizer {};
300300

301301
CL_LISPIFY_NAME("getEnergyFunction");
302302
CL_DEFMETHOD ScoringFunction_sp getEnergyFunction() {_OF(); ASSERTNOTNULL(this->_ScoringFunction); return this->_ScoringFunction; };
303-
void useDefaultSettings();
304303

305304
void changeOptions(core::List_sp options);
306305

@@ -356,8 +355,20 @@ takes a single argument, the NVECTOR position of the atoms.)dx");
356355
adapt::QDomNode_sp asXml();
357356

358357
Minimizer_O() :
358+
_InitialLineSearchStep(0.01),
359+
_SteepestDescentTolerance(100.0),
360+
_ConjugateGradientTolerance(0.5),
361+
_TruncatedNewtonTolerance(0.0001),
362+
_NumberOfSteepestDescentSteps(5000),
363+
_NumberOfConjugateGradientSteps(5000),
364+
_NumberOfTruncatedNewtonSteps(5000),
359365
_PrintIntermediateResults(1),
360-
_StepCallback(nil<core::T_O>())
366+
_StepCallback(nil<core::T_O>()),
367+
_ReportEveryNSteps(100),
368+
_Status(minimizerIdle),
369+
_ShowElapsedTime(true),
370+
_MinGradientMean(0.000001),
371+
_TruncatedNewtonPreconditioner(hessianPreconditioner)
361372
{};
362373
};
363374

src/chem/minimizer.cc

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,6 @@ namespace chem
139139

140140

141141
#define NOTFOUND -1
142-
#define MAXSTEEPESTDESCENTSTEPS 200 /* Should be 200 */
143-
#define MAXCONJUGATEGRADIENTSTEPS 10000 /* Should be 200 */
144-
#define MAXTRUNCATEDNEWTONSTEPS 500 /* Should be 200 */
145-
#define MAXLINESEARCHSTEPS 10
146-
#define STARTSTEPSIZE 0.0001
147-
#define MIN_GRADIENT_MEAN 0.000001
148-
149-
150142

151143

152144

@@ -2044,42 +2036,13 @@ void Minimizer_O::initialize()
20442036
this->bFCallback = NULL;
20452037
#endif
20462038
this->_DebugOn = false;
2047-
this->useDefaultSettings();
20482039
this->restart();
20492040
this->_Position = nil<core::T_O>();
20502041
this->_Force = nil<core::T_O>();
20512042
// this->_StepCallback = _Nil<core::LispCallback_O>();
20522043
}
20532044

20542045

2055-
2056-
CL_LISPIFY_NAME("useDefaultSettings");
2057-
CL_DEFMETHOD void Minimizer_O::useDefaultSettings()
2058-
{
2059-
this->_InitialLineSearchStep = 0.01;
2060-
this->_NumberOfSteepestDescentSteps = MAXSTEEPESTDESCENTSTEPS;
2061-
this->_SteepestDescentTolerance = 2000.0;
2062-
this->_NumberOfConjugateGradientSteps = MAXCONJUGATEGRADIENTSTEPS;
2063-
this->_ConjugateGradientTolerance = 10.0; // Use this for now, later add TN minimizer and switch to that when this is <10.0
2064-
this->_NumberOfTruncatedNewtonSteps = MAXTRUNCATEDNEWTONSTEPS;
2065-
this->_TruncatedNewtonTolerance = 0.00000001;
2066-
this->_TruncatedNewtonPreconditioner = hessianPreconditioner;
2067-
this->_PrintIntermediateResults = 0;
2068-
LOG("_PrintIntermediateResults = {}" , this->_PrintIntermediateResults );
2069-
this->_ReportEveryNSteps = 100;
2070-
this->_Status = minimizerIdle;
2071-
this->_ShowElapsedTime = true;
2072-
#ifdef USE_CALLBACKS
2073-
#ifdef USEBOOSTPYTHON
2074-
this->iPythonCallbackEverySteps = 1;
2075-
this->POPythonCallback = NULL;
2076-
#endif
2077-
#endif
2078-
this->_MinGradientMean = MIN_GRADIENT_MEAN;
2079-
}
2080-
2081-
2082-
20832046
CL_LISPIFY_NAME(minimizer-set-debug-on);
20842047
CL_DEFMETHOD void Minimizer_O::setDebugOn(bool debugOn) {
20852048
this->_DebugOn = debugOn;

0 commit comments

Comments
 (0)