-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlot_2.py
More file actions
47 lines (41 loc) · 1.71 KB
/
Plot_2.py
File metadata and controls
47 lines (41 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import pandas as pd
import sys
def main(iteration,size,temp_boundary,plotflag):
Reduced_Temp = []
Order_parameter = []
Order_parameter_STD = []
for i in range(0, temp_boundary*20):
filename = f"LL-Output-MSC={iteration}_size={size}_temp={i*0.05}.txt"
try:
df = pd.read_csv(filename,header=None,names=["MCS","Ratio","Energy","Order"],skiprows=9,sep="\s+")
# print(i*0.05)
temp = str(pd.read_csv(filename,header=None,nrows=1,skiprows=4).iloc[0])[28:33]
Reduced_Temp.append(temp)
Order_parameter.append(df[(df['MCS'] >600)]["Order"].mean())
Order_parameter_STD.append(df[(df['MCS'] >600)]["Order"].std())
except FileNotFoundError:
pass
# print(Reduced_Temp)
# print(Order_parameter)
# print(Order_parameter_STD)
fig,ax = plt.subplots()
ax.errorbar(Reduced_Temp,Order_parameter,yerr=Order_parameter_STD, fmt='-o', capsize=5)
ax.xaxis.set_major_locator(ticker.MultipleLocator(len(Reduced_Temp)/8))
ax.set_title(f"{size}x{size}Lebwohl-Lasher model")
ax.set_xlabel("Reduced Temperature, T*")
ax.set_ylabel("Mean Order Parameter, <S>")
if plotflag==1:
plt.savefig(f"OrderParameter_Temp_{filename}.png")
plt.show()
return 1
if __name__ == '__main__':
if int(len(sys.argv)) == 5:
ITERATIONS= int(sys.argv[1])
SIZE = int(sys.argv[2])
temp_boundary = int(sys.argv[3])
PLOTFLAG = int(sys.argv[4])
main(ITERATIONS, SIZE, temp_boundary,PLOTFLAG)
else:
print("Usage: python {} <ITERATIONS> <SIZE> <temp_boundary> <PLOTFLAG> ".format(sys.argv[0]))