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" |
16 |
|
|
17 |
|
// some defines for ensemble and Forcefield cases |
18 |
|
|
19 |
< |
#define NVE_ENS 0 |
20 |
< |
#define NVT_ENS 1 |
21 |
< |
#define NPTi_ENS 2 |
22 |
< |
#define NPTf_ENS 3 |
23 |
< |
#define NPTim_ENS 4 |
24 |
< |
#define NPTfm_ENS 5 |
19 |
> |
#define NVE_ENS 0 |
20 |
> |
#define NVT_ENS 1 |
21 |
> |
#define NPTi_ENS 2 |
22 |
> |
#define NPTf_ENS 3 |
23 |
> |
#define NPTim_ENS 4 |
24 |
> |
#define NPTfm_ENS 5 |
25 |
> |
#define NVEZCONS_ENS 6 |
26 |
> |
#define NVTZCONS_ENS 7 |
27 |
> |
#define NPTiZCONS_ENS 8 |
28 |
> |
#define NPTfZCONS_ENS 9 |
29 |
> |
#define NPTimZCONS_ENS 10 |
30 |
> |
#define NPTfmZCONS_ENS 11 |
31 |
|
|
24 |
– |
|
32 |
|
#define FF_DUFF 0 |
33 |
|
#define FF_LJ 1 |
34 |
+ |
#define FF_EAM 2 |
35 |
|
|
36 |
+ |
using namespace std; |
37 |
|
|
38 |
|
SimSetup::SimSetup(){ |
39 |
+ |
|
40 |
+ |
isInfoArray = 0; |
41 |
+ |
nInfo = 1; |
42 |
+ |
|
43 |
|
stamps = new MakeStamps(); |
44 |
|
globals = new Globals(); |
45 |
|
|
46 |
+ |
|
47 |
|
#ifdef IS_MPI |
48 |
|
strcpy( checkPointMsg, "SimSetup creation successful" ); |
49 |
|
MPIcheckPoint(); |
55 |
|
delete globals; |
56 |
|
} |
57 |
|
|
58 |
+ |
void SimSetup::setSimInfo( SimInfo* the_info, int theNinfo ) { |
59 |
+ |
info = the_info; |
60 |
+ |
nInfo = theNinfo; |
61 |
+ |
isInfoArray = 1; |
62 |
+ |
} |
63 |
+ |
|
64 |
+ |
|
65 |
|
void SimSetup::parseFile( char* fileName ){ |
66 |
|
|
67 |
|
#ifdef IS_MPI |
607 |
|
|
608 |
|
if( !strcasecmp( force_field, "DUFF" )) ffCase = FF_DUFF; |
609 |
|
else if( !strcasecmp( force_field, "LJ" )) ffCase = FF_LJ; |
610 |
+ |
else if( !strcasecmp( force_field, "EAM" )) ffCase = FF_EAM; |
611 |
|
else{ |
612 |
|
sprintf( painCave.errMsg, |
613 |
|
"SimSetup Error. Unrecognized force field -> %s\n", |
627 |
|
else if( !strcasecmp( ensemble, "NPTf" )) ensembleCase = NPTf_ENS; |
628 |
|
else if( !strcasecmp( ensemble, "NPTim" )) ensembleCase = NPTim_ENS; |
629 |
|
else if( !strcasecmp( ensemble, "NPTfm" )) ensembleCase = NPTfm_ENS; |
630 |
+ |
|
631 |
+ |
else if( !strcasecmp( ensemble, "NVEZCONS")) ensembleCase = NVEZCONS_ENS; |
632 |
+ |
else if( !strcasecmp( ensemble, "NVTZCONS")) ensembleCase = NVTZCONS_ENS; |
633 |
+ |
else if( !strcasecmp( ensemble, "NPTiZCONS") || !strcasecmp( ensemble, "NPTZCONS")) |
634 |
+ |
ensembleCase = NPTiZCONS_ENS; |
635 |
+ |
else if( !strcasecmp( ensemble, "NPTfZCONS")) ensembleCase = NPTfZCONS_ENS; |
636 |
+ |
else if( !strcasecmp( ensemble, "NPTimZCONS")) ensembleCase = NPTimZCONS_ENS; |
637 |
+ |
else if( !strcasecmp( ensemble, "NPTfmZCONS")) ensembleCase = NPTfmZCONS_ENS; |
638 |
+ |
|
639 |
|
else{ |
640 |
|
sprintf( painCave.errMsg, |
641 |
|
"SimSetup Warning. Unrecognized Ensemble -> %s, " |
793 |
|
MPI_Allreduce( &myUse, &usesDipoles, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD ); |
794 |
|
#endif //is_mpi |
795 |
|
|
796 |
+ |
double theEcr, theEst; |
797 |
|
|
798 |
|
if (globals->getUseRF() ) { |
799 |
|
info->useReactionField = 1; |
809 |
|
smallest = info->boxL[0]; |
810 |
|
if (info->boxL[1] <= smallest) smallest = info->boxL[1]; |
811 |
|
if (info->boxL[2] <= smallest) smallest = info->boxL[2]; |
812 |
< |
info->ecr = 0.5 * smallest; |
812 |
> |
theEcr = 0.5 * smallest; |
813 |
|
} else { |
814 |
< |
info->ecr = globals->getECR(); |
814 |
> |
theEcr = globals->getECR(); |
815 |
|
} |
816 |
|
|
817 |
|
if( !globals->haveEST() ){ |
821 |
|
); |
822 |
|
painCave.isFatal = 0; |
823 |
|
simError(); |
824 |
< |
info->est = 0.05 * info->ecr; |
824 |
> |
theEst = 0.05 * theEcr; |
825 |
|
} else { |
826 |
< |
info->est = globals->getEST(); |
826 |
> |
theEst= globals->getEST(); |
827 |
|
} |
828 |
+ |
|
829 |
+ |
info->setEcr( theEcr, theEst ); |
830 |
|
|
831 |
|
if(!globals->haveDielectric() ){ |
832 |
|
sprintf( painCave.errMsg, |
842 |
|
if (usesDipoles) { |
843 |
|
|
844 |
|
if( !globals->haveECR() ){ |
845 |
< |
sprintf( painCave.errMsg, |
846 |
< |
"SimSetup Warning: using default value of 1/2 the smallest " |
847 |
< |
"box length for the electrostaticCutoffRadius.\n" |
848 |
< |
"I hope you have a very fast processor!\n"); |
849 |
< |
painCave.isFatal = 0; |
850 |
< |
simError(); |
851 |
< |
double smallest; |
852 |
< |
smallest = info->boxL[0]; |
853 |
< |
if (info->boxL[1] <= smallest) smallest = info->boxL[1]; |
854 |
< |
if (info->boxL[2] <= smallest) smallest = info->boxL[2]; |
855 |
< |
info->ecr = 0.5 * smallest; |
845 |
> |
sprintf( painCave.errMsg, |
846 |
> |
"SimSetup Warning: using default value of 1/2 the smallest " |
847 |
> |
"box length for the electrostaticCutoffRadius.\n" |
848 |
> |
"I hope you have a very fast processor!\n"); |
849 |
> |
painCave.isFatal = 0; |
850 |
> |
simError(); |
851 |
> |
double smallest; |
852 |
> |
smallest = info->boxL[0]; |
853 |
> |
if (info->boxL[1] <= smallest) smallest = info->boxL[1]; |
854 |
> |
if (info->boxL[2] <= smallest) smallest = info->boxL[2]; |
855 |
> |
theEcr = 0.5 * smallest; |
856 |
|
} else { |
857 |
< |
info->ecr = globals->getECR(); |
857 |
> |
theEcr = globals->getECR(); |
858 |
|
} |
859 |
|
|
860 |
|
if( !globals->haveEST() ){ |
861 |
< |
sprintf( painCave.errMsg, |
862 |
< |
"SimSetup Warning: using default value of 5%% of the " |
863 |
< |
"electrostaticCutoffRadius for the " |
864 |
< |
"electrostaticSkinThickness\n" |
865 |
< |
); |
866 |
< |
painCave.isFatal = 0; |
867 |
< |
simError(); |
868 |
< |
info->est = 0.05 * info->ecr; |
869 |
< |
} else { |
870 |
< |
info->est = globals->getEST(); |
861 |
> |
sprintf( painCave.errMsg, |
862 |
> |
"SimSetup Warning: using default value of 0.05 * the " |
863 |
> |
"electrostaticCutoffRadius for the " |
864 |
> |
"electrostaticSkinThickness\n" |
865 |
> |
); |
866 |
> |
painCave.isFatal = 0; |
867 |
> |
simError(); |
868 |
> |
theEst = 0.05 * theEcr; |
869 |
> |
} else { |
870 |
> |
theEst= globals->getEST(); |
871 |
|
} |
872 |
+ |
|
873 |
+ |
info->setEcr( theEcr, theEst ); |
874 |
|
} |
875 |
|
} |
876 |
|
|
893 |
|
#ifdef IS_MPI |
894 |
|
}else fileInit = new InitializeFromFile( NULL ); |
895 |
|
#endif |
896 |
< |
fileInit->read_xyz( info ); // default velocities on |
896 |
> |
fileInit->readInit( info ); // default velocities on |
897 |
|
|
898 |
|
delete fileInit; |
899 |
|
} |
1063 |
|
the_ff = new LJFF(); |
1064 |
|
break; |
1065 |
|
|
1066 |
+ |
case FF_EAM: |
1067 |
+ |
the_ff = new EAM_FF(); |
1068 |
+ |
break; |
1069 |
+ |
|
1070 |
|
default: |
1071 |
|
sprintf( painCave.errMsg, |
1072 |
|
"SimSetup Error. Unrecognized force field in case statement.\n"); |
1316 |
|
|
1317 |
|
void SimSetup::makeIntegrator( void ){ |
1318 |
|
|
1319 |
< |
NVT* myNVT = NULL; |
1320 |
< |
NPTi* myNPTi = NULL; |
1321 |
< |
NPTf* myNPTf = NULL; |
1322 |
< |
NPTim* myNPTim = NULL; |
1323 |
< |
NPTfm* myNPTfm = NULL; |
1324 |
< |
|
1319 |
> |
NVT<RealIntegrator>* myNVT = NULL; |
1320 |
> |
NPTi<RealIntegrator>* myNPTi = NULL; |
1321 |
> |
NPTf<RealIntegrator>* myNPTf = NULL; |
1322 |
> |
NPTim<RealIntegrator>* myNPTim = NULL; |
1323 |
> |
NPTfm<RealIntegrator>* myNPTfm = NULL; |
1324 |
> |
ZConstraint<NVE<RealIntegrator> >* myNVEZCons = NULL; |
1325 |
> |
ZConstraint<NVT<RealIntegrator> >* myNVTZCons = NULL; |
1326 |
> |
ZConstraint<NPTi<RealIntegrator> >* myNPTiZCons = NULL; |
1327 |
> |
ZConstraint<NPTf<RealIntegrator> >* myNPTfZCons = NULL; |
1328 |
> |
ZConstraint<NPTim<RealIntegrator> >* myNPTimZCons = NULL; |
1329 |
> |
ZConstraint<NPTfm<RealIntegrator> >* myNPTfmZCons = NULL; |
1330 |
> |
|
1331 |
|
switch( ensembleCase ){ |
1332 |
|
|
1333 |
|
case NVE_ENS: |
1334 |
< |
new NVE( info, the_ff ); |
1334 |
> |
new NVE<RealIntegrator>( info, the_ff ); |
1335 |
|
break; |
1336 |
|
|
1337 |
|
case NVT_ENS: |
1338 |
< |
myNVT = new NVT( info, the_ff ); |
1338 |
> |
myNVT = new NVT<RealIntegrator>( info, the_ff ); |
1339 |
|
myNVT->setTargetTemp(globals->getTargetTemp()); |
1340 |
|
|
1341 |
|
if (globals->haveTauThermostat()) |
1351 |
|
break; |
1352 |
|
|
1353 |
|
case NPTi_ENS: |
1354 |
< |
myNPTi = new NPTi( info, the_ff ); |
1354 |
> |
myNPTi = new NPTi<RealIntegrator>( info, the_ff ); |
1355 |
|
myNPTi->setTargetTemp( globals->getTargetTemp() ); |
1356 |
|
|
1357 |
|
if (globals->haveTargetPressure()) |
1386 |
|
break; |
1387 |
|
|
1388 |
|
case NPTf_ENS: |
1389 |
< |
myNPTf = new NPTf( info, the_ff ); |
1389 |
> |
myNPTf = new NPTf<RealIntegrator>( info, the_ff ); |
1390 |
|
myNPTf->setTargetTemp( globals->getTargetTemp()); |
1391 |
|
|
1392 |
|
if (globals->haveTargetPressure()) |
1421 |
|
break; |
1422 |
|
|
1423 |
|
case NPTim_ENS: |
1424 |
< |
myNPTim = new NPTim( info, the_ff ); |
1424 |
> |
myNPTim = new NPTim<RealIntegrator>( info, the_ff ); |
1425 |
|
myNPTim->setTargetTemp( globals->getTargetTemp()); |
1426 |
|
|
1427 |
|
if (globals->haveTargetPressure()) |
1456 |
|
break; |
1457 |
|
|
1458 |
|
case NPTfm_ENS: |
1459 |
< |
myNPTfm = new NPTfm( info, the_ff ); |
1459 |
> |
myNPTfm = new NPTfm<RealIntegrator>( info, the_ff ); |
1460 |
|
myNPTfm->setTargetTemp( globals->getTargetTemp()); |
1461 |
|
|
1462 |
|
if (globals->haveTargetPressure()) |
1489 |
|
simError(); |
1490 |
|
} |
1491 |
|
break; |
1492 |
+ |
|
1493 |
+ |
case NVEZCONS_ENS: |
1494 |
|
|
1495 |
+ |
|
1496 |
+ |
//setup index of z-constraint molecules, z-constraint sampel time |
1497 |
+ |
//and z-constraint force output name. These parameter should be known |
1498 |
+ |
//before constructing the z-constraint integrator |
1499 |
+ |
setupZConstraint(); |
1500 |
+ |
|
1501 |
+ |
myNVEZCons = new ZConstraint<NVE<RealIntegrator> >( info, the_ff ); |
1502 |
+ |
|
1503 |
+ |
break; |
1504 |
+ |
|
1505 |
+ |
|
1506 |
+ |
case NVTZCONS_ENS: |
1507 |
+ |
|
1508 |
+ |
setupZConstraint(); |
1509 |
+ |
|
1510 |
+ |
myNVTZCons = new ZConstraint<NVT<RealIntegrator> >( info, the_ff ); |
1511 |
+ |
myNVTZCons->setTargetTemp(globals->getTargetTemp()); |
1512 |
+ |
|
1513 |
+ |
if (globals->haveTauThermostat()) |
1514 |
+ |
myNVTZCons->setTauThermostat(globals->getTauThermostat()); |
1515 |
+ |
|
1516 |
+ |
else { |
1517 |
+ |
sprintf( painCave.errMsg, |
1518 |
+ |
"SimSetup error: If you use the NVT\n" |
1519 |
+ |
" ensemble, you must set tauThermostat.\n"); |
1520 |
+ |
painCave.isFatal = 1; |
1521 |
+ |
simError(); |
1522 |
+ |
} |
1523 |
+ |
break; |
1524 |
+ |
|
1525 |
+ |
case NPTiZCONS_ENS: |
1526 |
+ |
|
1527 |
+ |
setupZConstraint(); |
1528 |
+ |
|
1529 |
+ |
myNPTiZCons = new ZConstraint<NPTi<RealIntegrator> >( info, the_ff ); |
1530 |
+ |
myNPTiZCons->setTargetTemp( globals->getTargetTemp() ); |
1531 |
+ |
|
1532 |
+ |
if (globals->haveTargetPressure()) |
1533 |
+ |
myNPTiZCons->setTargetPressure(globals->getTargetPressure()); |
1534 |
+ |
else { |
1535 |
+ |
sprintf( painCave.errMsg, |
1536 |
+ |
"SimSetup error: If you use a constant pressure\n" |
1537 |
+ |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1538 |
+ |
painCave.isFatal = 1; |
1539 |
+ |
simError(); |
1540 |
+ |
} |
1541 |
+ |
|
1542 |
+ |
if( globals->haveTauThermostat() ) |
1543 |
+ |
myNPTiZCons->setTauThermostat( globals->getTauThermostat() ); |
1544 |
+ |
else{ |
1545 |
+ |
sprintf( painCave.errMsg, |
1546 |
+ |
"SimSetup error: If you use an NPT\n" |
1547 |
+ |
" ensemble, you must set tauThermostat.\n"); |
1548 |
+ |
painCave.isFatal = 1; |
1549 |
+ |
simError(); |
1550 |
+ |
} |
1551 |
+ |
|
1552 |
+ |
if( globals->haveTauBarostat() ) |
1553 |
+ |
myNPTiZCons->setTauBarostat( globals->getTauBarostat() ); |
1554 |
+ |
else{ |
1555 |
+ |
sprintf( painCave.errMsg, |
1556 |
+ |
"SimSetup error: If you use an NPT\n" |
1557 |
+ |
" ensemble, you must set tauBarostat.\n"); |
1558 |
+ |
painCave.isFatal = 1; |
1559 |
+ |
simError(); |
1560 |
+ |
} |
1561 |
+ |
|
1562 |
+ |
break; |
1563 |
+ |
|
1564 |
+ |
case NPTfZCONS_ENS: |
1565 |
+ |
|
1566 |
+ |
setupZConstraint(); |
1567 |
+ |
|
1568 |
+ |
myNPTfZCons = new ZConstraint<NPTf<RealIntegrator> >( info, the_ff ); |
1569 |
+ |
myNPTfZCons->setTargetTemp( globals->getTargetTemp()); |
1570 |
+ |
|
1571 |
+ |
if (globals->haveTargetPressure()) |
1572 |
+ |
myNPTfZCons->setTargetPressure(globals->getTargetPressure()); |
1573 |
+ |
else { |
1574 |
+ |
sprintf( painCave.errMsg, |
1575 |
+ |
"SimSetup error: If you use a constant pressure\n" |
1576 |
+ |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1577 |
+ |
painCave.isFatal = 1; |
1578 |
+ |
simError(); |
1579 |
+ |
} |
1580 |
+ |
|
1581 |
+ |
if( globals->haveTauThermostat() ) |
1582 |
+ |
myNPTfZCons->setTauThermostat( globals->getTauThermostat() ); |
1583 |
+ |
else{ |
1584 |
+ |
sprintf( painCave.errMsg, |
1585 |
+ |
"SimSetup error: If you use an NPT\n" |
1586 |
+ |
" ensemble, you must set tauThermostat.\n"); |
1587 |
+ |
painCave.isFatal = 1; |
1588 |
+ |
simError(); |
1589 |
+ |
} |
1590 |
+ |
|
1591 |
+ |
if( globals->haveTauBarostat() ) |
1592 |
+ |
myNPTfZCons->setTauBarostat( globals->getTauBarostat() ); |
1593 |
+ |
else{ |
1594 |
+ |
sprintf( painCave.errMsg, |
1595 |
+ |
"SimSetup error: If you use an NPT\n" |
1596 |
+ |
" ensemble, you must set tauBarostat.\n"); |
1597 |
+ |
painCave.isFatal = 1; |
1598 |
+ |
simError(); |
1599 |
+ |
} |
1600 |
+ |
|
1601 |
+ |
break; |
1602 |
+ |
|
1603 |
+ |
case NPTimZCONS_ENS: |
1604 |
+ |
|
1605 |
+ |
setupZConstraint(); |
1606 |
+ |
|
1607 |
+ |
myNPTimZCons = new ZConstraint<NPTim<RealIntegrator> >( info, the_ff ); |
1608 |
+ |
myNPTimZCons->setTargetTemp( globals->getTargetTemp()); |
1609 |
+ |
|
1610 |
+ |
if (globals->haveTargetPressure()) |
1611 |
+ |
myNPTimZCons->setTargetPressure(globals->getTargetPressure()); |
1612 |
+ |
else { |
1613 |
+ |
sprintf( painCave.errMsg, |
1614 |
+ |
"SimSetup error: If you use a constant pressure\n" |
1615 |
+ |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1616 |
+ |
painCave.isFatal = 1; |
1617 |
+ |
simError(); |
1618 |
+ |
} |
1619 |
+ |
|
1620 |
+ |
if( globals->haveTauThermostat() ) |
1621 |
+ |
myNPTimZCons->setTauThermostat( globals->getTauThermostat() ); |
1622 |
+ |
else{ |
1623 |
+ |
sprintf( painCave.errMsg, |
1624 |
+ |
"SimSetup error: If you use an NPT\n" |
1625 |
+ |
" ensemble, you must set tauThermostat.\n"); |
1626 |
+ |
painCave.isFatal = 1; |
1627 |
+ |
simError(); |
1628 |
+ |
} |
1629 |
+ |
|
1630 |
+ |
if( globals->haveTauBarostat() ) |
1631 |
+ |
myNPTimZCons->setTauBarostat( globals->getTauBarostat() ); |
1632 |
+ |
else{ |
1633 |
+ |
sprintf( painCave.errMsg, |
1634 |
+ |
"SimSetup error: If you use an NPT\n" |
1635 |
+ |
" ensemble, you must set tauBarostat.\n"); |
1636 |
+ |
painCave.isFatal = 1; |
1637 |
+ |
simError(); |
1638 |
+ |
} |
1639 |
+ |
|
1640 |
+ |
break; |
1641 |
+ |
|
1642 |
+ |
case NPTfmZCONS_ENS: |
1643 |
+ |
|
1644 |
+ |
setupZConstraint(); |
1645 |
+ |
|
1646 |
+ |
myNPTfmZCons = new ZConstraint<NPTfm<RealIntegrator> >( info, the_ff ); |
1647 |
+ |
myNPTfmZCons->setTargetTemp( globals->getTargetTemp()); |
1648 |
+ |
|
1649 |
+ |
if (globals->haveTargetPressure()) |
1650 |
+ |
myNPTfmZCons->setTargetPressure(globals->getTargetPressure()); |
1651 |
+ |
else { |
1652 |
+ |
sprintf( painCave.errMsg, |
1653 |
+ |
"SimSetup error: If you use a constant pressure\n" |
1654 |
+ |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1655 |
+ |
painCave.isFatal = 1; |
1656 |
+ |
simError(); |
1657 |
+ |
} |
1658 |
+ |
|
1659 |
+ |
if( globals->haveTauThermostat() ) |
1660 |
+ |
myNPTfmZCons->setTauThermostat( globals->getTauThermostat() ); |
1661 |
+ |
else{ |
1662 |
+ |
sprintf( painCave.errMsg, |
1663 |
+ |
"SimSetup error: If you use an NPT\n" |
1664 |
+ |
" ensemble, you must set tauThermostat.\n"); |
1665 |
+ |
painCave.isFatal = 1; |
1666 |
+ |
simError(); |
1667 |
+ |
} |
1668 |
+ |
|
1669 |
+ |
if( globals->haveTauBarostat() ) |
1670 |
+ |
myNPTfmZCons->setTauBarostat( globals->getTauBarostat() ); |
1671 |
+ |
else{ |
1672 |
+ |
sprintf( painCave.errMsg, |
1673 |
+ |
"SimSetup error: If you use an NPT\n" |
1674 |
+ |
" ensemble, you must set tauBarostat.\n"); |
1675 |
+ |
painCave.isFatal = 1; |
1676 |
+ |
simError(); |
1677 |
+ |
} |
1678 |
+ |
break; |
1679 |
+ |
|
1680 |
+ |
|
1681 |
+ |
|
1682 |
|
default: |
1683 |
|
sprintf( painCave.errMsg, |
1684 |
|
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1714 |
|
#endif // is_mpi |
1715 |
|
|
1716 |
|
} |
1717 |
+ |
|
1718 |
+ |
void SimSetup::setupZConstraint() |
1719 |
+ |
{ |
1720 |
+ |
if(globals->haveZConsTime()){ |
1721 |
+ |
|
1722 |
+ |
//add sample time of z-constraint into SimInfo's property list |
1723 |
+ |
DoubleData* zconsTimeProp = new DoubleData(); |
1724 |
+ |
zconsTimeProp->setID("zconstime"); |
1725 |
+ |
zconsTimeProp->setData(globals->getZConsTime()); |
1726 |
+ |
info->addProperty(zconsTimeProp); |
1727 |
+ |
} |
1728 |
+ |
else{ |
1729 |
+ |
sprintf( painCave.errMsg, |
1730 |
+ |
"ZConstraint error: If you use an ZConstraint\n" |
1731 |
+ |
" , you must set sample time.\n"); |
1732 |
+ |
painCave.isFatal = 1; |
1733 |
+ |
simError(); |
1734 |
+ |
} |
1735 |
+ |
|
1736 |
+ |
if(globals->haveIndexOfAllZConsMols()){ |
1737 |
+ |
|
1738 |
+ |
//add index of z-constraint molecules into SimInfo's property list |
1739 |
+ |
vector<int> tempIndex = globals->getIndexOfAllZConsMols(); |
1740 |
+ |
|
1741 |
+ |
//sort the index |
1742 |
+ |
sort(tempIndex.begin(), tempIndex.end()); |
1743 |
+ |
|
1744 |
+ |
IndexData* zconsIndex = new IndexData(); |
1745 |
+ |
zconsIndex->setID("zconsindex"); |
1746 |
+ |
zconsIndex->setIndexData(tempIndex); |
1747 |
+ |
info->addProperty(zconsIndex); |
1748 |
+ |
} |
1749 |
+ |
else{ |
1750 |
+ |
sprintf( painCave.errMsg, |
1751 |
+ |
"SimSetup error: If you use an ZConstraint\n" |
1752 |
+ |
" , you must set index of z-constraint molecules.\n"); |
1753 |
+ |
painCave.isFatal = 1; |
1754 |
+ |
simError(); |
1755 |
+ |
|
1756 |
+ |
} |
1757 |
+ |
|
1758 |
+ |
//Determine the name of ouput file and add it into SimInfo's property list |
1759 |
+ |
//Be careful, do not use inFileName, since it is a pointer which |
1760 |
+ |
//point to a string at master node, and slave nodes do not contain that string |
1761 |
+ |
|
1762 |
+ |
string zconsOutput(info->finalName); |
1763 |
+ |
|
1764 |
+ |
zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1765 |
+ |
|
1766 |
+ |
StringData* zconsFilename = new StringData(); |
1767 |
+ |
zconsFilename->setID("zconsfilename"); |
1768 |
+ |
zconsFilename->setData(zconsOutput); |
1769 |
+ |
|
1770 |
+ |
info->addProperty(zconsFilename); |
1771 |
+ |
|
1772 |
+ |
} |