1 #ifndef SM_MonteCarloSystem_HPP
2 #define SM_MonteCarloSystem_HPP
4 template<
class StochOutputImplement>
16 tString routineName=
"SMOMPI_MonteCarloSystem::stochasticRun<StochOutputI>(const tIndex&,SM_StochasticFunction&,StochOutputI&)";
21 tBoolean succeeds=
true;
38 "SMOMPI_MonteCarloSystem::stochasticRun<StochF>()",
39 "bad size of magnetic moments directions");
52 while (iStep<steppersNumber) {
54 MCStep(sfs,material,network,St,t,
55 alpha,sigma,mMovesNumber,mRejectsNumber);
58 statistics.
store(*
this);
70 while (i<nDrawnSteps) {
71 MCStep(sfs,material,network,St,t,
72 alpha,sigma,mMovesNumber,mRejectsNumber);
80 statistics.
store(*
this);
81 }
while (iStep<steppersNumber);
88 template<
class StochFunctionsImplement>
91 tString routineName=
"SMOMPI_MonteCarloSystem::templatedStochasticRun<StochFI>(const tIndex&,Multi<StochF>&)";
95 tBoolean succeeds=
true;
113 "SMOMPI_MonteCarloSystem::templatedStochasticRun<StochF>()",
114 "bad size of magnetic moments directions");
128 while (iStep<steppersNumber) {
130 MCStepWithSCStochasticFunctions<StochFunctionsImplement>(sfs,material,network,St,t,
131 alpha,sigma,mMovesNumber,mRejectsNumber);
143 template<
class StochFunctionsImplement,
class StochOutputImplement>
154 if (nDrawnSteps==0)
return stochasticRunWithSCStochasticFunctions<StochFunctionsImplement>(steppersNumber,sfs);
156 tString routineName=
"SMOMPI_MonteCarloSystem::templatedStochasticRun<StochFI,StochOI>(const tIndex&,StochF&,StochOI&)";
160 tBoolean succeeds=
true;
178 "SMOMPI_MonteCarloSystem::templatedStochasticRun<StochF,StochO>()",
179 "bad size of magnetic moments directions");
191 if (nDrawnSteps==1) {
192 while (iStep<steppersNumber) {
194 MCStepWithSCStochasticFunctions<StochFunctionsImplement>(sfs,material,network,St,t,
195 alpha,sigma,mMovesNumber,mRejectsNumber);
198 statistics.
store(*
this);
209 while (i<nDrawnSteps) {
210 MCStepWithSCStochasticFunctions<StochFunctionsImplement>(sfs,material,network,St,t,
211 alpha,sigma,mMovesNumber,mRejectsNumber);
220 statistics.
store(*
this);
221 }
while (iStep<steppersNumber);
228 template<
class StochFunctionsImplement>
232 const tIndex& stepIndex,
const tReal& alpha,
const tReal& sigma,
233 tIndex& nMoves,tIndex& nRejects) {
242 const tReal *eSi=
null;
243 std::array<tReal,SM_Constants::DIM> oldSi;
250 for(tIndex r=0;r<nParticles;r++) {
299 template<
class StochFunctionsImplement>
302 tReal *bS,
const tReal* eS)
const{
323 invNormS=1./sqrt(invNormS);
337 invNormS=1./sqrt(invNormS);
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:17
tIndex getElementsNumber() const
return the number values of the container
Definition: CORE_Field.h:135
static void EndCallRoutine(const tString &routineName)
end calling routine
Definition: CORE_Profiler.h:91
static void StartCallRoutine(const tString &routineName)
start calling routine
Definition: CORE_Profiler.h:61
static constexpr tDimension DIM
space dimension
Definition: SM_Constants.h:80
This class describes a materials defined by state attributes:
Definition: SM_Material.h:61
const tReal & getEnergyScaling() const
get the energy scaling
Definition: SM_MonteCarloSystem.h:140
virtual void updateStateForNextStep(SM_RealField &St)=0
update the state for next step
void MCStep(SM_MultiStochasticFunctionsInterface &multiStochasticFunctions, const SM_Material &material, const SM_Network &network, SM_RealField &S, const tIndex &stepIndex, const tReal &alpha, const tReal &sigma, tIndex &nMoves, tIndex &nRejects)
stepper step
Definition: SM_MonteCarloSystem.cpp:61
void MCStepWithSCStochasticFunctions(SM_MultiStochasticFunctions< StochFunctionsImplement > &multiStochasticFunctions, const SM_Material &material, const SM_Network &network, SM_RealField &S, const tIndex &stepIndex, const tReal &alpha, const tReal &sigma, tIndex &nMoves, tIndex &nRejects)
stepper step with templated stochastic function
Definition: SM_MonteCarloSystem.hpp:229
tBoolean stochasticRunWithSCStochasticFunctions(const tIndex &steppersNumber, SM_MultiStochasticFunctions< StochFunctionsImplement > &sfs)
compute the relaxation process by calling only virtual methods
Definition: SM_MonteCarloSystem.hpp:89
const tReal & getNoiseRate() const
get the noise rate constant
Definition: SM_MonteCarloSystem.h:134
tBoolean stochasticRun(const tIndex &steppersNumber, SM_MultiStochasticFunctionsInterface &sfs)
compute the steppers number of system for reaching the relaxed state
Definition: SM_MonteCarloSystem.cpp:3
void randomTrialMoveWithSCStochasticFunctions(SM_StochasticFunctions< StochFunctionsImplement > &stochasticFunctions, const tReal &sigma, tReal *bS, const tReal *eS) const
make a trial move
Definition: SM_MonteCarloSystem.hpp:300
This class describes a multi stochastic functions based on same random number generator which impleme...
Definition: SM_MultiStochasticFunctionsInterface.h:18
This class describes a multi stochastic functions based on same random number generator which impleme...
Definition: SM_MultiStochasticFunctions.h:26
This class is describes a network composed by.
Definition: SM_Network.h:66
const tInteger & getHaloParticlesNumber() const
return the halo particles number
Definition: SM_Network.h:355
const tInteger & getParticlesNumber() const
return the particles number
Definition: SM_Network.h:349
This class describes a stochastic functions with templated methods.
Definition: SM_StochasticFunctions.h:25
tReal scNormalRandom()
compute a normal random number by static casting method
Definition: SM_StochasticFunctions.h:114
tReal scUniformRandom()
compute a uniform random number in [0,1] bu static casting method
Definition: SM_StochasticFunctions.h:121
const tInteger & getDrawnStepsNumber() const
get the drawn number to compute the stochastic output
Definition: SM_StochasticOutputComponent.h:243
this class implements the virtual methods of its base class SM_StochasticOutputComponent with templat...
Definition: SM_StochasticOutput.h:24
tBoolean store(const SM_System &system)
store the stochastic data during the relation method of the system
Definition: SM_StochasticOutput.h:164
const SM_RealField & getMagneticMomentDirections() const
get the unit direction of spins at time
Definition: SM_System.h:267
void updateOperatorsState(const tIndex &timeIndex, const SM_Network &network, const SM_Material &material, const SM_RealField &S)
update the operators state before computeing magnetic field
Definition: SM_System.h:573
const SM_Network & getNetwork() const
get the network
Definition: SM_System.h:170
const SM_Material & getMaterial() const
get the material of the network
Definition: SM_System.h:193
tReal computeSpinEnergy(const tIndex &i, const SM_Network &network, const SM_Material &material, const SM_RealField &S) const
compute the energy of the spin of the system
Definition: SM_System.h:629
const tIndex & getStepIndex() const
get the step index
Definition: SM_System.h:415