@ -29,7 +29,7 @@ def cmmde_gui():
# Terminal widget
TextArea = pn . widgets . TextAreaInput ( value = " Computational Molecular and Material Design Environment \n Authors: \n Universitas Pertamina \n Institut Teknologi Sumatera \n Masyarakat Komputasi Indonesia \n \n Supported by: \n Konsorsium Pengembangan Sains Komputasi ",
TextArea = pn . widgets . TextAreaInput ( value = " Computational Molecular and Material Design Environment \n Authors: \n Universitas Pertamina \n Institut Teknologi Sumatera \n Masyarakat Komputasi Indonesia \n \n Supported by: \n Konsorsium Pengembangan Sains Komputasi \n ",
height = 500 , disabled = True
)
# CMMDE software options
@ -52,7 +52,7 @@ def cmmde_gui():
# File input (if you don't want to draw the structure)
FileInput = pn . widgets . FileInput ( title = ' Input structure ' , accept = ' .xyz, .vasp, CONTCAR, POSCAR, .pdb ' )
FileInput = pn . widgets . FileInput ( title = ' Input structure ' , accept = ' .xyz,.vasp,.pdb ' )
def fileinput ( event ) :
if FileInput . value is not None :
FileInput . save ( " geom.xyz " )
@ -75,11 +75,13 @@ def cmmde_gui():
job_list = [ job [ i ] for i in job_btn . value ]
jobs = " , " . join ( job_list )
if editor == JSMEEditor ( value = " " ) :
geom = save ( FileInput . filename )
if editor . value == " " :
FileInput . save ( " geom.xyz " )
geom = " geom.xyz "
else :
geom = editor . value
TextArea . value = TextArea . value + " \n " + " Mempersiapkan Struktur 3 Dimensi! "
cmd = subprocess . run ( [ " cmmde.py " , " -i " , " {} " . format ( geom ) , " -s " , " {} " . format ( software [ software_btn . value ] ) , " -j " , " {} " . format ( jobs ) , " -m " , " {} " . format ( method [ method_btn . value ] ) , " -c " , " {} " . format ( charge . value ) , " -mult " , " {} " . format ( mult . value ) ] , capture_output = True , text = True )
#terminal.subprocess.run("cmmde.py","-i{}".format(editor.value),"-s{}".format(software[software_btn.value]), "-j{}".format(jobs), "-m{}".format(method[method_btn.value]))
@ -169,10 +171,16 @@ def cmmde_gui():
layer_input = pn . widgets . TextInput ( name = " Layer " , placeholder = " Example: 2 " )
slabbuilder_btn = pn . widgets . Button ( name = " Build it! " , button_type = " primary " )
Material_input = pn . widgets . TextInput ( name = " Material name " )
Material_upload = pn . widgets . FileInput ( title = ' Input structure ' )
def materialinput ( event ) :
if Material_upload . value is not None :
Material_upload . save ( " POSCAR " )
Material_upload . param . watch ( materialinput , ' value ' )
# Generate material folder button
materialdir_btn = pn . widgets . Button ( name = " Generate work directory " , type = " primary " )
TextWarning = pn . widgets . StaticText ( )
def materialgen ( event ) :
Folder = workdir + " / " + id_input . value + " / " + Material_input . value
isExist = os . path . exists ( Folder )
@ -185,9 +193,9 @@ def cmmde_gui():
materialdir_btn . on_click ( materialgen )
def slab_builder ( event ) :
Folder = workdir + " / " + id_input . value + " / " + Molecule _input . value
Folder = workdir + " / " + id_input . value + " / " + Material _input . value
os . chdir ( Folder )
os . system ( " mv geom.xyz POSCAR " )
# os.system("mv geom.xyz POSCAR" )
hkl = hkl_input . value
size = size_input . value
layer = layer_input . value
@ -257,8 +265,8 @@ def cmmde_gui():
return pn . template . MaterialTemplate (
site = " CMMDE-GUI " ,
title = " CMMDE Editor " ,
main = [ editor , TextArea , pn . Tabs ( xyzviewer ) ] ,
sidebar = [ pn . Card ( id_input , title = " User Information " , collapsed = True ) , pn . Card ( Molecule_input , charge , mult , checkdir_btn , TextWarning , pn . Card ( FileInput , title = " Upload molecule " , collapsed = True ) , title = " Molecule Information " , collapsed = True ) , pn . Card ( Material_input , materialdir_btn , pn . Card ( FileInput , title = " Unit cell " , collapsed = True ) , hkl_input , size_input , layer_input , pn . Row ( slabbuilder_btn , visual_btn ) , pn . Row ( download_xyz , download_slab ) , title = " Surface Builder " , collapsed = True ) , pn . Card ( pn . Card ( software_btn , job_btn , method_btn , pn . Row ( Run_btn , Progress_btn ) , pn . Row ( Checkcalc_btn , visual_btn ) , title = " General calculation " , collapsed = True ) , title = " Main Calculation " , collapsed = True ) , pn . Card ( post_software_btn , post_btn , post_method_btn , pn . Row ( runpost_btn , Progress_btn ) , pn . Row ( Checkcalc_btn , visual_btn ) , title = " Post-Calculation " , collapsed = True ) ] ,
main = [ TextArea , editor , xyzviewer ] ,
sidebar = [ pn . Card ( id_input , title = " User Information " , collapsed = True ) , pn . Card ( Molecule_input , charge , mult , checkdir_btn , TextWarning , pn . Card ( FileInput , title = " Upload molecule " , collapsed = True ) , title = " Molecule Information " , collapsed = True ) , pn . Card ( Material_input , materialdir_btn , TextWarning , pn . Card ( FileInput , title = " Unit cell " , collapsed = True ) , hkl_input , size_input , layer_input , pn . Row ( slabbuilder_btn , visual_btn ) , pn . Row ( download_xyz , download_slab ) , title = " Surface Builder " , collapsed = True ) , pn . Card ( software_btn , job_btn , method_btn , pn . Row ( Run_btn , Progress_btn ) , pn . Row ( Checkcalc_btn , visual_btn ) , title = " Main Calculation " , collapsed = True ) , pn . Card ( post_software_btn , post_btn , post_method_btn , pn . Row ( runpost_btn , Progress_btn ) , pn . Row ( Checkcalc_btn , visual_btn ) , title = " Post-Calculation " , collapsed = True ) ] ,
header_background = accent , accent_base_color = accent
)