1 |
|
#include <math.h> |
2 |
|
#include "OOPSEMinimizer.hpp" |
3 |
+ |
#include "ShakeMin.hpp" |
4 |
|
|
5 |
|
OOPSEMinimizer::OOPSEMinimizer( SimInfo *theInfo, ForceFields* the_ff , |
6 |
|
MinimizerParameterSet * param) |
7 |
|
:RealIntegrator(theInfo, the_ff), bVerbose(false), bShake(true){ |
8 |
+ |
dumpOut = NULL; |
9 |
+ |
statOut = NULL; |
10 |
|
|
11 |
|
tStats = new Thermo(info); |
12 |
< |
dumpOut = new DumpWriter(info); |
10 |
< |
statOut = new StatWriter(info); |
12 |
> |
|
13 |
|
|
14 |
|
paramSet = param; |
15 |
|
|
18 |
|
curX = getCoor(); |
19 |
|
curG.resize(ndim); |
20 |
|
|
21 |
< |
preMove(); |
21 |
> |
//preMove(); |
22 |
|
} |
23 |
|
|
24 |
|
OOPSEMinimizer::~OOPSEMinimizer(){ |
25 |
|
delete tStats; |
26 |
< |
delete dumpOut; |
27 |
< |
delete statOut; |
26 |
> |
if(dumpOut) |
27 |
> |
delete dumpOut; |
28 |
> |
if(statOut) |
29 |
> |
delete statOut; |
30 |
|
delete paramSet; |
31 |
|
} |
32 |
|
|
41 |
|
|
42 |
|
setCoor(x); |
43 |
|
|
44 |
< |
if (nConstrained && bShake){ |
45 |
< |
shakeStatus = shakeR(); |
46 |
< |
} |
44 |
> |
//if (nConstrained && bShake){ |
45 |
> |
// shakeStatus = shakeR(); |
46 |
> |
//} |
47 |
> |
|
48 |
> |
shakeAlgo->doShakeR(); |
49 |
|
|
50 |
|
calcForce(1, 1); |
51 |
|
|
52 |
< |
if (nConstrained && bShake){ |
53 |
< |
shakeStatus |= shakeF(); |
54 |
< |
} |
52 |
> |
//if (nConstrained && bShake){ |
53 |
> |
// shakeStatus |= shakeF(); |
54 |
> |
//} |
55 |
> |
|
56 |
> |
shakeAlgo->doShakeF(); |
57 |
|
|
58 |
|
x = getCoor(); |
59 |
|
|
167 |
|
|
168 |
|
} |
169 |
|
|
170 |
+ |
/* |
171 |
|
int OOPSEMinimizer::shakeR(){ |
172 |
|
int i, j; |
173 |
|
int done; |
407 |
|
return 1; |
408 |
|
} |
409 |
|
|
410 |
< |
//calculate the value of object function |
410 |
> |
*/ |
411 |
> |
|
412 |
> |
//calculate the value of object function |
413 |
|
void OOPSEMinimizer::calcF(){ |
414 |
|
calcEnergyGradient(curX, curG, curF, egEvalStatus); |
415 |
|
} |
494 |
|
|
495 |
|
/** |
496 |
|
* In thoery, we need to find the minimum along the search direction |
497 |
< |
* However, function evaluation is too expensive. I |
497 |
> |
* However, function evaluation is too expensive. |
498 |
|
* At the very begining of the problem, we check the search direction and make sure |
499 |
|
* it is a descent direction |
500 |
|
* we will compare the energy of two end points, |
703 |
|
|
704 |
|
if (bVerbose) |
705 |
|
printMinimizerInfo(); |
706 |
+ |
|
707 |
+ |
dumpOut = new DumpWriter(info); |
708 |
+ |
statOut = new StatWriter(info); |
709 |
|
|
710 |
|
init(); |
711 |
|
|