1 |
|
#include <cmath> |
2 |
|
|
3 |
< |
#include "minimizers/OOPSEMinimizer.hpp" |
3 |
> |
#include "minimizers/CGFamilyMinimizer.hpp" |
4 |
> |
#include "primitives/Molecule.hpp" |
5 |
|
#include "utils/Utility.hpp" |
6 |
|
|
7 |
< |
CGFamilyMinmizer::CGFamilyMinmizer(SimInfo *theInfo |
7 |
< |
MinimizerParameterSet * param) |
8 |
< |
:OOPSEMinimizer(theInfo, param){ |
9 |
< |
prevG.resize(ndim); |
10 |
< |
prevX.resize(ndim); |
11 |
< |
direction.resize(ndim); |
7 |
> |
namespace oopse { |
8 |
|
|
9 |
< |
stepSize = paramSet->getStepSize(); |
9 |
> |
CGFamilyMinimizer::CGFamilyMinimizer(SimInfo *info) : OOPSEMinimizer(info){ |
10 |
> |
prevG.resize(ndim); |
11 |
> |
prevX.resize(ndim); |
12 |
> |
direction.resize(ndim); |
13 |
|
|
14 |
+ |
stepSize = paramSet->getStepSize(); |
15 |
|
} |
16 |
< |
int CGFamilyMinmizer::checkConvg(){ |
16 |
> |
|
17 |
> |
int CGFamilyMinimizer::checkConvg(){ |
18 |
|
double fTol; |
19 |
|
double relativeFTol; // relative tolerance |
20 |
|
double deltaF; |
31 |
|
if (fabs(deltaF) <= relativeFTol) { |
32 |
|
|
33 |
|
if (bVerbose){ |
34 |
< |
cout << "function value tolerance test passed" << std::endl; |
35 |
< |
cout << "ftol = " << fTol |
34 |
> |
std::cout << "function value tolerance test passed" << std::endl; |
35 |
> |
std::cout << "ftol = " << fTol |
36 |
|
<< "\tdeltaf = " << deltaF<< std::endl; |
37 |
|
} |
38 |
|
return CONVG_FTOL; |
54 |
|
#endif |
55 |
|
|
56 |
|
if (gnorm <= relativeGTol) { |
57 |
< |
cout << "gradient tolerance test" << std::endl; |
58 |
< |
cout << "gnorm = " << gnorm |
57 |
> |
std::cout << "gradient tolerance test" << std::endl; |
58 |
> |
std::cout << "gnorm = " << gnorm |
59 |
|
<< "\trelativeGTol = " << relativeGTol<< std::endl; |
60 |
|
return CONVG_GTOL; |
61 |
|
} |
63 |
|
//absolute gradient tolerance test |
64 |
|
|
65 |
|
if (gnorm <= gTol) { |
66 |
< |
cout << "absolute gradient tolerance test" << std::endl; |
67 |
< |
cout << "gnorm = " << gnorm |
66 |
> |
std::cout << "absolute gradient tolerance test" << std::endl; |
67 |
> |
std::cout << "gnorm = " << gnorm |
68 |
|
<< "\tgTol = " << gTol<< std::endl; |
69 |
|
return CONVG_ABSGTOL; |
70 |
|
} |
73 |
|
return CONVG_UNCONVG; |
74 |
|
} |
75 |
|
|
76 |
+ |
} |