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 699 by tim, Fri Aug 15 19:24:13 2003 UTC vs.
Revision 770 by gezelter, Fri Sep 19 14:55:41 2003 UTC

# Line 385 | Line 385 | int SimInfo::getNDFraw() {
385  
386    return ndfRaw;
387   }
388 <
388 >
389 > int SimInfo::getNDFtranslational() {
390 >  int ndfTrans_local, ndfTrans;
391 >
392 >  ndfTrans_local = 3 * n_atoms - n_constraints;
393 >
394 > #ifdef IS_MPI
395 >  MPI_Allreduce(&ndfTrans_local,&ndfTrans,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD);
396 > #else
397 >  ndfTrans = ndfTrans_local;
398 > #endif
399 >
400 >  ndfTrans = ndfTrans - 3 - nZconstraints;
401 >
402 >  return ndfTrans;
403 > }
404 >
405   void SimInfo::refreshSim(){
406  
407    simtype fInfo;
# Line 441 | Line 457 | void SimInfo::refreshSim(){
457  
458    this->ndf = this->getNDF();
459    this->ndfRaw = this->getNDFraw();
460 <
460 >  this->ndfTrans = this->getNDFtranslational();
461   }
462  
463  
# Line 477 | Line 493 | void SimInfo::checkCutOffs( void ){
493   void SimInfo::checkCutOffs( void ){
494  
495    int cutChanged = 0;
496 <
481 <
482 <
496 >  
497    if( boxIsInit ){
498      
499      //we need to check cutOffs against the box
500 <  
500 >    
501      if(( maxCutoff > rCut )&&(usePBC)){
502        if( rCut < origRcut ){
503          rCut = origRcut;
# Line 491 | Line 505 | void SimInfo::checkCutOffs( void ){
505          
506          sprintf( painCave.errMsg,
507                   "New Box size is setting the long range cutoff radius "
508 <                 "to %lf\n",
509 <                 rCut );
508 >                 "to %lf at time %lf\n",
509 >                 rCut, currentTime );
510          painCave.isFatal = 0;
511          simError();
512        }
513      }
514 <
514 >    
515      if( maxCutoff > ecr ){
516        if( ecr < origEcr ){
517 <        rCut = origEcr;
517 >        ecr = origEcr;
518          if (ecr > maxCutoff) ecr = maxCutoff;
519          
520          sprintf( painCave.errMsg,
521                   "New Box size is setting the electrostaticCutoffRadius "
522 <                 "to %lf\n",
523 <                 ecr );
522 >                 "to %lf at time %lf\n",
523 >                 ecr, currentTime );
524          painCave.isFatal = 0;
525          simError();
526        }
527      }
528 <
529 <
528 >    
529 >    
530      if ((rCut > maxCutoff)&&(usePBC)) {
531        sprintf( painCave.errMsg,
532                 "New Box size is setting the long range cutoff radius "
533 <               "to %lf\n",
534 <               maxCutoff );
533 >               "to %lf at time %lf\n",
534 >               maxCutoff, currentTime );
535        painCave.isFatal = 0;
536        simError();
537        rCut = maxCutoff;
538      }
539 <
539 >    
540      if( ecr > maxCutoff){
541        sprintf( painCave.errMsg,
542                 "New Box size is setting the electrostaticCutoffRadius "
543 <               "to %lf\n",
544 <               maxCutoff  );
543 >               "to %lf at time %lf\n",
544 >               maxCutoff, currentTime  );
545        painCave.isFatal = 0;
546        simError();      
547        ecr = maxCutoff;
548      }
549  
550 +    if( (oldEcr != ecr) || ( oldRcut != rCut ) ) cutChanged = 1;
551      
552 <  }
538 <  
539 <
540 <  if( (oldEcr != ecr) || ( oldRcut != rCut ) ) cutChanged = 1;
541 <
542 <  // rlist is the 1.0 plus max( rcut, ecr )
543 <  
544 <  ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0;
545 <
546 <  if( cutChanged ){
552 >    // rlist is the 1.0 plus max( rcut, ecr )
553      
554 <    notifyFortranCutOffs( &rCut, &rList, &ecr, &est );
554 >    ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0;
555 >    
556 >    if( cutChanged ){
557 >      
558 >      notifyFortranCutOffs( &rCut, &rList, &ecr, &est );
559 >    }
560 >    
561 >    oldEcr = ecr;
562 >    oldRcut = rCut;
563 >    
564 >  } else {
565 >    // initialize this stuff before using it, OK?
566 >    sprintf( painCave.errMsg,
567 >             "Trying to check cutoffs without a box. Be smarter.\n" );
568 >    painCave.isFatal = 1;
569 >    simError();      
570    }
571 <
551 <  oldEcr = ecr;
552 <  oldRcut = rCut;
571 >  
572   }
573  
574   void SimInfo::addProperty(GenericData* prop){
# Line 599 | Line 618 | vector<GenericData*> SimInfo::getProperties(){
618    return result;
619   }
620  
621 + double SimInfo::matTrace3(double m[3][3]){
622 +  double trace;
623 +  trace = m[0][0] + m[1][1] + m[2][2];
624  
625 +  return trace;
626 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines