14 const std::string &lmpLocation,
const std::string &potentialName,
15 const double &temperature,
const std::string &filename)
16 : lmpLocation(lmpLocation), potentialName(potentialName),
17 temperature(temperature), countTP(0) {
18 if (!filename.empty())
24 const std::pair<StateType,SystemType>& currentStateSystem)
27 const auto& currentState= currentStateSystem.first;
28 const auto& currentSystem= currentStateSystem.second;
29 const auto& proposedState= proposedStateSystem.first;
30 const auto& proposedSystem= proposedStateSystem.second;
33 const auto &temp = currentSystem.densityEnergy(lmpLocation, potentialName,
false);
34 currentDensity = std::get<0>(temp);
35 currentEnergy = std::get<1>(temp);
36 stateEnergyMap[currentState] = currentEnergy;
40 assert(stateEnergyMap.find(currentState) != stateEnergyMap.end());
41 currentEnergy= stateEnergyMap[currentState];
44 double proposedEnergy, proposedDensity;
48 if (stateEnergyMap.find(proposedState) != stateEnergyMap.end()) {
49 proposedEnergy = stateEnergyMap.at(proposedState);
52 const auto& temp= proposedSystem.densityEnergy(lmpLocation, potentialName,
false);
53 proposedDensity= std::get<0>(temp);
54 proposedEnergy= std::get<1>(temp);
57 stateEnergyMap[proposedState] = proposedEnergy;
61 double delta = proposedEnergy - currentEnergy;
64 output << currentState <<
" " << currentState.density() <<
" " << currentEnergy << std::endl;
65 return std::min(1.0, exp(-delta / temperature));