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 855 by mmeineke, Thu Nov 6 22:01:37 2003 UTC vs.
Revision 859 by mmeineke, Mon Nov 10 21:50:36 2003 UTC

# Line 37 | Line 37 | SimInfo::SimInfo(){
37    thermalTime = 0.0;
38    currentTime = 0.0;
39    rCut = 0.0;
40  origRcut = -1.0;
40    ecr = 0.0;
42  origEcr = -1.0;
41    est = 0.0;
44  oldEcr = 0.0;
45  oldRcut = 0.0;
42  
43 <  haveOrigRcut = 0;
44 <  haveOrigEcr = 0;
43 >  haveRcut = 0;
44 >  haveEcr = 0;
45    boxIsInit = 0;
46    
47    resetTime = 1e99;
# Line 104 | Line 100 | void SimInfo::setBoxM( double theBox[3][3] ){
100                           // [ 2 5 8 ]
101    double FortranHmatInv[9]; // the inverted Hmat (for Fortran);
102  
107  
103    if( !boxIsInit ) boxIsInit = 1;
104  
105    for(i=0; i < 3; i++)
# Line 529 | Line 524 | void SimInfo::refreshSim(){
524    this->ndf = this->getNDF();
525    this->ndfRaw = this->getNDFraw();
526    this->ndfTrans = this->getNDFtranslational();
532 }
533
534
535 void SimInfo::setRcut( double theRcut ){
536
537  rCut = theRcut;
538  checkCutOffs();
527   }
528  
529   void SimInfo::setDefaultRcut( double theRcut ){
530  
531 <  haveOrigRcut = 1;
544 <  origRcut = theRcut;
531 >  haveRcut = 1;
532    rCut = theRcut;
533  
534    ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0;
# Line 549 | Line 536 | void SimInfo::setEcr( double theEcr ){
536    notifyFortranCutOffs( &rCut, &rList, &ecr, &est );
537   }
538  
552 void SimInfo::setEcr( double theEcr ){
553
554  ecr = theEcr;
555  checkCutOffs();
556 }
557
539   void SimInfo::setDefaultEcr( double theEcr ){
540  
541 <  haveOrigEcr = 1;
561 <  origEcr = theEcr;
541 >  haveEcr = 1;
542    
543    ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0;
544  
# Line 567 | Line 547 | void SimInfo::setEcr( double theEcr, double theEst ){
547    notifyFortranCutOffs( &rCut, &rList, &ecr, &est );
548   }
549  
570 void SimInfo::setEcr( double theEcr, double theEst ){
571
572  est = theEst;
573  setEcr( theEcr );
574 }
575
550   void SimInfo::setDefaultEcr( double theEcr, double theEst ){
551  
552    est = theEst;
# Line 581 | Line 555 | void SimInfo::checkCutOffs( void ){
555  
556  
557   void SimInfo::checkCutOffs( void ){
584
585  int cutChanged = 0;
558    
559    if( boxIsInit ){
560      
561      //we need to check cutOffs against the box
562 <
563 <    //detect the change of rCut
592 <    if(( maxCutoff > rCut )&&(usePBC)){
593 <      if( rCut < origRcut ){
594 <        rCut = origRcut;
595 <        
596 <        if (rCut > maxCutoff)
597 <          rCut = maxCutoff;
598 <  
599 <          sprintf( painCave.errMsg,
600 <                    "New Box size is setting the long range cutoff radius "
601 <                    "to %lf at time %lf\n",
602 <                    rCut, currentTime );
603 <          painCave.isFatal = 0;
604 <          simError();
605 <      }
606 <    }
607 <    else if ((rCut > maxCutoff)&&(usePBC)) {
562 >    
563 >    if( rCut > maxCutoff ){
564        sprintf( painCave.errMsg,
565 <               "New Box size is setting the long range cutoff radius "
566 <               "to %lf at time %lf\n",
567 <               maxCutoff, currentTime );
568 <      painCave.isFatal = 0;
565 >               "Box size is too small for the long range cutoff radius, "
566 >               "%lf, at time %lf\n",
567 >               rCut, currentTime );
568 >      painCave.isFatal = 1;
569        simError();
614      rCut = maxCutoff;
570      }
571 <
572 <
573 <    //detect the change of ecr
574 <    if( maxCutoff > ecr ){
575 <      if( ecr < origEcr ){
576 <        ecr = origEcr;
577 <        if (ecr > maxCutoff) ecr = maxCutoff;
578 <  
579 <          sprintf( painCave.errMsg,
625 <                    "New Box size is setting the electrostaticCutoffRadius "
626 <                    "to %lf at time %lf\n",
627 <                    ecr, currentTime );
628 <            painCave.isFatal = 0;
629 <            simError();
571 >    
572 >    if( haveEcr ){
573 >      if( ecr > maxCutoff ){
574 >        sprintf( painCave.errMsg,
575 >                 "Box size is too small for the electrostatic cutoff radius, "
576 >                 "%lf, at time %lf\n",
577 >                 ecr, currentTime );
578 >        painCave.isFatal = 1;
579 >        simError();
580        }
581      }
632    else if( ecr > maxCutoff){
633      sprintf( painCave.errMsg,
634               "New Box size is setting the electrostaticCutoffRadius "
635               "to %lf at time %lf\n",
636               maxCutoff, currentTime  );
637      painCave.isFatal = 0;
638      simError();      
639      ecr = maxCutoff;
640    }
641
642    if( (oldEcr != ecr) || ( oldRcut != rCut ) ) cutChanged = 1;
643    
644    // rlist is the 1.0 plus max( rcut, ecr )
645    
646    ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0;
647    
648    if( cutChanged ){
649      notifyFortranCutOffs( &rCut, &rList, &ecr, &est );
650    }
651    
652    oldEcr = ecr;
653    oldRcut = rCut;
654    
582    } else {
583      // initialize this stuff before using it, OK?
584      sprintf( painCave.errMsg,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines