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 645 by tim, Tue Jul 22 19:54:52 2003 UTC vs.
Revision 658 by tim, Thu Jul 31 15:35:07 2003 UTC

# Line 1 | Line 1
1 + #include <algorithm>
2   #include <cstdlib>
3   #include <iostream>
4   #include <cmath>
5 + #include <string>
6  
7   #include "SimSetup.hpp"
8   #include "parse_me.h"
# Line 20 | Line 22
22   #define NPTf_ENS  3
23   #define NPTim_ENS 4
24   #define NPTfm_ENS 5
25 + #define NVEZCONS_ENS 6
26  
27  
28   #define FF_DUFF 0
29   #define FF_LJ   1
30 + #define FF_EAM  2
31  
32 + using namespace std;
33  
34   SimSetup::SimSetup(){
35 +  
36 +  isInfoArray = 0;
37 +  nInfo = 1;
38 +  
39    stamps = new MakeStamps();
40    globals = new Globals();
41    
42 +  
43   #ifdef IS_MPI
44    strcpy( checkPointMsg, "SimSetup creation successful" );
45    MPIcheckPoint();
# Line 41 | Line 51 | void SimSetup::parseFile( char* fileName ){
51    delete globals;
52   }
53  
54 + void SimSetup::setSimInfo( SimInfo* the_info, int theNinfo ) {
55 +    info = the_info;
56 +    nInfo = theNinfo;
57 +    isInfoArray = 1;
58 +  }
59 +
60 +
61   void SimSetup::parseFile( char* fileName ){
62  
63   #ifdef IS_MPI
# Line 586 | Line 603 | void SimSetup::gatherInfo( void ){
603  
604    if( !strcasecmp( force_field, "DUFF" )) ffCase = FF_DUFF;
605    else if( !strcasecmp( force_field, "LJ" )) ffCase = FF_LJ;
606 +  else if( !strcasecmp( force_field, "EAM" )) ffCase = FF_EAM;
607    else{
608      sprintf( painCave.errMsg,
609               "SimSetup Error. Unrecognized force field -> %s\n",
# Line 605 | Line 623 | void SimSetup::gatherInfo( void ){
623    else if( !strcasecmp( ensemble, "NPTf" )) ensembleCase = NPTf_ENS;
624    else if( !strcasecmp( ensemble, "NPTim" )) ensembleCase = NPTim_ENS;
625    else if( !strcasecmp( ensemble, "NPTfm" )) ensembleCase = NPTfm_ENS;
626 +  else if( !strcasecmp( ensemble, "NVEZCONS")) ensembleCase = NVEZCONS_ENS;
627    else{
628      sprintf( painCave.errMsg,
629               "SimSetup Warning. Unrecognized Ensemble -> %s, "
# Line 1032 | Line 1051 | void SimSetup::createFF( void ){
1051      the_ff = new LJFF();
1052      break;
1053  
1054 +  case FF_EAM:
1055 +    the_ff = new EAM_FF();
1056 +    break;
1057 +
1058    default:
1059      sprintf( painCave.errMsg,
1060               "SimSetup Error. Unrecognized force field in case statement.\n");
# Line 1286 | Line 1309 | void SimSetup::makeIntegrator( void ){
1309    NPTf<RealIntegrator>* myNPTf = NULL;
1310    NPTim<RealIntegrator>* myNPTim = NULL;
1311    NPTfm<RealIntegrator>* myNPTfm = NULL;
1312 <
1312 >  ZConstraint<NVE<RealIntegrator> >* myNVEZCons = NULL;
1313 >      
1314 >  cerr << "setting integrator" <<endl;    
1315 >  
1316    switch( ensembleCase ){
1317  
1318    case NVE_ENS:
# Line 1448 | Line 1474 | void SimSetup::makeIntegrator( void ){
1474        simError();
1475      }
1476      break;
1477 +    
1478 +  case NVEZCONS_ENS:
1479 +    {
1480 +
1481 +      if(globals->haveZConsTime()){  
1482 +
1483 +        //add sample time of z-constraint  into SimInfo's property list                    
1484 +        DoubleData* zconsTimeProp = new DoubleData();
1485 +        zconsTimeProp->setID("zconstime");
1486 +        zconsTimeProp->setData(globals->getZConsTime());
1487 +        info->addProperty(zconsTimeProp);
1488 +      }
1489 +      else{
1490 +        sprintf( painCave.errMsg,
1491 +                 "ZConstraint error: If you use an ZConstraint\n"
1492 +                 " , you must set sample time.\n");
1493 +        painCave.isFatal = 1;
1494 +        simError();      
1495 +      }
1496 +      
1497 +      if(globals->haveIndexOfAllZConsMols()){
1498 +
1499 +        //add index of z-constraint molecules into SimInfo's property list
1500 +        vector<int> tempIndex = globals->getIndexOfAllZConsMols();
1501 +        sort(tempIndex.begin(), tempIndex.end());
1502 +        
1503 +        IndexData* zconsIndex = new IndexData();
1504 +        zconsIndex->setID("zconsindex");
1505 +        zconsIndex->setIndexData(tempIndex);
1506 +        info->addProperty(zconsIndex);
1507 +      }
1508 +      else{
1509 +        sprintf( painCave.errMsg,
1510 +                 "SimSetup error: If you use an ZConstraint\n"
1511 +                 " , you must set index of z-constraint molecules.\n");
1512 +        painCave.isFatal = 1;
1513 +        simError();    
1514 +      
1515 +      }
1516  
1517 +      //Determine the name of ouput file and add it into SimInfo's property list
1518 +      //Be careful, do not use inFileName, since it is a pointer which
1519 +      //point to a string at master node, and slave nodes do not contain that string
1520 +    
1521 +      string zconsOutput(info->finalName);
1522 +            
1523 +      zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz";
1524 +                
1525 +      StringData* zconsFilename = new StringData();
1526 +      zconsFilename->setID("zconsfilename");
1527 +      zconsFilename->setData(zconsOutput);
1528 +
1529 +      info->addProperty(zconsFilename);      
1530 +      
1531 +      myNVEZCons = new ZConstraint<NVE<RealIntegrator> >( info, the_ff );
1532 +        
1533 +    break;
1534 +    }
1535 +    
1536    default:
1537      sprintf( painCave.errMsg,
1538               "SimSetup Error. Unrecognized ensemble in case statement.\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines