-
Notifications
You must be signed in to change notification settings - Fork 0
/
VASP0.6.py
401 lines (284 loc) · 16.6 KB
/
VASP0.6.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# -*- coding: utf-8 -*-
# Improve and use it free !
import wx
class MDIFrame(wx.MDIParentFrame):
def __init__(self):
wx.MDIParentFrame.__init__(self, None, -1, "VASP", size = (800,600))
#--------------------------------------------------------------------------------------------
#-------------------------------------------- 菜单栏设置
#panel = wx.Panel(self)
#panel.SetBackgroundColour('Black')
menu1 = wx.Menu()
menu1.Append(5000, "&INCAR","计算参数文件")
menu1.Append(5001, "&KINPOINTS","K点设置文件")
menu1.Append(5002, "&POSCAR","几何结构信息文件")
menu1.Append(5003, "&POTCAR","原子赝势文件")
menu1.Append(5004, "&Exit","退出程序")
#---------------------------------
menu2 = wx.Menu()
menu2.Append(5005,"hello1","saysome")
menu2.Append(5006,"hello2","saysome")
menu2.Append(5007,"hello3","saysome")
#---------------------------------
menubar = wx.MenuBar()
menubar.Append(menu1, "&File")
menubar.Append(menu2, "&SomeThing")
#-----------------------------------------------------------
#---------------------------------------------菜单栏事件绑定
self.SetMenuBar(menubar)
self.Bind(wx.EVT_MENU, self.OnNewWindow, id = 5000)
self.Bind(wx.EVT_MENU, self.OnNewWindow1, id = 5001)
self.Bind(wx.EVT_MENU, self.OnNewWindow2, id = 5002)
self.Bind(wx.EVT_MENU, self.OnNewWindow3, id = 5003)
self.Bind(wx.EVT_MENU, self.OnExit, id = 5004)
#--------------------------------------------------创建状态栏
statusBar = self.CreateStatusBar()
#-----------------------------------------------------------
#----------------------------------------------菜单栏事件
def OnExit(self, evt):
self.Close(True)
#---------------------------------------------------------------------------------------------------------INCAR窗口
def OnNewWindow(self, evt):
win = wx.MDIChildFrame(self, -1, "INCAR", size = (780,510))
panel = wx.Panel(win)
#panel.SetBackgroundColour('Black')
#---------------------------------------------------------------------------
#--------------------------------------------------按钮
buttonA = wx.Button(panel, label = 'PRINT', pos = (405,430))
buttonB = wx.Button(panel, label = 'SAVE', pos = (510,430))
self.Bind(wx.EVT_BUTTON, self.OnClickA,buttonA)
self.Bind(wx.EVT_BUTTON, self.OnClickB,buttonB)
#--------------------------------------------------文本
text1 = wx.TextCtrl(panel, value="System name", style=wx.TE_MULTILINE,pos=(400, 10), size=(200, 400))
self.Bind(wx.EVT_TEXT_ENTER, self.OnText1, text1)
#------------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------标签
labelA0 = wx.StaticText(panel, label = "初始参数部分:", pos = (10,10))
labelA1 = wx.StaticText(panel, label = "SYSTEM", pos = (10,40))
labelA2 = wx.StaticText(panel, label = "ISTART", pos = (10,70))#
labelA3 = wx.StaticText(panel, label = "ICHARG", pos = (10,100))#
labelA4 = wx.StaticText(panel, label = "PREC", pos = (10,130))#
labelA5 = wx.StaticText(panel, label = "LREAL", pos = (10,160))#
#------------------------------------------------------------------------------------------
labelB0 = wx.StaticText(panel, label = "自恰迭代部分:", pos = (10,190))
labelB1 = wx.StaticText(panel, label = "ENCUT", pos = (10,220))
labelB2 = wx.StaticText(panel, label = "ISPIN", pos = (10,250))
labelB3 = wx.StaticText(panel, label = "NELM", pos = (10,280))
labelB4 = wx.StaticText(panel, label = "EDIFF", pos = (10,310))
labelB5 = wx.StaticText(panel, label = "LCHARG", pos = (10,340))
labelB6 = wx.StaticText(panel, label = "LWAVE", pos = (10,370))
labelB7 = wx.StaticText(panel, label = "ISMEAR", pos = (10,400))
labelB8 = wx.StaticText(panel, label = "SIGMA", pos = (10,430))
#------------------------------------------------------------------------------------------
labelC0 = wx.StaticText(panel, label = "离子驰豫部分:", pos = (200,10))
labelC1 = wx.StaticText(panel, label = "IBRION", pos = (200,40))#
labelC2 = wx.StaticText(panel, label = "ISIF", pos = (200,70))#
labelC3 = wx.StaticText(panel, label = "NSW", pos = (200,100))
labelC4 = wx.StaticText(panel, label = "POTIM", pos = (200,130))
labelC5 = wx.StaticText(panel, label = "EDIFFG", pos = (200,160))
#------------------------------------------------------------------------------------------
labelD0 = wx.StaticText(panel, label = "态密度相关参数设置:", pos = (200,190))
labelD1 = wx.StaticText(panel, label = "NBANDS", pos = (200,220))
labelD2 = wx.StaticText(panel, label = "LORBIT", pos = (200,250))
labelD3 = wx.StaticText(panel, label = "ICHARG", pos = (200,280))
labelD4 = wx.StaticText(panel, label = "EMIN", pos = (200,310))
labelD5 = wx.StaticText(panel, label = "EMAX", pos = (200,340))
labelD6 = wx.StaticText(panel, label = "NEDOS", pos = (200,370))
#--------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------列表
self.A1=wx.TextCtrl(panel,-1,"",pos=(100,40),size=(80,-1)) #----------SYSTEM
self.A1.SetInsertionPoint(0)
self.Bind(wx.EVT_TEXT, self.A1_F, self.A1)
ListA2 = ['0', '1' , '2'] #----------ISTART
self.chA2 = wx.Choice(panel, -1, (100, 70), choices = ListA2)
self.Bind(wx.EVT_CHOICE, self.A2_F, self.chA2)
ListA3 = ['0', '1' , '2',"11","12"] #----------ICHARG
self.chA3 = wx.Choice(panel, -1, (100, 100), choices = ListA3)
self.Bind(wx.EVT_CHOICE, self.A3_F, self.chA3)
ListA4 = [ 'Low','Medium', 'High', 'Accurate'] #-----------PREC
self.chA4 = wx.Choice(panel, -1, (100, 130), choices = ListA4)
self.Bind(wx.EVT_CHOICE, self.A4_F, self.chA4)
ListA5 = ['FALSE', 'TRUE', 'ON', 'AUTO'] #-----------LREAL
self.chA5 = wx.Choice(panel, -1, (100, 160), choices = ListA5)
self.Bind(wx.EVT_CHOICE, self.A5_F, self.chA5)
#-------------------------------------------------------------
self.B1=wx.TextCtrl(panel,-1,"",pos=(100, 220),size=(80,-1)) #----------ENCUT
self.B1.SetInsertionPoint(0)
self.Bind(wx.EVT_TEXT, self.B1_F, self.B1)
self.B2 = wx.SpinCtrl(panel, -1, "", pos=(100, 250),size=(80,-1)) #----------ISPIN
self.B2.SetRange(1,100)
self.B2.SetValue(1)
self.Bind(wx.EVT_SPINCTRL, self.B2_F, self.B2)
self.Bind(wx.EVT_TEXT, self.B2_F1, self.B2)
ListB3 = ['10', '20', '30', '40', '50', '60','70', '80']
self.chB3 = wx.Choice(panel, -1, (100, 280), choices = ListB3)
self.Bind(wx.EVT_CHOICE, self.B3_F, self.chB3)
ListB4 = ['1E-01', '1E-02', '1E-03', '1E-04', '1E-05', '1E-06','1E-07', '1E-08']
self.chB4 = wx.Choice(panel, -1, (100, 310), choices = ListB4)
self.Bind(wx.EVT_CHOICE, self.B4_F, self.chB4)
ListB5 = ['TRUE', 'FALSE']#
self.chB5 = wx.Choice(panel, -1, (100, 340), choices = ListB5)
self.Bind(wx.EVT_CHOICE, self.B5_F, self.chB5)
ListB6 = ['TRUE', 'FALSE']#
self.chB6 = wx.Choice(panel, -1, (100, 370), choices = ListB6)
self.Bind(wx.EVT_CHOICE, self.B6_F, self.chB6)
ListB7 = ['-5', '-4', '-3', '-2', '-1', '0']#
self.chB7 = wx.Choice(panel, -1, (100, 400), choices = ListB7)
self.Bind(wx.EVT_CHOICE, self.B7_F, self.chB7)
ListB8 = ['0.1', '0.2']#
self.chB8 = wx.Choice(panel, -1, (100, 430), choices = ListB8)
self.Bind(wx.EVT_CHOICE, self.B8_F, self.chB8)
#---------------------------------------------------------------
ListC1 = ['-1', '0', '1', '2', '3', '4','5', '6', '7', '8']#
self.chC1 = wx.Choice(panel, -1, (300, 40), choices = ListC1)
self.Bind(wx.EVT_CHOICE, self.C1_F, self.chC1)
ListC2 = ['0', '1', '2', '3', '4', '5','6','7']
self.chC2 = wx.Choice(panel, -1, (300, 70), choices = ListC2)
self.Bind(wx.EVT_CHOICE, self.C2_F, self.chC2)
self.C3=wx.TextCtrl(panel,-1,"",pos=(300, 100),size=(80,-1)) #----------ENCUT
self.C3.SetInsertionPoint(0)
self.Bind(wx.EVT_TEXT, self.C3_F, self.C3)
self.C4=wx.TextCtrl(panel,-1,"",pos=(300, 130),size=(80,-1)) #----------ENCUT
self.C4.SetInsertionPoint(0)
self.Bind(wx.EVT_TEXT, self.C4_F, self.C4)
ListC5 = ['1E-01', '1E-02', '1E-03', '1E-04', '1E-05', '1E-06','1E-07', '1E-08']
self.chC5 = wx.Choice(panel, -1, (300, 160), choices = ListC5)
self.Bind(wx.EVT_CHOICE, self.C5_F, self.chC5)
#--------------------------------------------------------------
ListD1 = ['zero', 'one', 'two', 'three', 'four', 'five','six', 'seven', 'eight']
self.chD1 = wx.Choice(panel, -1, (300, 220), choices = ListD1)
self.Bind(wx.EVT_CHOICE, self.EvtChoice, self.chD1)
ListD2 = ['zero', 'one', 'two', 'three', 'four', 'five','six', 'seven', 'eight']
self.chD2 = wx.Choice(panel, -1, (300, 250), choices = ListD2)
self.Bind(wx.EVT_CHOICE, self.EvtChoice, self.chD2)
ListD3 = ['zero', 'one', 'two', 'three', 'four', 'five','six', 'seven', 'eight']
self.chD3 = wx.Choice(panel, -1, (300, 280), choices = ListD3)
self.Bind(wx.EVT_CHOICE, self.EvtChoice, self.chD3)
ListD4 = ['zero', 'one', 'two', 'three', 'four', 'five','six', 'seven', 'eight']
self.chD4 = wx.Choice(panel, -1, (300, 310), choices = ListD4)
self.Bind(wx.EVT_CHOICE, self.EvtChoice, self.chD4)
ListD5 = ['zero', 'one', 'two', 'three', 'four', 'five','six', 'seven', 'eight']
self.chD5 = wx.Choice(panel, -1, (300, 340), choices = ListD5)
self.Bind(wx.EVT_CHOICE, self.EvtChoice, self.chD5)
ListD6 = ['zero', 'one', 'two', 'three', 'four', 'five','six', 'seven', 'eight']
self.chD6 = wx.Choice(panel, -1, (300, 370), choices = ListD6)
self.Bind(wx.EVT_CHOICE, self.EvtChoice, self.chD6)
win.Show(True)
#--------------------------------------------------事件1
def OnClickA(self, evt):
print("hello")
def OnClickB(self, evt):
print("hi")
def OnText1 (self ,event):
print( event.GetString())
def A1_F (self, event): #-----SYSTEM
print( "SYSTEM = %s\n" % event.GetString() )
def A2_F(self, event): #-----ISTART
print('ISTART = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
def A3_F(self, event): #-----ICHARG
print('ICHARG = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
def A4_F (self, event): #-----PREC
print( 'PREC = %s\n' % event.GetString())
def A5_F(self, event): #-----LREAL
print('LREAL = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
def B1_F (self, event): #-----SYSTEM
print( "ENCUT = %s\n" % event.GetString() )
def B2_F(self, evt):
print( 'ISPIN = : %d\n' % self.B2.GetValue())
def B2_F1(self, evt):
print( 'ISPIN = %d\n' % self.B2.GetValue())
def B3_F(self, event): #-----NELM
print('NELM = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
def B4_F(self, event): #-----EDIFF
print('EDIFF = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
def B5_F(self, event): #-----LCHARG
print('LCHARG = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
def B6_F(self, event): #-----LWAVE
print('LWAVE = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
def B7_F(self, event): #-----ISMEAR
print('ISMEAR = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
def B8_F(self, event): #-----SIGMA
print('SIGMA = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
#----------------------------------------------
def C1_F(self, event): #-----SIGMA
print('IBRION = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
def C2_F(self, event): #-----SIGMA
print('ISIF = %s\n' % event.GetString())
if event.GetString() == 'one':
print("well done")
def C3_F(self, evt):
print( 'NSW = %s\n' % self.C3.GetValue())
def C4_F(self, evt):
print( 'POTIM = %s\n' % self.C4.GetValue())
def C5_F(self, event):
print('EDIFFG = %s\n' % event.GetString())
#self.chA1.Append("A new item")
if event.GetString() == 'one':
print("well done")
def EvtChoice(self, event):
print('EvtChoice: %s\n' % event.GetString())
#self.chA1.Append("A new item")
if event.GetString() == 'one':
print("well done")
#------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------------KINPOINTS窗口
def OnNewWindow1(self, evt):
win = wx.MDIChildFrame(self, -1, "KINPOINTS")
panel = wx.Panel(win)
self.slider=wx.Slider(panel,100,1,1,10,pos=(25,60),size=(250,-1),style=wx.SL_HORIZONTAL|wx.SL_AUTOTICKS|wx.SL_LABELS)
self.slider.SetTickFreq(100)
#self.slider.SetPageSize(10)
self.Bind(wx.EVT_SLIDER, self.say, self.slider)
self.sc = wx.SpinCtrl(panel, -1, "", pos=(25, 120))
self.sc.SetRange(1,100)
self.sc.SetValue(5)
self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.sc)
self.Bind(wx.EVT_TEXT, self.OnText, self.sc)
self.basicText=wx.TextCtrl(panel,-1,"",pos=(25,180),size=(175,-1))
self.basicText.SetInsertionPoint(0)
self.Bind(wx.EVT_TEXT, self.printme, self.basicText)
win.Show(True)
#-------------------------------------------------------------------------事件2
def say(self, event):
print('OnSpin: %d\n' % self.slider.GetValue())
def OnSpin(self, evt):
print( 'OnSpin: %d\n' % self.sc.GetValue())
def OnText(self, evt):
print( 'OnText: %d\n' % self.sc.GetValue())
def printme (self ,event):
print( 'OnText: %s\n' % self.basicText.GetValue())
#--------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------------POSCAR窗口
def OnNewWindow2(self, evt):
win = wx.MDIChildFrame(self, -1, "POSCAR")
win.Show(True)
#---------------------------------------------------------------------------------------------------------POTCAR窗口
def OnNewWindow3(self, evt):
win = wx.MDIChildFrame(self, -1, "POTCAR")
win.Show(True)
#------------------------------------
#-------------------------------------------------------------------------
app = wx.App()
frame = MDIFrame()
frame.Show()
app.MainLoop()