| 10 | 
  | 
#include "Integrator.hpp" | 
| 11 | 
  | 
#include "simError.h" | 
| 12 | 
  | 
#include "RigidBody.hpp" | 
| 13 | 
– | 
//#include "ConjugateMinimizer.hpp" | 
| 13 | 
  | 
#include "OOPSEMinimizer.hpp" | 
| 14 | 
+ | 
//#include "ConstraintElement.hpp" | 
| 15 | 
+ | 
//#include "ConstraintPair.hpp" | 
| 16 | 
  | 
 | 
| 17 | 
  | 
#ifdef IS_MPI | 
| 18 | 
  | 
#include "mpiBASS.h" | 
| 199 | 
  | 
  char* molName; | 
| 200 | 
  | 
  char rbName[100]; | 
| 201 | 
  | 
 | 
| 202 | 
+ | 
  //ConstraintPair* consPair; //constraint pair | 
| 203 | 
+ | 
  //ConstraintElement* consElement1;  //first element of constraint pair | 
| 204 | 
+ | 
  //ConstraintElement* consElement2;  //second element of constraint pair | 
| 205 | 
+ | 
  //int whichRigidBody;  | 
| 206 | 
+ | 
  //int consAtomIndex;  //index of constraint atom in rigid body's atom array | 
| 207 | 
+ | 
  //vector<pair<int, int> > jointAtoms; | 
| 208 | 
  | 
  //init the forceField paramters | 
| 209 | 
  | 
 | 
| 210 | 
  | 
  the_ff->readParams(); | 
| 217 | 
  | 
    the_ff->setSimInfo(&(info[k])); | 
| 218 | 
  | 
 | 
| 219 | 
  | 
    atomOffset = 0; | 
| 220 | 
+ | 
    groupOffset = 0; | 
| 221 | 
  | 
 | 
| 222 | 
  | 
    for (i = 0; i < info[k].n_mol; i++){ | 
| 223 | 
  | 
      stampID = info[k].molecules[i].getStampID(); | 
| 506 | 
  | 
        nMembers = currentCutoffGroup->getNMembers();  | 
| 507 | 
  | 
 | 
| 508 | 
  | 
        myCutoffGroup = new CutoffGroup(); | 
| 509 | 
+ | 
        myCutoffGroup->setGlobalIndex(globalGroupIndex[j + groupOffset]); | 
| 510 | 
  | 
         | 
| 511 | 
  | 
        for (int cg = 0; cg < nMembers; cg++) { | 
| 512 | 
  | 
 | 
| 515 | 
  | 
 | 
| 516 | 
  | 
          // tempI is atom numbering on local processor | 
| 517 | 
  | 
          tempI = molI + atomOffset; | 
| 518 | 
< | 
           | 
| 518 | 
> | 
 | 
| 519 | 
> | 
#ifdef IS_MPI | 
| 520 | 
> | 
          globalID = info[k].atoms[tempI]->getGlobalIndex() | 
| 521 | 
> | 
#else  | 
| 522 | 
> | 
          globalID = info[k].atoms[tempI]->getIndex(); | 
| 523 | 
> | 
#endif | 
| 524 | 
> | 
 | 
| 525 | 
> | 
          globalGroupMembership[globalID] = globalGroupIndex[j+groupOffset];  | 
| 526 | 
> | 
 | 
| 527 | 
  | 
          myCutoffGroup->addAtom(info[k].atoms[tempI]);           | 
| 528 | 
  | 
 | 
| 529 | 
  | 
          cutoffAtomSet.insert(tempI); | 
| 530 | 
  | 
        } | 
| 531 | 
< | 
 | 
| 531 | 
> | 
        | 
| 532 | 
  | 
        molInfo.myCutoffGroups.push_back(myCutoffGroup); | 
| 533 | 
+ | 
        groupOffset++; | 
| 534 | 
+ | 
 | 
| 535 | 
  | 
      }//end for (j = 0; j < molInfo.nCutoffGroups; j++) | 
| 536 | 
  | 
 | 
| 537 | 
  | 
      //creat a cutoff group for every atom  in current molecule which does not belong to cutoffgroup defined at mdl file | 
| 541 | 
  | 
        if(cutoffAtomSet.find(molInfo.myAtoms[j]->getIndex()) == cutoffAtomSet.end()){ | 
| 542 | 
  | 
          myCutoffGroup = new CutoffGroup(); | 
| 543 | 
  | 
          myCutoffGroup->addAtom(molInfo.myAtoms[j]); | 
| 544 | 
+ | 
          myCutoffGroup->setGlobalIndex(globalGroupIndex[j + groupOffset]); | 
| 545 | 
+ | 
#ifdef IS_MPI | 
| 546 | 
+ | 
          globalID = info[k].atoms[atomOffset + j]->getGlobalIndex() | 
| 547 | 
+ | 
#else  | 
| 548 | 
+ | 
          globalID = info[k].atoms[atomOffset + j]->getIndex(); | 
| 549 | 
+ | 
#endif | 
| 550 | 
+ | 
          globalGroupMembership[globalID] = globalGroupIndex[j+groupOffset];  | 
| 551 | 
  | 
          molInfo.myCutoffGroups.push_back(myCutoffGroup); | 
| 552 | 
+ | 
          groupOffset++; | 
| 553 | 
  | 
        } | 
| 554 | 
  | 
           | 
| 555 | 
  | 
      } | 
| 556 | 
  | 
 | 
| 530 | 
– | 
               | 
| 531 | 
– | 
 | 
| 532 | 
– | 
 | 
| 557 | 
  | 
      // After this is all set up, scan through the atoms to  | 
| 558 | 
  | 
      // see if they can be added to the integrableObjects: | 
| 559 | 
  | 
 | 
| 584 | 
  | 
        info[k].integrableObjects.push_back(mySD);       | 
| 585 | 
  | 
        molInfo.myIntegrableObjects.push_back(mySD); | 
| 586 | 
  | 
      } | 
| 587 | 
< | 
     | 
| 587 | 
> | 
 | 
| 588 | 
> | 
 | 
| 589 | 
> | 
    /* | 
| 590 | 
> | 
 | 
| 591 | 
> | 
      //creat ConstraintPair. | 
| 592 | 
> | 
      molInfo.myConstraintPair.clear(); | 
| 593 | 
> | 
       | 
| 594 | 
> | 
      for (j = 0; j < molInfo.nBonds; j++){ | 
| 595 | 
> | 
 | 
| 596 | 
> | 
        //if both atoms are in the same rigid body, just skip it | 
| 597 | 
> | 
        currentBond = comp_stamps[stampID]->getBond(j); | 
| 598 | 
> | 
        if(!comp_stamps[stampID]->isBondInSameRigidBody(currentBond)){ | 
| 599 | 
> | 
 | 
| 600 | 
> | 
          tempI = currentBond->getA() + atomOffset; | 
| 601 | 
> | 
          if( comp_stamps[stampID]->isAtomInRigidBody(currentBond->getA(), whichRigidBody, consAtomIndex)) | 
| 602 | 
> | 
            consElement1 = new ConstraintRigidBody(molInfo.myRigidBodies[whichRigidBody], consAtomIndex); | 
| 603 | 
> | 
          else | 
| 604 | 
> | 
             consElement1 = new ConstraintAtom(info[k].atoms[tempI]);        | 
| 605 | 
> | 
 | 
| 606 | 
> | 
          tempJ =  currentBond->getB() + atomOffset; | 
| 607 | 
> | 
          if(comp_stamps[stampID]->isAtomInRigidBody(currentBond->getB(), whichRigidBody, consAtomIndex)) | 
| 608 | 
> | 
            consElement2 = new ConstraintRigidBody(molInfo.myRigidBodies[whichRigidBody], consAtomIndex); | 
| 609 | 
> | 
          else | 
| 610 | 
> | 
             consElement2 = new ConstraintAtom(info[k].atoms[tempJ]);      | 
| 611 | 
> | 
 | 
| 612 | 
> | 
          consPair = new DistanceConstraintPair(consElement1, consElement2); | 
| 613 | 
> | 
          molInfo.myConstraintPairs.push_back(consPair); | 
| 614 | 
> | 
        } | 
| 615 | 
> | 
      }   | 
| 616 | 
> | 
       | 
| 617 | 
> | 
      //loop over rigid bodies, if two rigid bodies share same joint, creat a HingeConstraintPair | 
| 618 | 
> | 
      for (int rb1 = 0; rb1 < molInfo.nRigidBodies -1 ; rb1++){ | 
| 619 | 
> | 
        for (int rb2 = rb1 + 1; rb2 < molInfo.nRigidBodies ; rb2++){ | 
| 620 | 
> | 
           | 
| 621 | 
> | 
          jointAtoms = comp_stamps[stampID]->getJointAtoms(rb1, rb2); | 
| 622 | 
> | 
 | 
| 623 | 
> | 
          for(size_t m = 0; m < jointAtoms.size(); m++){           | 
| 624 | 
> | 
            consElement1 = new ConstraintRigidBody(molInfo.myRigidBodies[rb1], jointAtoms[m].first); | 
| 625 | 
> | 
            consElement2 = new ConstraintRigidBody(molInfo.myRigidBodies[rb2], jointAtoms[m].second); | 
| 626 | 
> | 
 | 
| 627 | 
> | 
            consPair = new JointConstraintPair(consElement1, consElement2);   | 
| 628 | 
> | 
            molInfo.myConstraintPairs.push_back(consPair);             | 
| 629 | 
> | 
          } | 
| 630 | 
> | 
 | 
| 631 | 
> | 
        } | 
| 632 | 
> | 
      } | 
| 633 | 
  | 
       | 
| 634 | 
+ | 
*/       | 
| 635 | 
  | 
      // send the arrays off to the forceField for init. | 
| 636 | 
  | 
       | 
| 637 | 
  | 
      the_ff->initializeAtoms(molInfo.nAtoms, molInfo.myAtoms); | 
| 1020 | 
  | 
    info[i].orthoTolerance = globals->getOrthoBoxTolerance(); | 
| 1021 | 
  | 
 | 
| 1022 | 
  | 
    // check for thermodynamic integration | 
| 1023 | 
< | 
    if (globals->getUseThermInt()) { | 
| 1023 | 
> | 
    if (globals->getUseSolidThermInt() && !globals->getUseLiquidThermInt()) { | 
| 1024 | 
  | 
      if (globals->haveThermIntLambda() && globals->haveThermIntK()) { | 
| 1025 | 
< | 
        info[i].useThermInt = globals->getUseThermInt(); | 
| 1025 | 
> | 
        info[i].useSolidThermInt = globals->getUseSolidThermInt(); | 
| 1026 | 
  | 
        info[i].thermIntLambda = globals->getThermIntLambda(); | 
| 1027 | 
  | 
        info[i].thermIntK = globals->getThermIntK(); | 
| 1028 | 
  | 
         | 
| 1032 | 
  | 
      else { | 
| 1033 | 
  | 
        sprintf(painCave.errMsg, | 
| 1034 | 
  | 
                "SimSetup Error:\n" | 
| 1035 | 
< | 
                "\tKeyword useThermInt was set to 'true' but\n" | 
| 1035 | 
> | 
                "\tKeyword useSolidThermInt was set to 'true' but\n" | 
| 1036 | 
  | 
                "\tthermodynamicIntegrationLambda (and/or\n" | 
| 1037 | 
  | 
                "\tthermodynamicIntegrationK) was not specified.\n" | 
| 1038 | 
  | 
                "\tPlease provide a lambda value and k value in your .bass file.\n"); | 
| 1040 | 
  | 
        simError();     | 
| 1041 | 
  | 
      } | 
| 1042 | 
  | 
    } | 
| 1043 | 
+ | 
    else if(globals->getUseLiquidThermInt()) { | 
| 1044 | 
+ | 
      if (globals->getUseSolidThermInt()) { | 
| 1045 | 
+ | 
        sprintf( painCave.errMsg, | 
| 1046 | 
+ | 
                 "SimSetup Warning: It appears that you have both solid and\n" | 
| 1047 | 
+ | 
                 "\tliquid thermodynamic integration activated in your .bass\n" | 
| 1048 | 
+ | 
                 "\tfile. To avoid confusion, specify only one technique in\n" | 
| 1049 | 
+ | 
                 "\tyour .bass file. Liquid-state thermodynamic integration\n" | 
| 1050 | 
+ | 
                 "\twill be assumed for the current simulation. If this is not\n" | 
| 1051 | 
+ | 
                 "\twhat you desire, set useSolidThermInt to 'true' and\n" | 
| 1052 | 
+ | 
                 "\tuseLiquidThermInt to 'false' in your .bass file.\n"); | 
| 1053 | 
+ | 
        painCave.isFatal = 0; | 
| 1054 | 
+ | 
        simError(); | 
| 1055 | 
+ | 
      } | 
| 1056 | 
+ | 
      if (globals->haveThermIntLambda() && globals->haveThermIntK()) { | 
| 1057 | 
+ | 
        info[i].useLiquidThermInt = globals->getUseLiquidThermInt(); | 
| 1058 | 
+ | 
        info[i].thermIntLambda = globals->getThermIntLambda(); | 
| 1059 | 
+ | 
        info[i].thermIntK = globals->getThermIntK(); | 
| 1060 | 
+ | 
      } | 
| 1061 | 
+ | 
      else { | 
| 1062 | 
+ | 
        sprintf(painCave.errMsg, | 
| 1063 | 
+ | 
                "SimSetup Error:\n" | 
| 1064 | 
+ | 
                "\tKeyword useLiquidThermInt was set to 'true' but\n" | 
| 1065 | 
+ | 
                "\tthermodynamicIntegrationLambda (and/or\n" | 
| 1066 | 
+ | 
                "\tthermodynamicIntegrationK) was not specified.\n" | 
| 1067 | 
+ | 
                "\tPlease provide a lambda value and k value in your .bass file.\n"); | 
| 1068 | 
+ | 
        painCave.isFatal = 1; | 
| 1069 | 
+ | 
        simError();     | 
| 1070 | 
+ | 
      } | 
| 1071 | 
+ | 
    } | 
| 1072 | 
  | 
    else if(globals->haveThermIntLambda() || globals->haveThermIntK()){ | 
| 1073 | 
  | 
        sprintf(painCave.errMsg, | 
| 1074 | 
  | 
                "SimSetup Warning: If you want to use Thermodynamic\n" | 
| 1075 | 
< | 
                "\tIntegration, set useThermInt to 'true' in your .bass file.\n" | 
| 1076 | 
< | 
                "\tThe useThermInt keyword is 'false' by default, so your\n" | 
| 1077 | 
< | 
                "\tlambda and/or k values are being ignored.\n"); | 
| 1075 | 
> | 
                "\tIntegration, set useSolidThermInt or useLiquidThermInt to\n" | 
| 1076 | 
> | 
                "\t'true' in your .bass file.  These keywords are set to\n" | 
| 1077 | 
> | 
                "\t'false' by default, so your lambda and/or k values are\n" | 
| 1078 | 
> | 
                "\tbeing ignored.\n"); | 
| 1079 | 
  | 
        painCave.isFatal = 0; | 
| 1080 | 
  | 
        simError();    | 
| 1081 | 
  | 
    } |