CHROMA
global_metropolis_accrej.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Simple metropolis accept/reject
3  *
4  * Simple metropolis accept/reject
5  */
6 
7 #include "chromabase.h"
9 
10 namespace Chroma {
11 
12  // Metropolis accept/reject
13  /*! @ingroup hmc */
14  bool globalMetropolisAcceptReject(const Double& DeltaH)
15  {
16  START_CODE();
17 
18  // If deltaH is negative then always accept
19  bool ret_val;
20 
21 
22  if ( toBool( DeltaH <= Double(0)) ) {
23  ret_val = true;
24  }
25  else {
26  Double AccProb = exp(-DeltaH);
27  Double uni_dev;
28  random(uni_dev);
29 
30 
31  if( toBool( uni_dev <= AccProb ) ) {
32 
33  ret_val = true;
34 
35  }
36  else {
37 
38  ret_val = false;
39  }
40  }
41 
42  END_CODE();
43 
44  return ret_val;
45  }
46 
47 } // End namespace
Primary include file for CHROMA library code.
Global metropolis.
bool globalMetropolisAcceptReject(const Double &DeltaH)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
START_CODE()
FloatingPoint< double > Double
Definition: gtest.h:7351