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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines