ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/SimInfo.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/SimInfo.cpp (file contents):
Revision 642 by mmeineke, Mon Jul 21 16:23:57 2003 UTC vs.
Revision 674 by mmeineke, Mon Aug 11 18:29:46 2003 UTC

# Line 30 | Line 30 | SimInfo::SimInfo(){
30    n_dipoles = 0;
31    ndf = 0;
32    ndfRaw = 0;
33 +  nZconstraints = 0;
34    the_integrator = NULL;
35    setTemp = 0;
36    thermalTime = 0.0;
# Line 54 | Line 55 | SimInfo::SimInfo(){
55    useGB = 0;
56    useEAM = 0;
57  
58 +  myConfiguration = new SimState();
59 +
60    wrapMeSimInfo( this );
61   }
62  
63 +
64 + SimInfo::~SimInfo(){
65 +
66 +  delete myConfiguration;
67 +
68 +  map<string, GenericData*>::iterator i;
69 +  
70 +  for(i = properties.begin(); i != properties.end(); i++)
71 +    delete (*i).second;
72 +    
73 + }
74 +
75   void SimInfo::setBox(double newBox[3]) {
76    
77    int i, j;
# Line 292 | Line 307 | void SimInfo::calcBoxL( void ){
307    dsq = dx*dx + dy*dy + dz*dz;
308    boxL[2] = sqrt( dsq );
309    if( (0.5 * boxL[2]) < maxCutoff ) maxCutoff = 0.5 * boxL[2];
310 +  
311 +  checkCutOffs();
312  
313   }
314  
# Line 346 | Line 363 | int SimInfo::getNDF(){
363    ndf = ndf_local;
364   #endif
365  
366 <  ndf = ndf - 3;
366 >  ndf = ndf - 3 - nZconstraints;
367  
368    return ndf;
369   }
# Line 458 | Line 475 | void SimInfo::checkCutOffs( void ){
475  
476    int cutChanged = 0;
477  
478 +
479 +
480    if( boxIsInit ){
481      
482      //we need to check cutOffs against the box
483 <    
484 <    if( maxCutoff > rCut ){
483 >  
484 >    if(( maxCutoff > rCut )&&(usePBC)){
485        if( rCut < origRcut ){
486          rCut = origRcut;
487          if (rCut > maxCutoff) rCut = maxCutoff;
# Line 491 | Line 510 | void SimInfo::checkCutOffs( void ){
510      }
511  
512  
513 <    if (rCut > maxCutoff) {
513 >    if ((rCut > maxCutoff)&&(usePBC)) {
514        sprintf( painCave.errMsg,
515                 "New Box size is setting the long range cutoff radius "
516                 "to %lf\n",
# Line 528 | Line 547 | void SimInfo::checkCutOffs( void ){
547  
548    oldEcr = ecr;
549    oldRcut = rCut;
550 + }
551 +
552 + void SimInfo::addProperty(GenericData* prop){
553 +
554 +  map<string, GenericData*>::iterator result;
555 +  result = properties.find(prop->getID());
556 +  
557 +  //we can't simply use  properties[prop->getID()] = prop,
558 +  //it will cause memory leak if we already contain a propery which has the same name of prop
559 +  
560 +  if(result != properties.end()){
561 +    
562 +    delete (*result).second;
563 +    (*result).second = prop;
564 +      
565 +  }
566 +  else{
567 +
568 +    properties[prop->getID()] = prop;
569 +
570 +  }
571 +    
572   }
573 +
574 + GenericData* SimInfo::getProperty(const string& propName){
575 +
576 +  map<string, GenericData*>::iterator result;
577 +  
578 +  //string lowerCaseName = ();
579 +  
580 +  result = properties.find(propName);
581 +  
582 +  if(result != properties.end())
583 +    return (*result).second;  
584 +  else  
585 +    return NULL;  
586 + }
587 +
588 + vector<GenericData*> SimInfo::getProperties(){
589 +
590 +  vector<GenericData*> result;
591 +  map<string, GenericData*>::iterator i;
592 +  
593 +  for(i = properties.begin(); i != properties.end(); i++)
594 +    result.push_back((*i).second);
595 +    
596 +  return result;
597 + }
598 +
599 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines