|
Algorithm A2 Program Flow: Field-driven spin dynamics on the graph |
-
1:
INPUT: Graph , store as an array of Edge objects with identity of source and destination vertices, and the edges’s weight ; the defect edges are marked; the number of all edges is , the number of all vertices is N; input ;
-
2:
Find the maximum number of nearest neighbours among vertices in ; set the external field to ; reset time counter;
-
3:
Assign to defect bonds, else ;
-
4:
Attach two types of spins and (for parallel update) to each vertex; initialise the spin state as:
-
5:
for all vertices
do
-
6:
set and ; the magnetisation ;
-
7:
end for
-
8:
while
do
-
9:
Field ramping to trigger spin flips; Reset avalanche counters;
-
10:
Flips: reset counter of flipped spins ;
-
11:
for all vertices
do
-
12:
compute local field as the sum over all nearest neighbours and add the current ;
-
13:
check the orientation of the spin and the local field and, and with prob. c, flip the spin to align it with the local filed; for parallel update, the auxiliary spin is flipped;
-
14:
count the number of flipped spins ; update M from the number of flipped spins;
-
15:
end for
-
16:
update time t; sample temporal variables;
-
17:
Swap spins at all vertices;
-
18:
if
then
-
19:
go to Flips and repeat the process;
-
20:
else
-
21:
Determine the avalanche size from the number of flipped spins;
-
22:
end if
-
23:
end while
-
24:
Sample the data of interest;
-
25:
END
|