mcta 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mcta might be problematic. Click here for more details.
- mcta/__init__.py +11 -0
- mcta/__main__.py +7 -0
- mcta/bandplot/__main__.py +8 -0
- mcta/bandplot/mass.py +163 -0
- mcta/bandplot/ph.py +918 -0
- mcta/bandplot/plots.py +532 -0
- mcta/bandplot/pplots.py +436 -0
- mcta/bandplot/projected.py +208 -0
- mcta/bandplot/readdata.py +174 -0
- mcta/bandplot/vaspread.py +855 -0
- mcta/bandplot/wrapper.py +804 -0
- mcta/cli.py +236 -0
- mcta/pbandplot.py +8 -0
- mcta/ph.py +8 -0
- mcta/seeker/__main__.py +7 -0
- mcta/seeker/agent.py +270 -0
- mcta/seeker/cli.py +398 -0
- mcta/seeker/config.py +153 -0
- mcta/seeker/curate.py +615 -0
- mcta/seeker/llm.py +42 -0
- mcta/seeker/ml.py +230 -0
- mcta/seeker/sqs.py +488 -0
- mcta/seeker/state.py +70 -0
- mcta/seeker/tools.py +621 -0
- mcta/sh/__main__.py +8 -0
- mcta/sh/cli.py +129 -0
- mcta/sh/scripts/ck.sh +5 -0
- mcta/sh/scripts/cp.sh +3 -0
- mcta/sh/scripts/en.sh +3 -0
- mcta/sh/scripts/ex.sh +6 -0
- mcta/sh/scripts/gr.sh +5 -0
- mcta/sh/scripts/ig.sh +8 -0
- mcta/sh/scripts/il.sh +8 -0
- mcta/sh/scripts/kg.sh +18 -0
- mcta/sh/scripts/md.sh +24 -0
- mcta/sh/scripts/mv.sh +3 -0
- mcta/sh/scripts/po.sh +21 -0
- mcta/sh/scripts/pr.sh +3 -0
- mcta/sh/scripts/re.sh +5 -0
- mcta/sh/scripts/sh.sh +3 -0
- mcta/sh/scripts/su.sh +15 -0
- mcta/sh/scripts/x.sh +22 -0
- mcta/sh/scripts/xy.sh +20 -0
- mcta/sh/scripts/y.sh +19 -0
- mcta-0.0.1.dist-info/METADATA +165 -0
- mcta-0.0.1.dist-info/RECORD +50 -0
- mcta-0.0.1.dist-info/WHEEL +5 -0
- mcta-0.0.1.dist-info/entry_points.txt +7 -0
- mcta-0.0.1.dist-info/licenses/LICENSE +21 -0
- mcta-0.0.1.dist-info/top_level.txt +1 -0
mcta/__init__.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""mt —— Meta Crystal Toolkit Analysis"""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import platform
|
|
5
|
+
|
|
6
|
+
__version__ = "0.0.1"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def version_string() -> str:
|
|
10
|
+
"""统一的 -V 输出格式。"""
|
|
11
|
+
return "mt " + __version__ + " from " + os.path.dirname(__file__) + ' (python' + platform.python_version() + ')'
|
mcta/__main__.py
ADDED
mcta/bandplot/mass.py
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import glob
|
|
2
|
+
import numpy as np
|
|
3
|
+
import matplotlib.pyplot as plt
|
|
4
|
+
|
|
5
|
+
hp = 1.0545726663e-34 # 约化普朗克常数(J·s)
|
|
6
|
+
me = 9.10956e-31 # 电子质量(kg)
|
|
7
|
+
e = 1.602176634e-19 # 电荷(C)
|
|
8
|
+
|
|
9
|
+
def get_vbm_cbm(BAND_GAP):
|
|
10
|
+
with open(BAND_GAP, "r") as main_file:
|
|
11
|
+
lines = main_file.readlines()
|
|
12
|
+
if lines[1].split()[0]=="Band":
|
|
13
|
+
lumo = np.array([lines[6].split()[-1]]).astype(int)
|
|
14
|
+
homo = np.array([lines[6].split()[-2]]).astype(int)
|
|
15
|
+
filename = glob.glob("REFORMATTED_BAND.dat")
|
|
16
|
+
elif lines[1].split()[0]=="Spin":
|
|
17
|
+
lumo = np.array(lines[7].split()[-3:-1]).astype(int)
|
|
18
|
+
homo = np.array(lines[6].split()[-3:-1]).astype(int)
|
|
19
|
+
filename = [f for i in ["REFORMATTED_BAND_UP.dat", "REFORMATTED_BAND_DW.dat"] for f in glob.glob(i)]
|
|
20
|
+
homo_c = homo - 1
|
|
21
|
+
return lumo.tolist(), homo.tolist(), homo_c.tolist(), filename
|
|
22
|
+
|
|
23
|
+
def bs_dat_read(input):
|
|
24
|
+
data = []
|
|
25
|
+
for i in input:
|
|
26
|
+
data.append(np.loadtxt(i))
|
|
27
|
+
return np.array(data)
|
|
28
|
+
|
|
29
|
+
def dat_read(data, lumo, homo, homo_c, scale):
|
|
30
|
+
p_range = data.shape[0] - 1
|
|
31
|
+
N = int(scale*(p_range+1)/abs(data[-1,0]-data[0,0]))
|
|
32
|
+
if N < 5:
|
|
33
|
+
N = 5
|
|
34
|
+
points = [''] * 6
|
|
35
|
+
data_s = data[:,homo_c:lumo+1]
|
|
36
|
+
data_s = data_s[:,::-1]
|
|
37
|
+
for i in range(3):
|
|
38
|
+
if i == 0:
|
|
39
|
+
points[i*2] = points[i*2+1] = np.argmin(data_s[:,i])
|
|
40
|
+
else:
|
|
41
|
+
points[i*2] = points[i*2+1] = np.argmax(data_s[:,i])
|
|
42
|
+
if points[i*2] == 0:
|
|
43
|
+
points[i*2] = p_range
|
|
44
|
+
elif data[points[i*2],0]==data[points[i*2]-1,0]:
|
|
45
|
+
points[i*2] += -1
|
|
46
|
+
if points[i*2+1] == p_range:
|
|
47
|
+
points[i*2+1] = 0
|
|
48
|
+
elif data[points[i*2+1],0]==data[points[i*2+1]+1,0]:
|
|
49
|
+
points[i*2+1] += 1
|
|
50
|
+
calM = [''] * 4 if abs(data_s[points[3],1]-data_s[points[5],2]) > 0.1 else [''] * 6
|
|
51
|
+
for i in range(len(calM)):
|
|
52
|
+
if i%2 == 0:
|
|
53
|
+
calM[i]=[data[points[i]-N+1:points[i]+1,0].copy(), data_s[points[i]-N+1:points[i]+1,int(i/2)].copy()]
|
|
54
|
+
else:
|
|
55
|
+
calM[i]=[data[points[i]:points[i]+N,0].copy(), data_s[points[i]:points[i]+N,int(i/2)].copy()]
|
|
56
|
+
calM = np.array(calM)
|
|
57
|
+
if len(calM) > 4:
|
|
58
|
+
exchange(calM[2], calM[4])
|
|
59
|
+
exchange(calM[3], calM[5])
|
|
60
|
+
return calM
|
|
61
|
+
# 调整能带交错
|
|
62
|
+
def exchange(A_a, A_b):
|
|
63
|
+
Length = len(A_a[0])
|
|
64
|
+
for i in range(5, Length):
|
|
65
|
+
fun1 = np.polyfit(A_a[0,i-5:i], A_a[1,i-5:i], 2)
|
|
66
|
+
fun2 = np.polyfit(A_b[0,i-5:i], A_b[1,i-5:i], 2)
|
|
67
|
+
p1 = np.poly1d(fun1)
|
|
68
|
+
p2 = np.poly1d(fun2)
|
|
69
|
+
if abs(p1(A_a[0,i]) - A_a[1,i]) > abs(p1(A_a[0,i]) - A_b[1,i]) or abs(p2(A_b[0,i]) - A_b[1,i]) > abs(p2(A_b[0,i]) - A_a[1,i]):
|
|
70
|
+
A_a[1,i], A_b[1,i] = A_b[1,i], A_a[1,i]
|
|
71
|
+
|
|
72
|
+
def npfit(calM):
|
|
73
|
+
pltlabel=[''] * 6
|
|
74
|
+
for i in range(len(calM)):
|
|
75
|
+
if abs(np.corrcoef(calM[i,0], calM[i,1])[0,1]) > 0.99:
|
|
76
|
+
pltlabel[i] = 0.0
|
|
77
|
+
else:
|
|
78
|
+
fun = np.polyfit(calM[i,0], calM[i,1], 4)
|
|
79
|
+
x = calM[i,0,-1] if i%2 == 0 else calM[i,0,0]
|
|
80
|
+
le = 12*fun[0]*x**2 + 6*fun[1]*x + 2*fun[2]
|
|
81
|
+
pltlabel[i] = (hp**2/(le*e*1e-20))/me
|
|
82
|
+
if len(calM) > 4:
|
|
83
|
+
if pltlabel[2] > pltlabel[4]:
|
|
84
|
+
pltlabel[2], pltlabel[4] = pltlabel[4], pltlabel[2]
|
|
85
|
+
calM[2], calM[4] = calM[4], calM[2]
|
|
86
|
+
if pltlabel[3] > pltlabel[5]:
|
|
87
|
+
pltlabel[3], pltlabel[5] = pltlabel[5], pltlabel[3]
|
|
88
|
+
calM[3], calM[5] = calM[5], calM[3]
|
|
89
|
+
return pltlabel
|
|
90
|
+
|
|
91
|
+
def plot(data, calM, pltlabel, ticks, labels, legend, fig_p):
|
|
92
|
+
plt.figure(figsize=fig_p.size)
|
|
93
|
+
color = fig_p.color or ['red']
|
|
94
|
+
linestyle = fig_p.linestyle or [':']
|
|
95
|
+
linewidth = fig_p.linewidth or [0.8]
|
|
96
|
+
location = fig_p.location or [1, 2]
|
|
97
|
+
if len(location) == 1:
|
|
98
|
+
location = [location[0], 2]
|
|
99
|
+
plt.tick_params(axis='y', which='minor', color='gray')
|
|
100
|
+
plt.axhline(linewidth=0.4, linestyle='-.', c='gray')
|
|
101
|
+
if len(ticks) > 2:
|
|
102
|
+
ticks[0],ticks[-1] = data[0,0],data[-1,0]
|
|
103
|
+
for i in ticks[1:-1]:
|
|
104
|
+
plt.axvline(i, linewidth=0.4, linestyle='-.', c='gray')
|
|
105
|
+
plt.xticks(ticks,labels)
|
|
106
|
+
plt.xlim(data[0,0],data[-1,0])
|
|
107
|
+
plt.ylim(fig_p.vertical)
|
|
108
|
+
plt.plot(data[:,0], data[:,1:], color=color[0], linewidth=linewidth[0], linestyle=linestyle[0])
|
|
109
|
+
L = plt.legend([], frameon=False, loc=location[0], bbox_to_anchor=(0.5, 0., 0.5, 0.5), title=legend[0], title_fontproperties={'size':'medium'})
|
|
110
|
+
plt.gca().add_artist(L)
|
|
111
|
+
for i in range(len(calM)):
|
|
112
|
+
plt.plot(calM[i][0],calM[i][1], label='%7.3f'%pltlabel[i])
|
|
113
|
+
plt.ylabel('Energy (eV)')
|
|
114
|
+
plt.legend(frameon=False, loc=location[1], alignment='left', title='$LUMO$ & $HOMO$', title_fontproperties={'size':'medium'})
|
|
115
|
+
plt.savefig(fig_p.output, dpi=fig_p.dpi, transparent=True, bbox_inches='tight')
|
|
116
|
+
|
|
117
|
+
def plot2(data, calM_u, pltlabel_u, calM_d, pltlabel_d, ticks, labels, legend, fig_p):
|
|
118
|
+
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=fig_p.size)
|
|
119
|
+
fig.subplots_adjust(wspace=0.0)
|
|
120
|
+
color = fig_p.color or ['darkred', 'red']
|
|
121
|
+
linestyle = fig_p.linestyle or [':', ':']
|
|
122
|
+
linewidth = fig_p.linewidth or [0.8, 0.8]
|
|
123
|
+
location = fig_p.location or [1, 2, 2]
|
|
124
|
+
if len(color) == 1:
|
|
125
|
+
color = [color[0], 'red']
|
|
126
|
+
if len(linestyle) == 1:
|
|
127
|
+
linestyle = [linestyle[0], ':']
|
|
128
|
+
if len(linewidth) == 1:
|
|
129
|
+
linewidth = [linewidth[0], 0.8]
|
|
130
|
+
if len(location) < 3:
|
|
131
|
+
location += [2] * (3 - len(location))
|
|
132
|
+
ax1.tick_params(axis='y', which='minor', color='gray')
|
|
133
|
+
ax2.tick_params(axis='y', which='minor', color='gray')
|
|
134
|
+
ax1.axhline(linewidth=0.4, linestyle='-.', c='gray')
|
|
135
|
+
ax2.axhline(linewidth=0.4, linestyle='-.', c='gray')
|
|
136
|
+
ax2.set_yticklabels([])
|
|
137
|
+
L = ax1.legend([], frameon=False, loc=location[0], bbox_to_anchor=(0.5, 0., 0.5, 0.5), title=legend[0], title_fontproperties={'size':'medium'})
|
|
138
|
+
ax1.add_artist(L)
|
|
139
|
+
if len(ticks) > 2:
|
|
140
|
+
ticks[0],ticks[-1] = data[0,0,0],data[0,-1,0]
|
|
141
|
+
for i in ticks[1:-1]:
|
|
142
|
+
ax1.axvline(i, linewidth=0.4, linestyle='-.', c='gray')
|
|
143
|
+
ax2.axvline(i, linewidth=0.4, linestyle='-.', c='gray')
|
|
144
|
+
ax1.set_xlim(data[0,0,0], data[0,-1,0])
|
|
145
|
+
ax1.set_ylim(fig_p.vertical)
|
|
146
|
+
ax2.set_xlim(data[1,0,0], data[1,-1,0])
|
|
147
|
+
ax2.set_ylim(fig_p.vertical)
|
|
148
|
+
if len(labels) > 0:
|
|
149
|
+
ax1.set_xticks(ticks,labels[:-1]+[''])
|
|
150
|
+
else:
|
|
151
|
+
ax1.set_xticks(ticks,labels)
|
|
152
|
+
ax2.set_xticks(ticks,labels)
|
|
153
|
+
ax1.set_ylabel('Energy (eV)')
|
|
154
|
+
ax1.plot(data[0,:,0], data[0,:,1:], color=color[0], linewidth=linewidth[0], linestyle=linestyle[0])
|
|
155
|
+
ax2.plot(data[1,:,0], data[1,:,1:], color=color[1], linewidth=linewidth[1], linestyle=linestyle[1])
|
|
156
|
+
for i in range(len(calM_u)):
|
|
157
|
+
ax1.plot(calM_u[i,0], calM_u[i,1], label='%7.3f'%pltlabel_u[i])
|
|
158
|
+
for i in range(len(calM_d)):
|
|
159
|
+
ax2.plot(calM_d[i,0], calM_d[i,1], label='%7.3f'%pltlabel_d[i])
|
|
160
|
+
ax1.legend(frameon=False, loc=location[1], alignment='left', title='$LUMO$ & $HOMO$', title_fontproperties={'size':'small'})
|
|
161
|
+
ax2.legend(frameon=False, loc=location[2], alignment='left', title='$LUMO$ & $HOMO$', title_fontproperties={'size':'small'})
|
|
162
|
+
plt.savefig(fig_p.output, dpi=fig_p.dpi, transparent=True, bbox_inches='tight')
|
|
163
|
+
|