| 171 | 
  | 
  int i, j, k; | 
| 172 | 
  | 
  int exI, exJ, exK, exL, slI, slJ; | 
| 173 | 
  | 
  int tempI, tempJ, tempK, tempL; | 
| 174 | 
< | 
  int molI; | 
| 175 | 
< | 
  int stampID, atomOffset, rbOffset; | 
| 174 | 
> | 
  int molI, globalID; | 
| 175 | 
> | 
  int stampID, atomOffset, rbOffset, groupOffset; | 
| 176 | 
  | 
  molInit molInfo; | 
| 177 | 
  | 
  DirectionalAtom* dAtom; | 
| 178 | 
  | 
  RigidBody* myRB; | 
| 215 | 
  | 
 | 
| 216 | 
  | 
  for (k = 0; k < nInfo; k++){ | 
| 217 | 
  | 
    the_ff->setSimInfo(&(info[k])); | 
| 218 | 
+ | 
 | 
| 219 | 
+ | 
#ifdef IS_MPI | 
| 220 | 
+ | 
    info[k].globalGroupMembership = new int[mpiSim->getNAtomsGlobal()]; | 
| 221 | 
+ | 
    for (i = 0; i < mpiSim->getNAtomsGlobal(); i++)  | 
| 222 | 
+ | 
      info[k].globalGroupMembership[i] = 0; | 
| 223 | 
+ | 
#else | 
| 224 | 
+ | 
    info[k].globalGroupMembership = new int[info[k].n_atoms]; | 
| 225 | 
+ | 
    for (i = 0; i < info[k].n_atoms; i++)  | 
| 226 | 
+ | 
      info[k].globalGroupMembership[i] = 0; | 
| 227 | 
+ | 
#endif | 
| 228 | 
  | 
 | 
| 229 | 
  | 
    atomOffset = 0; | 
| 230 | 
  | 
    groupOffset = 0; | 
| 292 | 
  | 
 | 
| 293 | 
  | 
        molInfo.myAtoms[j]->setType(currentAtom->getType()); | 
| 294 | 
  | 
#ifdef IS_MPI | 
| 285 | 
– | 
 | 
| 295 | 
  | 
        molInfo.myAtoms[j]->setGlobalIndex(globalAtomIndex[j + atomOffset]); | 
| 287 | 
– | 
 | 
| 296 | 
  | 
#endif // is_mpi | 
| 297 | 
  | 
      }  | 
| 298 | 
  | 
 | 
| 514 | 
  | 
        nMembers = currentCutoffGroup->getNMembers();  | 
| 515 | 
  | 
 | 
| 516 | 
  | 
        myCutoffGroup = new CutoffGroup(); | 
| 517 | 
+ | 
         | 
| 518 | 
+ | 
#ifdef IS_MPI | 
| 519 | 
  | 
        myCutoffGroup->setGlobalIndex(globalGroupIndex[j + groupOffset]); | 
| 520 | 
+ | 
#else | 
| 521 | 
+ | 
        myCutoffGroup->setGlobalIndex(j + groupOffset); | 
| 522 | 
+ | 
#endif | 
| 523 | 
  | 
         | 
| 524 | 
  | 
        for (int cg = 0; cg < nMembers; cg++) { | 
| 525 | 
  | 
 | 
| 530 | 
  | 
          tempI = molI + atomOffset; | 
| 531 | 
  | 
 | 
| 532 | 
  | 
#ifdef IS_MPI | 
| 533 | 
< | 
          globalID = info[k].atoms[tempI]->getGlobalIndex() | 
| 533 | 
> | 
          globalID = info[k].atoms[tempI]->getGlobalIndex(); | 
| 534 | 
> | 
          info[k].globalGroupMembership[globalID] = globalGroupIndex[j+groupOffset]; | 
| 535 | 
  | 
#else  | 
| 536 | 
  | 
          globalID = info[k].atoms[tempI]->getIndex(); | 
| 537 | 
+ | 
          info[k].globalGroupMembership[globalID] = j + groupOffset; | 
| 538 | 
  | 
#endif | 
| 539 | 
+ | 
           | 
| 540 | 
  | 
 | 
| 541 | 
< | 
          globalGroupMembership[globalID] = globalGroupIndex[j+groupOffset];  | 
| 526 | 
< | 
 | 
| 541 | 
> | 
           | 
| 542 | 
  | 
          myCutoffGroup->addAtom(info[k].atoms[tempI]);           | 
| 543 | 
< | 
 | 
| 543 | 
> | 
           | 
| 544 | 
  | 
          cutoffAtomSet.insert(tempI); | 
| 545 | 
  | 
        } | 
| 546 | 
< | 
        | 
| 546 | 
> | 
         | 
| 547 | 
  | 
        molInfo.myCutoffGroups.push_back(myCutoffGroup); | 
| 548 | 
  | 
        groupOffset++; | 
| 549 | 
  | 
 | 
| 550 | 
  | 
      }//end for (j = 0; j < molInfo.nCutoffGroups; j++) | 
| 551 | 
< | 
 | 
| 551 | 
> | 
       | 
| 552 | 
  | 
      //creat a cutoff group for every atom  in current molecule which does not belong to cutoffgroup defined at mdl file | 
| 553 | 
< | 
 | 
| 553 | 
> | 
       | 
| 554 | 
  | 
      for(j = 0; j < molInfo.nAtoms; j++){ | 
| 555 | 
< | 
 | 
| 555 | 
> | 
         | 
| 556 | 
  | 
        if(cutoffAtomSet.find(molInfo.myAtoms[j]->getIndex()) == cutoffAtomSet.end()){ | 
| 557 | 
  | 
          myCutoffGroup = new CutoffGroup(); | 
| 558 | 
  | 
          myCutoffGroup->addAtom(molInfo.myAtoms[j]); | 
| 559 | 
< | 
          myCutoffGroup->setGlobalIndex(globalGroupIndex[j + groupOffset]); | 
| 559 | 
> | 
 | 
| 560 | 
  | 
#ifdef IS_MPI | 
| 561 | 
< | 
          globalID = info[k].atoms[atomOffset + j]->getGlobalIndex() | 
| 562 | 
< | 
#else  | 
| 561 | 
> | 
          myCutoffGroup->setGlobalIndex(globalGroupIndex[j + groupOffset]); | 
| 562 | 
> | 
          globalID = info[k].atoms[atomOffset + j]->getGlobalIndex(); | 
| 563 | 
> | 
          info[k].globalGroupMembership[globalID] = globalGroupIndex[j+groupOffset];  | 
| 564 | 
> | 
#else | 
| 565 | 
> | 
          myCutoffGroup->setGlobalIndex(j + groupOffset); | 
| 566 | 
  | 
          globalID = info[k].atoms[atomOffset + j]->getIndex(); | 
| 567 | 
+ | 
          info[k].globalGroupMembership[globalID] = j+groupOffset; | 
| 568 | 
  | 
#endif | 
| 550 | 
– | 
          globalGroupMembership[globalID] = globalGroupIndex[j+groupOffset];  | 
| 569 | 
  | 
          molInfo.myCutoffGroups.push_back(myCutoffGroup); | 
| 570 | 
  | 
          groupOffset++; | 
| 571 | 
  | 
        } | 
| 659 | 
  | 
                                 theTorsions); | 
| 660 | 
  | 
 | 
| 661 | 
  | 
      info[k].molecules[i].initialize(molInfo); | 
| 662 | 
< | 
 | 
| 663 | 
< | 
 | 
| 662 | 
> | 
       | 
| 663 | 
> | 
       | 
| 664 | 
  | 
      atomOffset += molInfo.nAtoms; | 
| 665 | 
  | 
      delete[] theBonds; | 
| 666 | 
  | 
      delete[] theBends; | 
| 667 | 
  | 
      delete[] theTorsions; | 
| 668 | 
< | 
    }     | 
| 668 | 
> | 
    } | 
| 669 | 
> | 
 | 
| 670 | 
> | 
 | 
| 671 | 
> | 
 | 
| 672 | 
> | 
#ifdef IS_MPI     | 
| 673 | 
> | 
    // Since the globalGroupMembership has been zero filled and we've only | 
| 674 | 
> | 
    // poked values into the atoms we know, we can do an Allreduce | 
| 675 | 
> | 
    // to get the full globalGroupMembership array (We think). | 
| 676 | 
> | 
    // This would be prettier if we could use MPI_IN_PLACE like the MPI-2 | 
| 677 | 
> | 
    // docs said we could. | 
| 678 | 
> | 
 | 
| 679 | 
> | 
    int* ggMjunk = new int[mpiSim->getNAtomsGlobal()];     | 
| 680 | 
> | 
 | 
| 681 | 
> | 
    MPI_Allreduce(info[k].globalGroupMembership, | 
| 682 | 
> | 
                  ggMjunk, | 
| 683 | 
> | 
                  mpiSim->getNAtomsGlobal(), | 
| 684 | 
> | 
                  MPI_INT, MPI_SUM, MPI_COMM_WORLD); | 
| 685 | 
> | 
 | 
| 686 | 
> | 
    for (i = 0; i < mpiSim->getNAtomsGlobal(); i++)  | 
| 687 | 
> | 
      info[k].globalGroupMembership[i] = ggMjunk[i]; | 
| 688 | 
> | 
 | 
| 689 | 
> | 
    delete[] ggMjunk; | 
| 690 | 
> | 
     | 
| 691 | 
> | 
#endif | 
| 692 | 
> | 
 | 
| 693 | 
> | 
 | 
| 694 | 
> | 
 | 
| 695 | 
  | 
  } | 
| 696 | 
  | 
 | 
| 697 | 
  | 
#ifdef IS_MPI | 
| 1064 | 
  | 
    info[i].orthoTolerance = globals->getOrthoBoxTolerance(); | 
| 1065 | 
  | 
 | 
| 1066 | 
  | 
    // check for thermodynamic integration | 
| 1067 | 
< | 
    if (globals->getUseThermInt()) { | 
| 1067 | 
> | 
    if (globals->getUseSolidThermInt() && !globals->getUseLiquidThermInt()) { | 
| 1068 | 
  | 
      if (globals->haveThermIntLambda() && globals->haveThermIntK()) { | 
| 1069 | 
< | 
        info[i].useThermInt = globals->getUseThermInt(); | 
| 1069 | 
> | 
        info[i].useSolidThermInt = globals->getUseSolidThermInt(); | 
| 1070 | 
  | 
        info[i].thermIntLambda = globals->getThermIntLambda(); | 
| 1071 | 
  | 
        info[i].thermIntK = globals->getThermIntK(); | 
| 1072 | 
  | 
         | 
| 1076 | 
  | 
      else { | 
| 1077 | 
  | 
        sprintf(painCave.errMsg, | 
| 1078 | 
  | 
                "SimSetup Error:\n" | 
| 1079 | 
< | 
                "\tKeyword useThermInt was set to 'true' but\n" | 
| 1079 | 
> | 
                "\tKeyword useSolidThermInt was set to 'true' but\n" | 
| 1080 | 
  | 
                "\tthermodynamicIntegrationLambda (and/or\n" | 
| 1081 | 
  | 
                "\tthermodynamicIntegrationK) was not specified.\n" | 
| 1082 | 
  | 
                "\tPlease provide a lambda value and k value in your .bass file.\n"); | 
| 1084 | 
  | 
        simError();     | 
| 1085 | 
  | 
      } | 
| 1086 | 
  | 
    } | 
| 1087 | 
+ | 
    else if(globals->getUseLiquidThermInt()) { | 
| 1088 | 
+ | 
      if (globals->getUseSolidThermInt()) { | 
| 1089 | 
+ | 
        sprintf( painCave.errMsg, | 
| 1090 | 
+ | 
                 "SimSetup Warning: It appears that you have both solid and\n" | 
| 1091 | 
+ | 
                 "\tliquid thermodynamic integration activated in your .bass\n" | 
| 1092 | 
+ | 
                 "\tfile. To avoid confusion, specify only one technique in\n" | 
| 1093 | 
+ | 
                 "\tyour .bass file. Liquid-state thermodynamic integration\n" | 
| 1094 | 
+ | 
                 "\twill be assumed for the current simulation. If this is not\n" | 
| 1095 | 
+ | 
                 "\twhat you desire, set useSolidThermInt to 'true' and\n" | 
| 1096 | 
+ | 
                 "\tuseLiquidThermInt to 'false' in your .bass file.\n"); | 
| 1097 | 
+ | 
        painCave.isFatal = 0; | 
| 1098 | 
+ | 
        simError(); | 
| 1099 | 
+ | 
      } | 
| 1100 | 
+ | 
      if (globals->haveThermIntLambda() && globals->haveThermIntK()) { | 
| 1101 | 
+ | 
        info[i].useLiquidThermInt = globals->getUseLiquidThermInt(); | 
| 1102 | 
+ | 
        info[i].thermIntLambda = globals->getThermIntLambda(); | 
| 1103 | 
+ | 
        info[i].thermIntK = globals->getThermIntK(); | 
| 1104 | 
+ | 
      } | 
| 1105 | 
+ | 
      else { | 
| 1106 | 
+ | 
        sprintf(painCave.errMsg, | 
| 1107 | 
+ | 
                "SimSetup Error:\n" | 
| 1108 | 
+ | 
                "\tKeyword useLiquidThermInt was set to 'true' but\n" | 
| 1109 | 
+ | 
                "\tthermodynamicIntegrationLambda (and/or\n" | 
| 1110 | 
+ | 
                "\tthermodynamicIntegrationK) was not specified.\n" | 
| 1111 | 
+ | 
                "\tPlease provide a lambda value and k value in your .bass file.\n"); | 
| 1112 | 
+ | 
        painCave.isFatal = 1; | 
| 1113 | 
+ | 
        simError();     | 
| 1114 | 
+ | 
      } | 
| 1115 | 
+ | 
    } | 
| 1116 | 
  | 
    else if(globals->haveThermIntLambda() || globals->haveThermIntK()){ | 
| 1117 | 
  | 
        sprintf(painCave.errMsg, | 
| 1118 | 
  | 
                "SimSetup Warning: If you want to use Thermodynamic\n" | 
| 1119 | 
< | 
                "\tIntegration, set useThermInt to 'true' in your .bass file.\n" | 
| 1120 | 
< | 
                "\tThe useThermInt keyword is 'false' by default, so your\n" | 
| 1121 | 
< | 
                "\tlambda and/or k values are being ignored.\n"); | 
| 1119 | 
> | 
                "\tIntegration, set useSolidThermInt or useLiquidThermInt to\n" | 
| 1120 | 
> | 
                "\t'true' in your .bass file.  These keywords are set to\n" | 
| 1121 | 
> | 
                "\t'false' by default, so your lambda and/or k values are\n" | 
| 1122 | 
> | 
                "\tbeing ignored.\n"); | 
| 1123 | 
  | 
        painCave.isFatal = 0; | 
| 1124 | 
  | 
        simError();    | 
| 1125 | 
  | 
    } | 
| 1653 | 
  | 
 | 
| 1654 | 
  | 
  mpiSim->divideLabor(); | 
| 1655 | 
  | 
  globalAtomIndex = mpiSim->getGlobalAtomIndex(); | 
| 1656 | 
+ | 
  globalGroupIndex = mpiSim->getGlobalGroupIndex(); | 
| 1657 | 
  | 
  //globalMolIndex = mpiSim->getGlobalMolIndex(); | 
| 1658 | 
  | 
 | 
| 1659 | 
  | 
  // set up the local variables  |