SunnySuite / Sunny.jl

Spin dynamics and generalization to SU(N) coherent states
Other
86 stars 19 forks source link

MetropolisSampler should allow adjustable magnitude of updates #36

Closed kbarros closed 1 year ago

kbarros commented 2 years ago

Currently MetropolisSampler can only do a "full randomization" of the Heisenberg spin or SU(N) coherent state, e.g. https://github.com/SunnySuite/Sunny.jl/blob/ef0d231df863f41f8cd5844c51959b640fe93c1a/src/Metropolis.jl#L239

At moderate to low temperatures, it is typically much more efficient to propose Gaussian perturbations to the given state, with magnitude controllable by the user. That is, MetropolisSampler should accept an additional parameter that defines the magnitude of the update, and this should be used by the _random_spin() function.

Note that we already have something like in WangLandau for Heisenberg spins: https://github.com/SunnySuite/Sunny.jl/blob/d0e863fba7a098c2bd566296951266e9285c51a2/src/WangLandau/WangLandau.jl#L125

Note that we probably don't need the spherical_cap_update() here: https://github.com/SunnySuite/Sunny.jl/blob/d0e863fba7a098c2bd566296951266e9285c51a2/src/WangLandau/WangLandau.jl#L69 (Since it requires some trig functions, I doubt that it's actually faster than generating the Gaussian random numbers.)

kbarros commented 1 year ago

This now works. LocalSampler replaces MetropolisSampler and accepts a general propose function.