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