Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pranabdas committed Jul 4, 2023
1 parent 21b5e47 commit ee886ce
Show file tree
Hide file tree
Showing 2 changed files with 246 additions and 116 deletions.
217 changes: 101 additions & 116 deletions examples/workflow/qe_scf_calculation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,125 +41,110 @@
"source": [
"# payload for workflow creation\n",
"BODY = {\n",
" \"name\": \"Silicon-SCF-bash-REST\",\n",
" \"subworkflows\": [\n",
" {\n",
" \"name\": \"QE-SCF\",\n",
" \"application\": {\n",
" \"name\": \"shell\",\n",
" \"version\": \"4.2.46\",\n",
" \"build\": \"Default\",\n",
" \"isDefault\": \"true\",\n",
" \"summary\": \"Shell Script\",\n",
" \"shortName\": \"sh\"\n",
" },\n",
" \"properties\": [\n",
" \"total_energy\",\n",
" \"fermi_energy\"\n",
" ],\n",
" \"units\": [\n",
" \"name\": \"Silicon-SCF-bash-REST\",\n",
" \"subworkflows\": [\n",
" {\n",
" \"type\": \"execution\",\n",
" \"application\": {\n",
" \"name\": \"shell\",\n",
" \"version\": \"4.2.46\",\n",
" \"build\": \"Default\",\n",
" \"isDefault\": \"true\",\n",
" \"summary\": \"Shell Script\",\n",
" \"shortName\": \"sh\"\n",
" },\n",
" \"head\": \"true\",\n",
" \"input\": [\n",
" {\n",
" \"content\": \"#!/bin/bash\\n# ---------------------- CLUSTER PARAMETERS ---------------------- #\\n#PBS -N Silicon-SCF\\n#PBS -j oe\\n#PBS -l nodes=1\\n#PBS -l ppn=4\\n#PBS -q OR\\n#PBS -l walltime=00:00:30:00\\n#PBS -A seminar-espresso-tutorials\\n# ------------------------- INPUT FILES -------------------------- #\\n# switch to the job working directory\\ncd $PBS_O_WORKDIR\\n\\nBASE_URL='https://github.com/pranabdas/espresso/raw/next/src'\\nIN_FILE='pw.scf.silicon.in'\\nPP_FILE='Si.pz-vbc.UPF'\\n\\n# get QE input file\\nwget ${BASE_URL}/silicon/${IN_FILE} -O ${IN_FILE}\\n\\n# get pseudopotential file\\nwget ${BASE_URL}/pseudos/${PP_FILE} -O ${PP_FILE}\\n\\n# delete pseudo_dir from input file and provide via env\\nsed -i '/^\\\\s*pseudo_dir/d' ${IN_FILE}\\nexport ESPRESSO_PSEUDO='./'\\n\\n# --------------------------- RUN JOB ---------------------------- #\\n# load required module\\nmodule add espresso/63-i-174-impi-044\\n\\n# run the calculation\\nmpirun -np $PBS_NP pw.x -in ${IN_FILE} | tee ${IN_FILE%*.in}.out\\n\\n# ----------------------------- END ------------------------------ #\\n\",\n",
" \"name\": \"pbs-Silicon-scf.sh\"\n",
" }\n",
" ],\n",
" \"name\": \"Silicon-SCF.sh\",\n",
" \"executable\": {\n",
" \"isDefault\": \"true\",\n",
" \"monitors\": [\n",
" \"standard_output\"\n",
" \"name\": \"QE-SCF\",\n",
" \"application\": {\n",
" \"name\": \"shell\",\n",
" \"version\": \"4.2.46\",\n",
" \"build\": \"Default\",\n",
" \"isDefault\": \"true\",\n",
" \"summary\": \"Shell Script\",\n",
" \"shortName\": \"sh\",\n",
" },\n",
" \"properties\": [\"total_energy\", \"fermi_energy\"],\n",
" \"units\": [\n",
" {\n",
" \"type\": \"execution\",\n",
" \"application\": {\n",
" \"name\": \"shell\",\n",
" \"version\": \"4.2.46\",\n",
" \"build\": \"Default\",\n",
" \"isDefault\": \"true\",\n",
" \"summary\": \"Shell Script\",\n",
" \"shortName\": \"sh\",\n",
" },\n",
" \"head\": \"true\",\n",
" \"input\": [\n",
" {\n",
" \"content\": \"#!/bin/bash\\n# ---------------------- CLUSTER PARAMETERS ---------------------- #\\n#PBS -N Silicon-SCF\\n#PBS -j oe\\n#PBS -l nodes=1\\n#PBS -l ppn=4\\n#PBS -q OR\\n#PBS -l walltime=00:00:30:00\\n#PBS -A seminar-espresso-tutorials\\n# ------------------------- INPUT FILES -------------------------- #\\n# switch to the job working directory\\ncd $PBS_O_WORKDIR\\n\\nBASE_URL='https://github.com/pranabdas/espresso/raw/next/src'\\nIN_FILE='pw.scf.silicon.in'\\nPP_FILE='Si.pz-vbc.UPF'\\n\\n# get QE input file\\nwget ${BASE_URL}/silicon/${IN_FILE} -O ${IN_FILE}\\n\\n# get pseudopotential file\\nwget ${BASE_URL}/pseudos/${PP_FILE} -O ${PP_FILE}\\n\\n# delete pseudo_dir from input file and provide via env\\nsed -i '/^\\\\s*pseudo_dir/d' ${IN_FILE}\\nexport ESPRESSO_PSEUDO='./'\\n\\n# --------------------------- RUN JOB ---------------------------- #\\n# load required module\\nmodule add espresso/63-i-174-impi-044\\n\\n# run the calculation\\nmpirun -np $PBS_NP pw.x -in ${IN_FILE} | tee ${IN_FILE%*.in}.out\\n\\n# ----------------------------- END ------------------------------ #\\n\",\n",
" \"name\": \"pbs-Silicon-scf.sh\",\n",
" }\n",
" ],\n",
" \"name\": \"Silicon-SCF.sh\",\n",
" \"executable\": {\n",
" \"isDefault\": \"true\",\n",
" \"monitors\": [\"standard_output\"],\n",
" \"results\": [\n",
" \"atomic_forces\",\n",
" \"band_gaps\",\n",
" \"band_structure\",\n",
" \"density_of_states\",\n",
" \"fermi_energy\",\n",
" \"phonon_dispersions\",\n",
" \"phonon_dos\",\n",
" \"pressure\",\n",
" \"stress_tensor\",\n",
" \"total_energy\",\n",
" \"total_energy_contributions\",\n",
" \"total_force\",\n",
" \"zero_point_energy\",\n",
" \"final_structure\",\n",
" \"magnetic_moments\",\n",
" \"reaction_energy_barrier\",\n",
" \"reaction_energy_profile\",\n",
" \"potential_profile\",\n",
" \"charge_density_profile\",\n",
" ],\n",
" \"name\": \"sh\",\n",
" },\n",
" \"flavor\": {\n",
" \"isDefault\": \"true\",\n",
" \"input\": [{\"name\": \"hello_world.sh\"}],\n",
" \"monitors\": [\"standard_output\"],\n",
" \"applicationName\": \"shell\",\n",
" \"executableName\": \"sh\",\n",
" \"name\": \"hello_world\",\n",
" \"executable\": {\n",
" \"isDefault\": \"true\",\n",
" \"monitors\": [\"standard_output\"],\n",
" \"results\": [\n",
" \"atomic_forces\",\n",
" \"band_gaps\",\n",
" \"band_structure\",\n",
" \"density_of_states\",\n",
" \"fermi_energy\",\n",
" \"phonon_dispersions\",\n",
" \"phonon_dos\",\n",
" \"pressure\",\n",
" \"stress_tensor\",\n",
" \"total_energy\",\n",
" \"total_energy_contributions\",\n",
" \"total_force\",\n",
" \"zero_point_energy\",\n",
" \"final_structure\",\n",
" \"magnetic_moments\",\n",
" \"reaction_energy_barrier\",\n",
" \"reaction_energy_profile\",\n",
" \"potential_profile\",\n",
" \"charge_density_profile\",\n",
" ],\n",
" \"name\": \"sh\",\n",
" },\n",
" },\n",
" }\n",
" ],\n",
" \"results\": [\n",
" \"atomic_forces\",\n",
" \"band_gaps\",\n",
" \"band_structure\",\n",
" \"density_of_states\",\n",
" \"fermi_energy\",\n",
" \"phonon_dispersions\",\n",
" \"phonon_dos\",\n",
" \"pressure\",\n",
" \"stress_tensor\",\n",
" \"total_energy\",\n",
" \"total_energy_contributions\",\n",
" \"total_force\",\n",
" \"zero_point_energy\",\n",
" \"final_structure\",\n",
" \"magnetic_moments\",\n",
" \"reaction_energy_barrier\",\n",
" \"reaction_energy_profile\",\n",
" \"potential_profile\",\n",
" \"charge_density_profile\"\n",
" ],\n",
" \"name\": \"sh\"\n",
" },\n",
" \"flavor\": {\n",
" \"isDefault\": \"true\",\n",
" \"input\": [\n",
" {\n",
" \"name\": \"hello_world.sh\"\n",
" }\n",
" ],\n",
" \"monitors\": [\n",
" \"standard_output\"\n",
" ],\n",
" \"applicationName\": \"shell\",\n",
" \"executableName\": \"sh\",\n",
" \"name\": \"hello_world\",\n",
" \"executable\": {\n",
" \"isDefault\": \"true\",\n",
" \"monitors\": [\n",
" \"standard_output\"\n",
" ],\n",
" \"results\": [\n",
" \"atomic_forces\",\n",
" \"band_gaps\",\n",
" \"band_structure\",\n",
" \"density_of_states\",\n",
" \"fermi_energy\",\n",
" \"phonon_dispersions\",\n",
" \"phonon_dos\",\n",
" \"pressure\",\n",
" \"stress_tensor\",\n",
" \"total_energy\",\n",
" \"total_energy_contributions\",\n",
" \"total_force\",\n",
" \"zero_point_energy\",\n",
" \"final_structure\",\n",
" \"magnetic_moments\",\n",
" \"reaction_energy_barrier\",\n",
" \"reaction_energy_profile\",\n",
" \"potential_profile\",\n",
" \"charge_density_profile\"\n",
" ],\n",
" \"name\": \"sh\"\n",
" }\n",
" }\n",
" }\n",
" ],\n",
" \"compute\": {\n",
" \"ppn\": 4,\n",
" \"nodes\": 1,\n",
" \"queue\": \"OR\",\n",
" \"timeLimit\": \"01:00:00\",\n",
" \"notify\": \"n\",\n",
" \"cluster\": {\n",
" \"fqdn\": \"master-production-20160630-cluster-001.exabyte.io\"\n",
" \"compute\": {\n",
" \"ppn\": 4,\n",
" \"nodes\": 1,\n",
" \"queue\": \"OR\",\n",
" \"timeLimit\": \"01:00:00\",\n",
" \"notify\": \"n\",\n",
" \"cluster\": {\"fqdn\": \"master-production-20160630-cluster-001.exabyte.io\"},\n",
" },\n",
" }\n",
" }\n",
" }\n",
" ]\n",
" ],\n",
"}"
]
},
Expand Down
145 changes: 145 additions & 0 deletions examples/workflow/qe_scf_calculation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
#!/usr/bin/env python
# coding: utf-8

# # Quantum Espresso SCF calcuation via API
#

# In[1]:


from utils.settings import ENDPOINT_ARGS, ACCOUNT_ID
from utils.generic import display_JSON

from exabyte_api_client.endpoints.workflows import WorkflowEndpoints


# In[2]:


# Initialize a helper class to interact with WorkflowEndpoints
endpoint = WorkflowEndpoints(*ENDPOINT_ARGS)


# In[3]:


# payload for workflow creation
BODY = {
"name": "Silicon-SCF-bash-REST",
"subworkflows": [
{
"name": "QE-SCF",
"application": {
"name": "shell",
"version": "4.2.46",
"build": "Default",
"isDefault": "true",
"summary": "Shell Script",
"shortName": "sh",
},
"properties": ["total_energy", "fermi_energy"],
"units": [
{
"type": "execution",
"application": {
"name": "shell",
"version": "4.2.46",
"build": "Default",
"isDefault": "true",
"summary": "Shell Script",
"shortName": "sh",
},
"head": "true",
"input": [
{
"content": "#!/bin/bash\n# ---------------------- CLUSTER PARAMETERS ---------------------- #\n#PBS -N Silicon-SCF\n#PBS -j oe\n#PBS -l nodes=1\n#PBS -l ppn=4\n#PBS -q OR\n#PBS -l walltime=00:00:30:00\n#PBS -A seminar-espresso-tutorials\n# ------------------------- INPUT FILES -------------------------- #\n# switch to the job working directory\ncd $PBS_O_WORKDIR\n\nBASE_URL='https://github.com/pranabdas/espresso/raw/next/src'\nIN_FILE='pw.scf.silicon.in'\nPP_FILE='Si.pz-vbc.UPF'\n\n# get QE input file\nwget ${BASE_URL}/silicon/${IN_FILE} -O ${IN_FILE}\n\n# get pseudopotential file\nwget ${BASE_URL}/pseudos/${PP_FILE} -O ${PP_FILE}\n\n# delete pseudo_dir from input file and provide via env\nsed -i '/^\\s*pseudo_dir/d' ${IN_FILE}\nexport ESPRESSO_PSEUDO='./'\n\n# --------------------------- RUN JOB ---------------------------- #\n# load required module\nmodule add espresso/63-i-174-impi-044\n\n# run the calculation\nmpirun -np $PBS_NP pw.x -in ${IN_FILE} | tee ${IN_FILE%*.in}.out\n\n# ----------------------------- END ------------------------------ #\n",
"name": "pbs-Silicon-scf.sh",
}
],
"name": "Silicon-SCF.sh",
"executable": {
"isDefault": "true",
"monitors": ["standard_output"],
"results": [
"atomic_forces",
"band_gaps",
"band_structure",
"density_of_states",
"fermi_energy",
"phonon_dispersions",
"phonon_dos",
"pressure",
"stress_tensor",
"total_energy",
"total_energy_contributions",
"total_force",
"zero_point_energy",
"final_structure",
"magnetic_moments",
"reaction_energy_barrier",
"reaction_energy_profile",
"potential_profile",
"charge_density_profile",
],
"name": "sh",
},
"flavor": {
"isDefault": "true",
"input": [{"name": "hello_world.sh"}],
"monitors": ["standard_output"],
"applicationName": "shell",
"executableName": "sh",
"name": "hello_world",
"executable": {
"isDefault": "true",
"monitors": ["standard_output"],
"results": [
"atomic_forces",
"band_gaps",
"band_structure",
"density_of_states",
"fermi_energy",
"phonon_dispersions",
"phonon_dos",
"pressure",
"stress_tensor",
"total_energy",
"total_energy_contributions",
"total_force",
"zero_point_energy",
"final_structure",
"magnetic_moments",
"reaction_energy_barrier",
"reaction_energy_profile",
"potential_profile",
"charge_density_profile",
],
"name": "sh",
},
},
}
],
"compute": {
"ppn": 4,
"nodes": 1,
"queue": "OR",
"timeLimit": "01:00:00",
"notify": "n",
"cluster": {"fqdn": "master-production-20160630-cluster-001.exabyte.io"},
},
}
],
}


# In[4]:


response = endpoint.create(BODY)


# In[ ]:




0 comments on commit ee886ce

Please sign in to comment.