@ -42,11 +42,11 @@ def cmmde_gui():
job = { ' Single point calculation ' : ' sp ' , ' Geometry optimization ' : ' opt ' , ' Frequency calculation ' : ' freq ' , ' Molecular dynamics ' : ' md ' , ' Metadynamics ' : ' mtd ' }
job = { ' Single point calculation ' : ' sp ' , ' Geometry optimization ' : ' opt ' , ' Frequency calculation ' : ' freq ' , ' Molecular dynamics ' : ' md ' , ' Metadynamics ' : ' mtd ' }
# CMMDE method options
# CMMDE method options
method_btn = pn . widgets . Select ( name = " Method selections " , value = ' GFN2-xTB ' , options = [ ' GFN2-xTB ' , ' GFN1-xTB ' , ' DFTB2 ' , ' DFTB2-gammah ' , ' DFTB3 ' , ' DFTB3-diag ' ] )
method_btn = pn . widgets . Select ( name = " Method selections " , value = ' GFN2-xTB ' , options = [ ' GFN2-xTB ' , ' GFN1-xTB ' , ' DFTB2 ' , ' DFTB2-gammah ' , ' DFTB3 ' , ' DFTB3-diag ' , ' B3LYP/def2-svp ' ] )
method = { ' GFN2-xTB ' : ' XTB2 ' , ' GFN1-xTB ' : ' XTB1 ' , ' DFTB2 ' : ' DFTB2 ' , ' DFTB2-gammah ' : ' DFTB2_gammah ' , ' DFTB3 ' : ' DFTB3 ' , ' DFTB3-diag ' : ' DFTB3-diag ' }
method = { ' GFN2-xTB ' : ' XTB2 ' , ' GFN1-xTB ' : ' XTB1 ' , ' DFTB2 ' : ' DFTB2 ' , ' DFTB2-gammah ' : ' DFTB2_gammah ' , ' DFTB3 ' : ' DFTB3 ' , ' DFTB3-diag ' : ' DFTB3-diag ' , ' B3LYP/def2-svp ' : ' B3LYP def2-svp ' }
# Name your molecule/Material
# Name your molecule/Material
Nam e_input = pn . widgets . TextInput ( name = " Molecule name " )
Molecul e_input = pn . widgets . TextInput ( name = " Molecule name " )
id_input = pn . widgets . TextInput ( name = " Input your name " )
id_input = pn . widgets . TextInput ( name = " Input your name " )
workdir = os . getenv ( " HOME " ) + " / " + " scr "
workdir = os . getenv ( " HOME " ) + " / " + " scr "
@ -68,7 +68,7 @@ def cmmde_gui():
# terminal.clear()
# terminal.clear()
# unik = str(uuid.uuid4().hex)
# unik = str(uuid.uuid4().hex)
Folder = workdir + " / " + id_input . value + " / " + Nam e_input. value
Folder = workdir + " / " + id_input . value + " / " + Molecul e_input. value
os . chdir ( Folder )
os . chdir ( Folder )
@ -96,7 +96,7 @@ def cmmde_gui():
checkdir_btn = pn . widgets . Button ( name = " Generate work directory " , type = " primary " )
checkdir_btn = pn . widgets . Button ( name = " Generate work directory " , type = " primary " )
TextWarning = pn . widgets . StaticText ( )
TextWarning = pn . widgets . StaticText ( )
def checkdir ( event ) :
def checkdir ( event ) :
Folder = workdir + " / " + id_input . value + " / " + Nam e_input. value
Folder = workdir + " / " + id_input . value + " / " + Molecul e_input. value
isExist = os . path . exists ( Folder )
isExist = os . path . exists ( Folder )
TextWarning . value = " "
TextWarning . value = " "
if isExist :
if isExist :
@ -110,9 +110,11 @@ def cmmde_gui():
# Post calculations
# Post calculations
post_calc = { ' Frequency calculation ' : ' freq ' , ' Radial distribution function ' : ' rdf ' , ' Mean Square Displacement ' : ' msd ' , ' Time-dependent calculation ' : ' td ' , ' Thermochemistry calculation ' : ' thermo ' }
post_calc = { ' Frequency calculation ' : ' freq ' , ' Radial distribution function ' : ' rdf ' , ' Mean Square Displacement ' : ' msd ' , ' Time-dependent calculation ' : ' td ' , ' Thermochemistry calculation ' : ' thermo ' , ' Optimized energy ' : ' opt ' }
post_btn = pn . widgets . Select ( name = " Job Selection " , value = ' Frequency calculation ' , options = [ ' Frequency calculation ' , ' Radial distribution function ' , ' Mean Square Displacement ' , ' Time-dependent calculation ' , ' Thermochemistry calculation ' ] )
post_btn = pn . widgets . Select ( name = " Job Selection " , value = ' Frequency calculation ' , options = [ ' Frequency calculation ' , ' Radial distribution function ' , ' Mean Square Displacement ' , ' Time-dependent calculation ' , ' Thermochemistry calculation ' , ' Optimized energy ' ] )
# Post Calculation CMMDE software options
# Post Calculation CMMDE software options
post_software_btn = pn . widgets . Select ( name = " Software selections for post calculations " , value = ' Orca ' , options = [ ' Orca ' , ' GROMACS ' , ' Dcdftbmd ' , ' Quantum Espresso ' ] )
post_software_btn = pn . widgets . Select ( name = " Software selections for post calculations " , value = ' Orca ' , options = [ ' Orca ' , ' GROMACS ' , ' Dcdftbmd ' , ' Quantum Espresso ' ] )
post_software = { ' Orca ' : ' orca ' , ' GROMACS ' : ' gromacs ' , ' Dcdftbmd ' : ' dcdftb ' , ' Quantum Espresso ' : ' qe ' }
post_software = { ' Orca ' : ' orca ' , ' GROMACS ' : ' gromacs ' , ' Dcdftbmd ' : ' dcdftb ' , ' Quantum Espresso ' : ' qe ' }
@ -124,9 +126,12 @@ def cmmde_gui():
if post_calc [ post_btn . value ] == ' thermo ' and post_software [ post_software_btn . value ] == ' orca ' :
if post_calc [ post_btn . value ] == ' thermo ' and post_software [ post_software_btn . value ] == ' orca ' :
cmd = subprocess . run ( [ " cmmdepost.py " , " -j " , " {} " . format ( post_calc [ post_btn . value ] ) , " -s " , " {} " . format ( post_software [ post_software_btn . value ] ) ] , capture_output = True , text = True )
cmd = subprocess . run ( [ " cmmdepost.py " , " -j " , " {} " . format ( post_calc [ post_btn . value ] ) , " -s " , " {} " . format ( post_software [ post_software_btn . value ] ) ] , capture_output = True , text = True )
TextArea . value = TextArea . value + " \n " + cmd . stdout
TextArea . value = TextArea . value + " \n " + cmd . stdout
# terminal.subprocess.run("cmmdepost.py","-j{}".format(post_calc[post_btn.value]),"-s{}".format(post_software[post_software_btn.value]))
# terminal.subprocess.run("cmmdepost.py","-j{}".format(post_calc[post_btn.value]),"-s{}".format(post_software[post_software_btn.value]))
elif post_calc [ post_btn . value ] == ' opt ' and post_software [ post_software_btn . value ] == ' orca ' :
cmd = subprocess . run ( [ " cmmdepost.py " , " -j " , " {} " . format ( post_calc [ post_btn . value ] ) , " -s " , " {} " . format ( post_software [ post_software_btn . value ] ) , " -m " , " {} " . format ( post_method [ post_method_btn . value ] ) ] , capture_output = True , text = True )
TextArea . value = TextArea . value + " \n " + cmd . stdout
else :
else :
Folder = workdir + " / " + id_input . value + " / " + Name_input . value
Folder = workdir + " / " + id_input . value + " / " + Molecul e_input. value
os . chdir ( Folder )
os . chdir ( Folder )
os . makedirs ( post_calc [ post_btn . value ] )
os . makedirs ( post_calc [ post_btn . value ] )
os . chdir ( post_calc [ post_btn . value ] )
os . chdir ( post_calc [ post_btn . value ] )
@ -163,8 +168,24 @@ def cmmde_gui():
size_input = pn . widgets . TextInput ( name = " Dimension " , placeholder = " Example: 2x2 " )
size_input = pn . widgets . TextInput ( name = " Dimension " , placeholder = " Example: 2x2 " )
layer_input = pn . widgets . TextInput ( name = " Layer " , placeholder = " Example: 2 " )
layer_input = pn . widgets . TextInput ( name = " Layer " , placeholder = " Example: 2 " )
slabbuilder_btn = pn . widgets . Button ( name = " Build it! " , button_type = " primary " )
slabbuilder_btn = pn . widgets . Button ( name = " Build it! " , button_type = " primary " )
Material_input = pn . widgets . TextInput ( name = " Material name " )
# 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 )
TextWarning . value = " "
if isExist :
TextWarning . value = " Directory exists! Change the material name! "
else :
os . makedirs ( Folder )
TextWarning . value = " Successfully create the directory! "
materialdir_btn . on_click ( materialgen )
def slab_builder ( event ) :
def slab_builder ( event ) :
Folder = workdir + " / " + id_input . value + " / " + Name_input . value
Folder = workdir + " / " + id_input . value + " / " + Molecul e_input. value
os . chdir ( Folder )
os . chdir ( Folder )
os . system ( " mv geom.xyz POSCAR " )
os . system ( " mv geom.xyz POSCAR " )
hkl = hkl_input . value
hkl = hkl_input . value
@ -190,7 +211,7 @@ def cmmde_gui():
# def SolutionBuilder(event):
# def SolutionBuilder(event):
# solute = fileinput_solute.value
# solute = fileinput_solute.value
# solvent = fileinput_solute.value
# solvent = fileinput_solute.value
# Visualize the results
# Visualize the results
@ -200,7 +221,7 @@ def cmmde_gui():
def visualize ( event ) :
def visualize ( event ) :
xyzview = py3Dmol . view ( )
xyzview = py3Dmol . view ( )
Folder = workdir + " / " + id_input . value + " / " + Nam e_input. value
Folder = workdir + " / " + id_input . value + " / " + Molecul e_input. value
os . chdir ( Folder )
os . chdir ( Folder )
with open ( ' cmmd.xyz ' , ' r ' ) as f :
with open ( ' cmmd.xyz ' , ' r ' ) as f :
xyz = f . read ( )
xyz = f . read ( )
@ -237,7 +258,7 @@ def cmmde_gui():
site = " CMMDE-GUI " ,
site = " CMMDE-GUI " ,
title = " CMMDE Editor " ,
title = " CMMDE Editor " ,
main = [ editor , TextArea , pn . Tabs ( xyzviewer ) ] ,
main = [ editor , TextArea , pn . Tabs ( xyzviewer ) ] ,
sidebar = [ pn . Card ( id_input , Nam e_input, charge , mult , checkdir_btn , TextWarning , pn . Card ( FileInput , title = " Upload molecule " , collapsed = True ) , pn . Card ( 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 ) , title = " Pre-Calculation " , 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 ) ] ,
sidebar = [ pn . Card ( id_input , title = " User information " , collapsed = True ) , pn . Card ( Molecul e_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 ) ] ,
header_background = accent , accent_base_color = accent
header_background = accent , accent_base_color = accent
)
)