14 const std::string& lmpLocation,
15 const std::string& potentialName,
16 const double& temperature,
17 const std::string& filename) :
18 lmpLocation(lmpLocation),
19 potentialName(potentialName),
20 temperature(temperature),
23 if (!filename.empty())
29 const std::pair<StateType,SystemType>& currentStateSystem)
32 const auto& currentState= currentStateSystem.first;
33 const auto& currentSystem= currentStateSystem.second;
34 const auto& proposedState= proposedStateSystem.first;
35 const auto& proposedSystem= proposedStateSystem.second;
38 const auto &temp = currentSystem.densityEnergy(lmpLocation, potentialName,
false);
39 currentDensity = std::get<0>(temp);
40 currentEnergy = std::get<1>(temp);
41 stateEnergyMap[currentState] = currentEnergy;
45 assert(stateEnergyMap.find(currentState) != stateEnergyMap.end());
46 currentEnergy= stateEnergyMap[currentState];
49 double proposedEnergy, proposedDensity;
53 if (stateEnergyMap.find(proposedState) != stateEnergyMap.end()) {
54 proposedEnergy = stateEnergyMap.at(proposedState);
57 const auto& temp= proposedSystem.densityEnergy(lmpLocation, potentialName,
false);
58 proposedDensity= std::get<0>(temp);
59 proposedEnergy= std::get<1>(temp);
62 stateEnergyMap[proposedState] = proposedEnergy;
66 double delta = proposedEnergy - currentEnergy;
69 output << currentState <<
" " << currentState.density() <<
" " << currentEnergy << std::endl;
70 return std::min(1.0, exp(-delta / temperature));