Flow for v-ZSISA-QHA calculations

See [Phys. Rev. B 110, 014103](https://doi.org/10.1103/PhysRevB.110.014103)

run qha vzsisa
scf_input
 ##############################################
####                SECTION: basic
##############################################
 ecut 18.0
 nband 4
 nstep 100
 tolvrs 1e-08
 ngkpt 2 2 2
 kptopt 1
 nshiftk 1
 shiftk 0 0 0
##############################################
####                SECTION: files
##############################################
 indata_prefix "indata/in"
 tmpdata_prefix "tmpdata/tmp"
 outdata_prefix "outdata/out"
 pseudos "/home/runner/.abinit/pseudos/ONCVPSP-PBEsol-SR-PDv0.4/Si/Si.psp8"
##############################################
####               SECTION: gstate
##############################################
 nline 10
 nbdbuf 0
##############################################
####                 SECTION: rlx
##############################################
 ecutsm 1.0
##############################################
####                  STRUCTURE
##############################################
 natom 2
 ntypat 1
 typat 1 1
 znucl 14
 xred
    0.0000000000    0.0000000000    0.0000000000
    0.2500000000    0.2500000000    0.2500000000
 acell    1.0    1.0    1.0
 rprim
    6.3285005287    0.0000000000    3.6537614838
    2.1095001762    5.9665675181    3.6537614838
    0.0000000000    0.0000000000    7.3075229676


#<JSON>
#{
#    "pseudos": [
#        {
#            "@module": "pymatgen.io.abinit.pseudos",
#            "@class": "NcAbinitPseudo",
#            "basename": "Si.psp8",
#            "type": "NcAbinitPseudo",
#            "symbol": "Si",
#            "Z": 14,
#            "Z_val": 4.0,
#            "l_max": 2,
#            "md5": "926731724df1b06af70b3ef370bdc1e4",
#            "filepath": "/home/runner/.abinit/pseudos/ONCVPSP-PBEsol-SR-PDv0.4/Si/Si.psp8"
#        }
#    ]
#}
#</JSON>

import sys
import os
import abipy.abilab as abilab
import abipy.data as abidata

from abipy import flowtk
from abipy.flowtk.vzsisa import VzsisaFlow


def build_flow(options):
    """
    Create a `VzsisaFlow`.
    """
    # Working directory (default is the name of the script with '.py' removed and "run_" replaced by "flow_")
    if not options.workdir:
        __file__ = os.path.join(os.getcwd(), "run_qha_vzsisa.py")
        options.workdir = os.path.basename(__file__).replace(".py", "").replace("run_", "flow_")

    # Initialize structure from cif file.
    structure = abilab.Structure.from_file(abidata.cif_file("si.cif"))

    # Get NC pseudos from pseudodojo.
    from abipy.flowtk.psrepos import get_oncvpsp_pseudos
    pseudos = get_oncvpsp_pseudos(xc_name="PBEsol", version="0.4")

    # Select k-mesh for electrons and q-mesh for phonons. NB: ngqpt should be a divisor of ngkpt.
    # These values are clearly UNDERCONVERGED, just for testing.
    ngkpt = [2, 2, 2]
    ngqpt = [1, 1, 1]

    # BECS are not needed for Si. quadrupoles require pseudos without non-linear core correction.
    with_becs = False
    with_quad = False
    #with_quad = not structure.has_zero_dynamical_quadrupoles

    # List of volumetric scaling factors for the BO energies and the phonon part.
    #bo_vol_scales = [0.96, 0.98, 1.0, 1.02, 1.04, 1.06]
    #ph_vol_scales = [0.98, 1.0, 1.02, 1.04, 1.06] # EinfVib4(D)
    bo_vol_scales = [0.96, 0.98, 1, 1.02, 1.04]    # EinfVib4(S)
    ph_vol_scales = [1, 1.02, 1.04]                # EinfVib2(D)

    scf_input = abilab.AbinitInput(structure, pseudos)

    # Set other important variables assuming a spin unpolarized semiconductor (nsppol 1, nspinor 1).
    # All the other DFPT runs will inherit these parameters.
    scf_input.set_vars(
        nband=scf_input.num_valence_electrons // 2,
        nline=10,
        nbdbuf=0,
        nstep=100,
        ecutsm=1.0,
        tolvrs=1.0e-8,   # SCF stopping criterion (modify default)
        #tolvrs=1.0e-18, # SCF stopping criterion (modify default)
    )

    scf_input.set_kmesh(ngkpt=ngkpt, shiftk=[0, 0, 0])
    print("scf_input\n", scf_input)

    return VzsisaFlow.from_scf_input(options.workdir, scf_input, bo_vol_scales, ph_vol_scales, ngqpt,
                                     with_becs, with_quad, edos_ngkpt=None)


# 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):
    """
    This is our main function that will be invoked by the script.
    flow_main is a decorator implementing the command line interface.
    Command line args are stored in `options`.
    """
    return build_flow(options)


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

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

Gallery generated by Sphinx-Gallery