Skip to content

Commit

Permalink
Update tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaojunfeng committed May 12, 2022
1 parent bdd7ce3 commit cbee896
Show file tree
Hide file tree
Showing 13 changed files with 255 additions and 215 deletions.
6 changes: 4 additions & 2 deletions aiida_wannier90_workflows/utils/workflows/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def plot_scdm_fit(workchain: int, save: bool = False):

formula = workchain.inputs.structure.get_formula()

w90calc = workchain.get_outgoing(link_label_filter="wannier90").one().node
# w90calc = workchain.get_outgoing(link_label_filter="wannier90").one().node
w90calc = workchain.outputs.wannier90.remote_folder.creator
p2w_workchain = workchain.get_outgoing(link_label_filter="pw2wannier90").one().node
p2wcalc = get_last_calcjob(p2w_workchain)
projcalc = workchain.get_outgoing(link_label_filter="projwfc").one().node
Expand All @@ -104,7 +105,8 @@ def plot_scdm_fit(workchain: int, save: bool = False):
# check the fitting are consistent
eps = 1e-6
assert abs(sigma - sigma_fit) < eps
sigma_factor = workchain.inputs.scdm_sigma_factor.value
# sigma_factor = workchain.inputs.scdm_sigma_factor.value
sigma_factor = 3
assert abs(mu - (mu_fit - sigma_fit * sigma_factor)) < eps
sorted_bands = data[0, :]
sorted_projwfc = data[1, :]
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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"
)
28 changes: 19 additions & 9 deletions .../scdm/include/snippets/launch_workflow.py → ...d/scdm/include/snippets/launch_wannier.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env runaiida
import os
import sys

from ase.io import read as aseread

from aiida import orm
Expand All @@ -9,14 +12,21 @@
# Code labels for `pw.x`, `pw2wannier90.x`, `projwfc.x`, and `wannier90.x`.
# Change these according to your aiida setup.
codes = {
"pw": "qe-7.0-pw@localhost",
"projwfc": "qe-7.0-projwfc@localhost",
"pw2wannier90": "qe-7.0-pw2wannier90@localhost",
"wannier90": "wannier90-3.1-wannier90@localhost",
"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"
# 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))
Expand All @@ -36,8 +46,8 @@
print(f"Submitted {workchain.process_label}<{workchain.pk}>")

print(
"Run any of these commands to check the progress:"
"verdi process report {workchain.pk}"
"verdi process show {workchain.pk}"
"verdi process list"
"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"
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
2020-03-19 07:58:27 [88 | REPORT]: [495|Wannier90BandsWorkChain|setup_protocol]: running the workchain with the "testing" protocol
2020-03-19 07:58:27 [89 | REPORT]: [495|Wannier90BandsWorkChain|setup]: workchain controls found in inputs: valence + conduction bands
2020-03-19 07:58:27 [90 | REPORT]: [495|Wannier90BandsWorkChain|run_seekpath]: running seekpath to get primitive structure for: CsH
2020-03-19 07:58:28 [91 | REPORT]: [495|Wannier90BandsWorkChain|setup_parameters]: number of machines 1 auto-set according to number of atoms
2020-03-19 07:58:30 [92 | REPORT]: [495|Wannier90BandsWorkChain|run_wannier_workchain]: launching Wannier90WorkChain<514>
2020-03-19 07:58:31 [93 | REPORT]: [514|Wannier90WorkChain|run_scf]: scf step - launching PwBaseWorkChain<517> in scf mode
2020-03-19 07:58:33 [94 | REPORT]: [517|PwBaseWorkChain|run_calculation]: launching PwCalculation<523> iteration #1
2020-03-19 07:58:46 [95 | REPORT]: [517|PwBaseWorkChain|inspect_calculation]: PwCalculation<523> completed successfully
2020-03-19 07:58:46 [96 | REPORT]: [517|PwBaseWorkChain|results]: work chain completed after 1 iterations
2020-03-19 07:58:46 [97 | REPORT]: [517|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
2020-03-19 07:58:47 [98 | REPORT]: [514|Wannier90WorkChain|inspect_scf]: scf PwBaseWorkChain successfully finished
2020-03-19 07:58:47 [99 | REPORT]: [514|Wannier90WorkChain|run_nscf]: nscf number of bands set as 24
2020-03-19 07:58:48 [100 | REPORT]: [514|Wannier90WorkChain|run_nscf]: nscf step - launching PwBaseWorkChain<537> in nscf mode
2020-03-19 07:58:49 [101 | REPORT]: [537|PwBaseWorkChain|run_calculation]: launching PwCalculation<540> iteration #1
2020-03-19 08:01:16 [102 | REPORT]: [537|PwBaseWorkChain|inspect_calculation]: PwCalculation<540> completed successfully
2020-03-19 08:01:16 [103 | REPORT]: [537|PwBaseWorkChain|results]: work chain completed after 1 iterations
2020-03-19 08:01:16 [104 | REPORT]: [537|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
2020-03-19 08:01:17 [105 | REPORT]: [514|Wannier90WorkChain|inspect_nscf]: nscf PwBaseWorkChain successfully finished
2020-03-19 08:01:17 [106 | REPORT]: [514|Wannier90WorkChain|should_do_projwfc]: SCDM mu & sigma are auto-set using projectability
2020-03-19 08:01:18 [107 | REPORT]: [514|Wannier90WorkChain|run_projwfc]: projwfc step - launching ProjwfcCalculation<546>
2020-03-19 08:01:27 [108 | REPORT]: [514|Wannier90WorkChain|inspect_projwfc]: projwfc ProjwfcCalculation successfully finished
2020-03-19 08:01:28 [109 | REPORT]: [514|Wannier90WorkChain|run_wannier90_pp]: number of Wannier functions extracted from projections: 14
2020-03-19 08:01:29 [110 | REPORT]: [514|Wannier90WorkChain|run_wannier90_pp]: wannier90 postproc step - launching Wannier90Calculation<559> in postproc mode
2020-03-19 08:01:35 [111 | REPORT]: [514|Wannier90WorkChain|inspect_wannier90_pp]: wannier90 postproc Wannier90Calculation successfully finished
2020-03-19 08:01:38 [112 | REPORT]: [514|Wannier90WorkChain|run_pw2wannier90]: pw2wannier90 step - launching Pw2Wannier90Calculation<567>
2020-03-19 08:02:16 [113 | REPORT]: [514|Wannier90WorkChain|inspect_pw2wannier90]: Pw2wannier90Calculation successfully finished
2020-03-19 08:02:16 [114 | REPORT]: [514|Wannier90WorkChain|run_wannier90]: wannier90 step - launching Wannier90Calculation<572>
2020-03-19 08:03:06 [115 | REPORT]: [514|Wannier90WorkChain|inspect_wannier90]: Wannier90Calculation successfully finished
2020-03-19 08:03:06 [116 | REPORT]: [514|Wannier90WorkChain|results]: final step - preparing outputs
2020-03-19 08:03:06 [117 | REPORT]: [514|Wannier90WorkChain|results]: Wannier90WorkChain successfully completed
2020-03-19 08:03:07 [118 | REPORT]: [495|Wannier90BandsWorkChain|results]: wannier90 interpolated bands pk: 575
2020-03-19 08:03:07 [119 | REPORT]: [495|Wannier90BandsWorkChain|results]: Wannier90BandsWorkChain successfully completed
2022-05-12 22:07:11 [179 | REPORT]: [446|Wannier90BandsWorkChain|run_seekpath]: launching seekpath: CsH -> CsH
2022-05-12 22:07:11 [180 | REPORT]: [446|Wannier90BandsWorkChain|run_scf]: launching PwBaseWorkChain<454> in scf mode
2022-05-12 22:07:12 [181 | REPORT]: [454|PwBaseWorkChain|run_process]: launching PwCalculation<459> iteration #1
2022-05-12 22:07:55 [182 | REPORT]: [454|PwBaseWorkChain|results]: work chain completed after 1 iterations
2022-05-12 22:07:55 [183 | REPORT]: [454|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
2022-05-12 22:07:55 [184 | REPORT]: [446|Wannier90BandsWorkChain|run_nscf]: launching PwBaseWorkChain<466> in nscf mode
2022-05-12 22:07:56 [185 | REPORT]: [466|PwBaseWorkChain|run_process]: launching PwCalculation<469> iteration #1
2022-05-12 22:19:39 [187 | REPORT]: [466|PwBaseWorkChain|results]: work chain completed after 1 iterations
2022-05-12 22:19:40 [188 | REPORT]: [466|PwBaseWorkChain|on_terminated]: remote folders will not be cleaned
2022-05-12 22:19:40 [189 | REPORT]: [446|Wannier90BandsWorkChain|run_projwfc]: launching ProjwfcBaseWorkChain<476>
2022-05-12 22:19:40 [190 | REPORT]: [476|ProjwfcBaseWorkChain|run_process]: launching ProjwfcCalculation<477> iteration #1
2022-05-12 22:19:50 [191 | REPORT]: [476|ProjwfcBaseWorkChain|results]: work chain completed after 1 iterations
2022-05-12 22:19:50 [192 | REPORT]: [476|ProjwfcBaseWorkChain|on_terminated]: remote folders will not be cleaned
2022-05-12 22:19:50 [193 | REPORT]: [446|Wannier90BandsWorkChain|run_wannier90_pp]: launching Wannier90BaseWorkChain<487> in postproc mode
2022-05-12 22:19:51 [194 | REPORT]: [487|Wannier90BaseWorkChain|run_process]: launching Wannier90Calculation<489> iteration #1
2022-05-12 22:19:59 [195 | REPORT]: [487|Wannier90BaseWorkChain|results]: work chain completed after 1 iterations
2022-05-12 22:19:59 [196 | REPORT]: [487|Wannier90BaseWorkChain|on_terminated]: remote folders will not be cleaned
2022-05-12 22:20:00 [197 | REPORT]: [446|Wannier90BandsWorkChain|run_pw2wannier90]: launching Pw2wannier90BaseWorkChain<495>
2022-05-12 22:20:02 [198 | REPORT]: [495|Pw2wannier90BaseWorkChain|run_process]: launching Pw2wannier90Calculation<497> iteration #1
2022-05-12 22:20:39 [199 | REPORT]: [495|Pw2wannier90BaseWorkChain|results]: work chain completed after 1 iterations
2022-05-12 22:20:39 [200 | REPORT]: [495|Pw2wannier90BaseWorkChain|on_terminated]: remote folders will not be cleaned
2022-05-12 22:20:40 [201 | REPORT]: [446|Wannier90BandsWorkChain|run_wannier90]: launching Wannier90BaseWorkChain<506>
2022-05-12 22:20:41 [202 | REPORT]: [506|Wannier90BaseWorkChain|run_process]: launching Wannier90Calculation<508> iteration #1
2022-05-12 22:21:00 [203 | REPORT]: [506|Wannier90BaseWorkChain|results]: work chain completed after 1 iterations
2022-05-12 22:21:00 [204 | REPORT]: [506|Wannier90BaseWorkChain|on_terminated]: remote folders will not be cleaned
2022-05-12 22:21:00 [205 | REPORT]: [446|Wannier90BandsWorkChain|results]: Wannier90BandsWorkChain successfully completed
2022-05-12 22:21:01 [206 | REPORT]: [446|Wannier90BandsWorkChain|on_terminated]: remote folders will not be cleaned
Loading

0 comments on commit cbee896

Please sign in to comment.