forked from cpueschel/Lammps-Data-File-Generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparseDiffusions.py
More file actions
64 lines (51 loc) · 2.05 KB
/
Copy pathparseDiffusions.py
File metadata and controls
64 lines (51 loc) · 2.05 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#PM env deepmd3
import numpy as np
import matplotlib.pyplot as plt
import glob
import sys
allDiffs = [] # size = samples/docs x 3 (bottom (pt/o surface),mid,top (pt surf))
fnames = sorted(glob.glob('out*'))
for fname in fnames:
# fname = 'out1'
with open(fname,'r') as f:
rangeDiffs = [] # single file sample range limited component diffusion values
for iline, line in enumerate(f):
# bottom, mid, top order of file
if line.startswith('diffusivity_c_range_components'):
botDiff = line.split()
# print(line.split())
# print(float(line.split()[1][1:]))
xTemp = float(line.split()[1][1:])
yTemp = float(line.split()[2])
zTemp = float(line.split()[3][:-1])
if line.startswith('total'):
totalTemp =float(line.split()[1])
rangeDiffs.append([xTemp, yTemp, zTemp, totalTemp])
# print([xTemp,yTemp,zTemp])
# if iline==:
# botDiff = line.split()
# # print(line.split())
# # print(float(line.split()[1][1:]))
# xTemp = float(line.split()[1][1:])
# yTemp = float(line.split()[2])
# zTemp = float(line.split()[3][:-1])
# rangeDiffs.append([xTemp,yTemp,zTemp])
# # print([xTemp,yTemp,zTemp])
# print(rangeDiffs)
allDiffs.append(rangeDiffs)
# print(np.array(allDiffs).shape) # samples, c range, [x,y,z,total]
allDiffNP = np.array(allDiffs)
prop_cycle = plt.rcParams['axes.prop_cycle']
colors = prop_cycle.by_key()['color']
print(colors)
labels = ['Pt/O Surface','Bulk','Pt Surface']
for i in range(3):
plt.plot(allDiffNP[:,i,3],color=colors[i],label=labels[i])
plt.hlines(np.mean(allDiffNP[:,i,3]),0,len(allDiffNP)-1,color=colors[i],linestyle='--')
plt.legend()
plt.savefig('totalDiff.pdf')
plt.close()
for i in range(3):
plt.plot(allDiffNP[:,i,2])
plt.legend(['Pt/O Surface','Bulk','Pt Surface'])
plt.savefig('zDiff.pdf')