Aditya Wibawa Sakti 2 years ago
parent 77f0211b18
commit 5a1345aa46
  1. BIN
      .README.md.swp
  2. 59
      cmmde_gui/gui.py

Binary file not shown.

@ -53,10 +53,10 @@ def cmmde_gui():
# File input (if you don't want to draw the structure)
FileInput = pn.widgets.FileInput(title='Input structure',accept='.xyz,.vasp,.pdb')
def fileinput(event):
if FileInput.value is not None:
FileInput.save("geom.xyz")
FileInput.param.watch(fileinput,'value')
# def fileinput(event):
# if FileInput.value is not None:
# FileInput.save("geom.xyz")
# FileInput.param.watch(fileinput,'value')
# CMMDE running button
Run_btn = pn.widgets.Button(name="Run CMMDE!",button_type='primary')
@ -77,8 +77,8 @@ def cmmde_gui():
jobs = ",".join(job_list)
if editor.value == "":
FileInput.save("geom.xyz")
geom = "geom.xyz"
FileInput.save(FileInput.filename)
geom = FileInput.filename
else:
geom = editor.value
@ -171,11 +171,12 @@ 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')
# 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")
@ -192,9 +193,11 @@ def cmmde_gui():
TextWarning.value = "Successfully create the directory!"
materialdir_btn.on_click(materialgen)
def slab_builder(event):
Folder = workdir + "/" + id_input.value + "/" + Material_input.value
os.chdir(Folder)
Material_upload.save("POSCAR")
# os.system("mv geom.xyz POSCAR")
hkl = hkl_input.value
size = size_input.value
@ -214,11 +217,30 @@ def cmmde_gui():
# xyzviewer.object = xyzview
slabbuilder_btn.on_click(slab_builder)
# Solution Builder
# fileinput_solute = pn.widgets.FileInput(accept=".xyz",multiple=True)
# fileinput_solvent = pn.widgets.FileInput(accept=".xyz")
# def SolutionBuilder(event):
# solute = fileinput_solute.value
# solvent = fileinput_solute.value
filename_solute = pn.widgets.TextInput(title="Solute name")
filename_solvent = pn.widgets.TextInput(title="Solvent name")
solute_upload = pn.widgets.FileInput(accept=".xyz",multiple=True)
solvent_upload = pn.widgets.FileInput(accept=".xyz")
def SolutionBuilder(event):
solute = filename_solute.value.split(",")
for i in solute:
solute_folder = workdir + "/" + id_input.value + "/" + "{}".format(i)
os.makedirs(i)
os.chdir(i)
solute_upload.save(solute_upload.filename)
solvent = filename_solvent.value
solvent_folder = workdir + "/" + id_input.value + "/" + solvent
os.chdir("../{}".format(solvent_folder))
solvent_upload.save(solvent_upload.filename)
os.chdir("../")
cmd = subprocess.run(["cmmde.py","-s","gromacs","-mt","{}".format(solute_folder)])
solvent = filename_solvent.value
solvent_upload.save(solvent_upload.filename)
@ -229,7 +251,10 @@ def cmmde_gui():
def visualize(event):
xyzview = py3Dmol.view()
Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value
if Material_input.value == "":
Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value
else:
Folder = workdir + "/" + id_input.value + "/" + Material_input.value
os.chdir(Folder)
with open('cmmd.xyz','r') as f:
xyz = f.read()
@ -266,7 +291,7 @@ def cmmde_gui():
site="CMMDE-GUI",
title="CMMDE Editor",
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)],
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(Material_upload,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
)

Loading…
Cancel
Save