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 1029 by chrisfen, Thu Aug 31 22:34:49 2006 UTC vs.
Revision 1413 by gezelter, Mon Mar 22 19:21:22 2010 UTC

# Line 6 | Line 6
6   * redistribute this software in source and binary code form, provided
7   * that the following conditions are met:
8   *
9 < * 1. Acknowledgement of the program authors must be made in any
10 < *    publication of scientific results based in part on use of the
11 < *    program.  An acceptable form of acknowledgement is citation of
12 < *    the article in which the program was described (Matthew
13 < *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 < *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 < *    Parallel Simulation Engine for Molecular Dynamics,"
16 < *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 < *
18 < * 2. Redistributions of source code must retain the above copyright
9 > * 1. Redistributions of source code must retain the above copyright
10   *    notice, this list of conditions and the following disclaimer.
11   *
12 < * 3. Redistributions in binary form must reproduce the above copyright
12 > * 2. Redistributions in binary form must reproduce the above copyright
13   *    notice, this list of conditions and the following disclaimer in the
14   *    documentation and/or other materials provided with the
15   *    distribution.
# Line 37 | Line 28
28   * arising out of the use of or inability to use software, even if the
29   * University of Notre Dame has been advised of the possibility of
30   * such damages.
31 + *
32 + * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your
33 + * research, please cite the appropriate papers when you publish your
34 + * work.  Good starting points are:
35 + *                                                                      
36 + * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37 + * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38 + * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 + * [4]  Vardeman & Gezelter, in progress (2009).                        
40   */
41  
42   /**
# Line 50 | Line 50
50   #include "integrators/VelocityVerletIntegrator.hpp"
51   #include "integrators/DLM.hpp"
52   #include "utils/StringUtils.hpp"
53 + #include "utils/ProgressBar.hpp"
54  
55 < namespace oopse {
55 > namespace OpenMD {
56    VelocityVerletIntegrator::VelocityVerletIntegrator(SimInfo *info) : Integrator(info), rotAlgo(NULL) {
57      dt2 = 0.5 * dt;
58      rotAlgo = new DLM();
# Line 94 | Line 95 | namespace oopse {
95  
96      dumpWriter->writeDumpAndEor();
97  
98 <    if (simParams->getUseSolidThermInt()) {
99 <      restWriter = createRestWriter();
99 <      restWriter->writeZAngFile();
100 <    }
101 <    
98 >    progressBar = new ProgressBar();
99 >
100      //save statistics, before writeStat,  we must save statistics
101      thermo.saveStat();
102      saveConservedQuantity();
103 +    if (simParams->getUseRNEMD())
104 +      rnemd_->getStarted();
105 +
106      statWriter->writeStat(currentSnapshot_->statData);
107      
108      currSample = sampleTime + currentSnapshot_->getTime();
109 <    currStatus =  statusTime + currentSnapshot_->getTime();;
109 >    currStatus =  statusTime + currentSnapshot_->getTime();
110      currThermal = thermalTime + currentSnapshot_->getTime();
111      if (needReset) {
112        currReset = resetTime + currentSnapshot_->getTime();
113      }
114 +    if (simParams->getUseRNEMD()){
115 +      currRNEMD = RNEMD_exchangeTime + currentSnapshot_->getTime();
116 +    }
117      needPotential = false;
118      needStress = false;      
119      
120    }
121 <
121 >
122    void VelocityVerletIntegrator::doIntegrate() {
123    
124    
# Line 127 | Line 131 | namespace oopse {
131        integrateStep();
132      
133        postStep();
134 <    
134 >      
135      }
136    
137      finalize();
# Line 138 | Line 142 | namespace oopse {
142    void VelocityVerletIntegrator::preStep() {
143      RealType difference = currentSnapshot_->getTime() + dt - currStatus;
144    
145 <    if (difference > 0 || fabs(difference) < oopse::epsilon) {
145 >    if (difference > 0 || fabs(difference) < OpenMD::epsilon) {
146        needPotential = true;
147        needStress = true;  
148      }
# Line 158 | Line 162 | namespace oopse {
162          currThermal += thermalTime;
163        }
164      }
165 <
165 >    if (useRNEMD) {
166 >      if (currentSnapshot_->getTime() >= currRNEMD) {
167 >        rnemd_->doRNEMD();
168 >        currRNEMD += RNEMD_exchangeTime;
169 >      }
170 >      rnemd_->collectData();
171 >    }
172 >    
173      if (currentSnapshot_->getTime() >= currSample) {
174        dumpWriter->writeDumpAndEor();
175 <
165 <      if (simParams->getUseSolidThermInt())
166 <        restWriter->writeZAngFile();
167 <    
175 >      
176        currSample += sampleTime;
177      }
178 <
178 >    
179      if (currentSnapshot_->getTime() >= currStatus) {
180        //save statistics, before writeStat,  we must save statistics
181        thermo.saveStat();
182        saveConservedQuantity();
183 +
184 +      if (simParams->getUseRNEMD()) {
185 +        rnemd_->getStatus();
186 +      }
187 +
188        statWriter->writeStat(currentSnapshot_->statData);
189 <    
189 >
190 >      progressBar->setStatus(currentSnapshot_->getTime(), runTime);
191 >      progressBar->update();
192 >
193        needPotential = false;
194        needStress = false;
195        currStatus += statusTime;
196      }
197 <
198 <      if (needReset && currentSnapshot_->getTime() >= currReset) {    
199 <        resetIntegrator();
200 <        currReset += resetTime;
201 <      }
186 <  
197 >    
198 >    if (needReset && currentSnapshot_->getTime() >= currReset) {    
199 >      resetIntegrator();
200 >      currReset += resetTime;
201 >    }        
202    }
203  
204  
205    void VelocityVerletIntegrator::finalize() {
206      dumpWriter->writeEor();
207    
193    if (simParams->getUseSolidThermInt()) {
194      restWriter->writeZAngFile();
195      delete restWriter;
196      restWriter = NULL;
197    }
198  
208      delete dumpWriter;
209      delete statWriter;
210    
# Line 225 | Line 234 | namespace oopse {
234  
235      std::string statFileFormatString = simParams->getStatFileFormat();
236      StatsBitSet mask = parseStatFileFormat(statFileFormatString);
237 <    
238 <    // if solidThermInt is true, add extra information to the statfile
239 <    if (simParams->getUseSolidThermInt()){
237 >  
238 >    // if we're doing a thermodynamic integration, we'll want the raw
239 >    // potential as well as the full potential:
240 >
241 >
242 >    if (simParams->getUseThermodynamicIntegration())
243        mask.set(Stats::VRAW);
244 +
245 +    // if we've got restraints turned on, we'll also want a report of the
246 +    // total harmonic restraints
247 +    if (simParams->getUseRestraints()){
248        mask.set(Stats::VHARM);
249      }
250  
251      if (simParams->havePrintPressureTensor() &&
252          simParams->getPrintPressureTensor()){
253 <        mask.set(Stats::PRESSURE_TENSOR_X);
254 <        mask.set(Stats::PRESSURE_TENSOR_Y);
255 <        mask.set(Stats::PRESSURE_TENSOR_Z);
253 >      mask.set(Stats::PRESSURE_TENSOR_XX);
254 >      mask.set(Stats::PRESSURE_TENSOR_XY);
255 >      mask.set(Stats::PRESSURE_TENSOR_XZ);
256 >      mask.set(Stats::PRESSURE_TENSOR_YX);
257 >      mask.set(Stats::PRESSURE_TENSOR_YY);
258 >      mask.set(Stats::PRESSURE_TENSOR_YZ);
259 >      mask.set(Stats::PRESSURE_TENSOR_ZX);
260 >      mask.set(Stats::PRESSURE_TENSOR_ZY);
261 >      mask.set(Stats::PRESSURE_TENSOR_ZZ);
262      }
263      
264      if (simParams->getAccumulateBoxDipole()) {
# Line 244 | Line 266 | namespace oopse {
266        mask.set(Stats::BOX_DIPOLE_Y);
267        mask.set(Stats::BOX_DIPOLE_Z);
268      }
269 +  
270 +    if (simParams->haveTaggedAtomPair() && simParams->havePrintTaggedPairDistance()) {
271 +      if (simParams->getPrintTaggedPairDistance()) {
272 +        mask.set(Stats::TAGGED_PAIR_DISTANCE);
273 +      }
274 +    }
275  
276 <     return new StatWriter(info_->getStatFileName(), mask);
277 <  }
276 >    if (simParams->getUseRNEMD()) {
277 >      mask.set(Stats::RNEMD_EXCHANGE_TOTAL);
278 >    }
279 >    
280  
281 <  RestWriter* VelocityVerletIntegrator::createRestWriter(){
252 <    return new RestWriter(info_);
281 >    return new StatWriter(info_->getStatFileName(), mask);
282    }
283  
284  
285 < } //end namespace oopse
285 > } //end namespace OpenMD

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines