ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/SimSetup.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/SimSetup.cpp (file contents):
Revision 1108 by tim, Wed Apr 14 15:37:41 2004 UTC vs.
Revision 1139 by gezelter, Wed Apr 28 22:06:29 2004 UTC

# Line 147 | Line 147 | void SimSetup::createSim(void){
147    // make the output filenames
148  
149    makeOutNames();
150
151  if (globals->haveMinimizer())
152    // make minimizer
153    makeMinimizer();
154  else
155    // make the integrator
156    makeIntegrator();
150    
151   #ifdef IS_MPI
152    mpiSim->mpiRefresh();
# Line 162 | Line 155 | void SimSetup::createSim(void){
155    // initialize the Fortran
156  
157    initFortran();
158 +
159 +  if (globals->haveMinimizer())
160 +    // make minimizer
161 +    makeMinimizer();
162 +  else
163 +    // make the integrator
164 +    makeIntegrator();
165 +
166   }
167  
168  
# Line 262 | Line 263 | void SimSetup::makeMolecules(void){
263          else{
264  
265            molInfo.myAtoms[j] = new Atom((j + atomOffset), info[k].getConfiguration());
266 +
267          }
268  
269          molInfo.myAtoms[j]->setType(currentAtom->getType());
268
270   #ifdef IS_MPI
271  
272          molInfo.myAtoms[j]->setGlobalIndex(globalAtomIndex[j + atomOffset]);
# Line 409 | Line 410 | void SimSetup::makeMolecules(void){
410          info[k].excludes->addPair(exK, exL);
411        }
412  
413 +      
414 +      molInfo.myRigidBodies.clear();
415 +      
416        for (j = 0; j < molInfo.nRigidBodies; j++){
417  
418          currentRigidBody = comp_stamps[stampID]->getRigidBody(j);
# Line 418 | Line 422 | void SimSetup::makeMolecules(void){
422  
423          myRB = new RigidBody();
424  
425 <        sprintf(rbName,"%s_RB_%s", molName, j);
425 >        sprintf(rbName,"%s_RB_%d", molName, j);
426          myRB->setType(rbName);
427          
428          for (rb1 = 0; rb1 < nMembers; rb1++) {
# Line 460 | Line 464 | void SimSetup::makeMolecules(void){
464              // used for the exclude list:
465              
466   #ifdef IS_MPI
467 <            exI = info[k].atoms[tempI]->getGlobalIndex() + 1;
468 <            exJ = info[k].atoms[tempJ]->getGlobalIndex() + 1;
467 >            exI = molInfo.myAtoms[tempI]->getGlobalIndex() + 1;
468 >            exJ = molInfo.myAtoms[tempJ]->getGlobalIndex() + 1;
469   #else
470 <            exI = tempI + 1;
471 <            exJ = tempJ + 1;
470 >            exI = molInfo.myAtoms[tempI]->getIndex() + 1;
471 >            exJ = molInfo.myAtoms[tempJ]->getIndex() + 1;
472   #endif
473              
474              info[k].excludes->addPair(exI, exJ);
# Line 480 | Line 484 | void SimSetup::makeMolecules(void){
484        // After this is all set up, scan through the atoms to
485        // see if they can be added to the integrableObjects:
486  
487 +      molInfo.myIntegrableObjects.clear();
488 +      
489 +
490        for (j = 0; j < molInfo.nAtoms; j++){
491  
492   #ifdef IS_MPI
# Line 827 | Line 834 | void SimSetup::gatherInfo(void){
834    }
835  
836    //check whether sample time, status time, thermal time and reset time are divisble by dt
837 <  if (!isDivisible(globals->getSampleTime(), globals->getDt())){
837 >  if (globals->haveSampleTime() && !isDivisible(globals->getSampleTime(), globals->getDt())){
838      sprintf(painCave.errMsg,
839              "Sample time is not divisible by dt.\n"
840              "\tThis will result in samples that are not uniformly\n"
# Line 837 | Line 844 | void SimSetup::gatherInfo(void){
844      simError();    
845    }
846  
847 <  if (globals->haveStatusTime() && !isDivisible(globals->getSampleTime(), globals->getDt())){
847 >  if (globals->haveStatusTime() && !isDivisible(globals->getStatusTime(), globals->getDt())){
848      sprintf(painCave.errMsg,
849              "Status time is not divisible by dt.\n"
850              "\tThis will result in status reports that are not uniformly\n"
# Line 873 | Line 880 | void SimSetup::gatherInfo(void){
880      if (globals->haveSampleTime()){
881        info[i].sampleTime = globals->getSampleTime();
882        info[i].statusTime = info[i].sampleTime;
876      info[i].thermalTime = info[i].sampleTime;
883      }
884      else{
885        info[i].sampleTime = globals->getRunTime();
886        info[i].statusTime = info[i].sampleTime;
881      info[i].thermalTime = info[i].sampleTime;
887      }
888  
889      if (globals->haveStatusTime()){
# Line 887 | Line 892 | void SimSetup::gatherInfo(void){
892  
893      if (globals->haveThermalTime()){
894        info[i].thermalTime = globals->getThermalTime();
895 +    } else {
896 +      info[i].thermalTime = globals->getRunTime();
897      }
898  
899      info[i].resetIntegrator = 0;
# Line 904 | Line 911 | void SimSetup::gatherInfo(void){
911  
912      info[i].useInitXSstate = globals->getUseInitXSstate();
913      info[i].orthoTolerance = globals->getOrthoBoxTolerance();
914 +    info[i].useMolecularCutoffs = globals->getUseMolecularCutoffs();
915 +
916      
917    }
918    
# Line 957 | Line 966 | void SimSetup::finalInfoCheck(void){
966   void SimSetup::finalInfoCheck(void){
967    int index;
968    int usesDipoles;
969 +  int usesCharges;
970    int i;
971  
972    for (i = 0; i < nInfo; i++){
# Line 968 | Line 978 | void SimSetup::finalInfoCheck(void){
978        usesDipoles = (info[i].atoms[index])->hasDipole();
979        index++;
980      }
981 <
981 >    index = 0;
982 >    usesCharges = 0;
983 >    while ((index < info[i].n_atoms) && !usesCharges){
984 >      usesCharges= (info[i].atoms[index])->hasCharge();
985 >      index++;
986 >    }
987   #ifdef IS_MPI
988      int myUse = usesDipoles;
989      MPI_Allreduce(&myUse, &usesDipoles, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD);
# Line 1019 | Line 1034 | void SimSetup::finalInfoCheck(void){
1034        info[i].dielectric = globals->getDielectric();
1035      }
1036      else{
1037 <      if (usesDipoles){
1037 >      if (usesDipoles || usesCharges){
1038          if (!globals->haveECR()){
1039            sprintf(painCave.errMsg,
1040                    "SimSetup Warning: No value was set for electrostaticCutoffRadius.\n"
# Line 1352 | Line 1367 | void SimSetup::mpiMolDivide(void){
1367    int localMol, allMol;
1368    int local_atoms, local_bonds, local_bends, local_torsions, local_SRI;
1369    int local_rigid;
1355  vector<int> globalAtomIndex;
1370    vector<int> globalMolIndex;
1371  
1372    mpiSim = new mpiSimulation(info);
1373  
1374    mpiSim->divideLabor();
1375    globalAtomIndex = mpiSim->getGlobalAtomIndex();
1376 <  globalMolIndex = mpiSim->getGlobalMolIndex();
1376 >  //globalMolIndex = mpiSim->getGlobalMolIndex();
1377  
1378    // set up the local variables
1379  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines