void _newParas();
gsl_rng* rangsl;
void updatePhi (const int& x);
+ void updatePhi_angle_relax (const int& x, const complex<double>& V);
+ void updatePhi_angle_rand (const int& x, const complex<double>& V);
+ void updatePhi_r (const int& x, const complex<double>& V);
};
nb = new neigh(2, _O815->comargs.lsize[0], _O815->comargs.lsize[1]);
}
-void sim::updatePhi (const int& x)
+void sim::updatePhi_r (const int& x, const complex<double>& V)
{
- complex<double> V=0;
-
- 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) ) );
+ V / M;
}
+void sim::updatePhi_angle_relax (const int& x, const complex<double>& V)
+{
+ 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);
+}
+
+void sim::updatePhi_angle_rand (const int& x, const complex<double>& V)
+{
+ conf[x].phi = polar( abs(conf[x].phi), gsl_rng_uniform(rangsl) * 2*M_PI );
+}
+
+void sim::updatePhi (const int& x)
+{
+ complex<double> V=0;
+
+ for (int nu=0; nu<4; nu++)
+ V += conf[ (*nb)[x*4+nu] ].phi;
+
+ updatePhi_r(x,V);
+
+ if ( gsl_rng_uniform(rangsl) < 0.5 )
+ updatePhi_angle_relax(x,V);
+ else
+ updatePhi_angle_rand(x,V);
+}
+
void sim::_makeSweep() {
for (int ichecker=0; ichecker<2; ichecker++)
for (int it=0; it<O815->comargs.lsize[0]; it++)
{
const double theta = gsl_rng_uniform(rangsl) * 2*M_PI;
complex<double> V=0;
- const double oldarg = arg(conf[x].phi);
for (int nu=0; nu<4; nu++)
V += conf[ (*nb)[x*4+nu] ].phi;
+ 2 * real( conf[x].phi * conj(V) ) );
conf[x].phi = sqrt(std::log( 1./(1-r) )) / sqrt(M)
- * polar(1.0, oldarg)
+ * polar( 1.0, arg(conf[x].phi) )
+ V / M;
}
void sim::updatePhi (const int& x)
{
const double r = gsl_rng_uniform(rangsl);
- const double theta = gsl_rng_uniform(rangsl) * 2*M_PI;
- const double oldarg = arg(conf[x].phi);
complex<double> V=0;
for (int nu=0; nu<4; nu++)
V += conf[ (*nb)[x*4+nu] ].phi;
conf[x].phi = sqrt(std::log( 1./(1-r) )) / sqrt(M)
- * polar(1.0, oldarg)
+ * polar( 1.0, arg(conf[x].phi) )
+ V / M;
}