ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/integrators/NVT.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-4/src/integrators/NVT.cpp (file contents):
Revision 1841 by tim, Fri Dec 3 17:59:45 2004 UTC vs.
Revision 1871 by tim, Thu Dec 9 16:22:42 2004 UTC

# Line 43 | Line 43 | void NVT::update() {
43      update();
44   }
45  
46 < void NVT::update() {
46 > void NVT::doUpdate() {
47      oldVel_.resize(info_->getNIntegrableObjects());
48      oldJi_.resize(info_->getNIntegrableObjects());    
49   }
# Line 59 | Line 59 | void NVT::moveA() {
59      Vector3d pos;
60      Vector3d frc;
61  
62 <    Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
63 <    double chi = currSnapshot->getChi();
64 <    double integralOfChidt = currSnapshot->getIntegralOfChiDt();
62 >    double chi = currentSnapshot_->getChi();
63 >    double integralOfChidt = currentSnapshot_->getIntegralOfChiDt();
64      
65      // We need the temperature at time = t for the chi update below:
66  
# Line 79 | Line 78 | void NVT::moveA() {
78  
79          // velocity half step  (use chi from previous step here):
80          //vel[j] += dt2 * ((frc[j] / mass ) * OOPSEConstant::energyConvert - vel[j]*chi);
81 <        vel = dt2 *OOPSEConstant::energyConvert/mass*frc - dt2*chi*vel;
81 >        vel += dt2 *OOPSEConstant::energyConvert/mass*frc - dt2*chi*vel;
82          
83          // position whole step
84          //pos[j] += dt * vel[j];
# Line 90 | Line 89 | void NVT::moveA() {
89  
90          if (integrableObject->isDirectional()) {
91  
92 <            // get and convert the torque to body frame
92 >            //convert the torque to body frame
93 >            Tb = integrableObject->lab2Body(integrableObject->getTrq());
94  
95            Tb = integrableObject->getTrq();
96            integrableObject->lab2Body(Tb);
97
95              // get the angular momentum, and propagate a half step
96  
97              ji = integrableObject->getJ();
# Line 118 | Line 115 | void NVT::moveA() {
115      chi += dt2 * (instTemp / targetTemp_ - 1.0) / (tauThermostat_ * tauThermostat_);
116      integralOfChidt += chi * dt2;
117  
118 <    currSnapshot->setChi(chi);
119 <    currSnapshot->setIntegralOfChiDt(integralOfChidt);
118 >    currentSnapshot_->setChi(chi);
119 >    currentSnapshot_->setIntegralOfChiDt(integralOfChidt);
120   }
121  
122   void NVT::moveB() {
# Line 137 | Line 134 | void NVT::moveB() {
134      int index;
135      // Set things up for the iteration:
136  
137 <    Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
141 <    double chi = currSnapshot->getChi();
137 >    double chi = currentSnapshot_->getChi();
138      double oldChi = chi;
139      double  prevChi;
140 <    double integralOfChidt = currSnapshot->getIntegralOfChiDt();
140 >    double integralOfChidt = currentSnapshot_->getIntegralOfChiDt();
141  
142      index = 0;
143      for (mol = info_->beginMolecule(i); mol != NULL; mol = info_->nextMolecule(i)) {
# Line 149 | Line 145 | void NVT::moveB() {
145                 integrableObject = mol->nextIntegrableObject(j)) {
146                  oldVel_[index] = integrableObject->getVel();
147                  oldJi_[index] = integrableObject->getJ();                
148 +
149 +                ++index;    
150          }
151 <        ++index;              
151 >          
152      }
153  
154      // do the iteration:
# Line 184 | Line 182 | void NVT::moveB() {
182  
183                      // get and convert the torque to body frame
184  
185 <                    Tb = integrableObject->getTrq();
188 <                    integrableObject->lab2Body(Tb);
185 >                    Tb =  integrableObject->lab2Body(integrableObject->getTrq());
186  
187                      //for(j = 0; j < 3; j++)
188                      //    ji[j] = oldJi_[3*i + j] + dt2 * (Tb[j] * OOPSEConstant::energyConvert - oldJi_[3*i+j]*chi);
189 <                    ji += dt2*OOPSEConstant::energyConvert*Tb - dt2*chi *oldJi_[index];
189 >                    ji = oldJi_[index] + dt2*OOPSEConstant::energyConvert*Tb - dt2*chi *oldJi_[index];
190  
191                      integrableObject->setJ(ji);
192                  }
193 +
194 +
195 +                ++index;
196              }
197          }
198      
# Line 202 | Line 202 | void NVT::moveB() {
202          if (fabs(prevChi - chi) <= chiTolerance_)
203              break;
204  
205        ++index;
205      }
206  
207      integralOfChidt += dt2 * chi;
208  
209 <    currSnapshot->setChi(chi);
210 <    currSnapshot->setIntegralOfChiDt(integralOfChidt);
209 >    currentSnapshot_->setChi(chi);
210 >    currentSnapshot_->setIntegralOfChiDt(integralOfChidt);
211   }
212  
213  
214   double NVT::calcConservedQuantity() {
215 <    Snapshot* currSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
216 <    double chi = currSnapshot->getChi();
217 <    double integralOfChidt = currSnapshot->getIntegralOfChiDt();
215 >
216 >    double chi = currentSnapshot_->getChi();
217 >    double integralOfChidt = currentSnapshot_->getIntegralOfChiDt();
218      double conservedQuantity;
219      double fkBT;
220      double Energy;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines