Skip to content

Commit

Permalink
Add AiiDA tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaojunfeng committed May 13, 2022
1 parent 7e18511 commit 88a6383
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 2022_05_Trieste/DAY3_PM_2_AiiDA/CsH.xsf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CRYSTAL
PRIMVEC 1
0.0000000000 3.2005628444 3.2005628444
3.2005628444 0.0000000000 3.2005628444
3.2005628444 3.2005628444 0.0000000000
PRIMCOORD 1
2 1
55 3.2005628444 0.0000000000 0.0000000000
1 0.0000000000 0.0000000000 0.0000000000

2 changes: 2 additions & 0 deletions 2022_05_Trieste/DAY3_PM_2_AiiDA/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
See the tutorial text here
https://aiida-wannier90-workflows.readthedocs.io/en/latest/user_guide/get_started/scdm/scdm.html
49 changes: 49 additions & 0 deletions 2022_05_Trieste/DAY3_PM_2_AiiDA/launch_pwbands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env runaiida
import os
import sys

from ase.io import read as aseread

from aiida import orm
from aiida.engine import submit

from aiida_quantumespresso.workflows.pw.bands import PwBandsWorkChain

# Code labels for `pw.x`
# Change these according to your aiida setup.
code = "qe-pw-6.8@localhost"

# Filename of a structure.
# filename = "GaAs.xsf"
if len(sys.argv) != 2:
print(f"Please pass a filename for a structure as the argument.")
sys.exit(1)
filename = sys.argv[1]
if not os.path.exists(filename):
print(f"{filename} not existed!")
sys.exit(1)

# Read a structure file and store as an `orm.StructureData`.
structure = orm.StructureData(ase=aseread(filename))
structure.store()
print(f"Read and stored structure {structure.get_formula()}<{structure.pk}>")

# Prepare the builder to launch the workchain.
# We use fast protocol to converge faster.
builder = PwBandsWorkChain.get_builder_from_protocol(
code,
structure,
protocol="fast",
)
builder.pop("relax", None)

# Submit the workchain.
workchain = submit(builder)
print(f"Submitted {workchain.process_label}<{workchain.pk}>")

print(
"Run any of these commands to check the progress:\n"
f"verdi process report {workchain.pk}\n"
f"verdi process show {workchain.pk}\n"
"verdi process list\n"
)
53 changes: 53 additions & 0 deletions 2022_05_Trieste/DAY3_PM_2_AiiDA/launch_wannier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env runaiida
import os
import sys

from ase.io import read as aseread

from aiida import orm
from aiida.engine import submit

from aiida_wannier90_workflows.workflows import Wannier90BandsWorkChain

# Code labels for `pw.x`, `pw2wannier90.x`, `projwfc.x`, and `wannier90.x`.
# Change these according to your aiida setup.
codes = {
"pw": "qe-pw-6.8@localhost",
"projwfc": "qe-projwfc-6.8@localhost",
"pw2wannier90": "qe-pw2wannier90-6.8@localhost",
"wannier90": "wannier90-3.1@localhost",
}

# Filename of a structure.
# filename = "GaAs.xsf"
if len(sys.argv) != 2:
print(f"Please pass a filename for a structure as the argument.")
sys.exit(1)
filename = sys.argv[1]
if not os.path.exists(filename):
print(f"{filename} not existed!")
sys.exit(1)

# Read a structure file and store as an `orm.StructureData`.
structure = orm.StructureData(ase=aseread(filename))
structure.store()
print(f"Read and stored structure {structure.get_formula()}<{structure.pk}>")

# Prepare the builder to launch the workchain.
# We use fast protocol to converge faster.
builder = Wannier90BandsWorkChain.get_builder_from_protocol(
codes,
structure,
protocol="fast",
)

# Submit the workchain.
workchain = submit(builder)
print(f"Submitted {workchain.process_label}<{workchain.pk}>")

print(
"Run any of these commands to check the progress:\n"
f"verdi process report {workchain.pk}\n"
f"verdi process show {workchain.pk}\n"
"verdi process list\n"
)

0 comments on commit 88a6383

Please sign in to comment.