| 42 | 
  | 
  thermalTime = 0.0; | 
| 43 | 
  | 
  currentTime = 0.0; | 
| 44 | 
  | 
  rCut = 0.0; | 
| 45 | 
< | 
  ecr = 0.0; | 
| 46 | 
< | 
  est = 0.0; | 
| 45 | 
> | 
  rSw = 0.0; | 
| 46 | 
  | 
 | 
| 47 | 
  | 
  haveRcut = 0; | 
| 48 | 
< | 
  haveEcr = 0; | 
| 48 | 
> | 
  haveRsw = 0; | 
| 49 | 
  | 
  boxIsInit = 0; | 
| 50 | 
  | 
   | 
| 51 | 
  | 
  resetTime = 1e99; | 
| 70 | 
  | 
  has_minimizer = false; | 
| 71 | 
  | 
  the_minimizer =NULL; | 
| 72 | 
  | 
 | 
| 73 | 
+ | 
  ngroup = 0; | 
| 74 | 
+ | 
 | 
| 75 | 
  | 
  wrapMeSimInfo( this ); | 
| 76 | 
  | 
} | 
| 77 | 
  | 
 | 
| 84 | 
  | 
   | 
| 85 | 
  | 
  for(i = properties.begin(); i != properties.end(); i++) | 
| 86 | 
  | 
    delete (*i).second; | 
| 87 | 
< | 
     | 
| 87 | 
> | 
   | 
| 88 | 
  | 
} | 
| 89 | 
  | 
 | 
| 90 | 
  | 
void SimInfo::setBox(double newBox[3]) { | 
| 440 | 
  | 
 | 
| 441 | 
  | 
  n_exclude = excludes->getSize(); | 
| 442 | 
  | 
  excl = excludes->getFortranArray(); | 
| 443 | 
< | 
 | 
| 443 | 
> | 
   | 
| 444 | 
  | 
#ifdef IS_MPI | 
| 445 | 
  | 
  n_global = mpiSim->getTotAtoms(); | 
| 446 | 
  | 
#else | 
| 447 | 
  | 
  n_global = n_atoms; | 
| 448 | 
  | 
#endif | 
| 449 | 
< | 
 | 
| 449 | 
> | 
   | 
| 450 | 
  | 
  isError = 0; | 
| 451 | 
< | 
 | 
| 451 | 
> | 
   | 
| 452 | 
> | 
  getFortranGroupArray(this, mfact, ngroup, groupList, groupStart); | 
| 453 | 
> | 
   | 
| 454 | 
  | 
  setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl,  | 
| 455 | 
< | 
                  &nGlobalExcludes, globalExcludes, molMembershipArray,  | 
| 456 | 
< | 
                  &isError ); | 
| 457 | 
< | 
 | 
| 455 | 
> | 
                  &nGlobalExcludes, globalExcludes, molMembershipArray,  | 
| 456 | 
> | 
                  &mfact[0], &ngroup, &groupList[0], &groupStart[0], &isError); | 
| 457 | 
> | 
   | 
| 458 | 
  | 
  if( isError ){ | 
| 459 | 
< | 
 | 
| 459 | 
> | 
     | 
| 460 | 
  | 
    sprintf( painCave.errMsg, | 
| 461 | 
< | 
             "There was an error setting the simulation information in fortran.\n" ); | 
| 461 | 
> | 
             "There was an error setting the simulation information in fortran.\n" ); | 
| 462 | 
  | 
    painCave.isFatal = 1; | 
| 463 | 
  | 
    simError(); | 
| 464 | 
  | 
  } | 
| 465 | 
< | 
 | 
| 465 | 
> | 
   | 
| 466 | 
  | 
#ifdef IS_MPI | 
| 467 | 
  | 
  sprintf( checkPointMsg, | 
| 468 | 
  | 
           "succesfully sent the simulation information to fortran.\n"); | 
| 469 | 
  | 
  MPIcheckPoint(); | 
| 470 | 
  | 
#endif // is_mpi | 
| 471 | 
< | 
 | 
| 471 | 
> | 
   | 
| 472 | 
  | 
  this->ndf = this->getNDF(); | 
| 473 | 
  | 
  this->ndfRaw = this->getNDFraw(); | 
| 474 | 
  | 
  this->ndfTrans = this->getNDFtranslational(); | 
| 475 | 
  | 
} | 
| 476 | 
  | 
 | 
| 477 | 
  | 
void SimInfo::setDefaultRcut( double theRcut ){ | 
| 478 | 
< | 
 | 
| 478 | 
> | 
   | 
| 479 | 
  | 
  haveRcut = 1; | 
| 480 | 
  | 
  rCut = theRcut; | 
| 481 | 
< | 
 | 
| 482 | 
< | 
  ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; | 
| 483 | 
< | 
 | 
| 481 | 
< | 
  notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); | 
| 481 | 
> | 
  rList = rCut + 1.0;  | 
| 482 | 
> | 
   | 
| 483 | 
> | 
  notifyFortranCutOffs( &rCut, &rSw, &rList ); | 
| 484 | 
  | 
} | 
| 485 | 
  | 
 | 
| 486 | 
< | 
void SimInfo::setDefaultEcr( double theEcr ){ | 
| 486 | 
> | 
void SimInfo::setDefaultRcut( double theRcut, double theRsw ){ | 
| 487 | 
  | 
 | 
| 488 | 
< | 
  haveEcr = 1; | 
| 489 | 
< | 
  ecr = theEcr; | 
| 488 | 
< | 
   | 
| 489 | 
< | 
  ( rCut > ecr )? rList = rCut + 1.0: rList = ecr + 1.0; | 
| 490 | 
< | 
 | 
| 491 | 
< | 
  notifyFortranCutOffs( &rCut, &rList, &ecr, &est ); | 
| 488 | 
> | 
  rSw = theRsw; | 
| 489 | 
> | 
  setDefaultRcut( theRcut ); | 
| 490 | 
  | 
} | 
| 491 | 
  | 
 | 
| 494 | 
– | 
void SimInfo::setDefaultEcr( double theEcr, double theEst ){ | 
| 492 | 
  | 
 | 
| 496 | 
– | 
  est = theEst; | 
| 497 | 
– | 
  setDefaultEcr( theEcr ); | 
| 498 | 
– | 
} | 
| 499 | 
– | 
 | 
| 500 | 
– | 
 | 
| 493 | 
  | 
void SimInfo::checkCutOffs( void ){ | 
| 494 | 
  | 
   | 
| 495 | 
  | 
  if( boxIsInit ){ | 
| 498 | 
  | 
     | 
| 499 | 
  | 
    if( rCut > maxCutoff ){ | 
| 500 | 
  | 
      sprintf( painCave.errMsg, | 
| 501 | 
< | 
               "LJrcut is too large for the current periodic box.\n" | 
| 502 | 
< | 
               "\tCurrent Value of LJrcut = %G at time %G\n " | 
| 501 | 
> | 
               "cutoffRadius is too large for the current periodic box.\n" | 
| 502 | 
> | 
               "\tCurrent Value of cutoffRadius = %G at time %G\n " | 
| 503 | 
  | 
               "\tThis is larger than half of at least one of the\n" | 
| 504 | 
  | 
               "\tperiodic box vectors.  Right now, the Box matrix is:\n" | 
| 505 | 
< | 
               "\n, %G" | 
| 505 | 
> | 
               "\n" | 
| 506 | 
  | 
               "\t[ %G %G %G ]\n" | 
| 507 | 
  | 
               "\t[ %G %G %G ]\n" | 
| 508 | 
  | 
               "\t[ %G %G %G ]\n", | 
| 509 | 
< | 
               rCut, currentTime, maxCutoff, | 
| 509 | 
> | 
               rCut, currentTime, | 
| 510 | 
  | 
               Hmat[0][0], Hmat[0][1], Hmat[0][2], | 
| 511 | 
  | 
               Hmat[1][0], Hmat[1][1], Hmat[1][2], | 
| 512 | 
  | 
               Hmat[2][0], Hmat[2][1], Hmat[2][2]); | 
| 513 | 
  | 
      painCave.isFatal = 1; | 
| 514 | 
  | 
      simError(); | 
| 515 | 
< | 
    } | 
| 524 | 
< | 
     | 
| 525 | 
< | 
    if( haveEcr ){ | 
| 526 | 
< | 
      if( ecr > maxCutoff ){ | 
| 527 | 
< | 
        sprintf( painCave.errMsg, | 
| 528 | 
< | 
                 "electrostaticCutoffRadius is too large for the current\n" | 
| 529 | 
< | 
                 "\tperiodic box.\n\n" | 
| 530 | 
< | 
                 "\tCurrent Value of ECR = %G at time %G\n " | 
| 531 | 
< | 
                 "\tThis is larger than half of at least one of the\n" | 
| 532 | 
< | 
                 "\tperiodic box vectors.  Right now, the Box matrix is:\n" | 
| 533 | 
< | 
                 "\n" | 
| 534 | 
< | 
                 "\t[ %G %G %G ]\n" | 
| 535 | 
< | 
                 "\t[ %G %G %G ]\n" | 
| 536 | 
< | 
                 "\t[ %G %G %G ]\n", | 
| 537 | 
< | 
                 ecr, currentTime, | 
| 538 | 
< | 
                 Hmat[0][0], Hmat[0][1], Hmat[0][2], | 
| 539 | 
< | 
                 Hmat[1][0], Hmat[1][1], Hmat[1][2], | 
| 540 | 
< | 
                 Hmat[2][0], Hmat[2][1], Hmat[2][2]); | 
| 541 | 
< | 
        painCave.isFatal = 1; | 
| 542 | 
< | 
        simError(); | 
| 543 | 
< | 
      } | 
| 544 | 
< | 
    } | 
| 515 | 
> | 
    }     | 
| 516 | 
  | 
  } else { | 
| 517 | 
  | 
    // initialize this stuff before using it, OK? | 
| 518 | 
  | 
    sprintf( painCave.errMsg, | 
| 560 | 
  | 
    return NULL;   | 
| 561 | 
  | 
} | 
| 562 | 
  | 
 | 
| 563 | 
+ | 
 | 
| 564 | 
+ | 
void getFortranGroupArray(SimInfo* info, vector<double>& mfact, int& ngroup,  | 
| 565 | 
+ | 
                          vector<int>& groupList, vector<int>& groupStart){ | 
| 566 | 
+ | 
  Molecule* mol; | 
| 567 | 
+ | 
  Atom** myAtoms; | 
| 568 | 
+ | 
  int numAtom; | 
| 569 | 
+ | 
  int curIndex; | 
| 570 | 
+ | 
  double mtot; | 
| 571 | 
+ | 
 | 
| 572 | 
+ | 
  mfact.clear(); | 
| 573 | 
+ | 
  groupList.clear(); | 
| 574 | 
+ | 
  groupStart.clear(); | 
| 575 | 
+ | 
   | 
| 576 | 
+ | 
  //Be careful, fortran array begin at 1 | 
| 577 | 
+ | 
  curIndex = 1; | 
| 578 | 
+ | 
   | 
| 579 | 
+ | 
  if(info->useMolecularCutoffs){ | 
| 580 | 
+ | 
     | 
| 581 | 
+ | 
#ifdef IS_MPI | 
| 582 | 
+ | 
    ngroup = mpiSim->getMyNMol(); | 
| 583 | 
+ | 
#else | 
| 584 | 
+ | 
    ngroup = info->n_mol; | 
| 585 | 
+ | 
#endif | 
| 586 | 
+ | 
     | 
| 587 | 
+ | 
    for(int i = 0; i < ngroup; i ++){ | 
| 588 | 
+ | 
      mol = &(info->molecules[i]); | 
| 589 | 
+ | 
      numAtom = mol->getNAtoms(); | 
| 590 | 
+ | 
      myAtoms = mol->getMyAtoms(); | 
| 591 | 
+ | 
      mtot = 0.0; | 
| 592 | 
+ | 
 | 
| 593 | 
+ | 
      for(int j=0; j < numAtom; j++) | 
| 594 | 
+ | 
        mtot += myAtoms[j]->getMass();                 | 
| 595 | 
+ | 
       | 
| 596 | 
+ | 
      for(int j=0; j < numAtom; j++){  | 
| 597 | 
+ | 
                | 
| 598 | 
+ | 
        // We want the local Index: | 
| 599 | 
+ | 
        groupList.push_back(myAtoms[j]->getIndex() + 1); | 
| 600 | 
+ | 
        mfact.push_back(myAtoms[j]->getMass() / mtot); | 
| 601 | 
+ | 
 | 
| 602 | 
+ | 
      } | 
| 603 | 
+ | 
       | 
| 604 | 
+ | 
      groupStart.push_back(curIndex); | 
| 605 | 
+ | 
      curIndex += numAtom; | 
| 606 | 
+ | 
       | 
| 607 | 
+ | 
    } //end for(int i =0 ; i < ngroup; i++)     | 
| 608 | 
+ | 
  } | 
| 609 | 
+ | 
  else{ | 
| 610 | 
+ | 
    //using atomic cutoff, every single atom is just a group | 
| 611 | 
+ | 
     | 
| 612 | 
+ | 
#ifdef IS_MPI | 
| 613 | 
+ | 
    ngroup = mpiSim->getMyNlocal(); | 
| 614 | 
+ | 
#else | 
| 615 | 
+ | 
    ngroup = info->n_atoms; | 
| 616 | 
+ | 
#endif | 
| 617 | 
+ | 
     | 
| 618 | 
+ | 
    for(int i =0 ; i < ngroup; i++){ | 
| 619 | 
+ | 
      groupStart.push_back(curIndex++);        | 
| 620 | 
+ | 
      groupList.push_back((info->atoms[i])->getIndex() + 1); | 
| 621 | 
+ | 
      mfact.push_back(1.0); | 
| 622 | 
+ | 
       | 
| 623 | 
+ | 
    }//end for(int i =0 ; i < ngroup; i++) | 
| 624 | 
+ | 
     | 
| 625 | 
+ | 
  }//end if (info->useMolecularCutoffs) | 
| 626 | 
+ | 
   | 
| 627 | 
+ | 
} |