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

Comparing trunk/src/integrators/Integrator.cpp (file contents):
Revision 507 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 2071 by gezelter, Sat Mar 7 21:41:51 2015 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, 234107 (2008).          
39 + * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 + * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   #include "brains/Snapshot.hpp"
44   #include "integrators/Integrator.hpp"
45 + #include "integrators/DLM.hpp"
46 + #include "flucq/FluctuatingChargeLangevin.hpp"
47 + #include "flucq/FluctuatingChargeNVT.hpp"
48   #include "utils/simError.h"
45 namespace oopse {
46  Integrator::Integrator(SimInfo* info)
47    : info_(info), forceMan_(NULL) , needPotential(false), needStress(false), velocitizer_(NULL),
48      needVelocityScaling(false), dumpWriter(NULL), statWriter(NULL), thermo(info),
49      currentSnapshot_(info->getSnapshotManager()->getCurrentSnapshot()) {
49  
50 <      simParams = info->getSimParams();
51 <
52 <      if (simParams->haveDt()) {
53 <        dt = simParams->getDt();
54 <      } else {
55 <        sprintf(painCave.errMsg,
56 <                "Integrator Error: dt is not set\n");
57 <        painCave.isFatal = 1;
59 <        simError();
60 <      }
50 > namespace OpenMD {
51 >  Integrator::Integrator(SimInfo* info)
52 >    : info_(info), forceMan_(NULL), rotAlgo_(NULL), flucQ_(NULL),
53 >      rattle_(NULL), velocitizer_(NULL), rnemd_(NULL),
54 >      needPotential(false), needStress(false),
55 >      needReset(false),  needVelocityScaling(false),
56 >      useRNEMD(false), dumpWriter(NULL), statWriter(NULL), thermo(info_),
57 >      snap(info_->getSnapshotManager()->getCurrentSnapshot()) {
58      
59 <      if (simParams->haveRunTime()) {
60 <        runTime = simParams->getRunTime();
61 <      } else {
62 <        sprintf(painCave.errMsg,
63 <                "Integrator Error: runTime is not set\n");
64 <        painCave.isFatal = 1;
65 <        simError();
66 <      }
67 <      // set the status, sample, and thermal kick times
68 <      if (simParams->haveSampleTime()){
69 <        sampleTime = simParams->getSampleTime();
70 <        statusTime = sampleTime;
71 <      } else{
72 <        sampleTime = simParams->getRunTime();
73 <        statusTime = sampleTime;
74 <      }
59 >    simParams = info->getSimParams();
60 >    
61 >    if (simParams->haveDt()) {
62 >      dt = simParams->getDt();
63 >    } else {
64 >      sprintf(painCave.errMsg,
65 >              "Integrator Error: dt is not set\n");
66 >      painCave.isFatal = 1;
67 >      simError();
68 >    }
69 >    
70 >    if (simParams->haveRunTime()) {
71 >      runTime = simParams->getRunTime();
72 >    } else {
73 >      sprintf(painCave.errMsg,
74 >              "Integrator Error: runTime is not set\n");
75 >      painCave.isFatal = 1;
76 >      simError();
77 >    }
78 >    
79 >    // set the status, sample, and thermal kick times
80 >    if (simParams->haveSampleTime()){
81 >      sampleTime = simParams->getSampleTime();
82 >      statusTime = sampleTime;
83 >    } else{
84 >      sampleTime = simParams->getRunTime();
85 >      statusTime = sampleTime;
86 >    }
87 >    
88 >    if (simParams->haveStatusTime()){
89 >      statusTime = simParams->getStatusTime();
90 >    }
91 >    
92 >    if (simParams->haveThermalTime()){
93 >      thermalTime = simParams->getThermalTime();
94 >    } else {
95 >      thermalTime = simParams->getRunTime();
96 >    }
97 >    
98 >    if (!simParams->getUseInitalTime()) {
99 >      snap->setTime(0.0);
100 >    }
101 >    
102 >    if (simParams->haveResetTime()) {
103 >      needReset = true;
104 >      resetTime = simParams->getResetTime();
105 >    }
106 >    
107 >    // Create a default ForceManager: If the subclass wants to use
108 >    // a different ForceManager, use setForceManager
109 >    forceMan_ = new ForceManager(info);
110 >    
111 >    // check for the temperature set flag (velocity scaling)      
112 >    needVelocityScaling = false;
113 >    if (simParams->haveTempSet()) {
114 >      needVelocityScaling = simParams->getTempSet();
115 >    }
116  
117 <      if (simParams->haveStatusTime()){
118 <        statusTime = simParams->getStatusTime();
117 >    if (needVelocityScaling) {
118 >      if (simParams->haveTargetTemp()) {
119 >        targetScalingTemp = simParams->getTargetTemp();
120        }
121 +      else {
122 +        sprintf(painCave.errMsg,
123 +                "Integrator Error: Target Temperature must be set to turn on tempSet\n");
124 +        painCave.isFatal = 1;
125 +        simError();
126  
83      if (simParams->haveThermalTime()){
84        thermalTime = simParams->getThermalTime();
85      } else {
86        thermalTime = simParams->getRunTime();
127        }
128 <
89 <      if (!simParams->getUseInitTime()) {
90 <        currentSnapshot_->setTime(0.0);
91 <      }
128 >    }
129      
130 <      //create a default ForceManager
131 <      //if the subclass wants to use a different ForceManager, use setForceManager
132 <      forceMan_ = new ForceManager(info);
130 >    // Create a default a velocitizer: If the subclass wants to use
131 >    // a different velocitizer, use setVelocitizer
132 >    velocitizer_ = new Velocitizer(info);
133      
134 <      //set the force manager for thermodynamic integration if specified
135 <      if (simParams->getUseSolidThermInt() || simParams->getUseLiquidThermInt()){
136 <        ThermoIntegrationForceManager* thermoForce_
137 <          = new ThermoIntegrationForceManager(info);
138 <        setForceManager(thermoForce_);
134 >    if (simParams->getRNEMDParameters()->haveUseRNEMD()) {
135 >      if (simParams->getRNEMDParameters()->getUseRNEMD()) {
136 >        // Create a default a RNEMD.
137 >        rnemd_ = new RNEMD(info);
138 >        useRNEMD = simParams->getRNEMDParameters()->getUseRNEMD();
139 >        if (simParams->getRNEMDParameters()->haveExchangeTime()) {
140 >          RNEMD_exchangeTime = simParams->getRNEMDParameters()->getExchangeTime();
141 >        }
142        }
143 +    }
144      
145 <      // check for the temperature set flag (velocity scaling)      
146 <      if (simParams->haveTempSet()) {
147 <        needVelocityScaling = simParams->getTempSet();
148 <
149 <        if (simParams->haveTargetTemp()) {
150 <          targetScalingTemp = simParams->getTargetTemp();
151 <        }
152 <        else {
153 <          sprintf(painCave.errMsg,
154 <                  "Integrator Error: Target Temperature is not set\n");
155 <          painCave.isFatal = 1;
156 <          simError();
157 <
117 <        }
145 >    rotAlgo_ = new DLM();
146 >    rattle_ = new Rattle(info);
147 >    if (simParams->getFluctuatingChargeParameters()->havePropagator()) {
148 >      std::string prop = toUpperCopy(simParams->getFluctuatingChargeParameters()->getPropagator());
149 >      if (prop.compare("NVT")==0){
150 >         flucQ_ = new FluctuatingChargeNVT(info);
151 >      } else if (prop.compare("LANGEVIN")==0) {
152 >         flucQ_ = new FluctuatingChargeLangevin(info);
153 >      } else {
154 >        sprintf(painCave.errMsg,
155 >                "Integrator Error: Unknown Fluctuating Charge propagator (%s) requested\n",
156 >                simParams->getFluctuatingChargeParameters()->getPropagator().c_str());
157 >        painCave.isFatal = 1;
158        }
119    
120      //create a default a velocitizer
121      //if the subclass want to using different velocitizer, use setVelocitizer
122      velocitizer_ = new Velocitizer(info);
123    
159      }
160 <
160 >    flucQ_->setForceManager(forceMan_);
161 >  }
162 >  
163    Integrator::~Integrator(){
164      delete forceMan_;
165      delete velocitizer_;
166 +    delete rnemd_;
167 +    delete flucQ_;
168 +    delete rotAlgo_;
169 +    delete rattle_;
170      
171      delete dumpWriter;
172      delete statWriter;
173    }
133
134
174   }
175  

Comparing trunk/src/integrators/Integrator.cpp (property svn:keywords):
Revision 507 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 2071 by gezelter, Sat Mar 7 21:41:51 2015 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines