-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCP2K_Editor.py
2019 lines (1869 loc) · 98.6 KB
/
CP2K_Editor.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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#Made by Andreas Vishart
#Python 2 or 3 can be used for the script, if an input file is given after the script
#the parameters of the input file is loaded into CP2K_Editor interface
#---------------Package----------------
import os
import sys
#PROGRAM SETTINGS
PROGRAM={}
#The name of the program
PROGRAM["Program_name"]="CP2K Editor"
PROGRAM["Script_name"]="CP2K_Editor.py"
#Python 3
if str(sys.version)[0]=="3":
import tkinter as tk
from tkinter import filedialog
import scr.coord_file_info as coord_file_info
import scr.program_to_input as program_to_input
import scr.default_parameters as default_parameters
import scr.program_to_input_cdft as program_to_input_cdft
#Python 2
elif str(sys.version)[0]=="2":
sys.path.insert(0, str(os.path.realpath(__file__))[:-len(PROGRAM["Script_name"])]+'scr/')
import Tkinter as tk
import tkFileDialog as filedialog
import coord_file_info as coord_file_info
import program_to_input as program_to_input
import default_parameters as default_parameters
import program_to_input_cdft as program_to_input_cdft
#---------------Parameters----------------
#Path to Script
PROGRAM["Path"]=str(os.path.realpath(__file__))[:-len(PROGRAM["Script_name"])]
#Size of the windows
PROGRAM["size_of_window_width"]=800
PROGRAM["size_of_window_height"]=750
PROGRAM["size_of_window_height_top_bottom"]=50
PROGRAM["size_of_window_height_middle"]=PROGRAM["size_of_window_width"]-2*PROGRAM["size_of_window_height_top_bottom"]
PROGRAM["pady_section_size"]=30
PROGRAM["pady_line_size"]=5
PROGRAM["padx_section_size"]=0.05*PROGRAM["size_of_window_width"]
#Load default parameters
GLOBAL,FORCE_EVAL,SUBSYS,EXT_RESTART,MOTION,BASIS_SET,POTENTIAL=default_parameters.default_parameters(PROGRAM)
#If an input file is given after the program the parameters from the input file is used
if len(sys.argv)>1:
if str(sys.version)[0]=="3":
import scr.import_output as import_output
elif str(sys.version)[0]=="2":
import import_output as import_output
GLOBAL,FORCE_EVAL,SUBSYS,EXT_RESTART,MOTION=import_output.load_parameters(sys.argv[1],PROGRAM)
class Window_Frame:
def __init__(self,master):
#self.master=master
master.geometry(str(PROGRAM["size_of_window_width"])+"x"+str(PROGRAM["size_of_window_height"])+"+0+0")
#Window can not change size
master.resizable(width=False, height=False)
#Title of window
master.title(PROGRAM["Program_name"])
#Menubar
master.Menubar_Top=Menubar(master)
#Top Frame
self.Top_Frame=tk.Frame(master,width=PROGRAM["size_of_window_width"],height=str(PROGRAM["size_of_window_height_top_bottom"]),relief=tk.SUNKEN)
self.Top_Frame.pack(side=tk.TOP)
#Bottom Frame
self.Bottom_Frame=tk.Frame(master,width=PROGRAM["size_of_window_width"],height=str(PROGRAM["size_of_window_height_top_bottom"]),relief=tk.SUNKEN)
self.Bottom_Frame.pack(side=tk.BOTTOM,pady=PROGRAM["pady_section_size"])
#Execute Bottom frame part
#Middle Frame
self.Middle_Frame=tk.Frame(master,width=PROGRAM["size_of_window_width"],height=str(PROGRAM["size_of_window_height_middle"]),relief=tk.SUNKEN)
self.Middle_Frame.pack(pady=(PROGRAM["pady_section_size"],0),padx=PROGRAM["padx_section_size"],fill="both",expand=True)
#Execute Top frame part and all frames of the middle frame
self.Top_F=Top_Frame_part(self.Top_Frame,self.Middle_Frame)
self.Bottom_F=Bottom_Frame_part(self.Bottom_Frame,self.Top_F)
#Setting up the Menu------
class Menubar:
def __init__(self,master):
self.menubar=tk.Menu(master)
master.config(menu=self.menubar)
#Filemenu
self.filemenu=tk.Menu(self.menubar,tearoff=0)
self.filemenu.add_command(label="New", command=self.new_input)
self.filemenu.add_command(label="Open", command=lambda: self.open_input(master))
self.filemenu.add_command(label="Save", command=Bottom_Frame_part.Save)
self.filemenu.add_command(label="About", command=self.popup_About)
self.filemenu.add_command(label="Exit", command=Bottom_Frame_part.popup_exit)
self.menubar.add_cascade(label="File", menu=self.filemenu)
#Function
self.functionmenu=tk.Menu(self.menubar,tearoff=0)
self.functionmenu.add_command(label="Cutoff test", command=lambda: self.Generate_cutoff_test(master))
self.menubar.add_cascade(label="Function", menu=self.functionmenu)
#Analyse
self.analysemenu=tk.Menu(self.menubar,tearoff=0)
self.analysemenu.add_command(label="CDFT charge", command=self.CDFT_charge_function)
self.analysemenu.add_command(label="CDFT coupling", command=self.CDFT_details_function)
self.analysemenu.add_command(label="Convergence", command=lambda: self.Convergence_function(master))
self.analysemenu.add_command(label="Cutoff test", command=lambda: self.Analyse_cutoff_test_function(master))
self.analysemenu.add_command(label="Geometry", command=lambda: self.Analyse_geometry_function(master))
self.analysemenu.add_command(label="MD energy", command=lambda: self.MD_energy_temp_function(master))
self.analysemenu.add_command(label="Optimization", command=lambda: self.Optimization_function(master))
self.analysemenu.add_command(label="UV-Vis", command=lambda: self.UV_Vis_function(master))
self.analysemenu.add_command(label="Vibrations", command=lambda: self.Vib_function(master))
self.menubar.add_cascade(label="Analyse", menu=self.analysemenu)
#Helpmenu
self.helpmenu=tk.Menu(self.menubar,tearoff=0)
self.helpmenu.add_command(label="Help", command=self.Help)
self.menubar.add_cascade(label="Help", menu=self.helpmenu)
#File
#New input file window
def new_input(self):
os.system(str(sys.executable)+" "+PROGRAM["Path"]+PROGRAM["Script_name"])
#Open an input file
def open_input(self,master):
if str(sys.version)[0]=="3":
import scr.import_output as import_output
elif str(sys.version)[0]=="2":
import import_output as import_output
inputfile=filedialog.askopenfilename(initialdir="./",title = "Select Input file",filetypes = (("Inp files","*.inp"),("all files","*")))
master.update()
if inputfile!="":
os.system(str(sys.executable)+" "+PROGRAM["Path"]+PROGRAM["Script_name"]+" "+str(inputfile))
#About pop up window
def popup_About(self):
popup=tk.Tk()
popup.title("About")
popup.geometry("500x"+str(int(PROGRAM["size_of_window_height"]*0.2))+"+0+0")
B_Okay=tk.Button(popup, text=" Okay ", command = popup.destroy)
B_Okay.pack(side=tk.BOTTOM)
with open(PROGRAM["Path"]+"scr/ABOUT.txt") as about_file:
About_content=about_file.read()
label=tk.Text(popup, height=int(PROGRAM["size_of_window_height"]*0.8), width=500)
label.pack(side=tk.LEFT, fill=tk.Y)
label.insert(tk.END, About_content)
label.config(state=tk.DISABLED,wrap=tk.WORD)
popup.mainloop()
#Help
#Open the Help
def Help(self):
popup=tk.Tk()
popup.title("Help")
popup.geometry("500x"+str(int(PROGRAM["size_of_window_height"]*0.85))+"+0+0")
B_Close=tk.Button(popup, text=" Close ", command = popup.destroy)
B_Close.pack(side=tk.BOTTOM)
with open(PROGRAM["Path"]+"scr/HELP.txt") as help_file:
Help_content=help_file.read()
scrollbar=tk.Scrollbar(popup)
label=tk.Text(popup, height=int(PROGRAM["size_of_window_height"]*0.8), width=500)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
label.pack(side=tk.LEFT, fill=tk.Y)
scrollbar.config(command=label.yview)
label.config(yscrollcommand=scrollbar.set)
label.insert(tk.END, Help_content)
label.config(state=tk.DISABLED,wrap=tk.WORD)
popup.mainloop()
#Function
#Generate Cutoff test
def Generate_cutoff_test(self,master):
generate_cutoff_file=filedialog.askopenfilename(initialdir="./",title = "Select input file",filetypes = (("INP files","*.inp"),("all files","*")))
master.update()
if str(generate_cutoff_file)!="":
if str(sys.version)[0]=="3":
import scr.Function_generate_cutoff_test as Function_generate_cutoff_test
elif str(sys.version)[0]=="2":
import Function_generate_cutoff_test as Function_generate_cutoff_test
Function_generate_cutoff_test.popup_generate_cutoff(generate_cutoff_file)
#Analyse
#CDFT charge on fragments details
def CDFT_charge_function(self):
if str(sys.version)[0]=="3":
import scr.Analyse_CDFT_charge as Analyse_CDFT_charge
elif str(sys.version)[0]=="2":
import Analyse_CDFT_charge as Analyse_CDFT_charge
try:
popup_cdft_start=Analyse_CDFT_charge.CDFT_start_popup()
except:
popup_cdft_start=Bottom_Frame_part.popup_error_file(self,cdft_detail_file)
popup_cdft_start.mainloop()
#CDFT electronic coupling details
def CDFT_details_function(self):
cdft_detail_file=filedialog.askopenfilename(initialdir="./",title = "Select output file",filetypes = (("OUT files","*.out"),("all files","*")))
if str(cdft_detail_file)!="":
if str(sys.version)[0]=="3":
import scr.Analyse_CDFT as Analyse_CDFT
elif str(sys.version)[0]=="2":
import Analyse_CDFT as Analyse_CDFT
try:
popup_cdft=Analyse_CDFT.CDFT_popup(cdft_detail_file)
except:
popup_cdft=Bottom_Frame_part.popup_error_file(self,cdft_detail_file)
popup_cdft.mainloop()
#Convergence (Is the file converged properly)
def Convergence_function(self,master):
convergence_file=filedialog.askopenfilename(initialdir="./",title = "Select output file",filetypes = (("OUT files","*.out"),("all files","*")))
master.update()
if str(convergence_file)!="":
if str(sys.version)[0]=="3":
import scr.Analyse_Convergence as Analyse_Convergence
elif str(sys.version)[0]=="2":
import Analyse_Convergence as Analyse_Convergence
try:
popup_conv=Analyse_Convergence.Convergence_popup(convergence_file)
except:
popup_conv=Bottom_Frame_part.popup_error_file(self,convergence_file)
popup_conv.mainloop()
#Analyse Cutoff test
def Analyse_cutoff_test_function(self,master):
cutoff_folder=filedialog.askdirectory(initialdir="./",title = "Select cutoff test folder")
master.update()
if str(cutoff_folder)!="":
if str(sys.version)[0]=="3":
import scr.Analyse_cutoff_test as Analyse_cutoff_test
elif str(sys.version)[0]=="2":
import Analyse_cutoff_test as Analyse_cutoff_test
try:
cutoff_analyse_data=Analyse_cutoff_test.Cutoff_test(cutoff_folder)
except:
popup=tk.Tk()
popup.title("No such folder")
tk.Label(popup, text="Could not find or use the folder called "+str(cutoff_folder)).pack()
tk.Button(popup, text=" Okay ", command = popup.destroy).pack()
popup.mainloop()
else:
Analyse_cutoff_test.plot_cutoff_test(cutoff_analyse_data)
#Geometry Optimization
def Analyse_geometry_function(self,master):
geometry_file=filedialog.askopenfilename(initialdir="./",title = "Select position file",filetypes = (("XYZ files","*.xyz"),("all files","*")))
master.update()
if str(geometry_file)!="":
if str(sys.version)[0]=="3":
import scr.Analyse_Geometry as Analyse_Geometry
elif str(sys.version)[0]=="2":
import Analyse_Geometry as Analyse_Geometry
try:
popup_geo=tk.Tk()
Analyse_Geometry.Geometry_popup(popup_geo,geometry_file)
except:
popup_geo.destroy()
popup_geo=Bottom_Frame_part.popup_error_file(self,geometry_file)
popup_geo.mainloop()
#Energy and Temperature plot for MD
def MD_energy_temp_function(self,master):
md_e_t_file=filedialog.askopenfilename(initialdir="./",title = "Select energy file",filetypes = (("ENER files","*.ener"),("all files","*")))
master.update()
if str(md_e_t_file)!="":
if str(sys.version)[0]=="3":
import scr.Analyse_MD_Ener as Analyse_MD_Ener
elif str(sys.version)[0]=="2":
import Analyse_MD_Ener as Analyse_MD_Ener
try:
MD_analyse_data=Analyse_MD_Ener.MD_Ener(md_e_t_file)
except:
Bottom_Frame_part.popup_error_file(self,md_e_t_file)
else:
Analyse_MD_Ener.plot_MD_Ener(MD_analyse_data)
#Geometry Optimization
def Optimization_function(self,master):
optimization_file=filedialog.askopenfilename(initialdir="./",title = "Select position file",filetypes = (("XYZ files","*.xyz"),("all files","*")))
master.update()
if str(optimization_file)!="":
if str(sys.version)[0]=="3":
import scr.Analyse_Optimization as Analyse_Optimization
elif str(sys.version)[0]=="2":
import Analyse_Optimization as Analyse_Optimization
try:
Optimization_analyse_data=Analyse_Optimization.Optimization(optimization_file)
except:
Bottom_Frame_part.popup_error_file(self,optimization_file)
else:
Analyse_Optimization.plot_Optimization(Optimization_analyse_data)
#UV-Vis spectrum
def UV_Vis_function(self,master):
uvvis_file=filedialog.askopenfilename(initialdir="./",title = "Select output file",filetypes = (("OUT files","*.out"),("all files","*")))
master.update()
if str(uvvis_file)!="":
if str(sys.version)[0]=="3":
import scr.Analyse_UV_Vis as Analyse_UV_Vis
elif str(sys.version)[0]=="2":
import Analyse_UV_Vis as Analyse_UV_Vis
try:
popup_uv_vis=Analyse_UV_Vis.UV_Vis_pop_up(uvvis_file)
except:
popup_uv_vis=Bottom_Frame_part.popup_error_file(self,uvvis_file)
popup_uv_vis.mainloop()
#Vibrational spectrum
def Vib_function(self,master):
vib_file=filedialog.askopenfilename(initialdir="./",title = "Select output file",filetypes = (("OUT files","*.out"),("all files","*")))
master.update()
if str(vib_file)!="":
if str(sys.version)[0]=="3":
import scr.Analyse_Vib as Analyse_Vib
elif str(sys.version)[0]=="2":
import Analyse_Vib as Analyse_Vib
try:
popup_vib=Analyse_Vib.Vibration_popup(vib_file)
except:
popup_vib=Bottom_Frame_part.popup_error_file(self,vib_file)
popup_vib.mainloop()
#Make the Bottom-----
class Bottom_Frame_part:
def __init__(self,Bot_F,Top_F):
#Rows and Columns
i=0;j=0
#The button for save to input file
self.save_btn=tk.Button(Bot_F,text="SAVE",width=10,command=lambda type=type: self.Save(Top_F))
self.save_btn.grid(row=i,column=j)
j+=1
#The button for Preview to input file
self.preview_btn=tk.Button(Bot_F,text="PREVIEW",width=10,command=lambda type=type: self.Preview(Top_F))
self.preview_btn.grid(row=i,column=j)
j+=1
#The button for cancel program
self.cancel_btn=tk.Button(Bot_F,text="CANCEL",width=10,command=self.popup_exit)
self.cancel_btn.grid(row=i,column=j)
j+=1
#Exit the program
def Exit(self,popup):
popup.destroy()
CP2K_Editor.destroy()
#Exit pop up window
def popup_exit(self):
popup=tk.Tk()
popup.title("Exit")
self.label=tk.Label(popup, text="Do you want to exit "+PROGRAM["Program_name"]+"?")
self.label.grid(row=0,column=1)
self.B1=tk.Button(popup, text="Yes",width=5, command=lambda popup=popup: self.Exit(popup))
self.B1.grid(row=1,column=0,)
self.B2=tk.Button(popup, text="No",width=5, command=popup.destroy)
self.B2.grid(row=1,column=2)
popup.mainloop()
#Save the input file
def Save(self,Top_F):
global GLOBAL
global FORCE_EVAL
global SUBSYS
global EXT_RESTART
global MOTION
self.save_entries(Top_F)
self.popup_save_file()
#Save the input file as
def popup_save_file(self):
global GLOBAL
input_filename=filedialog.asksaveasfilename(initialdir = "./",initialfile=GLOBAL["FILE_NAME"],title = "Save input file as",filetypes = (("INP files","*.inp"),("all files","*")))
if input_filename!="":
GLOBAL["FILE_NAME"]=input_filename
if GLOBAL["PROPERTIES"]=="CDFT":
inputfile_content=program_to_input_cdft.Save_cdft_files(PROGRAM,GLOBAL,FORCE_EVAL,SUBSYS,EXT_RESTART,MOTION)
else:
inputfile_content=program_to_input.Save_to_input(PROGRAM,GLOBAL,FORCE_EVAL,SUBSYS,EXT_RESTART,MOTION)
the_inputfile=open(input_filename,"w")
the_inputfile.write(inputfile_content)
the_inputfile.close()
self.popup_save()
#Save the input file
def Save_Edit(self,Top_F):
global GLOBAL
global FORCE_EVAL
global SUBSYS
global EXT_RESTART
global MOTION
self.save_entries(Top_F)
self.inputfile_content=self.label.get(1.0,tk.END)
self.popup_save_file_edit(self.inputfile_content)
#Save the input file as
def popup_save_file_edit(self,inputfile_content):
global GLOBAL
input_filename=filedialog.asksaveasfilename(initialdir = "./",initialfile=GLOBAL["FILE_NAME"],title = "Save input file as",filetypes = (("INP files","*.inp"),("all files","*")))
if input_filename!="":
GLOBAL["FILE_NAME"]=input_filename
the_inputfile=open(input_filename,"w")
the_inputfile.write(inputfile_content)
the_inputfile.close()
self.popup_save()
#The input file is saved pop up window
def popup_save(self):
popup=tk.Tk()
popup.title("Saved")
self.label=tk.Label(popup, text="The input file is saved as "+GLOBAL["FILE_NAME"])
self.label.grid(row=0)
self.B1=tk.Button(popup, text=" Okay ", command=popup.destroy)
self.B1.grid(row=1)
popup.mainloop()
#Error could not find such file
def popup_error_file(self,filename):
popup_error=tk.Tk()
popup_error.title("No such file")
tk.Label(popup_error, text="Could not find or use the file called "+str(filename)).pack()
tk.Button(popup_error, text=" Okay ", command=popup_error.destroy).pack()
return popup_error
#Preview input file
def Preview(self,Top_F):
global GLOBAL
global FORCE_EVAL
global SUBSYS
global EXT_RESTART
global MOTION
self.save_entries(Top_F)
popup=tk.Tk()
popup.title("Preview")
popup.geometry("500x"+str(int(PROGRAM["size_of_window_height"]*0.85))+"+0+0")
if GLOBAL["PROPERTIES"]=="CDFT":
self.inputfile_content=program_to_input_cdft.Save_cdft_files(PROGRAM,GLOBAL,FORCE_EVAL,SUBSYS,EXT_RESTART,MOTION)
else:
self.inputfile_content=program_to_input.Save_to_input(PROGRAM,GLOBAL,FORCE_EVAL,SUBSYS,EXT_RESTART,MOTION)
self.B_Close=tk.Button(popup, text=" Close ", command = popup.destroy)
self.B_Close.pack(side=tk.BOTTOM)
self.B_Save=tk.Button(popup, text=" Save ",command=lambda: self.Save_Edit(Top_F))
self.B_Save.pack(side=tk.BOTTOM)
scrollbar=tk.Scrollbar(popup)
self.label=tk.Text(popup, height=int(PROGRAM["size_of_window_height"]*0.8), width=500)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
self.label.pack(side=tk.LEFT, fill=tk.Y)
scrollbar.config(command=self.label.yview)
self.label.config(yscrollcommand=scrollbar.set)
self.label.insert(tk.END, self.inputfile_content)
#self.label.config(state=tk.DISABLED)
popup.mainloop()
#Save all the entries
def save_entries(self,Top_F):
global GLOBAL
global FORCE_EVAL
global SUBSYS
global EXT_RESTART
global MOTION
GLOBAL["PROJECT_NAME"]=Top_F.Global_sec.project_name_entry.get()
GLOBAL["NSTATES"]=Top_F.Global_sec.properties_info_nstates_entry.get()
GLOBAL["FILE_NAME"]=GLOBAL["PROJECT_NAME"]+".inp"
FORCE_EVAL["EACH"]=Top_F.Global_sec.each_entry.get()
if FORCE_EVAL["BASIS_SET"]=="Custom":
FORCE_EVAL["BASIS_SET"]=Top_F.FORCE_EVAL_sec.Force_Eval_DFT_sec.FE_basis_set_entry.get()
if FORCE_EVAL["POTENTIAL"]=="Custom":
FORCE_EVAL["POTENTIAL"]=Top_F.FORCE_EVAL_sec.Force_Eval_DFT_sec.FE_potential_entry.get()
FORCE_EVAL["LIBXC"]=Top_F.FORCE_EVAL_sec.Force_Eval_DFT_sec.FE_XC_functional_custom_entry.get()
FORCE_EVAL["FRACTION"]=Top_F.FORCE_EVAL_sec.Force_Eval_DFT_sec.FE_HF_X_entry.get()
FORCE_EVAL["MAX_SCF"]=Top_F.FORCE_EVAL_sec.Force_Eval_DFT_sec.FE_MAX_SCF_entry.get()
FORCE_EVAL["EPS_SCF"]=Top_F.FORCE_EVAL_sec.Force_Eval_DFT_sec.FE_EPS_SCF_entry.get()
FORCE_EVAL["NGRIDS"]=Top_F.FORCE_EVAL_sec.Force_Eval_DFT_sec.FE_NGRIDS_entry.get()
FORCE_EVAL["CUTOFF"]=Top_F.FORCE_EVAL_sec.Force_Eval_DFT_sec.FE_PW_Cutoff_entry.get()
FORCE_EVAL["REL_CUTOFF"]=Top_F.FORCE_EVAL_sec.Force_Eval_DFT_sec.FE_Gau_Cutoff_entry.get()
FORCE_EVAL["PARM_FILE_NAME"]=Top_F.FORCE_EVAL_sec.Force_Eval_FF_sec.FE_parm_file_entry.get()
SUBSYS["COORD"]=Top_F.SUBSYS_sec.SS_coord_file_entry.get()
SUBSYS["ABC"]=Top_F.SUBSYS_sec.SS_Cell_entry.get()
SUBSYS["CHARGE"]=Top_F.SUBSYS_sec.SS_Charge_entry.get()
SUBSYS["MULTIPLICITY"]=Top_F.SUBSYS_sec.SS_Multiplicity_entry.get()
SUBSYS["FIXED"]=Top_F.SUBSYS_sec.SS_fixed_atoms_entry.get()
SUBSYS["TARGET1"]=Top_F.SUBSYS_sec.SS_target1_entry.get()
SUBSYS["TARGET2"]=str(float(SUBSYS["TARGET1"])+2)
SUBSYS["ATOMS_FRAG1"]=Top_F.SUBSYS_sec.SS_frag1_entry.get()
SUBSYS["ATOMS_FRAG2"]=Top_F.SUBSYS_sec.SS_frag2_entry.get()
EXT_RESTART["RESTART_EACH"]=Top_F.EXT_RESTART_sec.save_restart_entry.get()
EXT_RESTART["RESTART_FILE_NAME"]=Top_F.EXT_RESTART_sec.restart_entry.get()
MOTION["MAX_DR"]=Top_F.MOTION_sec.MT_Geo_sec.MT_Geo_Max_Dr_entry.get()
MOTION["MAX_ITER"]=Top_F.MOTION_sec.MT_Geo_sec.MT_Geo_Max_Iter_entry.get()
MOTION["STEPS"]=Top_F.MOTION_sec.MT_MD_sec.MT_MD_steps_entry.get()
MOTION["TIMESTEP"]=Top_F.MOTION_sec.MT_MD_sec.MT_MD_timestep_entry.get()
MOTION["TEMPERATURE"]=Top_F.MOTION_sec.MT_MD_sec.MT_MD_temperature_entry.get()
MOTION["TIMECON"]=Top_F.MOTION_sec.MT_MD_sec.MT_MD_TIMECON_entry.get()
MOTION["REPLICA1"]=Top_F.MOTION_sec.MT_BAND_sec.MT_BAND_initial_entry.get()
MOTION["REPLICA2"]=Top_F.MOTION_sec.MT_BAND_sec.MT_BAND_interm_entry.get()
MOTION["REPLICA3"]=Top_F.MOTION_sec.MT_BAND_sec.MT_BAND_final_entry.get()
MOTION["NUMBER_OF_REPLICA"]=Top_F.MOTION_sec.MT_BAND_sec.MT_BAND_num_replica_entry.get()
MOTION["MAX_STEPS"]=Top_F.MOTION_sec.MT_BAND_sec.MT_BAND_max_steps_entry.get()
#Make the Top------
class Top_Frame_part:
def __init__(self,Top_F,Middle_F):
#Rows and Columns
i=0;j=0
#The button for the section &Global
self.sec_global=tk.Button(Top_F,text="&GLOBAL",width=15,fg="green",command=self.GLOBAL_Frame_btn_func)
self.sec_global.grid(row=i,column=j)
self.GLOBAL_F=tk.Frame(Middle_F)
self.GLOBAL_F.place(in_=Middle_F, x=0, y=0, relwidth=1, relheight=1)
self.Global_sec=Global_section(self.GLOBAL_F,self)
j+=1
#The button for the section &Force_Eval
self.sec_force_eval=tk.Button(Top_F,text="&FORCE_EVAL",width=15,fg="green",command=self.FORCE_EVAL_Frame_btn_func)
self.sec_force_eval.grid(row=i,column=j)
self.FORCE_EVAL_F=tk.Frame(Middle_F)
self.FORCE_EVAL_F.place(in_=Middle_F, x=0, y=0, relwidth=1, relheight=1)
self.FORCE_EVAL_sec=Force_Eval_section(self.FORCE_EVAL_F)
j+=1
#The button for the section &Subsys
self.sec_subsys=tk.Button(Top_F,text="&SUBSYS",width=15,fg="green",command=self.SUBSYS_Frame_btn_func)
self.sec_subsys.grid(row=i,column=j)
self.SUBSYS_F=tk.Frame(Middle_F)
self.SUBSYS_F.place(in_=Middle_F, x=0, y=0, relwidth=1, relheight=1)
self.SUBSYS_sec=Subsys_section(self.SUBSYS_F)
j+=1
#The button for the section EXT_RESTART
self.sec_ext_restart=tk.Button(Top_F,text="&EXT_RESTART",width=15,fg="green",command=self.EXT_RESTART_Frame_btn_func)
self.sec_ext_restart.grid(row=i,column=j)
self.EXT_RESTART_F=tk.Frame(Middle_F)
self.EXT_RESTART_F.place(in_=Middle_F, x=0, y=0, relwidth=1, relheight=1)
self.EXT_RESTART_sec=Ext_section(self.EXT_RESTART_F)
j+=1
#The button for the section &MOTION
self.sec_motion=tk.Button(Top_F,text="&MOTION",width=15,fg="green",state=tk.DISABLED,command=self.MOTION_sec_Frame_func)
self.sec_motion.grid(row=i,column=j)
self.MOTION_F=tk.Frame(Middle_F)
self.MOTION_F.place(in_=Middle_F, x=0, y=0, relwidth=1, relheight=1)
self.MOTION_sec=Motion_section(self.MOTION_F)
j+=1
#Activate Global section first
self.sec_global.config(fg="blue")
self.GLOBAL_F.lift()
#Global command when Global section button is pressed
def GLOBAL_Frame_btn_func(self):
self.GLOBAL_F.lift()
self.sec_global.config(fg="blue")
self.sec_force_eval.config(fg="green")
self.sec_subsys.config(fg="green")
self.sec_ext_restart.config(fg="green")
self.sec_motion.config(fg="green")
#FORCE_EVAL command when FORCE_EVAL section button is pressed
def FORCE_EVAL_Frame_btn_func(self):
self.FORCE_EVAL_F.lift()
self.sec_global.config(fg="green")
self.sec_force_eval.config(fg="blue")
self.sec_subsys.config(fg="green")
self.sec_ext_restart.config(fg="green")
self.sec_motion.config(fg="green")
#SUBSYS command when SUBSYS section button is pressed
def SUBSYS_Frame_btn_func(self):
self.SUBSYS_F.lift()
self.sec_global.config(fg="green")
self.sec_force_eval.config(fg="green")
self.sec_subsys.config(fg="blue")
self.sec_ext_restart.config(fg="green")
self.sec_motion.config(fg="green")
#EXT_RESTART command when EXT_RESTART section button is pressed
def EXT_RESTART_Frame_btn_func(self):
self.EXT_RESTART_F.lift()
self.sec_global.config(fg="green")
self.sec_force_eval.config(fg="green")
self.sec_subsys.config(fg="green")
self.sec_ext_restart.config(fg="blue")
self.sec_motion.config(fg="green")
#MOTION command when MOTION section button is pressed
def MOTION_sec_Frame_func(self):
self.MOTION_F.lift()
self.sec_global.config(fg="green")
self.sec_force_eval.config(fg="green")
self.sec_subsys.config(fg="green")
self.sec_ext_restart.config(fg="green")
self.sec_motion.config(fg="blue")
#Make the &Global_section------
class Global_section:
def __init__(self,GLOBAL_Frame,Top_Frame_p):
#Choose the Run Type
#Rows and
i=0;j=0
#Make the label for Run_Type
self.label_runtype=tk.Label(GLOBAL_Frame,text="Run type: ").grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
#Make Run_Type button
self.run_type_btn=tk.Menubutton(GLOBAL_Frame,text=GLOBAL["RUN_TYPE"])
#Give it the function as a push down list / Menu
self.content_run_type_btn=tk.Menu(self.run_type_btn)
#So you can press the button and have the content
self.run_type_btn.config(menu=self.content_run_type_btn)
self.run_type_btn.grid(row=i,column=j,sticky="WE")
#Give the options of Run_Types
run_type_list=["ENERGY","GEO_OPT","MD","BAND","RT_PROPAGATION"]
for types in run_type_list:
self.content_run_type_btn.add_command(label=types,command=lambda types=types: self.Run_Type_button_click(types,Top_Frame_p))
#Choose the Project Name
#Rows and
i+=1;j=0
#Make the label for Project Name
tk.Label(GLOBAL_Frame, text="Project name: ").grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
#Make Entry
self.project_name_entry=tk.Entry(GLOBAL_Frame)
#Set the text to the right
self.project_name_entry.config(justify=tk.LEFT)
#Give the default Project Name
self.project_name_entry.insert(tk.END,GLOBAL["PROJECT_NAME"])
self.project_name_entry.grid(row=i,column=j,sticky="WE")
#Choose the Print level
i+=1;j=0
#Make the label for Print_level
tk.Label(GLOBAL_Frame,text="Print level: ").grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
#Make Print_Level button
self.print_level_btn=tk.Menubutton(GLOBAL_Frame,text=GLOBAL["PRINT_LEVEL"])
#Give it the function as a push down list / Menu
self.content_print_level_btn=tk.Menu(self.print_level_btn)
#So you can press the button and have the content
self.print_level_btn.config(menu=self.content_print_level_btn)
self.print_level_btn.grid(row=i,column=j,sticky="WE")
#Give the options of Print_Level
print_level_list=["SILENT","LOW","MEDIUM","HIGH","DEBUG"]
for level in print_level_list:
self.content_print_level_btn.add_command(label=level,command=lambda level=level: self.Print_Level_button_click(level))
#Choose the Properties
#Rows and Columns
i+=1;j=0
#Make the label for Properties
tk.Label(GLOBAL_Frame,text="Properties: ").grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
#Make Properties button
self.properties_btn=tk.Menubutton(GLOBAL_Frame,text=GLOBAL["PROPERTIES"])
#Give it the function as a push down list / Menu
self.content_properties_btn=tk.Menu(self.properties_btn)
#So you can press the button and have the content
self.properties_btn.config(menu=self.content_properties_btn)
self.properties_btn.grid(row=i,column=j,sticky="WE")
#Give the options of Properties
properties_list=["NONE","MO","DIPOLE","TDDFPT","VIBRATIONAL_ANALYSIS","MULLIKEN","CDFT"]
for proper in properties_list:
self.content_properties_btn.add_command(label=proper,command=lambda proper=proper: self.Properties_button_click(proper,Top_Frame_p))
#Properties info
i+=1
j=0
self.properties_info_nstates_label=tk.Label(GLOBAL_Frame,text="NStates: ")
self.properties_info_nstates_label.grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
self.properties_info_nstates_entry=tk.Entry(GLOBAL_Frame,justify=tk.LEFT)
self.properties_info_nstates_entry.insert(tk.END,GLOBAL["NSTATES"])
self.properties_info_nstates_entry.grid(row=i,column=j,sticky="WE")
if GLOBAL["PROPERTIES"]!="MO" or GLOBAL["PROPERTIES"]!="TDDFPT":
self.properties_info_nstates_label.grid_forget()
self.properties_info_nstates_entry.grid_forget()
#How often to Print
i+=1;j=0
self.each_label=tk.Label(GLOBAL_Frame,text="Each step: ")
self.each_label.grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
self.each_entry=tk.Entry(GLOBAL_Frame,justify=tk.LEFT)
self.each_entry.insert(tk.END,FORCE_EVAL["EACH"])
self.each_entry.grid(row=i,column=j,sticky="WE")
if GLOBAL["RUN_TYPE"]=="ENERGY":
self.each_label.grid_forget()
self.each_entry.grid_forget()
#Choose the Run_Type
def Run_Type_button_click(self,types,Top_Frame_p):
global GLOBAL
GLOBAL["RUN_TYPE"]=types
self.run_type_btn.config(text=GLOBAL["RUN_TYPE"])
if GLOBAL["RUN_TYPE"]!="ENERGY":
Top_Frame_p.sec_motion.config(state="normal")
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_label.grid(row=10,column=0,sticky=tk.W,pady=PROGRAM["pady_line_size"])
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_entry.grid(row=10,column=1,sticky="WE")
if GLOBAL["PROPERTIES"]!="NONE":
self.each_label.grid(row=6,column=0,sticky=tk.W,pady=PROGRAM["pady_line_size"])
self.each_entry.grid(row=6,column=1,sticky="WE")
if GLOBAL["RUN_TYPE"]=="GEO_OPT":
Top_Frame_p.MOTION_sec.MT_Geo_F.lift()
elif GLOBAL["RUN_TYPE"]=="MD" or GLOBAL["RUN_TYPE"]=="RT_PROPAGATION":
Top_Frame_p.MOTION_sec.MT_MD_F.lift()
elif GLOBAL["RUN_TYPE"]=="BAND":
Top_Frame_p.MOTION_sec.MT_BAND_F.lift()
else:
Top_Frame_p.sec_motion.config(state=tk.DISABLED)
self.each_label.grid_forget()
self.each_entry.grid_forget()
if GLOBAL["PROPERTIES"]=="VIBRATIONAL_ANALYSIS":
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_label.grid(row=10,column=0,sticky=tk.W,pady=PROGRAM["pady_line_size"])
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_entry.grid(row=10,column=1,sticky="WE")
else:
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_label.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_entry.grid_forget()
#Choose the Print_Level
def Print_Level_button_click(self,level):
global GLOBAL
GLOBAL["PRINT_LEVEL"]=level
self.print_level_btn.config(text=GLOBAL["PRINT_LEVEL"])
#Choose the Properties
def Properties_button_click(self,proper,Top_Frame_p):
global GLOBAL
GLOBAL["PROPERTIES"]=proper
self.properties_btn.config(text=GLOBAL["PROPERTIES"])
if GLOBAL["PROPERTIES"]=="NONE":
self.properties_info_nstates_label.grid_forget()
self.properties_info_nstates_entry.grid_forget()
self.each_label.grid_forget()
self.each_entry.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_target1_label.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_target1_entry.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_frag1_label.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_frag1_entry.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_frag2_label.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_frag2_entry.grid_forget()
if GLOBAL["RUN_TYPE"]=="ENERGY":
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_label.grid_forget();Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_entry.grid_forget()
else:
if GLOBAL["RUN_TYPE"]!="ENERGY":
self.each_label.grid(row=6,column=0,sticky=tk.W,pady=PROGRAM["pady_line_size"])
self.each_entry.grid(row=6,column=1)
if GLOBAL["PROPERTIES"]=="MO" or GLOBAL["PROPERTIES"]=="TDDFPT":
self.properties_info_nstates_label.grid(row=5,column=0,sticky=tk.W,pady=PROGRAM["pady_line_size"])
self.properties_info_nstates_entry.grid(row=5,column=1,sticky="WE")
else:
self.properties_info_nstates_label.grid_forget()
self.properties_info_nstates_entry.grid_forget()
if GLOBAL["PROPERTIES"]=="CDFT":
Top_Frame_p.SUBSYS_sec.SS_frag1_label.grid(row=11,column=0,sticky=tk.W,pady=PROGRAM["pady_line_size"])
Top_Frame_p.SUBSYS_sec.SS_frag1_entry.grid(row=11,column=1,sticky="WE")
Top_Frame_p.SUBSYS_sec.SS_frag2_label.grid(row=12,column=0,sticky=tk.W,pady=PROGRAM["pady_line_size"])
Top_Frame_p.SUBSYS_sec.SS_frag2_entry.grid(row=12,column=1,sticky="WE")
Top_Frame_p.SUBSYS_sec.SS_target1_label.grid(row=13,column=0,sticky=tk.W,pady=PROGRAM["pady_line_size"])
Top_Frame_p.SUBSYS_sec.SS_target1_entry.grid(row=13,column=1,sticky="WE")
else:
Top_Frame_p.SUBSYS_sec.SS_target1_label.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_target1_entry.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_frag1_label.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_frag1_entry.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_frag2_label.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_frag2_entry.grid_forget()
if GLOBAL["PROPERTIES"]=="VIBRATIONAL_ANALYSIS":
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_label.grid(row=9,column=0,sticky=tk.W,pady=PROGRAM["pady_line_size"])
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_entry.grid(row=9,column=1,sticky="WE")
elif GLOBAL["PROPERTIES"]!="VIBRATIONAL_ANALYSIS" and GLOBAL["RUN_TYPE"]=="ENERGY":
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_label.grid_forget()
Top_Frame_p.SUBSYS_sec.SS_fixed_atoms_entry.grid_forget()
#Make the &Force_Eval_section------
class Force_Eval_section:
def __init__(self,FORCE_EVAL_Frame):
i=0;j=0
#Make the label for the Method
tk.Label(FORCE_EVAL_Frame,text="Method: ").grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
#Make Method button
self.FE_method_btn=tk.Menubutton(FORCE_EVAL_Frame,text=FORCE_EVAL["METHOD"])
#Give it the function as a push down list / Menu
self.content_FE_method_btn=tk.Menu(self.FE_method_btn)
#So you can press the button and have the content
self.FE_method_btn.config(menu=self.content_FE_method_btn)
self.FE_method_btn.grid(row=i,column=j,sticky="WE")
#Give the options of Methods
FE_method_list=["EIP","EMBED","FIST","MIXED","QMMM","QUICKSTEP","SIRIUS"]
for methods in FE_method_list:
self.content_FE_method_btn.add_command(label=methods,command=lambda methods=methods: self.FE_Method_button_click(methods))
#Make FE method frames!!
self.FE_DFT_F=tk.Frame(FORCE_EVAL_Frame)
self.FE_DFT_F.place(in_=FORCE_EVAL_Frame, x=0, rely=0.1, relwidth=1, relheight=0.9)
self.Force_Eval_DFT_sec=Force_Eval_section_DFT(self.FE_DFT_F)
self.FE_EIP_F=tk.Frame(FORCE_EVAL_Frame)
self.FE_EIP_F.place(in_=FORCE_EVAL_Frame, x=0, rely=0.1, relwidth=1, relheight=0.9)
self.Force_Eval_EIP_sec=Force_Eval_section_EIP(self.FE_EIP_F)
self.FE_EMBED_F=tk.Frame(FORCE_EVAL_Frame)
self.FE_EMBED_F.place(in_=FORCE_EVAL_Frame, x=0, rely=0.1, relwidth=1, relheight=0.9)
self.Force_Eval_EMBED_sec=Force_Eval_section_EMBED(self.FE_EMBED_F)
self.FE_FIST_F=tk.Frame(FORCE_EVAL_Frame)
self.FE_FIST_F.place(in_=FORCE_EVAL_Frame, x=0, rely=0.1, relwidth=1, relheight=0.9)
self.Force_Eval_FF_sec=Force_Eval_section_FF(self.FE_FIST_F)
self.FE_MIXED_F=tk.Frame(FORCE_EVAL_Frame)
self.FE_MIXED_F.place(in_=FORCE_EVAL_Frame, x=0, rely=0.1, relwidth=1, relheight=0.9)
self.Force_Eval_MIXED_sec=Force_Eval_section_Mixed(self.FE_MIXED_F)
self.FE_QMMM_F=tk.Frame(FORCE_EVAL_Frame)
self.FE_QMMM_F.place(in_=FORCE_EVAL_Frame, x=0, rely=0.1, relwidth=1, relheight=0.9)
self.Force_Eval_QMMM_sec=Force_Eval_section_QMMM(self.FE_QMMM_F)
self.FE_SIRIUS_F=tk.Frame(FORCE_EVAL_Frame)
self.FE_SIRIUS_F.place(in_=FORCE_EVAL_Frame, x=0, rely=0.1, relwidth=1, relheight=0.9)
self.Force_Eval_SIRIUS_sec=Force_Eval_section_SIRIUS(self.FE_SIRIUS_F)
if FORCE_EVAL["METHOD"].upper()=="QUICKSTEP":
self.FE_DFT_F.lift()
elif FORCE_EVAL["METHOD"].upper()=="EIP":
self.FE_EIP_F.lift()
elif FORCE_EVAL["METHOD"].upper()=="EMBED":
self.FE_EMBED_Frame.lift()
elif FORCE_EVAL["METHOD"].upper()=="FIST":
self.FE_FIST_F.lift()
elif FORCE_EVAL["METHOD"].upper()=="MIXED":
self.FE_MIXED_F.lift()
elif FORCE_EVAL["METHOD"].upper()=="QMMM":
self.FE_QMMM_F.lift()
elif FORCE_EVAL["METHOD"].upper()=="SIRIUS":
self.FE_SIRIUS_F.lift()
#Choose the Method
def FE_Method_button_click(self,method):
global FORCE_EVAL
FORCE_EVAL["METHOD"]=method
self.FE_method_btn.config(text=FORCE_EVAL["METHOD"])
if FORCE_EVAL["METHOD"]=="QUICKSTEP":
FORCE_EVAL["METHOD_SECTION"]="DFT"
self.FE_DFT_F.lift()
elif FORCE_EVAL["METHOD"]=="EIP":
FORCE_EVAL["METHOD_SECTION"]=FORCE_EVAL["METHOD"]
self.FE_EIP_F.lift()
elif FORCE_EVAL["METHOD"]=="EMBED":
FORCE_EVAL["METHOD_SECTION"]=FORCE_EVAL["METHOD"]
self.FE_EMBED_F.lift()
elif FORCE_EVAL["METHOD"]=="FIST":
FORCE_EVAL["METHOD_SECTION"]=FORCE_EVAL["METHOD"]
self.FE_FIST_F.lift()
elif FORCE_EVAL["METHOD"]=="MIXED":
FORCE_EVAL["METHOD_SECTION"]=FORCE_EVAL["METHOD"]
self.FE_MIXED_F.lift()
elif FORCE_EVAL["METHOD"]=="QMMM":
FORCE_EVAL["METHOD_SECTION"]=FORCE_EVAL["METHOD"]
self.FE_QMMM_F.lift()
elif FORCE_EVAL["METHOD"]=="SIRIUS":
FORCE_EVAL["METHOD_SECTION"]=FORCE_EVAL["METHOD"]
self.FE_SIRIUS_F.lift()
#DFT or Quickstep method
class Force_Eval_section_DFT:
def __init__(self,FE_DFT_Frame):
#Make label for Basis set file
i=0;j=0
tk.Label(FE_DFT_Frame,text="Basis set file: ").grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
#The path to the basis set folder
path_to_basis_set0=PROGRAM["Path"]+"data/Basis_set_folder/"
path_to_basis_set=FORCE_EVAL["BASIS_SET_FILE_NAME"][:-len(FORCE_EVAL["BASIS_SET_FILE_NAME-path"])]
#The basis set file menu
self.FE_basis_set_files_btn=tk.Menubutton(FE_DFT_Frame,text=FORCE_EVAL["BASIS_SET_FILE_NAME-path"])
#Give it the function as a push down list / Menu
self.content_FE_basis_set_files_btn=tk.Menu(self.FE_basis_set_files_btn)
#So you can press the button and have the content
self.FE_basis_set_files_btn.config(menu=self.content_FE_basis_set_files_btn)
self.FE_basis_set_files_btn.grid(row=i,column=j,sticky="WE")
#Give the options of basis set files
for files in BASIS_SET["BASIS_SETS_NAMES"]:
self.content_FE_basis_set_files_btn.add_command(label=files,command=lambda files=files: self.basis_set_file_click(files,path_to_basis_set0))
#Make label for Basis set
i+=1;j=0
tk.Label(FE_DFT_Frame,text="Basis set: ").grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
#The basis set menu for each basis set file
self.FE_basis_set_btn=tk.Menubutton(FE_DFT_Frame,text=FORCE_EVAL["BASIS_SET"])
self.BASIS_SET_OPTIONS={}
for key in BASIS_SET["BASIS_SETS_NAMES"]:
#Make each basis set file to its own menu content
self.BASIS_SET_OPTIONS[key]=tk.Menu(self.FE_basis_set_btn)
#Give the options of basis set for each file
for set in BASIS_SET[key]:
self.BASIS_SET_OPTIONS[key].add_command(label=set,command=lambda set=set: self.basis_set_click(set))
if key!="Find":
self.BASIS_SET_OPTIONS[key].add_command(label="Custom",command=lambda set="Custom": self.basis_set_click(set))
#Basis set menu as default
#For files in the basis set directory
if FORCE_EVAL["BASIS_SET_FILE_NAME-path"] in BASIS_SET["BASIS_SETS_NAMES"]:
self.FE_basis_set_btn.config(menu=self.BASIS_SET_OPTIONS[FORCE_EVAL["BASIS_SET_FILE_NAME-path"]])
#For files not in the basis set directory
else:
FORCE_EVAL["BASIS_SET"]="Custom"
self.FE_basis_set_btn.config(menu=self.BASIS_SET_OPTIONS["Find"],text=FORCE_EVAL["BASIS_SET"])
self.FE_basis_set_btn.grid(row=i,column=j,sticky="WE")
j+=1
#Make Entry for Basis set file
self.FE_basis_set_entry=tk.Entry(FE_DFT_Frame,justify=tk.LEFT)
#Give the default Basis set file
self.FE_basis_set_entry.grid(row=i,column=j,sticky="WE")
#Select the default basis set
if FORCE_EVAL["BASIS_SET"]=="Custom":
self.FE_basis_set_entry.config(state="normal")
else:
self.FE_basis_set_entry.config(state=tk.DISABLED)
#Make label for Potential file
i+=1
j=0
tk.Label(FE_DFT_Frame,text="Pseudopotential file: ").grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
#The path to the potential folder
path_to_potential0=PROGRAM["Path"]+"data/Potential_folder/"
path_to_potential=FORCE_EVAL["POTENTIAL_FILE_NAME"][:-len(FORCE_EVAL["POTENTIAL_FILE_NAME-path"])]
#The potential file menu
self.FE_potential_files_btn=tk.Menubutton(FE_DFT_Frame,text=FORCE_EVAL["POTENTIAL_FILE_NAME-path"])
#Give it the function as a push down list / Menu
self.content_FE_potential_files_btn=tk.Menu(self.FE_potential_files_btn)
#So you can press the button and have the content
self.FE_potential_files_btn.config(menu=self.content_FE_potential_files_btn)
self.FE_potential_files_btn.grid(row=i,column=j,sticky="WE")
#Give the options of potential files
for files in POTENTIAL["POTENTIALS_NAMES"]:
self.content_FE_potential_files_btn.add_command(label=files,command=lambda files=files: self.potential_file_click(files,path_to_potential0))
#Make label for potentials
i+=1
j=0
tk.Label(FE_DFT_Frame,text="Pseudopotential: ").grid(row=i,column=j,sticky=tk.W,pady=PROGRAM["pady_line_size"])
j+=1
#The potential menu for each potential file
self.FE_potential_btn=tk.Menubutton(FE_DFT_Frame,text=FORCE_EVAL["POTENTIAL"])
self.POTENTIAL_OPTIONS={}
for key in POTENTIAL["POTENTIALS_NAMES"]:
#Make each potential file to its own menu content
self.POTENTIAL_OPTIONS[key]=tk.Menu(self.FE_potential_btn)
#Give the options of potential for each file
for set in POTENTIAL[key]:
self.POTENTIAL_OPTIONS[key].add_command(label=set,command=lambda set=set: self.potential_click(set))
if key!="Find" and key!="ECP_POTENTIALS.dat":
self.POTENTIAL_OPTIONS[key].add_command(label="Custom",command=lambda set="Custom": self.potential_click(set))
#Potential menu as default
#For files in the potential directory
if FORCE_EVAL["POTENTIAL_FILE_NAME-path"] in POTENTIAL["POTENTIALS_NAMES"]:
self.FE_potential_btn.config(menu=self.POTENTIAL_OPTIONS[FORCE_EVAL["POTENTIAL_FILE_NAME-path"]])
#For files not in the potential directory
else:
FORCE_EVAL["POTENTIAL"]="Custom"
self.FE_potential_btn.config(menu=self.POTENTIAL_OPTIONS["Find"],text=FORCE_EVAL["POTENTIAL"])
self.FE_potential_btn.grid(row=i,column=j,sticky="WE")
j+=1
#Make Entry for Potential file
self.FE_potential_entry=tk.Entry(FE_DFT_Frame,justify=tk.LEFT)
#Give the default Basis set file
self.FE_potential_entry.grid(row=i,column=j,sticky="WE")
#Select the default potential
if FORCE_EVAL["POTENTIAL"]=="Custom":
self.FE_potential_entry.config(state="normal")
else:
self.FE_potential_entry.config(state=tk.DISABLED)
#Exchange-Correlation functional label
i+=1;j=0
self.FE_XC_functional_label=tk.Label(FE_DFT_Frame,text="Exchange-Correlation functional: ")
self.FE_XC_functional_label.grid(row=i,column=j,pady=PROGRAM["pady_line_size"])
j+=1
#Exchange-Correlation functional button
self.FE_XC_functional_btn=tk.Menubutton(FE_DFT_Frame,text=FORCE_EVAL["XC_FUNCTIONAL"])
#Give it the function as a push down list / Menu
self.content_FE_XC_functional_btn=tk.Menu(self.FE_XC_functional_btn)
#So you can press the button and have the content
self.FE_XC_functional_btn.config(menu=self.content_FE_XC_functional_btn)
self.FE_XC_functional_btn.grid(row=i,column=j,sticky="WE")
#Give the options of XC functionals
FE_XC_functional_btn_list=["B3LYP","BEEFVDW","BLYP","BP","HCTH120","OLYP","PADE","PBE","PBE0","TPSS","NONE","NO_SHORTCUT","CUSTOM"]
for functionals in FE_XC_functional_btn_list:
self.content_FE_XC_functional_btn.add_command(label=functionals,command=lambda functionals=functionals: self.FE_XC_functional_button_click(functionals))
#Make Entry for XCLIB functioncations when Custom is selected
j+=1
self.FE_XC_functional_custom_entry=tk.Entry(FE_DFT_Frame,text=FORCE_EVAL["LIBXC"])
#Set the text to the left