]> git.treefish.org Git - phys/heatbath.git/blobdiff - sim-1mr+.hpp
Fixed wrong 1mr+ update.
[phys/heatbath.git] / sim-1mr+.hpp
index 8902558d655f75977ec826423df565e092bdb236..e46a9ea89066ab6982510fc60ef679078b168586 100644 (file)
@@ -44,22 +44,21 @@ sim::sim(o815 *_O815) : o815::sim( _O815,
 void sim::updatePhi (const int& x) 
 {
   complex<double> V=0;
-  const double theta = gsl_rng_uniform(rangsl) * 2*M_PI;
 
   for (int nu=0; nu<4; nu++)
     V += conf[ (*nb)[x*4+nu] ].phi;
-
+  
   const double V2diff = pow(real(V), 2) - pow(imag(V), 2);
   const double Vprod = real(V)*imag(V);
   conf[x].phi = complex<double> ( + real(conf[x].phi) * V2diff + 2 * imag(conf[x].phi) * Vprod,
                                  - imag(conf[x].phi) * V2diff + 2 * real(conf[x].phi) * Vprod ) / norm(V);
-  
+
   const double r = exp( - M * norm(conf[x].phi)
                        - 1./M * norm(V)
                        + 2 * real( conf[x].phi * conj(V) ) );
   
   conf[x].phi = sqrt(std::log( 1./(1-r) )) / sqrt(M)
-    * complex<double>( cos(theta), sin(theta) )
+    * polar( 1.0, gsl_rng_uniform(rangsl) * 2*M_PI )
     + V / M;
 }