--- trunk/OOPSE/libmdtools/SimInfo.cpp 2003/07/16 21:30:56 626 +++ trunk/OOPSE/libmdtools/SimInfo.cpp 2003/08/15 19:24:13 699 @@ -26,15 +26,20 @@ SimInfo::SimInfo(){ SimInfo::SimInfo(){ excludes = NULL; n_constraints = 0; + nZconstraints = 0; n_oriented = 0; n_dipoles = 0; ndf = 0; ndfRaw = 0; + nZconstraints = 0; the_integrator = NULL; setTemp = 0; thermalTime = 0.0; + currentTime = 0.0; rCut = 0.0; + origRcut = -1.0; ecr = 0.0; + origEcr = -1.0; est = 0.0; oldEcr = 0.0; oldRcut = 0.0; @@ -53,7 +58,21 @@ SimInfo::SimInfo(){ useGB = 0; useEAM = 0; + myConfiguration = new SimState(); + wrapMeSimInfo( this ); +} + + +SimInfo::~SimInfo(){ + + delete myConfiguration; + + map::iterator i; + + for(i = properties.begin(); i != properties.end(); i++) + delete (*i).second; + } void SimInfo::setBox(double newBox[3]) { @@ -291,6 +310,8 @@ void SimInfo::calcBoxL( void ){ dsq = dx*dx + dy*dy + dz*dz; boxL[2] = sqrt( dsq ); if( (0.5 * boxL[2]) < maxCutoff ) maxCutoff = 0.5 * boxL[2]; + + checkCutOffs(); } @@ -345,7 +366,7 @@ int SimInfo::getNDF(){ ndf = ndf_local; #endif - ndf = ndf - 3; + ndf = ndf - 3 - nZconstraints; return ndf; } @@ -457,11 +478,13 @@ void SimInfo::checkCutOffs( void ){ int cutChanged = 0; + + if( boxIsInit ){ //we need to check cutOffs against the box - - if( maxCutoff > rCut ){ + + if(( maxCutoff > rCut )&&(usePBC)){ if( rCut < origRcut ){ rCut = origRcut; if (rCut > maxCutoff) rCut = maxCutoff; @@ -490,7 +513,7 @@ void SimInfo::checkCutOffs( void ){ } - if (rCut > maxCutoff) { + if ((rCut > maxCutoff)&&(usePBC)) { sprintf( painCave.errMsg, "New Box size is setting the long range cutoff radius " "to %lf\n", @@ -527,4 +550,53 @@ void SimInfo::checkCutOffs( void ){ oldEcr = ecr; oldRcut = rCut; +} + +void SimInfo::addProperty(GenericData* prop){ + + map::iterator result; + result = properties.find(prop->getID()); + + //we can't simply use properties[prop->getID()] = prop, + //it will cause memory leak if we already contain a propery which has the same name of prop + + if(result != properties.end()){ + + delete (*result).second; + (*result).second = prop; + + } + else{ + + properties[prop->getID()] = prop; + + } + } + +GenericData* SimInfo::getProperty(const string& propName){ + + map::iterator result; + + //string lowerCaseName = (); + + result = properties.find(propName); + + if(result != properties.end()) + return (*result).second; + else + return NULL; +} + +vector SimInfo::getProperties(){ + + vector result; + map::iterator i; + + for(i = properties.begin(); i != properties.end(); i++) + result.push_back((*i).second); + + return result; +} + +