ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new-templateless/OOPSE/libmdtools/NPT.cpp
(Generate patch)

Comparing branches/new-templateless/OOPSE/libmdtools/NPT.cpp (file contents):
Revision 848, Fri Oct 31 18:28:53 2003 UTC vs.
Revision 850 by mmeineke, Mon Nov 3 22:07:17 2003 UTC

# Line 1 | Line 1
1 + #include <stdlib.h>
2   #include <math.h>
3 +
4   #include "Atom.hpp"
5   #include "SRI.hpp"
6   #include "AbstractClasses.hpp"
# Line 24 | Line 26
26   //
27   //    Hoover, W. G., 1986, Phys. Rev. A, 34, 2499.
28  
29 < template<typename T> NPT<T>::NPT ( SimInfo *theInfo, ForceFields* the_ff):
30 <  T( theInfo, the_ff )
29 > NPT::NPT ( SimInfo *theInfo, ForceFields* the_ff):
30 >  Integrator( theInfo, the_ff )
31   {
32    GenericData* data;
33 <  DoubleData * chiValue;
32 <  DoubleData * integralOfChidtValue;
33 <
34 <  chiValue = NULL;
35 <  integralOfChidtValue = NULL;
36 <
33 >  
34    chi = 0.0;
35    integralOfChidt = 0.0;
36    have_tau_thermostat = 0;
# Line 46 | Line 43 | template<typename T> NPT<T>::NPT ( SimInfo *theInfo, F
43  
44    // retrieve chi and integralOfChidt from simInfo
45    data = info->getProperty(CHIVALUE_ID);
46 <  if(data){
47 <    chiValue = dynamic_cast<DoubleData*>(data);
46 >  if(data != NULL ){
47 >    chi = data->getDval();
48    }
49  
50    data = info->getProperty(INTEGRALOFCHIDT_ID);
51 <  if(data){
52 <    integralOfChidtValue = dynamic_cast<DoubleData*>(data);
56 <  }
57 <
58 <  // chi and integralOfChidt should appear by pair
59 <  if(chiValue && integralOfChidtValue){
60 <    chi = chiValue->getData();
61 <    integralOfChidt = integralOfChidtValue->getData();
51 >  if(data != NULL ){
52 >    integralOfChidt = data->getDval();
53    }
54  
55    oldPos = new double[3*nAtoms];
# Line 72 | Line 63 | template<typename T> NPT<T>::NPT ( SimInfo *theInfo, F
63  
64   }
65  
66 < template<typename T> NPT<T>::~NPT() {
66 > NPT::~NPT() {
67    delete[] oldPos;
68    delete[] oldVel;
69    delete[] oldJi;
70   }
71  
72 < template<typename T> void NPT<T>::moveA() {
72 > void NPT::moveA() {
73  
74    //new version of NPT
75    int i, j, k;
# Line 180 | Line 171 | template<typename T> void NPT<T>::moveA() {
171    this->scaleSimBox();
172   }
173  
174 < template<typename T> void NPT<T>::moveB( void ){
174 > void NPT::moveB( void ){
175  
176    //new version of NPT
177    int i, j, k;
# Line 268 | Line 259 | template<typename T> void NPT<T>::moveB( void ){
259  
260   }
261  
262 < template<typename T> void NPT<T>::resetIntegrator() {
262 > void NPT::resetIntegrator() {
263    chi = 0.0;
264 <  T::resetIntegrator();
264 >  Integrator::resetIntegrator();
265   }
266  
267 < template<typename T> void NPT<T>::evolveChiA() {
267 > void NPT::evolveChiA() {
268    chi += dt2 * ( instaTemp / targetTemp - 1.0) / tt2;
269    oldChi = chi;
270   }
271  
272 < template<typename T> void NPT<T>::evolveChiB() {
272 > void NPT::evolveChiB() {
273  
274    prevChi = chi;
275    chi = oldChi + dt2 * ( instaTemp / targetTemp - 1.0) / tt2;
276   }
277  
278 < template<typename T> bool NPT<T>::chiConverged() {
278 > bool NPT::chiConverged() {
279  
280    return ( fabs( prevChi - chi ) <= chiTolerance );
281   }
282  
283 < template<typename T> int NPT<T>::readyCheck() {
283 > int NPT::readyCheck() {
284  
285    //check parent's readyCheck() first
286 <  if (T::readyCheck() == -1)
286 >  if (Integrator::readyCheck() == -1)
287      return -1;
288  
289    // First check to see if we have a target temperature.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines