ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/brains/SimCreator.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/brains/SimCreator.cpp (file contents):
Revision 1733 by tim, Fri Nov 12 06:19:04 2004 UTC vs.
Revision 1740 by tim, Mon Nov 15 23:00:32 2004 UTC

# Line 35 | Line 35 | void SimSetup::parseFile(const std::string& mdFileName
35  
36   namespace oopse {
37  
38 < void SimSetup::parseFile(const std::string& mdFileName, MakeStamps *stamps, Globals *globals) {
38 > void SimCreator::parseFile(const std::string& mdFileName, MakeStamps *stamps, Globals *globals) {
39  
40   #ifdef IS_MPI
41  
# Line 81 | Line 81 | SimInfo*  SimCreator::createSim(const std::string & md
81      //create the force field
82      ForceFiled * ff = ForceFieldFactory::getInstance()->createObject(
83                            globals->getForceField());
84 <
84 >    
85      if (ff == NULL) {
86          sprintf(painCave.errMsg, "ForceFiled Factory can not create %s force field\n",
87                  globals->getForceField());
88          painCave.isFatal = 1;
89          simError();
90      }
91 +    ff->parse();
92  
93      //extract the molecule stamps
94      std::vector < std::pair<MoleculeStamp *, int> > moleculeStampPairs;
# Line 513 | Line 514 | void SimCreator::setGlobalIndex(SimInfo *info) {
514          }
515      }
516  
517 +    //fill globalGroupMembership
518      std::vector<int> globalGroupMembership(info->getNGlobalAtoms(), 0);
519      for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) {        
520          for (cg = mol->beginCutoffGroup(ci); cg != NULL; cg = mol->nextCutoffGroup(ci)) {
# Line 523 | Line 525 | void SimCreator::setGlobalIndex(SimInfo *info) {
525  
526          }      
527      }
528 <    
528 >
529 > #ifdef IS_MPI    
530      // Since the globalGroupMembership has been zero filled and we've only
531      // poked values into the atoms we know, we can do an Allreduce
532      // to get the full globalGroupMembership array (We think).
# Line 534 | Line 537 | void SimCreator::setGlobalIndex(SimInfo *info) {
537                    info->getGlobalGroupMembershipPointer(),
538                    info->getNGlobalAtoms(),
539                    MPI_INT, MPI_SUM, MPI_COMM_WORLD);
540 + #else
541 +    std::copy(globalGroupMembership.begin(), globalGroupMembership.end(),
542 +        info->getGlobalGroupMembershipPointer());
543 + #endif
544  
545      //fill molMembership
546      std::vector<int> globalMolMembership(info->getNGlobalAtoms(), 0);
# Line 544 | Line 551 | void SimCreator::setGlobalIndex(SimInfo *info) {
551              globalMolMembership[atom->getGlobalIndex()] = mol->getGlobalIndex();
552          }
553  
554 + #ifdef IS_MPI
555      MPI_Allreduce(&globalMolMembership[0],
556                    info->getGlobalMolMembershipPointer(),
557                    info->getNGlobalAtoms(),
558                    MPI_INT, MPI_SUM, MPI_COMM_WORLD);
559 <        
560 < }
561 <
554 <
555 < void SimCreator::initFortran(SimInfo* info) {
556 <    info->update();
557 <
558 <    std::vector<AtomType*> atomTypes;
559 <    std::vector<AtomType*>::iterator i;
560 <    std::vector<double> cutoffRadius;
561 <    ForceField* ff;
562 <
563 <    //get the unique atom types
564 <    atomTypes = info->getUniqueAtomTypes();
565 <
566 <    ff = info->getForceField();
567 <
568 <    //query the max cutoff radius among these atom types
569 <    for (i = atomTypes.begin(); i != atomTypes.end(); ++i) {
570 <        cutoffRadius.push_back(ff->(*i));
571 <    }
572 <
573 <    double maxCutoffRadius = std::max_element(cutoffRadius.begin(), cutoffRadius.end());
574 <
575 < #ifdef IS_MPI
576 <    //pick the max cutoff radius among the processors
559 > #else
560 >    std::copy(globalMolMembership.begin(), globalMolMembership.end(),
561 >        info->getGlobalMolMembershipPointer());
562   #endif
563  
579    
580    
564   }
565  
566   void SimCreator::loadCoordinates(SimInfo* info) {
# Line 597 | Line 580 | void SimCreator::loadCoordinates(SimInfo* info) {
580      if (nframes > 0) {
581          reader.readFrame(info, nframes - 1);
582      } else {
583 <    //invalid initial coordinate file
583 >        //invalid initial coordinate file
584          sprintf(painCave.errMsg, "Initial configuration file %s should at least contain one frame\n",
585                  globals->getInitialConfig());
586          painCave.isFatal = 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines