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 1097 by gezelter, Mon Apr 12 20:32:20 2004 UTC vs.
Revision 1144 by tim, Sat May 1 18:52:38 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 322 | Line 325 | int SimInfo::getNDF(){
325   int SimInfo::getNDF(){
326    int ndf_local;
327  
328 +  ndf_local = 0;
329 +  
330    for(int i = 0; i < integrableObjects.size(); i++){
331      ndf_local += 3;
332 <    if (integrableObjects[i]->isDirectional())
333 <      ndf_local += 3;
332 >    if (integrableObjects[i]->isDirectional()) {
333 >      if (integrableObjects[i]->isLinear())
334 >        ndf_local += 2;
335 >      else
336 >        ndf_local += 3;
337 >    }
338    }
339  
340    // n_constraints is local, so subtract them on each processor:
# Line 350 | Line 359 | int SimInfo::getNDFraw() {
359    int ndfRaw_local;
360  
361    // Raw degrees of freedom that we have to set
362 +  ndfRaw_local = 0;
363  
364    for(int i = 0; i < integrableObjects.size(); i++){
365      ndfRaw_local += 3;
366 <    if (integrableObjects[i]->isDirectional())
367 <      ndfRaw_local += 3;
366 >    if (integrableObjects[i]->isDirectional()) {
367 >       if (integrableObjects[i]->isLinear())
368 >        ndfRaw_local += 2;
369 >      else
370 >        ndfRaw_local += 3;
371 >    }
372    }
373      
374   #ifdef IS_MPI
# Line 383 | Line 397 | int SimInfo::getNDFtranslational() {
397    return ndfTrans;
398   }
399  
400 + int SimInfo::getTotIntegrableObjects() {
401 +  int nObjs_local;
402 +  int nObjs;
403 +
404 +  nObjs_local =  integrableObjects.size();
405 +
406 +
407 + #ifdef IS_MPI
408 +  MPI_Allreduce(&nObjs_local,&nObjs,1,MPI_INT,MPI_SUM, MPI_COMM_WORLD);
409 + #else
410 +  nObjs = nObjs_local;
411 + #endif
412 +
413 +
414 +  return nObjs;
415 + }
416 +
417   void SimInfo::refreshSim(){
418  
419    simtype fInfo;
# Line 411 | 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
# Line 420 | Line 451 | void SimInfo::refreshSim(){
451  
452    isError = 0;
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 <                  &isError );
457 >                                    &nGlobalExcludes, globalExcludes, molMembershipArray,
458 >                                    &mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError );
459  
460    if( isError ){
461  
# Line 482 | 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 561 | Line 594 | GenericData* SimInfo::getProperty(const string& propNa
594      return NULL;  
595   }
596  
564 vector<GenericData*> SimInfo::getProperties(){
597  
598 <  vector<GenericData*> result;
599 <  map<string, GenericData*>::iterator i;
600 <  
601 <  for(i = properties.begin(); i != properties.end(); i++)
602 <    result.push_back((*i).second);
598 > void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup,
599 >                                                          vector<int>& groupList, vector<int>& groupStart){
600 >  Molecule* mol;
601 >  int numAtom;
602 >  int curIndex;
603 >
604 >  mfact.clear();
605 >  groupList.clear();
606 >  groupStart.clear();
607 >
608 >  //Be careful, fortran array begin at 1
609 >  curIndex = 1;
610      
611 <  return result;
611 >  if(info->useMolecularCutoffs){
612 >    //if using molecular cutoff
613 >    ngroup = info->n_mol;
614 >
615 >    for(int i = 0; i < ngroup; i ++){
616 >      mol = &(info->molecules[i]);
617 >      numAtom = mol->getNAtoms();
618 >      
619 >      for(int j=0; j < numAtom; j++){
620 > #ifdef IS_MPI
621 >        groupList.push_back((info->atoms[i])->getGlobalIndex() + 1);
622 > #else
623 >        groupList.push_back((info->atoms[i])->getIndex() + 1);
624 > #endif
625 >      }//for(int j=0; j < numAtom; j++)
626 >            
627 >      groupStart.push_back(curIndex);
628 >      curIndex += numAtom;
629 >      
630 >    }//end for(int i =0 ; i < ngroup; i++)    
631 >  }
632 >  else{
633 >    //using atomic cutoff, every single atom is just a group
634 >    ngroup = info->n_atoms;
635 >    for(int i =0 ; i < ngroup; i++){
636 >      groupStart.push_back(curIndex++);
637 >
638 > #ifdef IS_MPI
639 >      groupList.push_back((info->atoms[i])->getGlobalIndex() + 1);
640 > #else
641 >      groupList.push_back((info->atoms[i])->getIndex() + 1);
642 > #endif
643 >
644 >    }//end for(int i =0 ; i < ngroup; i++)
645 >
646 >  }//end if (info->useMolecularCutoffs)
647 >
648   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines