ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/integrators/Integrator.cpp
(Generate patch)

Comparing trunk/src/integrators/Integrator.cpp (file contents):
Revision 246 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
Revision 1330 by skuang, Thu Mar 19 21:03:36 2009 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4   * The University of Notre Dame grants you ("Licensee") a
# Line 43 | Line 43 | namespace oopse {
43   #include "integrators/Integrator.hpp"
44   #include "utils/simError.h"
45   namespace oopse {
46 < Integrator::Integrator(SimInfo* info)
47 <    : info_(info), forceMan_(NULL) , needPotential(false), needStress(false), velocitizer_(NULL),
48 <      needVelocityScaling(false), dumpWriter(NULL), statWriter(NULL), thermo(info),
46 >  Integrator::Integrator(SimInfo* info)
47 >    : info_(info), forceMan_(NULL) , needPotential(false), needStress(false),
48 >      needReset(false), velocitizer_(NULL), needVelocityScaling(false),
49 >      rnemd_(NULL), useRNEMD(false),
50 >      dumpWriter(NULL), statWriter(NULL), thermo(info),
51        currentSnapshot_(info->getSnapshotManager()->getCurrentSnapshot()) {
52  
53 <    Globals* simParams = info->getSimParams();
53 >      simParams = info->getSimParams();
54  
55 <    if (simParams->haveDt()) {
55 >      if (simParams->haveDt()) {
56          dt = simParams->getDt();
57 <    } else {
58 <            sprintf(painCave.errMsg,
59 <                    "Integrator Error: dt is not set\n");
60 <            painCave.isFatal = 1;
61 <            simError();
62 <    }
57 >      } else {
58 >        sprintf(painCave.errMsg,
59 >                "Integrator Error: dt is not set\n");
60 >        painCave.isFatal = 1;
61 >        simError();
62 >      }
63      
64 <    if (simParams->haveRunTime()) {
64 >      if (simParams->haveRunTime()) {
65          runTime = simParams->getRunTime();
66 <    } else {
67 <
68 <    }
69 <    // set the status, sample, and thermal kick times
70 <    if (simParams->haveSampleTime()){
66 >      } else {
67 >        sprintf(painCave.errMsg,
68 >                "Integrator Error: runTime is not set\n");
69 >        painCave.isFatal = 1;
70 >        simError();
71 >      }
72 >      // set the status, sample, and thermal kick times
73 >      if (simParams->haveSampleTime()){
74          sampleTime = simParams->getSampleTime();
75          statusTime = sampleTime;
76 <    } else{
76 >      } else{
77          sampleTime = simParams->getRunTime();
78          statusTime = sampleTime;
79 <    }
79 >      }
80  
81 <    if (simParams->haveStatusTime()){
81 >      if (simParams->haveStatusTime()){
82          statusTime = simParams->getStatusTime();
83 <    }
83 >      }
84  
85 <    if (simParams->haveThermalTime()){
85 >      if (simParams->haveThermalTime()){
86          thermalTime = simParams->getThermalTime();
87 <    } else {
87 >      } else {
88          thermalTime = simParams->getRunTime();
89 <    }
89 >      }
90  
91 <    if (!simParams->getUseInitTime()) {
91 >      if (!simParams->getUseInitalTime()) {
92          currentSnapshot_->setTime(0.0);
93 <    }
93 >      }
94 >
95 >      if (simParams->haveResetTime()) {
96 >        needReset = true;
97 >        resetTime = simParams->getResetTime();
98 >      }
99 >
100 >
101 >     if (simParams->haveUseRNEMD()) {
102 >        if (simParams->getUseRNEMD()) {
103 >           useRNEMD = simParams->getUseRNEMD();
104 >           if (simParams->haveRNEMD_swapTime()) {
105 >              RNEMD_swapTime = simParams->getRNEMD_swapTime();
106 >           }
107 >         }
108 >      }
109 >      
110 >      // Create a default ForceManager: If the subclass wants to use
111 >      // a different ForceManager, use setForceManager
112 >      forceMan_ = new ForceManager(info);
113      
114 <    //create a default a ForceManager
115 <    //if the subclass want to using different ForceManager, use setForceManager
92 <    forceMan_ = new ForceManager(info);
93 <    
94 <    // check for the temperature set flag (velocity scaling)      
95 <    if (simParams->haveTempSet()) {
114 >      // check for the temperature set flag (velocity scaling)      
115 >      if (simParams->haveTempSet()) {
116          needVelocityScaling = simParams->getTempSet();
117  
118          if (simParams->haveTargetTemp()) {
119 <            targetScalingTemp = simParams->getTargetTemp();
119 >          targetScalingTemp = simParams->getTargetTemp();
120          }
121          else {
122 <            sprintf(painCave.errMsg,
123 <                    "Integrator Error: Target Temperature is not set\n");
124 <            painCave.isFatal = 1;
125 <            simError();
122 >          sprintf(painCave.errMsg,
123 >                  "Integrator Error: Target Temperature is not set\n");
124 >          painCave.isFatal = 1;
125 >          simError();
126  
127          }
128 <    }
128 >      }
129      
130 <    //create a default a velocitizer
131 <    //if the subclass want to using different velocitizer, use setVelocitizer
132 <    velocitizer_ = new Velocitizer(info);
130 >      // Create a default a velocitizer: If the subclass wants to use
131 >      // a different velocitizer, use setVelocitizer
132 >      velocitizer_ = new Velocitizer(info);
133 >      // Create a default a RNEMD.
134 >      rnemd_ = new RNEMD(info);
135      
136 < }
136 >    }
137  
138 < Integrator::~Integrator(){
138 >  Integrator::~Integrator(){
139      delete forceMan_;
140      delete velocitizer_;
141 +    delete rnemd_;
142      
143      delete dumpWriter;
144      delete statWriter;
145 < }
145 >  }
146  
147  
148   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines