| 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 | 
  | 
 | 
| 19 | 
  | 
  curX = getCoor(); | 
| 20 | 
  | 
  curG.resize(ndim); | 
| 21 | 
  | 
 | 
| 22 | 
< | 
  //preMove(); | 
| 22 | 
> | 
  shakeAlgo = new ShakeMinFramework(theInfo); | 
| 23 | 
> | 
  shakeAlgo->doPreConstraint(); | 
| 24 | 
  | 
} | 
| 25 | 
  | 
 | 
| 26 | 
  | 
OOPSEMinimizer::~OOPSEMinimizer(){ | 
| 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 | 
  | 
 | 
| 92 | 
  | 
  | 
| 93 | 
  | 
  energy = tStats->getPotential(); | 
| 94 | 
  | 
 | 
| 91 | 
– | 
  status = shakeStatus; | 
| 95 | 
  | 
} | 
| 96 | 
  | 
 | 
| 97 | 
  | 
/** | 
| 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 | 
  | 
 | 
| 725 | 
  | 
 | 
| 726 | 
  | 
    stepStatus = step(); | 
| 727 | 
  | 
 | 
| 728 | 
+ | 
    if (bShake) | 
| 729 | 
+ | 
      shakeAlgo->doPreConstraint(); | 
| 730 | 
+ | 
     | 
| 731 | 
  | 
    if (stepStatus < 0){ | 
| 732 | 
  | 
      saveResult(); | 
| 733 | 
  | 
      minStatus = MIN_LSERROR; | 
| 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){ |