-
Notifications
You must be signed in to change notification settings - Fork 52
/
plot_sdc.py
49 lines (38 loc) · 1.55 KB
/
plot_sdc.py
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
48
import matplotlib.pyplot as plt
import numpy as np
sdc=np.loadtxt('nve/sdc.out')
msd=np.loadtxt('nve/msd.out')
M=sdc.shape[0]
t=sdc[:,0] # ps
print('SDC from VAC = ', np.mean(sdc[-1,4:7]), ' +- ', np.std(sdc[-1,4:7])/np.sqrt(3))
print('SDC from MSD = ', np.mean(msd[-1,4:7]), ' +- ', np.std(msd[-1,4:7])/np.sqrt(3))
plt.figure(figsize=(12, 4))
plt.subplot(1, 3, 1)
plt.plot(t, sdc[:,4], '-', linewidth=3,label='x')
plt.plot(t, sdc[:,5], '-', linewidth=3,label='y')
plt.plot(t, sdc[:,6], '-', linewidth=3,label='z')
plt.plot(t, np.mean(sdc[:,4:7],axis=1), '--', linewidth=2,label='mean')
plt.xlabel('Correlation time (ps)', fontsize=15)
plt.ylabel('SDC from VAC ($\mathrm{\AA}^2$/ps)', fontsize=15)
plt.title('(a)', fontsize=15)
plt.legend(fontsize=15)
plt.subplot(1, 3, 2)
plt.plot(t, msd[:,4], '-', linewidth=3,label='x')
plt.plot(t, msd[:,5], '-', linewidth=3,label='y')
plt.plot(t, msd[:,6], '-', linewidth=3,label='z')
plt.plot(t, np.mean(sdc[:,4:7],axis=1), '--', linewidth=2,label='mean')
plt.xlim((0,4))
plt.xlabel('Correlation time (ps)', fontsize=15)
plt.ylabel('SDC fromo MSD ($\mathrm{\AA}^2$/ps)', fontsize=15)
plt.title('(b)', fontsize=15)
plt.legend(fontsize=15)
plt.subplot(1, 3, 3)
plt.plot(t, np.mean(sdc[:,4:7],axis=1), '-', linewidth=3,label='From VAC')
plt.plot(t, np.mean(msd[:,4:7],axis=1), '--', linewidth=3,label='From MSD')
plt.xlim((0,4))
plt.xlabel('Correlation time (ps)', fontsize=15)
plt.ylabel('SDC ($\mathrm{\AA}^2$/ps)', fontsize=15)
plt.title('(c)', fontsize=15)
plt.legend(fontsize=15)
plt.tight_layout()
plt.savefig('fig-c09-sdc.pdf')