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