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

Comparing:
branches/development/src/integrators/FluctuatingChargeNVT.cpp (file contents), Revision 1716 by gezelter, Wed May 23 01:26:15 2012 UTC vs.
branches/development/src/flucq/FluctuatingChargeNVT.cpp (file contents), Revision 1735 by jmichalk, Tue Jun 5 17:50:53 2012 UTC

# Line 52 | Line 52 | namespace OpenMD {
52      thermo(info),
53      currentSnapshot_(info->getSnapshotManager()->getCurrentSnapshot()) {
54  
55 +
56      if (info_->usesFluctuatingCharges()) {
57        if (info_->getNFluctuatingCharges() > 0) {
58  
59          hasFlucQ_ = true;
60          Globals* simParams = info_->getSimParams();
61 +        FluctuatingChargeParameters* fqParams = simParams->getFluctuatingChargeParameters();
62  
63          if (simParams->haveDt()) {
64            dt_ = simParams->getDt();
# Line 73 | Line 75 | namespace OpenMD {
75            currentSnapshot_->setIntegralOfChiElectronicDt(0.0);
76          }
77          
78 <        if (!simParams->haveFlucQTargetTemp()) {
78 >        if (!fqParams->haveTargetTemp()) {
79            sprintf(painCave.errMsg, "You can't use the FluctuatingChargeNVT "
80                    "propagator without a flucQ.targetTemp!\n");
81            painCave.isFatal = 1;
82            painCave.severity = OPENMD_ERROR;
83            simError();
84          } else {
85 <          targetTemp_ = simParams->getFlucQTargetTemp();
85 >          targetTemp_ = fqParams->getTargetTemp();
86          }
87          
88          // We must set tauThermostat.
89          
90 <        if (!simParams->haveFlucQtauThermostat()) {
90 >        if (!fqParams->haveTauThermostat()) {
91            sprintf(painCave.errMsg, "If you use the FluctuatingChargeNVT\n"
92                    "\tpropagator, you must set flucQ.tauThermostat .\n");
93            
# Line 93 | Line 95 | namespace OpenMD {
95            painCave.isFatal = 1;
96            simError();
97          } else {
98 <          tauThermostat_ = simParams->getFlucQtauThermostat();
98 >          tauThermostat_ = fqParams->getTauThermostat();
99          }
100          updateSizes();
101        }
# Line 135 | Line 137 | namespace OpenMD {
137      RealType integralOfChidt = currentSnapshot_->getIntegralOfChiElectronicDt();
138      RealType instTemp = thermo.getElectronicTemperature();
139  
138    cerr << "why are we here?\n";
140  
141      for (mol = info_->beginMolecule(i); mol != NULL;
142           mol = info_->nextMolecule(i)) {
# Line 147 | Line 148 | namespace OpenMD {
148          cfrc = atom->getFlucQFrc();
149          cmass = atom->getChargeMass();
150          
151 <        // velocity half step
152 <        cvel += dt2_ *PhysicalConstants::energyConvert/cmass*cfrc - dt2_*chi*cvel;                    
151 >        cerr << atom->getType() << "\n";
152 >        cerr << "Before\n";
153 >        cerr << "cvel: " << cvel << "\tcpos: " << cpos << "\tcfrc: " << cfrc << "\tcmass: " << cmass << "\n";
154 >        
155 >        // velocity half step
156 >        cvel += dt2_ * cfrc / cmass - dt2_*chi*cvel;                    
157          // position whole step
158          cpos += dt_ * cvel;
159 <        
159 >        
160 >        cerr << "After\n";
161 >        cerr << "cvel: " << cvel << "\tcpos: " << cpos << "\n\n";        
162 >
163          atom->setFlucQVel(cvel);
164          atom->setFlucQPos(cpos);
165        }
# Line 161 | Line 169 | namespace OpenMD {
169        (tauThermostat_ * tauThermostat_);
170  
171      integralOfChidt += chi * dt2_;
172 +    cerr << "Move A instTemp: " << instTemp << "\n";
173      currentSnapshot_->setChiElectronic(chi);
174      currentSnapshot_->setIntegralOfChiElectronicDt(integralOfChidt);
175        
# Line 201 | Line 210 | namespace OpenMD {
210      for(int k = 0; k < maxIterNum_; k++) {
211        index = 0;
212        instTemp = thermo.getElectronicTemperature();
213 <
213 >      cerr << "MoveB instTemp: " << instTemp << "\n";
214        // evolve chi another half step using the temperature at t + dt/2
215        prevChi = chi;
216        chi = oldChi + dt2_ * (instTemp / targetTemp_ - 1.0) /
# Line 217 | Line 226 | namespace OpenMD {
226            cmass = atom->getChargeMass();
227            
228            // velocity half step
229 <          cvel = oldVel_[index] + dt2_/cmass*PhysicalConstants::energyConvert * cfrc - dt2_*chi*oldVel_[index];
229 >          cvel = oldVel_[index] + dt2_ * cfrc / cmass - dt2_*chi*oldVel_[index];
230            
231            atom->setFlucQVel(cvel);      
232            ++index;          

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines