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

Comparing trunk/src/integrators/VelocityVerletIntegrator.cpp (file contents):
Revision 963 by tim, Wed May 17 21:51:42 2006 UTC vs.
Revision 1360 by cli2, Mon Sep 7 16:31:51 2009 UTC

# Line 67 | Line 67 | namespace oopse {
67      
68      forceMan_->init();
69      
70 <    // remove center of mass drift velocity (in case we passed in a configuration
71 <    // that was drifting
70 >    // remove center of mass drift velocity (in case we passed in a
71 >    // configuration that was drifting)
72      velocitizer_->removeComDrift();
73      
74      // initialize the forces before the first step
75      calcForce(true, true);
76      
77 <    //execute constraint algorithm to make sure at the very beginning the system is constrained  
77 >    // execute the constraint algorithm to make sure that the system is
78 >    // constrained at the very beginning  
79      if (info_->getNGlobalConstraints() > 0) {
80        rattle->constraintA();
81        calcForce(true, true);
82 <      rattle->constraintB();        
83 <      info_->getSnapshotManager()->advance();//copy the current snapshot to previous snapshot
82 >      rattle->constraintB();      
83 >      //copy the current snapshot to previous snapshot
84 >      info_->getSnapshotManager()->advance();
85      }
86      
87      if (needVelocityScaling) {
# Line 89 | Line 91 | namespace oopse {
91      dumpWriter = createDumpWriter();
92      
93      statWriter = createStatWriter();
94 <    
93 <    if (simParams->getUseSolidThermInt()) {
94 <      restWriter = createRestWriter();
95 <      restWriter->writeZangle();
96 <    }
97 <    
94 >
95      dumpWriter->writeDumpAndEor();
96 <    
100 <    
96 >
97      //save statistics, before writeStat,  we must save statistics
98      thermo.saveStat();
99      saveConservedQuantity();
100 +    if (simParams->getUseRNEMD())
101 +      rnemd_->getStatus();
102 +
103      statWriter->writeStat(currentSnapshot_->statData);
104      
105      currSample = sampleTime + currentSnapshot_->getTime();
106 <    currStatus =  statusTime + currentSnapshot_->getTime();;
106 >    currStatus =  statusTime + currentSnapshot_->getTime();
107      currThermal = thermalTime + currentSnapshot_->getTime();
108      if (needReset) {
109        currReset = resetTime + currentSnapshot_->getTime();
110      }
111 +    if (simParams->getUseRNEMD()){
112 +      currRNEMD = RNEMD_swapTime + currentSnapshot_->getTime();
113 +    }
114      needPotential = false;
115      needStress = false;      
116      
# Line 150 | Line 152 | namespace oopse {
152    
153      //increase time
154      currentSnapshot_->increaseTime(dt);        
155 <  
155 >  
156      if (needVelocityScaling) {
157        if (currentSnapshot_->getTime() >= currThermal) {
158          velocitizer_->velocitize(targetScalingTemp);
159          currThermal += thermalTime;
160        }
161      }
162 <  
162 >    if (useRNEMD) {
163 >      if (currentSnapshot_->getTime() >= currRNEMD) {
164 >        rnemd_->doSwap();
165 >        currRNEMD += RNEMD_swapTime;
166 >      }
167 >    }
168 >    
169      if (currentSnapshot_->getTime() >= currSample) {
170        dumpWriter->writeDumpAndEor();
171 <    
164 <      if (simParams->getUseSolidThermInt())
165 <        restWriter->writeZangle();
166 <    
171 >      
172        currSample += sampleTime;
173      }
174 <  
174 >    
175      if (currentSnapshot_->getTime() >= currStatus) {
176        //save statistics, before writeStat,  we must save statistics
177        thermo.saveStat();
178        saveConservedQuantity();
179 +
180 +      if (simParams->getUseRNEMD())
181 +        rnemd_->getStatus();
182 +
183        statWriter->writeStat(currentSnapshot_->statData);
184 <    
184 >      
185        needPotential = false;
186        needStress = false;
187        currStatus += statusTime;
188      }
189 <
190 <      if (needReset && currentSnapshot_->getTime() >= currReset) {    
191 <        resetIntegrator();
192 <        currReset += resetTime;
193 <      }
185 <  
189 >    
190 >    if (needReset && currentSnapshot_->getTime() >= currReset) {    
191 >      resetIntegrator();
192 >      currReset += resetTime;
193 >    }        
194    }
195  
196  
197    void VelocityVerletIntegrator::finalize() {
198      dumpWriter->writeEor();
199    
192    if (simParams->getUseSolidThermInt()) {
193      restWriter->writeZangle();
194      delete restWriter;
195      restWriter = NULL;
196    }
197  
200      delete dumpWriter;
201      delete statWriter;
202    
# Line 224 | Line 226 | namespace oopse {
226  
227      std::string statFileFormatString = simParams->getStatFileFormat();
228      StatsBitSet mask = parseStatFileFormat(statFileFormatString);
229 <    
230 <    // if solidThermInt is true, add extra information to the statfile
231 <    if (simParams->getUseSolidThermInt()){
229 >  
230 >    // if we're doing a thermodynamic integration, we'll want the raw
231 >    // potential as well as the full potential:
232 >
233 >
234 >    if (simParams->getUseThermodynamicIntegration())
235        mask.set(Stats::VRAW);
236 +
237 +    // if we've got restraints turned on, we'll also want a report of the
238 +    // total harmonic restraints
239 +    if (simParams->getUseRestraints()){
240        mask.set(Stats::VHARM);
241      }
242  
243 <    if (simParams->havePrintPressureTensor() && simParams->getPrintPressureTensor()){
244 <        mask.set(Stats::PRESSURE_TENSOR_X);
245 <        mask.set(Stats::PRESSURE_TENSOR_Y);
246 <        mask.set(Stats::PRESSURE_TENSOR_Z);
243 >    if (simParams->havePrintPressureTensor() &&
244 >        simParams->getPrintPressureTensor()){
245 >      mask.set(Stats::PRESSURE_TENSOR_XX);
246 >      mask.set(Stats::PRESSURE_TENSOR_XY);
247 >      mask.set(Stats::PRESSURE_TENSOR_XZ);
248 >      mask.set(Stats::PRESSURE_TENSOR_YX);
249 >      mask.set(Stats::PRESSURE_TENSOR_YY);
250 >      mask.set(Stats::PRESSURE_TENSOR_YZ);
251 >      mask.set(Stats::PRESSURE_TENSOR_ZX);
252 >      mask.set(Stats::PRESSURE_TENSOR_ZY);
253 >      mask.set(Stats::PRESSURE_TENSOR_ZZ);
254      }
255      
256 +    if (simParams->getAccumulateBoxDipole()) {
257 +      mask.set(Stats::BOX_DIPOLE_X);
258 +      mask.set(Stats::BOX_DIPOLE_Y);
259 +      mask.set(Stats::BOX_DIPOLE_Z);
260 +    }
261 +  
262 +    if (simParams->haveTaggedAtomPair() && simParams->havePrintTaggedPairDistance()) {
263 +      if (simParams->getPrintTaggedPairDistance()) {
264 +        mask.set(Stats::TAGGED_PAIR_DISTANCE);
265 +      }
266 +    }
267 +
268 +    if (simParams->getUseRNEMD()) {
269 +      mask.set(Stats::RNEMD_SWAP_TOTAL);
270 +    }
271 +      
272 +
273       return new StatWriter(info_->getStatFileName(), mask);
274    }
275  
243  RestWriter* VelocityVerletIntegrator::createRestWriter(){
244    return new RestWriter(info_);
245  }
276  
247
277   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines