ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/OOPSEMinimizer.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/OOPSEMinimizer.cpp (file contents):
Revision 1234 by tim, Fri Jun 4 03:15:31 2004 UTC vs.
Revision 1330 by gezelter, Fri Jul 16 16:29:44 2004 UTC

# Line 1 | Line 1
1   #include <math.h>
2   #include "OOPSEMinimizer.hpp"
3   #include "ShakeMin.hpp"
4 + #include "Integrator.cpp"
5  
6   OOPSEMinimizer::OOPSEMinimizer( SimInfo *theInfo, ForceFields* the_ff ,
7 <                                              MinimizerParameterSet * param)
8 <                     :RealIntegrator(theInfo, the_ff), bVerbose(false), bShake(true){
7 >                                              MinimizerParameterSet * param) :
8 >              RealIntegrator(theInfo, the_ff), bShake(true), bVerbose(false) {
9    dumpOut = NULL;
10    statOut = NULL;
11  
# Line 18 | Line 19 | OOPSEMinimizer::OOPSEMinimizer( SimInfo *theInfo, Forc
19    curX = getCoor();
20    curG.resize(ndim);
21  
22 <  //preMove();
22 >  shakeAlgo = new ShakeMinFramework(theInfo);
23 >  shakeAlgo->doPreConstraint();
24   }
25  
26   OOPSEMinimizer::~OOPSEMinimizer(){
# Line 38 | Line 40 | void OOPSEMinimizer::calcEnergyGradient(vector<double>
40    double force[3];
41    double dAtomGrad[6];
42    int shakeStatus;
43 +
44 +  status = 1;
45    
46    setCoor(x);
47  
48 <  //if (nConstrained && bShake){
49 <  //  shakeStatus = shakeR();
50 <  //}
48 >  if (bShake){
49 >    shakeStatus = shakeAlgo->doShakeR();
50 >    if(shakeStatus < 0)
51 >      status = -1;
52 >  }
53  
48  shakeAlgo->doShakeR();
49      
54    calcForce(1, 1);
55 <  
56 <  //if (nConstrained && bShake){
57 <  //  shakeStatus |= shakeF();
58 <  //}
55 >
56 >  if (bShake){
57 >    shakeStatus = shakeAlgo->doShakeF();
58 >    if(shakeStatus < 0)
59 >      status = -1;
60 >  }
61  
56  shakeAlgo->doShakeF();
57  
62    x = getCoor();
63    
64  
# Line 88 | Line 92 | void OOPSEMinimizer::calcEnergyGradient(vector<double>
92  
93    energy = tStats->getPotential();
94  
91  status = shakeStatus;
95   }
96  
97   /**
# Line 547 | Line 550 | int OOPSEMinimizer::doLineSearch(vector<double>& direc
550    lsTol = paramSet->getLineSearchTol();
551          
552    //calculate the derivative at a = 0
553 +  slopeA = 0;
554    for (size_t i = 0; i < ndim; i++)
555      slopeA += curG[i]*direction[i];
556  
# Line 721 | Line 725 | void OOPSEMinimizer::minimize(){
725  
726      stepStatus = step();
727  
728 +    if (bShake)
729 +      shakeAlgo->doPreConstraint();
730 +    
731      if (stepStatus < 0){
732        saveResult();
733        minStatus = MIN_LSERROR;
# Line 733 | Line 740 | void OOPSEMinimizer::minimize(){
740        writeOut(curX, curIter);
741      }
742  
736    //if (curIter == nextResetIter){
737    //  reset();
738    //  nextResetIter += resetFrq;      
739    //}
740
743      convgStatus = checkConvg();
744  
745      if (convgStatus > 0){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines