| 24 | 
  | 
 | 
| 25 | 
  | 
#define FF_DUFF 0 | 
| 26 | 
  | 
#define FF_LJ   1 | 
| 27 | 
+ | 
#define FF_EAM  2 | 
| 28 | 
  | 
 | 
| 28 | 
– | 
 | 
| 29 | 
  | 
SimSetup::SimSetup(){ | 
| 30 | 
+ | 
   | 
| 31 | 
+ | 
  isInfoArray = 0; | 
| 32 | 
+ | 
  nInfo = 1; | 
| 33 | 
+ | 
   | 
| 34 | 
  | 
  stamps = new MakeStamps(); | 
| 35 | 
  | 
  globals = new Globals(); | 
| 36 | 
  | 
   | 
| 37 | 
+ | 
   | 
| 38 | 
  | 
#ifdef IS_MPI | 
| 39 | 
  | 
  strcpy( checkPointMsg, "SimSetup creation successful" ); | 
| 40 | 
  | 
  MPIcheckPoint(); | 
| 45 | 
  | 
  delete stamps; | 
| 46 | 
  | 
  delete globals; | 
| 47 | 
  | 
} | 
| 48 | 
+ | 
 | 
| 49 | 
+ | 
void SimSetup::setSimInfo( SimInfo* the_info, int theNinfo ) { | 
| 50 | 
+ | 
    info = the_info; | 
| 51 | 
+ | 
    nInfo = theNinfo; | 
| 52 | 
+ | 
    isInfoArray = 1; | 
| 53 | 
+ | 
  } | 
| 54 | 
  | 
 | 
| 55 | 
+ | 
 | 
| 56 | 
  | 
void SimSetup::parseFile( char* fileName ){ | 
| 57 | 
  | 
 | 
| 58 | 
  | 
#ifdef IS_MPI | 
| 410 | 
  | 
    have_extra =1; | 
| 411 | 
  | 
 | 
| 412 | 
  | 
    n_cells = (int)temp3 - 1; | 
| 413 | 
< | 
    cellx = info->boxLx / temp3; | 
| 414 | 
< | 
    celly = info->boxLy / temp3; | 
| 415 | 
< | 
    cellz = info->boxLz / temp3; | 
| 413 | 
> | 
    cellx = info->boxL[0] / temp3; | 
| 414 | 
> | 
    celly = info->boxL[1] / temp3; | 
| 415 | 
> | 
    cellz = info->boxL[2] / temp3; | 
| 416 | 
  | 
    n_extra = tot_nmol - ( 4 * n_cells * n_cells * n_cells ); | 
| 417 | 
  | 
    temp1 = ((double)n_extra) / ( pow( temp3, 3.0 ) - pow( n_cells, 3.0 ) ); | 
| 418 | 
  | 
    n_per_extra = (int)ceil( temp1 ); | 
| 427 | 
  | 
  } | 
| 428 | 
  | 
  else{ | 
| 429 | 
  | 
    n_cells = (int)temp3; | 
| 430 | 
< | 
    cellx = info->boxLx / temp3; | 
| 431 | 
< | 
    celly = info->boxLy / temp3; | 
| 432 | 
< | 
    cellz = info->boxLz / temp3; | 
| 430 | 
> | 
    cellx = info->boxL[0] / temp3; | 
| 431 | 
> | 
    celly = info->boxL[1] / temp3; | 
| 432 | 
> | 
    cellz = info->boxL[2] / temp3; | 
| 433 | 
  | 
  } | 
| 434 | 
  | 
 | 
| 435 | 
  | 
  current_mol = 0; | 
| 598 | 
  | 
 | 
| 599 | 
  | 
  if( !strcasecmp( force_field, "DUFF" )) ffCase = FF_DUFF; | 
| 600 | 
  | 
  else if( !strcasecmp( force_field, "LJ" )) ffCase = FF_LJ; | 
| 601 | 
+ | 
  else if( !strcasecmp( force_field, "EAM" )) ffCase = FF_EAM; | 
| 602 | 
  | 
  else{ | 
| 603 | 
  | 
    sprintf( painCave.errMsg, | 
| 604 | 
  | 
             "SimSetup Error. Unrecognized force field -> %s\n", | 
| 775 | 
  | 
  MPI_Allreduce( &myUse, &usesDipoles, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD ); | 
| 776 | 
  | 
#endif //is_mpi | 
| 777 | 
  | 
 | 
| 778 | 
+ | 
  double theEcr, theEst; | 
| 779 | 
  | 
 | 
| 780 | 
  | 
  if (globals->getUseRF() ) { | 
| 781 | 
  | 
    info->useReactionField = 1; | 
| 788 | 
  | 
      painCave.isFatal = 0; | 
| 789 | 
  | 
      simError(); | 
| 790 | 
  | 
      double smallest; | 
| 791 | 
< | 
      smallest = info->boxLx; | 
| 792 | 
< | 
      if (info->boxLy <= smallest) smallest = info->boxLy; | 
| 793 | 
< | 
      if (info->boxLz <= smallest) smallest = info->boxLz; | 
| 794 | 
< | 
      info->ecr = 0.5 * smallest; | 
| 791 | 
> | 
      smallest = info->boxL[0]; | 
| 792 | 
> | 
      if (info->boxL[1] <= smallest) smallest = info->boxL[1]; | 
| 793 | 
> | 
      if (info->boxL[2] <= smallest) smallest = info->boxL[2]; | 
| 794 | 
> | 
      theEcr = 0.5 * smallest; | 
| 795 | 
  | 
    } else { | 
| 796 | 
< | 
      info->ecr        = globals->getECR(); | 
| 796 | 
> | 
      theEcr = globals->getECR(); | 
| 797 | 
  | 
    } | 
| 798 | 
  | 
 | 
| 799 | 
  | 
    if( !globals->haveEST() ){ | 
| 803 | 
  | 
               ); | 
| 804 | 
  | 
      painCave.isFatal = 0; | 
| 805 | 
  | 
      simError(); | 
| 806 | 
< | 
      info->est = 0.05 * info->ecr; | 
| 806 | 
> | 
      theEst = 0.05 * theEcr; | 
| 807 | 
  | 
    } else { | 
| 808 | 
< | 
      info->est        = globals->getEST(); | 
| 808 | 
> | 
      theEst= globals->getEST(); | 
| 809 | 
  | 
    } | 
| 810 | 
+ | 
 | 
| 811 | 
+ | 
    info->setEcr( theEcr, theEst ); | 
| 812 | 
  | 
     | 
| 813 | 
  | 
    if(!globals->haveDielectric() ){ | 
| 814 | 
  | 
      sprintf( painCave.errMsg, | 
| 824 | 
  | 
    if (usesDipoles) { | 
| 825 | 
  | 
       | 
| 826 | 
  | 
      if( !globals->haveECR() ){ | 
| 827 | 
< | 
        sprintf( painCave.errMsg, | 
| 828 | 
< | 
                 "SimSetup Warning: using default value of 1/2 the smallest " | 
| 829 | 
< | 
                 "box length for the electrostaticCutoffRadius.\n" | 
| 830 | 
< | 
                 "I hope you have a very fast processor!\n"); | 
| 831 | 
< | 
        painCave.isFatal = 0; | 
| 832 | 
< | 
        simError(); | 
| 833 | 
< | 
        double smallest; | 
| 834 | 
< | 
        smallest = info->boxLx; | 
| 835 | 
< | 
        if (info->boxLy <= smallest) smallest = info->boxLy; | 
| 836 | 
< | 
        if (info->boxLz <= smallest) smallest = info->boxLz; | 
| 837 | 
< | 
        info->ecr = 0.5 * smallest; | 
| 827 | 
> | 
        sprintf( painCave.errMsg, | 
| 828 | 
> | 
                 "SimSetup Warning: using default value of 1/2 the smallest " | 
| 829 | 
> | 
                 "box length for the electrostaticCutoffRadius.\n" | 
| 830 | 
> | 
                 "I hope you have a very fast processor!\n"); | 
| 831 | 
> | 
        painCave.isFatal = 0; | 
| 832 | 
> | 
        simError(); | 
| 833 | 
> | 
        double smallest; | 
| 834 | 
> | 
        smallest = info->boxL[0]; | 
| 835 | 
> | 
        if (info->boxL[1] <= smallest) smallest = info->boxL[1]; | 
| 836 | 
> | 
        if (info->boxL[2] <= smallest) smallest = info->boxL[2]; | 
| 837 | 
> | 
        theEcr = 0.5 * smallest; | 
| 838 | 
  | 
      } else { | 
| 839 | 
< | 
        info->ecr        = globals->getECR(); | 
| 839 | 
> | 
        theEcr = globals->getECR(); | 
| 840 | 
  | 
      } | 
| 841 | 
  | 
       | 
| 842 | 
  | 
      if( !globals->haveEST() ){ | 
| 843 | 
< | 
        sprintf( painCave.errMsg, | 
| 844 | 
< | 
                 "SimSetup Warning: using default value of 5%% of the " | 
| 845 | 
< | 
                 "electrostaticCutoffRadius for the " | 
| 846 | 
< | 
                 "electrostaticSkinThickness\n" | 
| 847 | 
< | 
                 ); | 
| 848 | 
< | 
        painCave.isFatal = 0; | 
| 849 | 
< | 
        simError(); | 
| 850 | 
< | 
        info->est = 0.05 * info->ecr; | 
| 843 | 
> | 
        sprintf( painCave.errMsg, | 
| 844 | 
> | 
                 "SimSetup Warning: using default value of 0.05 * the " | 
| 845 | 
> | 
                 "electrostaticCutoffRadius for the " | 
| 846 | 
> | 
                 "electrostaticSkinThickness\n" | 
| 847 | 
> | 
                 ); | 
| 848 | 
> | 
        painCave.isFatal = 0; | 
| 849 | 
> | 
        simError(); | 
| 850 | 
> | 
        theEst = 0.05 * theEcr; | 
| 851 | 
  | 
      } else { | 
| 852 | 
< | 
        info->est        = globals->getEST(); | 
| 852 | 
> | 
        theEst= globals->getEST(); | 
| 853 | 
  | 
      } | 
| 854 | 
+ | 
 | 
| 855 | 
+ | 
      info->setEcr( theEcr, theEst ); | 
| 856 | 
  | 
    } | 
| 857 | 
  | 
  }   | 
| 858 | 
  | 
 | 
| 875 | 
  | 
#ifdef IS_MPI | 
| 876 | 
  | 
     }else fileInit = new InitializeFromFile( NULL ); | 
| 877 | 
  | 
#endif | 
| 878 | 
< | 
   fileInit->read_xyz( info ); // default velocities on | 
| 878 | 
> | 
   fileInit->readInit( info ); // default velocities on | 
| 879 | 
  | 
 | 
| 880 | 
  | 
   delete fileInit; | 
| 881 | 
  | 
 } | 
| 1043 | 
  | 
 | 
| 1044 | 
  | 
  case FF_LJ: | 
| 1045 | 
  | 
    the_ff = new LJFF(); | 
| 1046 | 
+ | 
    break; | 
| 1047 | 
+ | 
 | 
| 1048 | 
+ | 
  case FF_EAM: | 
| 1049 | 
+ | 
    the_ff = new EAM_FF(); | 
| 1050 | 
  | 
    break; | 
| 1051 | 
  | 
 | 
| 1052 | 
  | 
  default: | 
| 1298 | 
  | 
 | 
| 1299 | 
  | 
void SimSetup::makeIntegrator( void ){ | 
| 1300 | 
  | 
 | 
| 1301 | 
< | 
  NVT*  myNVT = NULL; | 
| 1302 | 
< | 
  NPTi* myNPTi = NULL; | 
| 1303 | 
< | 
  NPTf* myNPTf = NULL; | 
| 1304 | 
< | 
  NPTim* myNPTim = NULL; | 
| 1305 | 
< | 
  NPTfm* myNPTfm = NULL; | 
| 1301 | 
> | 
  NVT<RealIntegrator>*  myNVT = NULL; | 
| 1302 | 
> | 
  NPTi<RealIntegrator>* myNPTi = NULL; | 
| 1303 | 
> | 
  NPTf<RealIntegrator>* myNPTf = NULL; | 
| 1304 | 
> | 
  NPTim<RealIntegrator>* myNPTim = NULL; | 
| 1305 | 
> | 
  NPTfm<RealIntegrator>* myNPTfm = NULL; | 
| 1306 | 
  | 
 | 
| 1307 | 
  | 
  switch( ensembleCase ){ | 
| 1308 | 
  | 
 | 
| 1309 | 
  | 
  case NVE_ENS: | 
| 1310 | 
< | 
    new NVE( info, the_ff ); | 
| 1310 | 
> | 
    new NVE<RealIntegrator>( info, the_ff ); | 
| 1311 | 
  | 
    break; | 
| 1312 | 
  | 
 | 
| 1313 | 
  | 
  case NVT_ENS: | 
| 1314 | 
< | 
    myNVT = new NVT( info, the_ff ); | 
| 1314 | 
> | 
    myNVT = new NVT<RealIntegrator>( info, the_ff ); | 
| 1315 | 
  | 
    myNVT->setTargetTemp(globals->getTargetTemp()); | 
| 1316 | 
  | 
 | 
| 1317 | 
  | 
    if (globals->haveTauThermostat())  | 
| 1327 | 
  | 
    break; | 
| 1328 | 
  | 
 | 
| 1329 | 
  | 
  case NPTi_ENS: | 
| 1330 | 
< | 
    myNPTi = new NPTi( info, the_ff ); | 
| 1330 | 
> | 
    myNPTi = new NPTi<RealIntegrator>( info, the_ff ); | 
| 1331 | 
  | 
    myNPTi->setTargetTemp( globals->getTargetTemp() ); | 
| 1332 | 
  | 
 | 
| 1333 | 
  | 
    if (globals->haveTargetPressure()) | 
| 1362 | 
  | 
    break; | 
| 1363 | 
  | 
 | 
| 1364 | 
  | 
  case NPTf_ENS: | 
| 1365 | 
< | 
    myNPTf = new NPTf( info, the_ff ); | 
| 1365 | 
> | 
    myNPTf = new NPTf<RealIntegrator>( info, the_ff ); | 
| 1366 | 
  | 
    myNPTf->setTargetTemp( globals->getTargetTemp()); | 
| 1367 | 
  | 
 | 
| 1368 | 
  | 
    if (globals->haveTargetPressure()) | 
| 1397 | 
  | 
    break; | 
| 1398 | 
  | 
     | 
| 1399 | 
  | 
  case NPTim_ENS: | 
| 1400 | 
< | 
    myNPTim = new NPTim( info, the_ff ); | 
| 1400 | 
> | 
    myNPTim = new NPTim<RealIntegrator>( info, the_ff ); | 
| 1401 | 
  | 
    myNPTim->setTargetTemp( globals->getTargetTemp()); | 
| 1402 | 
  | 
 | 
| 1403 | 
  | 
    if (globals->haveTargetPressure()) | 
| 1432 | 
  | 
    break; | 
| 1433 | 
  | 
 | 
| 1434 | 
  | 
  case NPTfm_ENS: | 
| 1435 | 
< | 
    myNPTfm = new NPTfm( info, the_ff ); | 
| 1435 | 
> | 
    myNPTfm = new NPTfm<RealIntegrator>( info, the_ff ); | 
| 1436 | 
  | 
    myNPTfm->setTargetTemp( globals->getTargetTemp()); | 
| 1437 | 
  | 
 | 
| 1438 | 
  | 
    if (globals->haveTargetPressure()) |