4 #include <gsl/gsl_rng.h>
8 #include "latlib/neigh.h"
10 class sim : public o815::sim {
26 void updatePhi (const int& x);
31 sim::sim(o815 *_O815) : o815::sim( _O815,
33 (_O815->comargs.lsize[0]*_O815->comargs.lsize[1]) ) {
34 conf = (siteconf*)confMem;
36 rangsl = gsl_rng_alloc(gsl_rng_ranlxs0);
37 gsl_rng_set(rangsl, time(NULL));
39 LSIZE2 = _O815->comargs.lsize[0] * _O815->comargs.lsize[1];
41 nb = new neigh(2, _O815->comargs.lsize[0], _O815->comargs.lsize[1]);
44 void sim::updatePhi (const int& x)
46 const double theta = gsl_rng_uniform(rangsl) * 2*M_PI;
49 for (int nu=0; nu<4; nu++)
50 V += conf[ (*nb)[x*4+nu] ].phi;
52 const double r = exp( - M * norm(conf[x].phi)
54 + 2 * real( conf[x].phi * conj(V) ) );
56 conf[x].phi = sqrt(std::log( 1./(1-r) )) / sqrt(M)
57 * complex<double>( cos(theta), sin(theta) )
61 void sim::_makeSweep() {
62 for (int ichecker=0; ichecker<2; ichecker++)
63 for (int it=0; it<O815->comargs.lsize[0]; it++)
64 for (int iy=(it+ichecker)%2; iy<O815->comargs.lsize[1]; iy+=2)
65 updatePhi( it*O815->comargs.lsize[1] + iy );
68 void sim::_newParas() {
69 m = (*O815->paraQ)["mass"];
70 M = pow( (*O815->paraQ)["mass"], 2 ) + 4;
71 *log << "SIM: Resetting fields." << endl << flush;
73 for (int ix=0; ix<LSIZE2; ix++)