2 Dimensional Ising Model
Simulate the change in energy and magnetization in a ferro magnet
Loading...
Searching...
No Matches
burn_in_time.py
1import matplotlib.pyplot as plt
2
3def plot_from_file():
4 files = [
5 "output/burn_in_time/unordered_1_0.txt",
6 "output/burn_in_time/ordered_1_0.txt",
7 "output/burn_in_time/unordered_2_4.txt",
8 "output/burn_in_time/ordered_2_4.txt",
9 ]
10 labels = [
11 "1.0, unordered",
12 "1.0, ordered",
13 "2.4, unordered",
14 "2.4, ordered"
15 ]
16 figure1, ax1 = plt.subplots()
17 figure2, ax2 = plt.subplots()
18
19 for infile, label in zip(files, labels):
20 with open(infile) as f:
21 lines = f.readlines()
22
23 t = []
24 energy = []
25 magnetization = []
26 for line in lines:
27 items = line.strip().split(",")
28 t.append(int(items[0]))
29 energy.append(float(items[1]))
30 magnetization.append(float(items[5]))
31
32 ax1.plot(t, energy, label=fr"$\langle \epsilon \rangle$ {label}")
33 ax2.plot(t, magnetization, label=fr"$\langle | m | \rangle$ {label}")
34
35 figure1.legend()
36 figure1.savefig("../latex/images/burn_in_time_energy.pdf")
37 figure2.legend()
38 figure2.savefig("../latex/images/burn_in_time_magnetization.pdf")
39
40def main():
41 plot_from_file()
42
43if __name__ == "__main__":
44 main()
int main()
The main function.
Definition: test_suite.cpp:148