edit README

Aditya Wibawa Sakti 2 years ago
parent f473e7b09c
commit d3eea9cc7d
  1. 20
      bin/cmmdepost.py
  2. 112
      cmmde_gui/gui.py

@ -201,12 +201,9 @@ if opt.job == 'ir' and opt.software == 'orca':
if "Final Gibbs free energy" in line: if "Final Gibbs free energy" in line:
arr = line.split() arr = line.split()
Gibbs = float(arr[5]) Gibbs = float(arr[5])
if "Total entropy" in line: # if "Total entropy" in line:
arr = line.split() # arr = line.split()
Entropy = float(arr[4]) # Entropy = float(arr[4])
if "Temperature" in line:
arr = line.split()
Temperature = float(arr[2])
if "IR SPECTRUM" in line: if "IR SPECTRUM" in line:
for i in range(NFreq): for i in range(NFreq):
arr = lines[index+6+i].split() arr = lines[index+6+i].split()
@ -247,12 +244,9 @@ if opt.job == 'thermo' and opt.software == 'orca':
if "Final Gibbs free energy" in line: if "Final Gibbs free energy" in line:
arr = line.split() arr = line.split()
Gibbs = float(arr[5]) Gibbs = float(arr[5])
if "Total entropy" in line: # if "Total entropy" in line:
arr = line.split() # arr = line.split()
Entropy = float(arr[4]) # Entropy = float(arr[4])
if "Temperature" in line:
arr = line.split()
Temperature = float(arr[2])
if "Non-thermal (ZPE)" in line: if "Non-thermal (ZPE)" in line:
arr = line.split() arr = line.split()
ZPE = float(arr[3]) ZPE = float(arr[3])
@ -325,7 +319,7 @@ if opt.job == 'thermo' and opt.software == 'orca':
print('') print('')
print('######INFORMASI BESARAN TERMOKIMIA######') print('######INFORMASI BESARAN TERMOKIMIA######')
print("Entalpi (H) = {} Hartree = {} kj/mol".format(Enthalpy,Enthalpy*Ha2kj)) print("Entalpi (H) = {} Hartree = {} kj/mol".format(Enthalpy,Enthalpy*Ha2kj))
print("Entropi (S) = {} Hartree/K = {} J/(mol K)".format(Entropy/Temperature,Entropy*Ha2kj/Temperature*1000)) # print("Entropi (S) = {} Hartree/K = {} J/(mol K)".format(Entropy/Temperature,Entropy*Ha2kj/Temperature*1000))
print("Energi bebas Gibbs (G) = {} Hartree = {} kJ/mol".format(Gibbs,Gibbs*Ha2kj)) print("Energi bebas Gibbs (G) = {} Hartree = {} kJ/mol".format(Gibbs,Gibbs*Ha2kj))
else: else:

@ -16,8 +16,8 @@ import uuid
# from iodata import IOData # from iodata import IOData
def test_can_construct(): # def test_can_construct():
JSMEEditor() # JSMEEditor()
def cmmde_gui(): def cmmde_gui():
@ -27,28 +27,62 @@ def cmmde_gui():
editor = JSMEEditor(value = " ",height=500,format="smiles",subscriptions=['smiles']) editor = JSMEEditor(value = " ",height=500,format="smiles",subscriptions=['smiles'])
# Name your molecule
Molecule_input = pn.widgets.TextInput(name="Molecule name")
id_input = pn.widgets.TextInput(name="Input your name")
charge = pn.widgets.TextInput(name="Charge",value="0")
mult = pn.widgets.TextInput(name="Spin multiplicity",value="1")
workdir = os.getenv("HOME") + "/" + "scr"
# Terminal widget # 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\nSupported by:\n Konsorsium Pengembangan Sains Komputasi\n", TextArea= pn.widgets.TextAreaInput(value = "Computational Molecular and Material Design Environment\n Authors:\n Universitas Pertamina\n Institut Teknologi Sumatera\n Institut Teknologi Bandung\n Masyarakat Komputasi Indonesia\n\nSupported by:\n Konsorsium Pengembangan Sains Komputasi\n",
height = 500, disabled=True height = 500, disabled=True
) )
# CMMDE software options # CMMDE software options
software_btn = pn.widgets.Select(name="Software selections",value='Orca',options=['Orca','GROMACS','Dcdftbmd','Quantum Espresso']) software_main = pn.widgets.Select(name="Software selections",value='Orca',options=['Orca','GROMACS','Dcdftbmd','Quantum Espresso'])
software = {'Orca':'orca','GROMACS':'gromacs','Dcdftbmd':'dcdftb','Quantum Espresso':'qe'} software = {'Orca':'orca','GROMACS':'gromacs','Dcdftbmd':'dcdftb','Quantum Espresso':'qe'}
# Orca card
job_orca = pn.widgets.MultiSelect(name="Job selections",value=['Single point calculation'],options=['Single point calculation','Geometry optimization','Frequency calculation','TS optimizer','Nudged elastic band'])
job_orca_dict = {'Single point calculation':'sp','Geometry optimization':'opt','Frequency calculation':'freq','TS optimizer':'ts','Nudged elastic band':'neb'}
method_orca = pn.widgets.Select(name="Method selections",value='GFN2-xTB',options=['GFN2-xTB','GFN1-xTB','B3LYP/def2-svp','M06/def2-svp'])
method_orca_dict = {'GFN2-xTB':'XTB2', 'GFN1-xTB':'XTB1','DFTB2':'DFTB2','DFTB2-gammah':'DFTB2_gammah','DFTB3':'DFTB3','DFTB3-diag':'DFTB3-diag','B3LYP/def2-svp':'B3LYP def2-svp','M06/def2-svp':'M06 def2-svp'}
dispersion_cor = pn.widgets.Select(name="Dispersion corrections",value='None',options=['None','D3','D3BJ','D4'])
solvent = pn.widgets.Select(name='Solvent',value='None',options=['None','water','acetone','acetonitrile','aniline','benzaldehyde','benzene','CH2Cl2','CHCl3','CS2','dioxane','DMF','ethanol','ether','ethylacetate','furane','hexadecane','hexane','ocatnol','octanol(wet)','phenol','toluene','THF'])
run_orca_btn = pn.widgets.Button(name="Run Orca!",button_type='primary')
def run_orca(event):
# RunMessage.value = " "
# terminal.clear()
# unik = str(uuid.uuid4().hex)
Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value
os.chdir(Folder)
job_list = [job[i] for i in job_orca.value]
jobs = ",".join(job_list)
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","orca","-j","{}".format(jobs),"-m","{}".format(method[method_orca.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_main.value]), "-j{}".format(jobs), "-m{}".format(method[method_btn.value]))
TextArea.value = TextArea.value + "\n" + "Perhitungan anda telah tersubmit!"
# RunMessage = pn.widgets.StaticText()
run_orca_btn.on_click(run_orca)
# CMMDE job options # CMMDE job options
job_btn = pn.widgets.MultiSelect(name="Job selections",value=['Single point calculation'],options=['Single point calculation','Geometry optimization','Frequency calculation','Molecular dynamics','Metadynamics']) job_main = pn.widgets.MultiSelect(name="Job selections",value=['Single point calculation'],options=['Single point calculation','Geometry optimization','Frequency calculation'])
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'}
# 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','B3LYP/def2-svp']) method_btn = pn.widgets.Select(name="Method selections",value='GFN2-xTB',options=['GFN2-xTB','GFN1-xTB','B3LYP/def2-svp','M06/def2-svp','DFTB2','DFTB2-gammah','DFTB3','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'} 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','M06/def2-svp':'M06 def2-svp'}
# Name your molecule/Material
Molecule_input = pn.widgets.TextInput(name="Molecule name")
id_input = pn.widgets.TextInput(name="Input your name")
workdir = os.getenv("HOME") + "/" + "scr"
# File input (if you don't want to draw the structure) # File input (if you don't want to draw the structure)
@ -61,8 +95,7 @@ def cmmde_gui():
# 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')
# RunMessage = pn.widgets.StaticText() # RunMessage = pn.widgets.StaticText()
charge = pn.widgets.TextInput(name="Charge",value="0")
mult = pn.widgets.TextInput(name="Spin multiplicity",value="1")
def run(event): def run(event):
# RunMessage.value = " " # RunMessage.value = " "
# terminal.clear() # terminal.clear()
@ -73,7 +106,7 @@ def cmmde_gui():
os.chdir(Folder) os.chdir(Folder)
job_list = [job[i] for i in job_btn.value] job_list = [job[i] for i in job_main.value]
jobs = ",".join(job_list) jobs = ",".join(job_list)
if editor.value == "": if editor.value == "":
@ -83,8 +116,17 @@ def cmmde_gui():
geom = editor.value geom = editor.value
TextArea.value = TextArea.value + "\n" + "Mempersiapkan Struktur 3 Dimensi!" 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) list_commands = ["cmmde.py","-i","{}".format(geom),"-s","{}".format(software[software_main.value]),"-j","{}".format(jobs),"-m","{}".format(method[method_btn.value]),"-c","{}".format(charge.value),"-mult","{}".format(mult.value)]
#terminal.subprocess.run("cmmde.py","-i{}".format(editor.value),"-s{}".format(software[software_btn.value]), "-j{}".format(jobs), "-m{}".format(method[method_btn.value])) if dispersion_cor.value != 'None':
new_commands = ["-disp","{}".format(dispersion_cor.value)]
for i in new_commands:
list_commands.append(i)
if solvent.value != 'None':
new_commands = ["-solvent","{}".format(solvent.value)]
for i in new_commands:
list_commands.append(i)
cmd = subprocess.run(list_commands,capture_output=True,text=True)
#terminal.subprocess.run("cmmde.py","-i{}".format(editor.value),"-s{}".format(software[software_main.value]), "-j{}".format(jobs), "-m{}".format(method[method_btn.value]))
TextArea.value = TextArea.value + "\n" + "Perhitungan anda telah tersubmit!" TextArea.value = TextArea.value + "\n" + "Perhitungan anda telah tersubmit!"
@ -118,8 +160,8 @@ def cmmde_gui():
post_calc = {'Frequency calculation':'freq', 'Radial distribution function':'rdf','Mean Square Displacement':'msd','Time-dependent calculation':'td','Thermochemistry calculation':'thermo','Optimized energy':'opt','IR plot':'ir'} post_calc = {'Frequency calculation':'freq', 'Radial distribution function':'rdf','Mean Square Displacement':'msd','Time-dependent calculation':'td','Thermochemistry calculation':'thermo','Optimized energy':'opt','IR plot':'ir'}
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','IR plot']) 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','IR plot'])
# 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_main = pn.widgets.Select(name="Software selections for post calculations",value='Orca',options=['Orca','Dcdftbmd','Quantum Espresso'])
post_software = {'Orca':'orca','GROMACS':'gromacs','Dcdftbmd':'dcdftb','Quantum Espresso':'qe'} post_software = {'Orca':'orca','Dcdftbmd':'dcdftb','Quantum Espresso':'qe'}
# Post CMMDE method options # Post CMMDE method options
post_method_btn = pn.widgets.Select(name="Method selections for post calculations",value='GFN2-xTB',options=['GFN2-xTB','GFN1-xTB','DFTB2','DFTB2-gammah','DFTB3','DFTB3-diag','B3LYP/def2-svp']) post_method_btn = pn.widgets.Select(name="Method selections for post calculations",value='GFN2-xTB',options=['GFN2-xTB','GFN1-xTB','DFTB2','DFTB2-gammah','DFTB3','DFTB3-diag','B3LYP/def2-svp'])
post_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'} post_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'}
@ -127,37 +169,47 @@ def cmmde_gui():
# terminal.clear() # terminal.clear()
Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value
os.chdir(Folder) os.chdir(Folder)
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_main.value] == 'orca':
# Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value # Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value
# os.chdir(Folder) # os.chdir(Folder)
if not os.path.exists(post_calc[post_btn.value]): if not os.path.exists(post_calc[post_btn.value]):
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])
os.system("cp ../freq/cmmd.out .") os.system("cp ../freq/cmmd.out .")
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_main.value])],capture_output=True,text=True)
TextArea.value = TextArea.value + "\n" + cmd.stdout TextArea.value = TextArea.value + "\n" + cmd.stdout
elif post_calc[post_btn.value] == 'ir' and post_software[post_software_btn.value] == 'orca': elif post_calc[post_btn.value] == 'ir' and post_software[post_software_main.value] == 'orca':
# Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value # Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value
# os.chdir(Folder) # os.chdir(Folder)
if not os.path.exists(post_calc[post_btn.value]): if not os.path.exists(post_calc[post_btn.value]):
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])
os.system("cp ../freq/cmmd.out .") os.system("cp ../freq/cmmd.out .")
cmd = subprocess.run(["cmmdepost.py","-j","{}".format(post_calc[post_btn.value]),"-s","{}".format(post_software[post_software_btn.value])]) cmd = subprocess.run(["cmmdepost.py","-j","{}".format(post_calc[post_btn.value]),"-s","{}".format(post_software[post_software_main.value])])
TextArea.value = TextArea.value + "\n" + "Plot spektrum IR berhasil dilakukan" TextArea.value = TextArea.value + "\n" + "Plot spektrum IR berhasil dilakukan"
# 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_main.value]))
elif post_calc[post_btn.value] == 'opt' and post_software[post_software_btn.value] == 'orca': elif post_calc[post_btn.value] == 'opt' and post_software[post_software_main.value] == 'orca':
# Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value # Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value
# os.chdir(Folder) # os.chdir(Folder)
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) cmd = subprocess.run(["cmmdepost.py","-j","{}".format(post_calc[post_btn.value]),"-s","{}".format(post_software[post_software_main.value]),"-m","{}".format(post_method[post_method_btn.value])],capture_output=True,text=True)
TextArea.value = TextArea.value + "\n" + cmd.stdout TextArea.value = TextArea.value + "\n" + cmd.stdout
else: else:
# Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value # Folder = workdir + "/" + id_input.value + "/" + Molecule_input.value
# os.chdir(Folder) # os.chdir(Folder)
if not os.path.exists(post_calc[post_btn.value]):
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])
cmd = subprocess.run(["cmmde.py","-i","{}".format("../cmmd.xyz"),"-s","{}".format(post_software[post_software_btn.value]),"-j","{}".format(post_calc[post_btn.value]),"-m","{}".format(post_method[post_method_btn.value])],capture_output=True,text=True) list_commands = ["cmmde.py","-i","{}".format("../cmmd.xyz"),"-s","{}".format(post_software[post_software_main.value]),"-j","{}".format(post_calc[post_btn.value]),"-m","{}".format(post_method[post_method_btn.value])]
# terminal.subprocess.run("cmmde.py","-i{}".format("../cmmd.xyz"),"-s{}".format(post_software[post_software_btn.value]), "-j{}".format(post_calc[post_btn.value]), "-m{}".format(post_method[post_method_btn.value])) if dispersion_cor.value != 'None':
new_commands = ["-disp","{}".format(dispersion_cor.value)]
for i in new_commands:
list_commands.append(i)
if solvent.value != 'None':
new_commands = ["-solvent","{}".format(solvent.value)]
for i in new_commands:
list_commands.append(i)
cmd = subprocess.run(list_commands,capture_output=True,text=True)
# terminal.subprocess.run("cmmde.py","-i{}".format("../cmmd.xyz"),"-s{}".format(post_software[post_software_main.value]), "-j{}".format(post_calc[post_btn.value]), "-m{}".format(post_method[post_method_btn.value]))
TextArea.value = TextArea.value + "\n" + cmd.stdout TextArea.value = TextArea.value + "\n" + cmd.stdout
runpost_btn = pn.widgets.Button(name="Run post calculation!",button_type='primary') runpost_btn = pn.widgets.Button(name="Run post calculation!",button_type='primary')
runpost_btn.on_click(post_calculation) runpost_btn.on_click(post_calculation)
@ -314,7 +366,7 @@ def cmmde_gui():
site="Computational Molecular and Material Design Environment", site="Computational Molecular and Material Design Environment",
title="CMMDE", title="CMMDE",
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(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),download_xyz,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),pn.Row(download_spec_raw,download_spec_plot),pn.Row(download_opt_raw,download_opt_plot),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_main,job_main,method_btn, dispersion_cor,solvent, pn.Row(Run_btn,Progress_btn),pn.Row(Checkcalc_btn,visual_btn),download_xyz,title="Main Calculation",collapsed=True),pn.Card(post_software_main,post_btn,post_method_btn,dispersion_cor,solvent,pn.Row(runpost_btn,Progress_btn),pn.Row(Checkcalc_btn,visual_btn),pn.Row(download_spec_raw,download_spec_plot),pn.Row(download_opt_raw,download_opt_plot),title="Post-Calculation",collapsed=True)],
header_background=accent, accent_base_color=accent header_background=accent, accent_base_color=accent
) )

Loading…
Cancel
Save