--- trunk/OOPSE/libmdtools/OOPSEMinimizer.cpp 2004/04/12 20:32:20 1097 +++ trunk/OOPSE/libmdtools/OOPSEMinimizer.cpp 2004/06/04 03:15:31 1234 @@ -1,13 +1,15 @@ #include #include "OOPSEMinimizer.hpp" +#include "ShakeMin.hpp" OOPSEMinimizer::OOPSEMinimizer( SimInfo *theInfo, ForceFields* the_ff , MinimizerParameterSet * param) :RealIntegrator(theInfo, the_ff), bVerbose(false), bShake(true){ + dumpOut = NULL; + statOut = NULL; tStats = new Thermo(info); - dumpOut = new DumpWriter(info); - statOut = new StatWriter(info); + paramSet = param; @@ -16,13 +18,15 @@ OOPSEMinimizer::OOPSEMinimizer( SimInfo *theInfo, Forc curX = getCoor(); curG.resize(ndim); - preMove(); + //preMove(); } OOPSEMinimizer::~OOPSEMinimizer(){ delete tStats; - delete dumpOut; - delete statOut; + if(dumpOut) + delete dumpOut; + if(statOut) + delete statOut; delete paramSet; } @@ -37,15 +41,19 @@ void OOPSEMinimizer::calcEnergyGradient(vector setCoor(x); - if (nConstrained && bShake){ - shakeStatus = shakeR(); - } + //if (nConstrained && bShake){ + // shakeStatus = shakeR(); + //} + + shakeAlgo->doShakeR(); calcForce(1, 1); - if (nConstrained && bShake){ - shakeStatus |= shakeF(); - } + //if (nConstrained && bShake){ + // shakeStatus |= shakeF(); + //} + + shakeAlgo->doShakeF(); x = getCoor(); @@ -159,6 +167,7 @@ vector OOPSEMinimizer::getCoor(){ } +/* int OOPSEMinimizer::shakeR(){ int i, j; int done; @@ -398,7 +407,9 @@ int OOPSEMinimizer::shakeF(){ return 1; } - //calculate the value of object function +*/ + +//calculate the value of object function void OOPSEMinimizer::calcF(){ calcEnergyGradient(curX, curG, curF, egEvalStatus); } @@ -483,7 +494,7 @@ void OOPSEMinimizer::printMinimizerInfo(){ /** * In thoery, we need to find the minimum along the search direction - * However, function evaluation is too expensive. I + * However, function evaluation is too expensive. * At the very begining of the problem, we check the search direction and make sure * it is a descent direction * we will compare the energy of two end points, @@ -692,6 +703,9 @@ void OOPSEMinimizer::minimize(){ if (bVerbose) printMinimizerInfo(); + + dumpOut = new DumpWriter(info); + statOut = new StatWriter(info); init();