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 1144 by tim, Sat May 1 18:52:38 2004 UTC vs.
Revision 1250 by gezelter, Fri Jun 4 21:00:20 2004 UTC

# Line 1 | Line 1
1   #include <math.h>
2   #include "OOPSEMinimizer.hpp"
3 + #include "ShakeMin.hpp"
4  
5   OOPSEMinimizer::OOPSEMinimizer( SimInfo *theInfo, ForceFields* the_ff ,
6                                                MinimizerParameterSet * param)
# Line 17 | Line 18 | OOPSEMinimizer::OOPSEMinimizer( SimInfo *theInfo, Forc
18    curX = getCoor();
19    curG.resize(ndim);
20  
21 <  preMove();
21 >  shakeAlgo = new ShakeMinFramework(theInfo);
22 >  shakeAlgo->doPreConstraint();
23   }
24  
25   OOPSEMinimizer::~OOPSEMinimizer(){
# Line 37 | Line 39 | void OOPSEMinimizer::calcEnergyGradient(vector<double>
39    double force[3];
40    double dAtomGrad[6];
41    int shakeStatus;
42 +
43 +  status = 1;
44    
45    setCoor(x);
46  
47 <  if (nConstrained && bShake){
48 <    shakeStatus = shakeR();
47 >  if (bShake){
48 >    shakeStatus = shakeAlgo->doShakeR();
49 >    if(shakeStatus < 0)
50 >      status = -1;
51    }
52 <      
52 >
53    calcForce(1, 1);
54 <  
55 <  if (nConstrained && bShake){
56 <    shakeStatus |= shakeF();
54 >
55 >  if (bShake){
56 >    shakeStatus = shakeAlgo->doShakeF();
57 >    if(shakeStatus < 0)
58 >      status = -1;
59    }
60 <  
60 >
61    x = getCoor();
62    
63  
# Line 83 | Line 91 | void OOPSEMinimizer::calcEnergyGradient(vector<double>
91  
92    energy = tStats->getPotential();
93  
86  status = shakeStatus;
94   }
95  
96   /**
# Line 162 | Line 169 | int OOPSEMinimizer::shakeR(){
169  
170   }
171  
172 + /*
173   int OOPSEMinimizer::shakeR(){
174    int i, j;
175    int done;
# Line 401 | Line 409 | int OOPSEMinimizer::shakeF(){
409      return 1;
410   }
411  
412 <    //calculate the value of object function
412 > */
413 >
414 > //calculate the value of object function
415   void OOPSEMinimizer::calcF(){
416    calcEnergyGradient(curX, curG, curF, egEvalStatus);
417   }
# Line 539 | Line 549 | int OOPSEMinimizer::doLineSearch(vector<double>& direc
549    lsTol = paramSet->getLineSearchTol();
550          
551    //calculate the derivative at a = 0
552 +  slopeA = 0;
553    for (size_t i = 0; i < ndim; i++)
554      slopeA += curG[i]*direction[i];
555  
# Line 713 | Line 724 | void OOPSEMinimizer::minimize(){
724  
725      stepStatus = step();
726  
727 +    if (bShake)
728 +      shakeAlgo->doPreConstraint();
729 +    
730      if (stepStatus < 0){
731        saveResult();
732        minStatus = MIN_LSERROR;
# Line 725 | Line 739 | void OOPSEMinimizer::minimize(){
739        writeOut(curX, curIter);
740      }
741  
728    //if (curIter == nextResetIter){
729    //  reset();
730    //  nextResetIter += resetFrq;      
731    //}
732
742      convgStatus = checkConvg();
743  
744      if (convgStatus > 0){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines