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

Comparing branches/new_design/OOPSE-2.0/src/integrators/VelocityVerletIntegrator.cpp (file contents):
Revision 1819 by tim, Wed Dec 1 22:45:49 2004 UTC vs.
Revision 1847 by tim, Sat Dec 4 05:24:07 2004 UTC

# Line 32 | Line 32
32   */
33  
34   #include "integrators/VelocityVerletIntegrator.hpp"
35 + #include "integrators/DLM.hpp"
36  
37   namespace oopse {
38 < VelocityVerletIntegrator::VelocityVerletIntegrator(SimInfo *info) : Integrator(info) {
38 > VelocityVerletIntegrator::VelocityVerletIntegrator(SimInfo *info) : Integrator(info), rotAlgo(NULL) {
39 >    rotAlgo = new DLM();
40      dt2 = 0.5 * dt;
41   }
42  
43 < VelocityVerletIntegrator::~VelocityVerletIntegrator() { }
43 > VelocityVerletIntegrator::~VelocityVerletIntegrator() {
44 >    delete rotAlgo;
45 > }
46  
47   void VelocityVerletIntegrator::initialize(){
48  
# Line 69 | Line 73 | void VelocityVerletIntegrator::initialize(){
73      dumpWriter = createDumpWriter();
74      statWriter = createStatWriter();
75  
76 <    dumpWriter->writeFrame();
73 <    statWriter->writeStat(currentSnapshot_.statData);
76 >    dumpWriter->writeDump();
77  
78 <    
78 >    //save statistics
79 >    thermo.saveStat();
80 >    saveConservedQuantity();
81 >
82 >    //before writeStat,  we must save statistics
83 >    statWriter->writeStat(currentSnapshot_->statData);
84 >  
85   }
86          
87   void VelocityVerletIntegrator::doIntegrate() {
# Line 85 | Line 94 | void VelocityVerletIntegrator::doIntegrate() {
94          preStep();
95  
96          integrateStep();
88
89        info_->incrTime(dt);
97          
98          postStep();
99  
# Line 108 | Line 115 | void VelocityVerletIntegrator::postStep() {
115   }
116  
117   void VelocityVerletIntegrator::postStep() {
118 +
119 +        //save snapshot
120 +        info_->getSnapshotManager()->advance();
121 +
122 +        //increase time
123 +        currentSnapshot_->increaseTime(dt);        
124 +
125 +        //save statistics
126 +        thermo.saveStat();
127 +        saveConservedQuantity();
128          
112        
129          if (needVelocityScaling) {
130              if (currentSnapshot_->getTime() >= currThermal) {
131                  velocitizer_->velocitize(targetScalingTemp);
# Line 118 | Line 134 | void VelocityVerletIntegrator::postStep() {
134          }
135  
136          if (currentSnapshot_->getTime() >= currSample) {
137 <            dumpWriter->writeFrame(currentSnapshot_->getTime());
137 >            dumpWriter->writeDump();
138              currSample += sampleTime;
139          }
140  
141          if (currentSnapshot_->getTime() >= currStatus) {
142 <            statWriter->writeStat(currentSnapshot_.statData);
142 >            statWriter->writeStat(currentSnapshot_->statData);
143              needPotential = false;
144              needStress = false;
145              currStatus += statusTime;
146          }
147 +
148 +        
149   }
150  
151  
152   void VelocityVerletIntegrator::finalize() {
153  
154 <    dumpWriter->writeFrame();
154 >    dumpWriter->writeDump();
155  
156      delete dumpWriter;
157      delete statWriter;
# Line 153 | Line 171 | void VelocityVerletIntegrator::calcForce(bool needPote
171  
172   void VelocityVerletIntegrator::calcForce(bool needPotential,
173                                           bool needStress) {
174 <    forceMan_->calcForces(needPotential, needStress)
174 >    forceMan_->calcForces(needPotential, needStress);
175   }
176  
177 + DumpWriter* VelocityVerletIntegrator::createDumpWriter() {
178 +    return new DumpWriter(info_, info_->getDumpFileName());
179 + }
180  
181 + StatWriter* VelocityVerletIntegrator::createStatWriter() {
182 +    return new StatWriter(info_->getStatFileName());
183 + }
184 +
185 +
186   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines