oILAB
Loading...
Searching...
No Matches
EvolutionAlgorithmImplementation.h
Go to the documentation of this file.
1//
2// Created by Nikhil Chandra Admal on 8/14/24.
3//
4
5#ifndef OILAB_EVOLUTIONALGORITHMIMPLEMENTATION_H
6#define OILAB_EVOLUTIONALGORITHMIMPLEMENTATION_H
7
8#include "../Utilities/randomInteger.h"
9#include "../Lattices/OrderedTuplet.h"
10#include "CanonicalTP.h"
11#include "LandauWangTP.h"
12#include "../Lattices/GbMesoState.h"
13
14namespace oILAB {
15template <typename StateType, typename SystemType,
16 typename TransitionProbabilityType>
17EvolutionAlgorithm<StateType, SystemType,
18 TransitionProbabilityType>::EvolutionAlgorithm()
19 : transitionProbability(static_cast<TransitionProbabilityType &>(*this)) {}
21template <typename StateType, typename SystemType,
22 typename TransitionProbabilityType>
25 const std::pair<StateType, SystemType> &proposedStateSystem,
26 const std::pair<StateType, SystemType> &currentStateSystem) const {
27 double probability = transitionProbability.probability(proposedStateSystem,
28 currentStateSystem);
29 if (random<double>(0.0, 1.0) <= probability)
30 return true;
31 else
32 return false;
33 }
34
35 } // namespace oILAB
36#endif
bool acceptMove(const std::pair< StateType, SystemType > &proposedStateSystem, const std::pair< StateType, SystemType > &currentStateSystem) const