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 1125 by gezelter, Mon Apr 19 22:13:01 2004 UTC vs.
Revision 1150 by gezelter, Fri May 7 21:35:05 2004 UTC

# Line 63 | Line 63 | SimInfo::SimInfo(){
63    useReactionField = 0;
64    useGB = 0;
65    useEAM = 0;
66 +  useMolecularCutoffs = 0;
67  
68    excludes = Exclude::Instance();
69  
# Line 71 | Line 72 | SimInfo::SimInfo(){
72    has_minimizer = false;
73    the_minimizer =NULL;
74  
75 +  ngroup = 0;
76 +
77    wrapMeSimInfo( this );
78   }
79  
# Line 83 | Line 86 | SimInfo::~SimInfo(){
86    
87    for(i = properties.begin(); i != properties.end(); i++)
88      delete (*i).second;
89 <    
89 >  
90   }
91  
92   void SimInfo::setBox(double newBox[3]) {
# Line 349 | Line 352 | int SimInfo::getNDF(){
352  
353    ndf = ndf - 3 - nZconstraints;
354  
352  std::cerr << "ndf = " << ndf;
353
355    return ndf;
356   }
357  
# Line 441 | Line 442 | void SimInfo::refreshSim(){
442  
443    n_exclude = excludes->getSize();
444    excl = excludes->getFortranArray();
445 <
445 >  
446   #ifdef IS_MPI
447    n_global = mpiSim->getTotAtoms();
448   #else
449    n_global = n_atoms;
450   #endif
451 <
451 >  
452    isError = 0;
453 <
454 <  setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl,
455 <                  &nGlobalExcludes, globalExcludes, molMembershipArray,
456 <                  &isError );
457 <
453 >  
454 >  getFortranGroupArray(this, mfact, ngroup, groupList, groupStart);
455 >  
456 >  setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl,
457 >                  &nGlobalExcludes, globalExcludes, molMembershipArray,
458 >                  &mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError);
459 >  
460    if( isError ){
461 <
461 >    
462      sprintf( painCave.errMsg,
463 <             "There was an error setting the simulation information in fortran.\n" );
463 >             "There was an error setting the simulation information in fortran.\n" );
464      painCave.isFatal = 1;
465      simError();
466    }
467 <
467 >  
468   #ifdef IS_MPI
469    sprintf( checkPointMsg,
470             "succesfully sent the simulation information to fortran.\n");
471    MPIcheckPoint();
472   #endif // is_mpi
473 <
473 >  
474    this->ndf = this->getNDF();
475    this->ndfRaw = this->getNDFraw();
476    this->ndfTrans = this->getNDFtranslational();
477   }
478  
479   void SimInfo::setDefaultRcut( double theRcut ){
480 <
480 >  
481    haveRcut = 1;
482    rCut = theRcut;
483 <
483 >  
484    ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0;
485 <
485 >  
486    notifyFortranCutOffs( &rCut, &rList, &ecr, &est );
487   }
488  
# Line 512 | Line 515 | void SimInfo::checkCutOffs( void ){
515                 "\tCurrent Value of LJrcut = %G at time %G\n "
516                 "\tThis is larger than half of at least one of the\n"
517                 "\tperiodic box vectors.  Right now, the Box matrix is:\n"
518 <               "\n, %G"
518 >               "\n"
519                 "\t[ %G %G %G ]\n"
520                 "\t[ %G %G %G ]\n"
521                 "\t[ %G %G %G ]\n",
522 <               rCut, currentTime, maxCutoff,
522 >               rCut, currentTime,
523                 Hmat[0][0], Hmat[0][1], Hmat[0][2],
524                 Hmat[1][0], Hmat[1][1], Hmat[1][2],
525                 Hmat[2][0], Hmat[2][1], Hmat[2][2]);
# Line 590 | Line 593 | GenericData* SimInfo::getProperty(const string& propNa
593    else  
594      return NULL;  
595   }
596 +
597 +
598 + void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup,
599 +                          vector<int>& groupList, vector<int>& groupStart){
600 +  Molecule* mol;
601 +  Atom** myAtoms;
602 +  int numAtom;
603 +  int curIndex;
604 +  double mtot;
605 +
606 +  mfact.clear();
607 +  groupList.clear();
608 +  groupStart.clear();
609 +  
610 +  //Be careful, fortran array begin at 1
611 +  curIndex = 1;
612 +  
613 +  if(info->useMolecularCutoffs){
614 +    
615 + #ifdef IS_MPI
616 +    ngroup = mpiSim->getMyNMol();
617 + #else
618 +    ngroup = info->n_mol;
619 + #endif
620 +    
621 +    for(int i = 0; i < ngroup; i ++){
622 +      mol = &(info->molecules[i]);
623 +      numAtom = mol->getNAtoms();
624 +      myAtoms = mol->getMyAtoms();
625 +      mtot = 0.0;
626  
627 +      for(int j=0; j < numAtom; j++)
628 +        mtot += myAtoms[j]->getMass();                
629 +      
630 +      for(int j=0; j < numAtom; j++){
631 +              
632 +        // We want the local Index:
633 +        groupList.push_back(myAtoms[j]->getIndex() + 1);
634 +        mfact.push_back(myAtoms[j]->getMass() / mtot);
635 +
636 +      }
637 +      
638 +      groupStart.push_back(curIndex);
639 +      curIndex += numAtom;
640 +      
641 +    } //end for(int i =0 ; i < ngroup; i++)    
642 +  }
643 +  else{
644 +    //using atomic cutoff, every single atom is just a group
645 +    
646 + #ifdef IS_MPI
647 +    ngroup = mpiSim->getMyNlocal();
648 + #else
649 +    ngroup = info->n_atoms;
650 + #endif
651 +    
652 +    for(int i =0 ; i < ngroup; i++){
653 +      groupStart.push_back(curIndex++);      
654 +      groupList.push_back((info->atoms[i])->getIndex() + 1);
655 +      mfact.push_back(1.0);
656 +      
657 +    }//end for(int i =0 ; i < ngroup; i++)
658 +    
659 +  }//end if (info->useMolecularCutoffs)
660 +  
661 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines