From c0993d9db869e6000ba2e34874d3bb346043ccd8 Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Mon, 23 Dec 2013 23:20:01 +0100 Subject: [PATCH] mc_tools : add debug print under macro When TRIQS_MCTOOLS_DEBUG is defined, the qmc now reports some basic debug info (when is a move accepted, rejected, ...). --- triqs/mc_tools/mc_basic_step.hpp | 38 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/triqs/mc_tools/mc_basic_step.hpp b/triqs/mc_tools/mc_basic_step.hpp index e0d42778..d767cc78 100644 --- a/triqs/mc_tools/mc_basic_step.hpp +++ b/triqs/mc_tools/mc_basic_step.hpp @@ -26,26 +26,34 @@ #include #include "mc_move_set.hpp" -namespace triqs { namespace mc_tools { namespace Step { +namespace triqs { +namespace mc_tools { + namespace Step { - // Performs one Metropolis step - template - struct Metropolis { - static void do_it (move_set & MoveGroup, random_generator & RNG, MCSignType & signe){ - double r = MoveGroup.attempt(); - if (RNG() < std::min(1.0,r)) { - signe *= MoveGroup.accept(); -#ifdef DEBUG - std::cerr<<" Metropolis sign = "<< signe < struct Metropolis { + static void do_it(move_set& MoveGroup, random_generator& RNG, MCSignType& signe) { + double r = MoveGroup.attempt(); + if (RNG() < std::min(1.0, r)) { +#ifdef TRIQS_MCTOOLS_DEBUG + std::cerr << " Move accepted " << std::endl; #endif + signe *= MoveGroup.accept(); +#ifdef TRIQS_MCTOOLS_DEBUG + std::cerr << " New sign = " << signe << std::endl; +#endif + } else { +#ifdef TRIQS_MCTOOLS_DEBUG + std::cerr << " Move rejected " << std::endl; +#endif + MoveGroup.reject(); } - else MoveGroup.reject(); } }; - // Put heat Bath here .... - -}}} + // Put heat Bath here .... + } +} +} #endif -