| 1358 |
|
switch( ensembleCase ){ |
| 1359 |
|
|
| 1360 |
|
case NVE_ENS: |
| 1361 |
< |
if (haveZConstraint){ |
| 1362 |
< |
setupZConstraint(); |
| 1361 |
> |
if (globals->haveZconstraints()){ |
| 1362 |
> |
setupZConstraint(info[k]); |
| 1363 |
|
new ZConstraint<NVE<RealIntegrator> >( &(info[k]), the_ff ); |
| 1364 |
|
} |
| 1365 |
|
|
| 1368 |
|
break; |
| 1369 |
|
|
| 1370 |
|
case NVT_ENS: |
| 1371 |
< |
if (haveZConstraint){ |
| 1372 |
< |
setupZConstraint(); |
| 1371 |
> |
if (globals->haveZconstraints()){ |
| 1372 |
> |
setupZConstraint(info[k]); |
| 1373 |
|
myNVT = new ZConstraint<NVT<RealIntegrator> >( &(info[k]), the_ff ); |
| 1374 |
|
} |
| 1375 |
|
else |
| 1390 |
|
break; |
| 1391 |
|
|
| 1392 |
|
case NPTi_ENS: |
| 1393 |
< |
if (haveZConstraint){ |
| 1394 |
< |
setupZConstraint(); |
| 1393 |
> |
if (globals->haveZconstraints()){ |
| 1394 |
> |
setupZConstraint(info[k]); |
| 1395 |
|
myNPTi = new ZConstraint<NPTi<RealIntegrator> >( &(info[k]), the_ff ); |
| 1396 |
|
} |
| 1397 |
|
else |
| 1431 |
|
break; |
| 1432 |
|
|
| 1433 |
|
case NPTf_ENS: |
| 1434 |
< |
if (haveZConstraint){ |
| 1435 |
< |
setupZConstraint(); |
| 1434 |
> |
if (globals->haveZconstraints()){ |
| 1435 |
> |
setupZConstraint(info[k]); |
| 1436 |
|
myNPTf = new ZConstraint<NPTf<RealIntegrator> >( &(info[k]), the_ff ); |
| 1437 |
|
} |
| 1438 |
|
else |
| 1472 |
|
break; |
| 1473 |
|
|
| 1474 |
|
case NPTim_ENS: |
| 1475 |
< |
if (haveZConstraint){ |
| 1476 |
< |
setupZConstraint(); |
| 1475 |
> |
if (globals->haveZconstraints()){ |
| 1476 |
> |
setupZConstraint(info[k]); |
| 1477 |
|
myNPTim = new ZConstraint<NPTim<RealIntegrator> >( &(info[k]), the_ff ); |
| 1478 |
|
} |
| 1479 |
|
else |
| 1513 |
|
break; |
| 1514 |
|
|
| 1515 |
|
case NPTfm_ENS: |
| 1516 |
< |
if (haveZConstraint){ |
| 1517 |
< |
setupZConstraint(); |
| 1516 |
> |
if (globals->haveZconstraints()){ |
| 1517 |
> |
setupZConstraint(info[k]); |
| 1518 |
|
myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >( &(info[k]), the_ff ); |
| 1519 |
|
} |
| 1520 |
|
else |
| 1589 |
|
|
| 1590 |
|
} |
| 1591 |
|
|
| 1592 |
< |
void SimSetup::setupZConstraint() |
| 1592 |
> |
void SimSetup::setupZConstraint(SimInfo& theInfo) |
| 1593 |
|
{ |
| 1594 |
< |
int k; |
| 1595 |
< |
|
| 1596 |
< |
for(k=0; k<nInfo; k++){ |
| 1597 |
< |
|
| 1598 |
< |
if(globals->haveZConsTime()){ |
| 1594 |
> |
int nZConstraints; |
| 1595 |
> |
ZconStamp** zconStamp; |
| 1596 |
> |
|
| 1597 |
> |
if(globals->haveZconstraintTime()){ |
| 1598 |
|
|
| 1599 |
|
//add sample time of z-constraint into SimInfo's property list |
| 1600 |
|
DoubleData* zconsTimeProp = new DoubleData(); |
| 1601 |
< |
zconsTimeProp->setID("zconstime"); |
| 1602 |
< |
zconsTimeProp->setData(globals->getZConsTime()); |
| 1603 |
< |
info[k].addProperty(zconsTimeProp); |
| 1601 |
> |
zconsTimeProp->setID(ZCONSTIME_ID); |
| 1602 |
> |
zconsTimeProp->setData(globals->getZconsTime()); |
| 1603 |
> |
theInfo.addProperty(zconsTimeProp); |
| 1604 |
|
} |
| 1605 |
|
else{ |
| 1606 |
|
sprintf( painCave.errMsg, |
| 1609 |
|
painCave.isFatal = 1; |
| 1610 |
|
simError(); |
| 1611 |
|
} |
| 1612 |
< |
|
| 1613 |
< |
if(globals->haveIndexOfAllZConsMols()){ |
| 1614 |
< |
|
| 1615 |
< |
//add index of z-constraint molecules into SimInfo's property list |
| 1616 |
< |
vector<int> tempIndex = globals->getIndexOfAllZConsMols(); |
| 1617 |
< |
|
| 1618 |
< |
//sort the index |
| 1619 |
< |
sort(tempIndex.begin(), tempIndex.end()); |
| 1620 |
< |
|
| 1621 |
< |
IndexData* zconsIndex = new IndexData(); |
| 1622 |
< |
zconsIndex->setID("zconsindex"); |
| 1623 |
< |
zconsIndex->setIndexData(tempIndex); |
| 1624 |
< |
info[k].addProperty(zconsIndex); |
| 1625 |
< |
} |
| 1626 |
< |
else{ |
| 1627 |
< |
sprintf( painCave.errMsg, |
| 1629 |
< |
"SimSetup error: If you use an ZConstraint\n" |
| 1630 |
< |
" , you must set index of z-constraint molecules.\n"); |
| 1631 |
< |
painCave.isFatal = 1; |
| 1632 |
< |
simError(); |
| 1633 |
< |
|
| 1612 |
> |
|
| 1613 |
> |
// |
| 1614 |
> |
nZConstraints = globals->getNzConstraints(); |
| 1615 |
> |
zconStamp = globals->getZconStamp(); |
| 1616 |
> |
ZConsParaItem tempParaItem; |
| 1617 |
> |
|
| 1618 |
> |
ZConsParaData* zconsParaData = new ZConsParaData(); |
| 1619 |
> |
zconsParaData->setID(ZCONSPARADATA_ID); |
| 1620 |
> |
|
| 1621 |
> |
for(int i = 0; i < nZConstraints; i++){ |
| 1622 |
> |
tempParaItem.havingZPos = zconStamp[i]->haveZpos(); |
| 1623 |
> |
tempParaItem.zPos = zconStamp[i]->getZpos(); |
| 1624 |
> |
tempParaItem.zconsIndex = zconStamp[i]->getMolIndex(); |
| 1625 |
> |
tempParaItem.kRatio = zconStamp[i]->getKratio(); |
| 1626 |
> |
|
| 1627 |
> |
zconsParaData->addItem(tempParaItem); |
| 1628 |
|
} |
| 1629 |
< |
|
| 1629 |
> |
|
| 1630 |
> |
//sort the parameters by index of molecules |
| 1631 |
> |
zconsParaData->sortByIndex(); |
| 1632 |
> |
|
| 1633 |
> |
//push data into siminfo, therefore, we can retrieve later |
| 1634 |
> |
theInfo.addProperty(zconsParaData); |
| 1635 |
> |
|
| 1636 |
> |
//push zconsTol into siminfo, if user does not specify |
| 1637 |
> |
//value for zconsTol, a default value will be used |
| 1638 |
> |
DoubleData* zconsTol = new DoubleData(); |
| 1639 |
> |
zconsTol->setID(ZCONSTOL_ID); |
| 1640 |
> |
if(globals->haveZconsTol()){ |
| 1641 |
> |
zconsTol->setData(globals->getZconsTol()); |
| 1642 |
> |
} |
| 1643 |
> |
else{ |
| 1644 |
> |
double defaultZConsTol = 1E-6; |
| 1645 |
> |
sprintf( painCave.errMsg, |
| 1646 |
> |
"ZConstraint Waring: Tolerance for z-constraint methodl is not specified\n" |
| 1647 |
> |
" , default value %f is used.\n", defaultZConsTol); |
| 1648 |
> |
painCave.isFatal = 0; |
| 1649 |
> |
simError(); |
| 1650 |
> |
|
| 1651 |
> |
zconsTol->setData(defaultZConsTol); |
| 1652 |
> |
} |
| 1653 |
> |
theInfo.addProperty(zconsTol); |
| 1654 |
> |
|
| 1655 |
|
//Determine the name of ouput file and add it into SimInfo's property list |
| 1656 |
|
//Be careful, do not use inFileName, since it is a pointer which |
| 1657 |
|
//point to a string at master node, and slave nodes do not contain that string |
| 1658 |
|
|
| 1659 |
< |
string zconsOutput(info[k].finalName); |
| 1659 |
> |
string zconsOutput(theInfo.finalName); |
| 1660 |
|
|
| 1661 |
|
zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
| 1662 |
|
|
| 1663 |
|
StringData* zconsFilename = new StringData(); |
| 1664 |
< |
zconsFilename->setID("zconsfilename"); |
| 1664 |
> |
zconsFilename->setID(ZCONSFILENAME_ID); |
| 1665 |
|
zconsFilename->setData(zconsOutput); |
| 1666 |
|
|
| 1667 |
< |
info[k].addProperty(zconsFilename); |
| 1649 |
< |
} |
| 1667 |
> |
theInfo.addProperty(zconsFilename); |
| 1668 |
|
} |