anderkve / FYS3150

https://anderkve.github.io/FYS3150
26 stars 14 forks source link

validation for different temperatures #93

Closed ghost closed 1 year ago

ghost commented 1 year ago

We tried to do the bonus plots of problem4 for different temperatures and we noted something weird: $m$ is doing fine but $m^2$ is not following the expected curve.

double true_m2(double beta){
    return 0.5*(std::exp(8.*beta) + 1.)/(std::cosh(8.*beta) + 3.);
}

in our mcmc function we have (omitting useless things)

    double m0 = std::fabs(lattice.magnetization())/N;
    for (int counter_cycles{}; counter_cycles < counter_max; counter_cycles++)
    {
        lattice.metropolis_step(epsilon0, m0, accepted);
        lattice.m = m0;

        avg_m += m0;
        avg_m2 += m0*m0;
    }

    avg_m /= counter_max;
    avg_m2 /= counter_max;

afterwards we take $n$ mcmc and average over $n-burnin$. m_temp.pdf m2_temp.pdf chi_temp.pdf But for bigger $L$ we don't see this big of a difference from Morten notes... is it a problem (you actually only require T=1 in problem4)?

anderkve commented 1 year ago

Hi @lnigro97!

Hmm, those results are a bit surprising, yes. They should match the analytical result as a function of T much more precisely than this. So while we don't require these plots in the report, it may be a sign that there is something wrong with your code.

afterwards we take n mcmc and average over n - burnin

I'm not sure I understand this statement. In the code snippet above you have already averaged over the number of samples, by dividing by counter_max. Why are you doing more averaging after this? Or am I misunderstanding?

I'm mostly guessing here, but one plausible source of problems could be if there is something wrong with how you have implemented the periodic boundary conditions. This would be much more noticeable for L=2 than for much higher L, since for L=2 the boundary interactions make up half of the total number of spin interactions.

ghost commented 1 year ago

OK thanks we are gonna look into it. Hopefully nothing serious thanks again.