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 542 by chuckv, Sun May 22 21:36:21 2005 UTC vs.
Revision 1029 by chrisfen, Thu Aug 31 22:34:49 2006 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 <    
94 >
95 >    dumpWriter->writeDumpAndEor();
96 >
97      if (simParams->getUseSolidThermInt()) {
98        restWriter = createRestWriter();
99 <      restWriter->writeZangle();
99 >      restWriter->writeZAngFile();
100      }
101      
98    dumpWriter->writeDumpAndEor();
99    
100    
102      //save statistics, before writeStat,  we must save statistics
103      thermo.saveStat();
104      saveConservedQuantity();
# Line 105 | Line 106 | namespace oopse {
106      
107      currSample = sampleTime + currentSnapshot_->getTime();
108      currStatus =  statusTime + currentSnapshot_->getTime();;
109 <    currThermal = thermalTime +  + currentSnapshot_->getTime();
109 >    currThermal = thermalTime + currentSnapshot_->getTime();
110 >    if (needReset) {
111 >      currReset = resetTime + currentSnapshot_->getTime();
112 >    }
113      needPotential = false;
114      needStress = false;      
115      
# Line 132 | Line 136 | namespace oopse {
136  
137  
138    void VelocityVerletIntegrator::preStep() {
139 <    double difference = currentSnapshot_->getTime() + dt - currStatus;
139 >    RealType difference = currentSnapshot_->getTime() + dt - currStatus;
140    
141      if (difference > 0 || fabs(difference) < oopse::epsilon) {
142        needPotential = true;
143        needStress = true;  
144      }
141  
145    }
146  
147    void VelocityVerletIntegrator::postStep() {
148 <  
148 >
149      //save snapshot
150      info_->getSnapshotManager()->advance();
151    
152      //increase time
153      currentSnapshot_->increaseTime(dt);        
154 <  
154 >  
155      if (needVelocityScaling) {
156        if (currentSnapshot_->getTime() >= currThermal) {
157          velocitizer_->velocitize(targetScalingTemp);
158          currThermal += thermalTime;
159        }
160      }
161 <  
161 >
162      if (currentSnapshot_->getTime() >= currSample) {
163        dumpWriter->writeDumpAndEor();
164 <    
164 >
165        if (simParams->getUseSolidThermInt())
166 <        restWriter->writeZangle();
166 >        restWriter->writeZAngFile();
167      
168        currSample += sampleTime;
169      }
170 <  
170 >
171      if (currentSnapshot_->getTime() >= currStatus) {
172        //save statistics, before writeStat,  we must save statistics
173        thermo.saveStat();
# Line 175 | Line 178 | namespace oopse {
178        needStress = false;
179        currStatus += statusTime;
180      }
181 <  
181 >
182 >      if (needReset && currentSnapshot_->getTime() >= currReset) {    
183 >        resetIntegrator();
184 >        currReset += resetTime;
185 >      }
186    
187    }
188  
# Line 184 | Line 191 | namespace oopse {
191      dumpWriter->writeEor();
192    
193      if (simParams->getUseSolidThermInt()) {
194 <      restWriter->writeZangle();
194 >      restWriter->writeZAngFile();
195        delete restWriter;
196        restWriter = NULL;
197      }
# Line 215 | Line 222 | namespace oopse {
222    }
223  
224    StatWriter* VelocityVerletIntegrator::createStatWriter() {
225 +
226 +    std::string statFileFormatString = simParams->getStatFileFormat();
227 +    StatsBitSet mask = parseStatFileFormat(statFileFormatString);
228 +    
229      // if solidThermInt is true, add extra information to the statfile
230      if (simParams->getUseSolidThermInt()){
220      StatsBitSet mask;
221      mask.set(Stats::TIME);
222      mask.set(Stats::TOTAL_ENERGY);
223      mask.set(Stats::POTENTIAL_ENERGY);
224      mask.set(Stats::KINETIC_ENERGY);
225      mask.set(Stats::TEMPERATURE);
226      mask.set(Stats::PRESSURE);
227      mask.set(Stats::VOLUME);
228      mask.set(Stats::CONSERVED_QUANTITY);
231        mask.set(Stats::VRAW);
232        mask.set(Stats::VHARM);
231      return new StatWriter(info_->getStatFileName(), mask);
233      }
234  
235 <    if (simParams->havePrintPressureTensor() && simParams->getPrintPressureTensor()){
236 <       StatsBitSet mask;
236 <        mask.set(Stats::TIME);
237 <        mask.set(Stats::TOTAL_ENERGY);
238 <        mask.set(Stats::POTENTIAL_ENERGY);
239 <        mask.set(Stats::KINETIC_ENERGY);
240 <        mask.set(Stats::TEMPERATURE);
241 <        mask.set(Stats::PRESSURE);
242 <        mask.set(Stats::VOLUME);
243 <        mask.set(Stats::CONSERVED_QUANTITY);
235 >    if (simParams->havePrintPressureTensor() &&
236 >        simParams->getPrintPressureTensor()){
237          mask.set(Stats::PRESSURE_TENSOR_X);
238          mask.set(Stats::PRESSURE_TENSOR_Y);
239          mask.set(Stats::PRESSURE_TENSOR_Z);
247        return new StatWriter(info_->getStatFileName(), mask);
240      }
241      
242 <    return new StatWriter(info_->getStatFileName());
242 >    if (simParams->getAccumulateBoxDipole()) {
243 >      mask.set(Stats::BOX_DIPOLE_X);
244 >      mask.set(Stats::BOX_DIPOLE_Y);
245 >      mask.set(Stats::BOX_DIPOLE_Z);
246 >    }
247 >
248 >     return new StatWriter(info_->getStatFileName(), mask);
249    }
250  
251    RestWriter* VelocityVerletIntegrator::createRestWriter(){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines