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 699 by tim, Fri Aug 15 19:24:13 2003 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines