nextsite() Ti function changes the current site of the ... to a new site. Ti
function can have two different implementations depending on the type of Metropolis
algorithmn in use. We '.y the ':.. )ler version, where we i .:.ly traverse the
lattice ;: ,' :"y from left to right and then going up after completing each line.
After the full lattice has been traversed, the state variable .- 1 :: is set. to TRUE
and the update_hereup and update_heredown variables are set. to FALSE.
prob() T: : is more or less the heart of the TwoDI model class. Ti. function calculates
the .1. lility of a spin flip at the current site of the If the state of the
system calls for a double i ': flip the function calculates the probability of that.
Since this function is called very often and lies at the core of the simulation, it is
very important that it is efficient in terms of ::: utational speed. It is therefore set
up as a list of if .. else statements which once an appropriate condition
is met the probability is calculated and the function terminates. ': : most conmmnon
system states are checked for first and the less common ones later, which means
that the prob() function needs only calculate those values required for just the
ability needed. If a spin "' is disallowed (if it. generates a time slice with all
spin downs for example) then this is immediate recognized and the probability
returned is zero, without computation. Also, the :, stations actually done, are
.:. .ed so that t.. require as few complex evaluations (such as exp) as possible.
absaction() T- : function calculates the value of the action for the l~m in its current
state. Ti function prob() certainly calculates the change in the action for each
successive spin flip, but this function instead calculates the value of the action
straight from the state as it is. T.. function is present only for purposes of error
i.e., by the sequential change in the action obtained through
() to the absolute value of the action at some final state (after i.. i:)s millions
of sweeps) we have a very good check on how accurate the prob() function works.
': results from this function helped us find many errors until we finally started