GWR flow with convergence studies

This script shows how to compute the G0W0 corrections in silicon. More specifically, we build a flow to analyze the convergence of the QP corrections wrt to the number of bands in the self-energy. More complicated convergence studies can be implemented on the basis of this example.

run gwr g0w0
Downloading repository from: https://github.com/PseudoDojo/ONCVPSP-PBE-PDv0.4/archive/refs/heads/master.zip ...
Installing ONCVPSP-PBE-SR-PDv0.4 in: /home/runner/.abinit/pseudos/ONCVPSP-PBE-SR-PDv0.4

0.00iB [00:00, ?iB/s]
339kiB [00:00, 3.09MiB/s]
1.23MiB [00:00, 6.07MiB/s]
1.88MiB [00:00, 4.81MiB/s]
3.22MiB [00:00, 7.38MiB/s]
4.06MiB [00:00, 6.18MiB/s]
5.21MiB [00:00, 6.68MiB/s]
6.18MiB [00:00, 6.91MiB/s]
6.91MiB [00:01, 6.95MiB/s]
7.67MiB [00:01, 6.82MiB/s]
8.42MiB [00:01, 6.95MiB/s]
9.21MiB [00:01, 6.96MiB/s]
9.94MiB [00:01, 6.96MiB/s]
10.7MiB [00:01, 6.63MiB/s]
11.4MiB [00:01, 6.76MiB/s]
12.2MiB [00:01, 6.59MiB/s]
12.9MiB [00:02, 5.69MiB/s]
13.7MiB [00:02, 5.76MiB/s]
14.5MiB [00:02, 5.77MiB/s]
15.8MiB [00:02, 7.20MiB/s]
16.6MiB [00:02, 7.43MiB/s]
17.5MiB [00:02, 7.05MiB/s]
18.2MiB [00:02, 6.72MiB/s]
19.0MiB [00:02, 6.81MiB/s]
19.8MiB [00:03, 6.88MiB/s]
20.5MiB [00:03, 6.74MiB/s]
21.3MiB [00:03, 6.82MiB/s]
22.0MiB [00:03, 6.83MiB/s]
22.7MiB [00:03, 6.27MiB/s]
23.6MiB [00:03, 6.97MiB/s]
24.4MiB [00:03, 7.00MiB/s]
25.2MiB [00:03, 6.93MiB/s]
25.9MiB [00:03, 6.87MiB/s]
26.7MiB [00:04, 6.90MiB/s]
27.4MiB [00:04, 5.75MiB/s]
28.2MiB [00:04, 5.85MiB/s]
29.0MiB [00:04, 6.28MiB/s]
29.7MiB [00:04, 5.86MiB/s]
30.7MiB [00:04, 6.33MiB/s]
31.6MiB [00:04, 6.64MiB/s]
32.3MiB [00:04, 6.51MiB/s]
33.0MiB [00:05, 6.44MiB/s]
34.1MiB [00:05, 7.28MiB/s]
34.9MiB [00:05, 7.18MiB/s]
35.6MiB [00:05, 6.76MiB/s]
36.5MiB [00:05, 7.01MiB/s]
37.3MiB [00:05, 6.97MiB/s]
38.1MiB [00:05, 6.84MiB/s]
38.8MiB [00:05, 7.09MiB/s]
39.6MiB [00:05, 6.83MiB/s]
40.4MiB [00:06, 6.80MiB/s]
41.1MiB [00:06, 6.13MiB/s]
41.8MiB [00:06, 5.20MiB/s]
42.9MiB [00:06, 5.51MiB/s]
44.3MiB [00:06, 6.49MiB/s]
45.1MiB [00:06, 6.47MiB/s]
46.4MiB [00:06, 7.86MiB/s]
47.3MiB [00:07, 7.52MiB/s]
48.1MiB [00:07, 7.24MiB/s]
48.9MiB [00:07, 7.25MiB/s]
49.6MiB [00:07, 7.06MiB/s]
50.4MiB [00:07, 6.89MiB/s]
51.2MiB [00:07, 6.34MiB/s]
51.9MiB [00:07, 5.45MiB/s]
52.8MiB [00:08, 5.96MiB/s]
53.9MiB [00:08, 7.18MiB/s]
54.7MiB [00:08, 7.14MiB/s]
55.5MiB [00:08, 6.82MiB/s]
56.3MiB [00:08, 7.13MiB/s]
57.1MiB [00:08, 7.09MiB/s]
57.9MiB [00:08, 6.87MiB/s]
58.7MiB [00:08, 6.89MiB/s]
59.4MiB [00:08, 6.05MiB/s]
60.3MiB [00:09, 6.64MiB/s]
61.1MiB [00:09, 7.06MiB/s]
61.9MiB [00:09, 7.05MiB/s]
62.7MiB [00:09, 6.60MiB/s]
63.5MiB [00:09, 6.09MiB/s]
64.1MiB [00:09, 6.07MiB/s]
64.9MiB [00:09, 5.91MiB/s]
66.1MiB [00:09, 7.13MiB/s]
66.9MiB [00:10, 6.81MiB/s]
67.6MiB [00:10, 6.20MiB/s]
68.3MiB [00:10, 5.75MiB/s]
69.3MiB [00:10, 4.76MiB/s]
71.0MiB [00:10, 7.12MiB/s]
72.0MiB [00:10, 7.61MiB/s]
72.9MiB [00:10, 7.63MiB/s]
73.8MiB [00:11, 7.40MiB/s]
74.7MiB [00:11, 6.64MiB/s]
75.4MiB [00:11, 6.01MiB/s]
76.5MiB [00:11, 7.18MiB/s]
77.3MiB [00:11, 7.00MiB/s]
78.1MiB [00:11, 6.78MiB/s]
78.8MiB [00:11, 6.80MiB/s]
79.5MiB [00:12, 4.21MiB/s]
81.4MiB [00:12, 6.22MiB/s]
82.5MiB [00:12, 4.91MiB/s]
84.7MiB [00:12, 7.17MiB/s]
85.6MiB [00:13, 6.55MiB/s]
86.9MiB [00:13, 6.41MiB/s]
88.4MiB [00:13, 7.72MiB/s]
89.3MiB [00:13, 7.68MiB/s]
90.2MiB [00:13, 7.61MiB/s]
91.0MiB [00:13, 6.23MiB/s]
92.2MiB [00:13, 6.99MiB/s]
93.0MiB [00:14, 7.18MiB/s]
93.8MiB [00:14, 6.88MiB/s]
94.6MiB [00:14, 6.22MiB/s]
95.5MiB [00:14, 6.63MiB/s]

Validating md5 checksums of ONCVPSP-PBE-SR-PDv0.4...
Checksum test: OK
Installation completed successfully in 16.21 [s]

import os
import sys

from abipy import abilab, data, flowtk
from abipy.flowtk.gwr_works import DirectDiagoWork, GWRSigmaConvWork


def build_flow(options):
    # Working directory (default is the name of the script with '.py' removed and "run_" replaced by "flow_")
    if not options.workdir:
        options.workdir = os.path.basename(sys.argv[0]).replace(".py", "").replace("run_", "flow_")

    # IMPORTANT: Note stringent table to have semi-core states.
    from abipy.flowtk.psrepos import get_oncvpsp_pseudos

    pseudos = get_oncvpsp_pseudos(xc_name="PBE", version="0.4", relativity_type="SR", accuracy="stringent")

    scf_input = abilab.AbinitInput(structure=data.cif_file("si.cif"), pseudos=pseudos)

    num_ele = scf_input.num_valence_electrons

    # Global variables.
    scf_input.set_vars(
        ecut=6,
        nband=num_ele // 2,
        tolvrs=1e-8,
        paral_kgb=1,
    )

    # IMPORTANT: k-grid for GWR must be Gamma-centered.
    scf_input.set_kmesh(ngkpt=[2, 2, 2], shiftk=[0.0, 0.0, 0.0])

    flow = flowtk.Flow(workdir=options.workdir)

    # GS-SCF run to get the DEN, followed by direct diago to obtain green_nband bands.
    green_nband = -1  # -1 this means full diago
    diago_work = DirectDiagoWork.from_scf_input(scf_input, green_nband)
    flow.register_work(diago_work)

    # Build template for GWR.
    gwr_template = scf_input.make_gwr_qprange_input(gwr_ntau=6, nband=8, ecuteps=4, ecutwfn=2)

    # Two possibilities:
    # 1) To change the value of one variable, use:

    varname_values = ("nband", [8, 12, 14])

    # 2) To take the Cartesian product of two or more variables use e.g.:
    #
    # varname_values = [
    #   ("nband", [50, 100]),
    #   ("ecuteps", [2, 4]),
    # ]

    # Can also use strings with path to files for den_node and wfk_node
    # so that one does not need to recompute these files.

    gwr_work = GWRSigmaConvWork.from_varname_values(
        varname_values,
        gwr_template,
        den_node=diago_work.scf_task,
        wfk_node=diago_work.diago_task,
    )
    flow.register_work(gwr_work)

    return flow


# This block generates the thumbnails in the AbiPy gallery.
# You can safely REMOVE this part if you are using this script for production runs.
if os.getenv("READTHEDOCS", False):
    __name__ = None
    import tempfile

    options = flowtk.build_flow_main_parser().parse_args(["-w", tempfile.mkdtemp()])
    build_flow(options).graphviz_imshow()


@flowtk.flow_main
def main(options):
    return build_flow(options)


if __name__ == "__main__":
    sys.exit(main())

Total running time of the script: (0 minutes 16.554 seconds)

Gallery generated by Sphinx-Gallery