2 Dimensional Ising Model
Simulate the change in energy and magnetization in a ferro magnet
Loading...
Searching...
No Matches
2x2_analysis.py
1import matplotlib.pyplot as plt
2
3
4def plot_from_file():
5 figure, ax = plt.subplots()
6
7 with open("output/2_lattice_test.txt") as f:
8 lines = f.readlines()
9
10 t = []
11 energy = []
12 magnetization = []
13 for line in lines:
14 items = line.strip().split(",")
15 t.append(int(items[0]))
16 energy.append(float(items[1]))
17 magnetization.append(float(items[5]))
18
19 ax.plot(t, energy, label=f"<epsilon> {label}")
20 ax.plot(t, magnetization, label=f"<|m|> {label}")
21
22 figure.legend()
23 figure.savefig("../latex/images/2x2_analysis.pdf")
24
25def main():
26 plot_from_file()
27
28if __name__ == "__main__":
29 main()
int main()
The main function.
Definition: main.cpp:20