9 |
|
#include "parse_me.h" |
10 |
|
#include "Integrator.hpp" |
11 |
|
#include "simError.h" |
12 |
+ |
//#include "ConjugateMinimizer.hpp" |
13 |
+ |
#include "OOPSEMinimizer.hpp" |
14 |
|
|
15 |
|
#ifdef IS_MPI |
16 |
|
#include "mpiBASS.h" |
26 |
|
#define NPTxyz_ENS 4 |
27 |
|
|
28 |
|
|
29 |
< |
#define FF_DUFF 0 |
30 |
< |
#define FF_LJ 1 |
31 |
< |
#define FF_EAM 2 |
29 |
> |
#define FF_DUFF 0 |
30 |
> |
#define FF_LJ 1 |
31 |
> |
#define FF_EAM 2 |
32 |
> |
#define FF_H2O 3 |
33 |
|
|
34 |
|
using namespace std; |
35 |
|
|
147 |
|
|
148 |
|
makeOutNames(); |
149 |
|
|
150 |
< |
// make the integrator |
151 |
< |
|
152 |
< |
makeIntegrator(); |
153 |
< |
|
150 |
> |
if (globals->haveMinimizer()) |
151 |
> |
// make minimizer |
152 |
> |
makeMinimizer(); |
153 |
> |
else |
154 |
> |
// make the integrator |
155 |
> |
makeIntegrator(); |
156 |
> |
|
157 |
|
#ifdef IS_MPI |
158 |
|
mpiSim->mpiRefresh(); |
159 |
|
#endif |
230 |
|
// in space using the three Euler angles. We assume the standard |
231 |
|
// unit vector was originally along the z axis below. |
232 |
|
|
233 |
< |
phi = currentAtom->getEulerPhi(); |
234 |
< |
theta = currentAtom->getEulerTheta(); |
235 |
< |
psi = currentAtom->getEulerPsi(); |
233 |
> |
phi = currentAtom->getEulerPhi() * M_PI / 180.0; |
234 |
> |
theta = currentAtom->getEulerTheta() * M_PI / 180.0; |
235 |
> |
psi = currentAtom->getEulerPsi()* M_PI / 180.0; |
236 |
|
|
237 |
|
Axx = (cos(phi) * cos(psi)) - (sin(phi) * cos(theta) * sin(psi)); |
238 |
|
Axy = (sin(phi) * cos(psi)) + (cos(phi) * cos(theta) * sin(psi)); |
641 |
|
else if (!strcasecmp(force_field, "EAM")){ |
642 |
|
ffCase = FF_EAM; |
643 |
|
} |
644 |
+ |
else if (!strcasecmp(force_field, "WATER")){ |
645 |
+ |
ffCase = FF_H2O; |
646 |
+ |
} |
647 |
|
else{ |
648 |
|
sprintf(painCave.errMsg, "SimSetup Error. Unrecognized force field -> %s\n", |
649 |
|
force_field); |
846 |
|
for (int i = 0; i < nInfo; i++){ |
847 |
|
info[i].setSeed(seedValue); |
848 |
|
} |
849 |
< |
|
849 |
> |
|
850 |
|
#ifdef IS_MPI |
851 |
< |
strcpy(checkPointMsg, "Succesfully gathered all information from Bass\n"); |
851 |
> |
strcpy(checkPointMsg, "Successfully gathered all information from Bass\n"); |
852 |
|
MPIcheckPoint(); |
853 |
|
#endif // is_mpi |
854 |
|
} |
1143 |
|
|
1144 |
|
case FF_EAM: |
1145 |
|
the_ff = new EAM_FF(); |
1146 |
+ |
break; |
1147 |
+ |
|
1148 |
+ |
case FF_H2O: |
1149 |
+ |
the_ff = new WATER(); |
1150 |
|
break; |
1151 |
|
|
1152 |
|
default: |
1663 |
|
} |
1664 |
|
|
1665 |
|
theInfo.addProperty(zconsForcePolicy); |
1666 |
+ |
|
1667 |
+ |
//set zcons gap |
1668 |
+ |
DoubleData* zconsGap = new DoubleData(); |
1669 |
+ |
zconsGap->setID(ZCONSGAP_ID); |
1670 |
+ |
|
1671 |
+ |
if (globals->haveZConsGap()){ |
1672 |
+ |
zconsGap->setData(globals->getZconsGap()); |
1673 |
+ |
theInfo.addProperty(zconsGap); |
1674 |
+ |
} |
1675 |
|
|
1676 |
+ |
//set zcons fixtime |
1677 |
+ |
DoubleData* zconsFixtime = new DoubleData(); |
1678 |
+ |
zconsFixtime->setID(ZCONSFIXTIME_ID); |
1679 |
+ |
|
1680 |
+ |
if (globals->haveZConsFixTime()){ |
1681 |
+ |
zconsFixtime->setData(globals->getZconsFixtime()); |
1682 |
+ |
theInfo.addProperty(zconsFixtime); |
1683 |
+ |
} |
1684 |
+ |
|
1685 |
+ |
//set zconsUsingSMD |
1686 |
+ |
IntData* zconsUsingSMD = new IntData(); |
1687 |
+ |
zconsUsingSMD->setID(ZCONSUSINGSMD_ID); |
1688 |
+ |
|
1689 |
+ |
if (globals->haveZConsUsingSMD()){ |
1690 |
+ |
zconsUsingSMD->setData(globals->getZconsUsingSMD()); |
1691 |
+ |
theInfo.addProperty(zconsUsingSMD); |
1692 |
+ |
} |
1693 |
+ |
|
1694 |
|
//Determine the name of ouput file and add it into SimInfo's property list |
1695 |
|
//Be careful, do not use inFileName, since it is a pointer which |
1696 |
|
//point to a string at master node, and slave nodes do not contain that string |
1720 |
|
tempParaItem.zPos = zconStamp[i]->getZpos(); |
1721 |
|
tempParaItem.zconsIndex = zconStamp[i]->getMolIndex(); |
1722 |
|
tempParaItem.kRatio = zconStamp[i]->getKratio(); |
1723 |
< |
|
1723 |
> |
tempParaItem.havingCantVel = zconStamp[i]->haveCantVel(); |
1724 |
> |
tempParaItem.cantVel = zconStamp[i]->getCantVel(); |
1725 |
|
zconsParaData->addItem(tempParaItem); |
1726 |
|
} |
1727 |
|
|
1739 |
|
//push data into siminfo, therefore, we can retrieve later |
1740 |
|
theInfo.addProperty(zconsParaData); |
1741 |
|
} |
1742 |
+ |
|
1743 |
+ |
void SimSetup::makeMinimizer(){ |
1744 |
+ |
|
1745 |
+ |
OOPSEMinimizer* myOOPSEMinimizer; |
1746 |
+ |
MinimizerParameterSet* param; |
1747 |
+ |
char minimizerName[100]; |
1748 |
+ |
|
1749 |
+ |
for (int i = 0; i < nInfo; i++){ |
1750 |
+ |
|
1751 |
+ |
//prepare parameter set for minimizer |
1752 |
+ |
param = new MinimizerParameterSet(); |
1753 |
+ |
param->setDefaultParameter(); |
1754 |
+ |
|
1755 |
+ |
if (globals->haveMinimizer()){ |
1756 |
+ |
param->setFTol(globals->getMinFTol()); |
1757 |
+ |
} |
1758 |
+ |
|
1759 |
+ |
if (globals->haveMinGTol()){ |
1760 |
+ |
param->setGTol(globals->getMinGTol()); |
1761 |
+ |
} |
1762 |
+ |
|
1763 |
+ |
if (globals->haveMinMaxIter()){ |
1764 |
+ |
param->setMaxIteration(globals->getMinMaxIter()); |
1765 |
+ |
} |
1766 |
+ |
|
1767 |
+ |
if (globals->haveMinWriteFrq()){ |
1768 |
+ |
param->setMaxIteration(globals->getMinMaxIter()); |
1769 |
+ |
} |
1770 |
+ |
|
1771 |
+ |
if (globals->haveMinWriteFrq()){ |
1772 |
+ |
param->setWriteFrq(globals->getMinWriteFrq()); |
1773 |
+ |
} |
1774 |
+ |
|
1775 |
+ |
if (globals->haveMinStepSize()){ |
1776 |
+ |
param->setStepSize(globals->getMinStepSize()); |
1777 |
+ |
} |
1778 |
+ |
|
1779 |
+ |
if (globals->haveMinLSMaxIter()){ |
1780 |
+ |
param->setLineSearchMaxIteration(globals->getMinLSMaxIter()); |
1781 |
+ |
} |
1782 |
+ |
|
1783 |
+ |
if (globals->haveMinLSTol()){ |
1784 |
+ |
param->setLineSearchTol(globals->getMinLSTol()); |
1785 |
+ |
} |
1786 |
+ |
|
1787 |
+ |
strcpy(minimizerName, globals->getMinimizer()); |
1788 |
+ |
|
1789 |
+ |
if (!strcasecmp(minimizerName, "CG")){ |
1790 |
+ |
myOOPSEMinimizer = new PRCGMinimizer(&(info[i]), the_ff, param); |
1791 |
+ |
} |
1792 |
+ |
else if (!strcasecmp(minimizerName, "SD")){ |
1793 |
+ |
//myOOPSEMinimizer = MinimizerFactory.creatMinimizer("", &(info[i]), the_ff, param); |
1794 |
+ |
myOOPSEMinimizer = new SDMinimizer(&(info[i]), the_ff, param); |
1795 |
+ |
} |
1796 |
+ |
else{ |
1797 |
+ |
sprintf(painCave.errMsg, |
1798 |
+ |
"SimSetup error: Unrecognized Minimizer, use Conjugate Gradient \n"); |
1799 |
+ |
painCave.isFatal = 0; |
1800 |
+ |
simError(); |
1801 |
+ |
|
1802 |
+ |
myOOPSEMinimizer = new PRCGMinimizer(&(info[i]), the_ff, param); |
1803 |
+ |
} |
1804 |
+ |
info[i].the_integrator = myOOPSEMinimizer; |
1805 |
+ |
|
1806 |
+ |
//store the minimizer into simInfo |
1807 |
+ |
info[i].the_minimizer = myOOPSEMinimizer; |
1808 |
+ |
info[i].has_minimizer = true; |
1809 |
+ |
} |
1810 |
+ |
|
1811 |
+ |
} |