Skip to content

dos

DOS/ProjWFC recipes for performing dos calculations

DosSchema

Bases: TypedDict

dos_job instance-attribute

dos_job: RunSchema

non_scf_job instance-attribute

non_scf_job: RunSchema

static_job instance-attribute

static_job: RunSchema

ProjwfcSchema

Bases: TypedDict

non_scf_job instance-attribute

non_scf_job: RunSchema

static_job instance-attribute

static_job: RunSchema

dos_flow

dos_flow(
    atoms: Atoms,
    job_decorators: (
        dict[str, Callable | None] | None
    ) = None,
    job_params: dict[str, Any] | None = None,
) -> DosSchema

This function performs a total density of states calculations.

Consists of following jobs that can be modified:

  1. pw.x static

  2. pw.x non self-consistent

  3. dos.x total density of states

Parameters:

  • atoms (Atoms) –

    Atoms object

  • job_params (dict[str, Any] | None, default: None ) –

    Custom parameters to pass to each Job in the Flow. This is a dictionary where the keys are the names of the jobs and the values are dictionaries of parameters.

  • job_decorators (dict[str, Callable | None] | None, default: None ) –

    Custom decorators to apply to each Job in the Flow. This is a dictionary where the keys are the names of the jobs and the values are decorators.

Returns:

Source code in quacc/recipes/espresso/dos.py
@flow
def dos_flow(
    atoms: Atoms,
    job_decorators: dict[str, Callable | None] | None = None,
    job_params: dict[str, Any] | None = None,
) -> DosSchema:
    """
    This function performs a total density of states calculations.

    Consists of following jobs that can be modified:

    1. pw.x static
        - name: "static_job"
        - job: [quacc.recipes.espresso.core.static_job][]

    2. pw.x non self-consistent
        - name: "non_scf_job"
        - job: [quacc.recipes.espresso.core.non_scf_job][]

    3. dos.x total density of states
        - name: "dos_job"
        - job: [quacc.recipes.espresso.dos.dos_job][]

    Parameters
    ----------
    atoms
        Atoms object
    job_params
        Custom parameters to pass to each Job in the Flow. This is a dictionary where
        the keys are the names of the jobs and the values are dictionaries of parameters.
    job_decorators
        Custom decorators to apply to each Job in the Flow. This is a dictionary where
        the keys are the names of the jobs and the values are decorators.

    Returns
    -------
    DosSchema
        Dictionary of results from [quacc.schemas.ase.summarize_run][].
        See the type-hint for the data structure.
    """
    default_job_params = {
        "static_job": {
            "kspacing": 0.2,
            "input_data": {"system": {"occupations": "tetrahedra"}},
        },
        "non_scf_job": recursive_dict_merge(
            job_params.get("static_job"),
            {
                "kspacing": 0.01,
                "input_data": {
                    "control": {"calculation": "nscf", "verbosity": "high"},
                    "system": {"occupations": "tetrahedra"},
                },
            },
        ),
    }

    static_job_, non_scf_job_, dos_job_ = customize_funcs(
        ["static_job", "non_scf_job", "dos_job"],
        [static_job, non_scf_job, dos_job],
        param_defaults=default_job_params,
        param_swaps=job_params,
        decorators=job_decorators,
    )

    static_results = static_job_(atoms)
    non_scf_results = non_scf_job_(atoms, prev_outdir=static_results["dir_name"])
    dos_results = dos_job_(prev_outdir=static_results["dir_name"])

    return {
        "static_job": static_results,
        "non_scf_job": non_scf_results,
        "dos_job": dos_results,
    }

dos_job

dos_job(
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    parallel_info: dict[str] | None = None,
    test_run: bool = False,
    **calc_kwargs
) -> RunSchema

Function to carry out a basic dos.x calculation (density of states). It is mainly used to extract the charge density and wavefunction from a previous pw.x calculation. It generates the total density of states. For more details, please see https://www.quantum-espresso.org/Doc/INPUT_DOS.html

Parameters:

  • copy_files (SourceDirectory | list[SourceDirectory] | dict[SourceDirectory, Filenames] | None, default: None ) –

    Source directory or directories to copy files from. If a SourceDirectory or a list of SourceDirectory is provided, this interface will automatically guess which files have to be copied over by looking at the binary and input_data. If a dict is provided, the mode is manual, keys are source directories and values are relative path to files or directories to copy. Glob patterns are supported.

  • prev_outdir (SourceDirectory | None, default: None ) –

    The output directory of a previous calculation. If provided, Quantum Espresso will directly read the necessary files from this directory, eliminating the need to manually copy files. The directory will be ungzipped if necessary.

  • parallel_info (dict[str] | None, default: None ) –

    Dictionary containing information about the parallelization of the calculation. See the ASE documentation for more information.

  • **calc_kwargs

    Additional keyword arguments to pass to the Espresso calculator. Set a value to quacc.Remove to remove a pre-existing key entirely. See the docstring of ase.io.espresso.write_fortran_namelist for more information.

Returns:

Source code in quacc/recipes/espresso/dos.py
@job
def dos_job(
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    parallel_info: dict[str] | None = None,
    test_run: bool = False,
    **calc_kwargs,
) -> RunSchema:
    """
    Function to carry out a basic dos.x calculation (density of states).
    It is mainly used to extract the charge density and wavefunction from a previous pw.x calculation.
    It generates the total density of states. For more details, please see
    https://www.quantum-espresso.org/Doc/INPUT_DOS.html

    Parameters
    ----------
    copy_files
        Source directory or directories to copy files from. If a `SourceDirectory` or a
        list of `SourceDirectory` is provided, this interface will automatically guess
        which files have to be copied over by looking at the binary and `input_data`.
        If a dict is provided, the mode is manual, keys are source directories and values
        are relative path to files or directories to copy. Glob patterns are supported.
    prev_outdir
        The output directory of a previous calculation. If provided, Quantum Espresso
        will directly read the necessary files from this directory, eliminating the need
        to manually copy files. The directory will be ungzipped if necessary.
    parallel_info
        Dictionary containing information about the parallelization of the
        calculation. See the ASE documentation for more information.
    **calc_kwargs
        Additional keyword arguments to pass to the Espresso calculator. Set a value to
        `quacc.Remove` to remove a pre-existing key entirely. See the docstring of
        `ase.io.espresso.write_fortran_namelist` for more information.

    Returns
    -------
    RunSchema
        Dictionary of results from [quacc.schemas.ase.summarize_run][].
        See the type-hint for the data structure.
    """
    return run_and_summarize(
        template=EspressoTemplate("dos", test_run=test_run, outdir=prev_outdir),
        calc_defaults=None,
        calc_swaps=calc_kwargs,
        parallel_info=parallel_info,
        additional_fields={"name": "dos.x Density-of-States"},
        copy_files=copy_files,
    )

projwfc_flow

projwfc_flow(
    atoms: Atoms,
    job_decorators: (
        dict[str, Callable | None] | None
    ) = None,
    job_params: dict[str, Any] | None = None,
) -> ProjwfcSchema

This function performs a projwfc calculation.

Consists of following jobs that can be modified:

  1. pw.x static

  2. pw.x non self-consistent

  3. projwfc.x job

Parameters:

  • atoms (Atoms) –

    Atoms object

  • job_params (dict[str, Any] | None, default: None ) –

    Custom parameters to pass to each Job in the Flow. This is a dictionary where the keys are the names of the jobs and the values are dictionaries of parameters.

  • job_decorators (dict[str, Callable | None] | None, default: None ) –

    Custom decorators to apply to each Job in the Flow. This is a dictionary where the keys are the names of the jobs and the values are decorators.

Returns:

Source code in quacc/recipes/espresso/dos.py
@flow
def projwfc_flow(
    atoms: Atoms,
    job_decorators: dict[str, Callable | None] | None = None,
    job_params: dict[str, Any] | None = None,
) -> ProjwfcSchema:
    """
    This function performs a projwfc calculation.

    Consists of following jobs that can be modified:

    1. pw.x static
        - name: "static_job"
        - job: [quacc.recipes.espresso.core.static_job][]

    2. pw.x non self-consistent
        - name: "non_scf_job"
        - job: [quacc.recipes.espresso.core.non_scf_job][]

    3. projwfc.x job
        - name: "projwfc_job"
        - job: [quacc.recipes.espresso.dos.projwfc_job][]

    Parameters
    ----------
    atoms
        Atoms object
    job_params
        Custom parameters to pass to each Job in the Flow. This is a dictionary where
        the keys are the names of the jobs and the values are dictionaries of parameters.
    job_decorators
        Custom decorators to apply to each Job in the Flow. This is a dictionary where
        the keys are the names of the jobs and the values are decorators.

    Returns
    -------
    ProjwfcSchema
        Dictionary of results from [quacc.schemas.ase.summarize_run][].
        See the type-hint for the data structure.
    """
    default_job_params = {
        "static_job": {
            "kspacing": 0.2,
            "input_data": {"system": {"occupations": "tetrahedra"}},
        },
        "non_scf_job": recursive_dict_merge(
            job_params.get("static_job"),
            {
                "kspacing": 0.01,
                "input_data": {
                    "control": {"calculation": "nscf", "verbosity": "high"},
                    "system": {"occupations": "tetrahedra"},
                },
            },
        ),
    }
    static_job_, non_scf_job_, projwfc_job_ = customize_funcs(
        ["static_job", "non_scf_job", "projwfc_job"],
        [static_job, non_scf_job, projwfc_job],
        param_defaults=default_job_params,
        param_swaps=job_params,
        decorators=job_decorators,
    )

    static_results = static_job_(atoms)
    non_scf_results = non_scf_job_(atoms, prev_outdir=static_results["dir_name"])
    projwfc_results = projwfc_job_(prev_outdir=static_results["dir_name"])

    return {
        "static_job": static_results,
        "non_scf_job": non_scf_results,
        "projwfc_job": projwfc_results,
    }

projwfc_job

projwfc_job(
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    parallel_info: dict[str] | None = None,
    test_run: bool = False,
    **calc_kwargs
) -> RunSchema

Function to carry out a basic projwfc.x calculation. It is mainly used to extract the charge density and wavefunction from a previous pw.x calculation. It can generate partial dos, local dos, spilling parameter and more. Fore more details please see https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html

Parameters:

  • copy_files (SourceDirectory | list[SourceDirectory] | dict[SourceDirectory, Filenames] | None, default: None ) –

    Source directory or directories to copy files from. If a SourceDirectory or a list of SourceDirectory is provided, this interface will automatically guess which files have to be copied over by looking at the binary and input_data. If a dict is provided, the mode is manual, keys are source directories and values are relative path to files or directories to copy. Glob patterns are supported.

  • prev_outdir (SourceDirectory | None, default: None ) –

    The output directory of a previous calculation. If provided, Quantum Espresso will directly read the necessary files from this directory, eliminating the need to manually copy files. The directory will be ungzipped if necessary.

  • parallel_info (dict[str] | None, default: None ) –

    Dictionary containing information about the parallelization of the calculation. See the ASE documentation for more information.

  • **calc_kwargs

    Additional keyword arguments to pass to the Espresso calculator. Set a value to quacc.Remove to remove a pre-existing key entirely. See the docstring of ase.io.espresso.write_fortran_namelist for more information.

Returns:

Source code in quacc/recipes/espresso/dos.py
@job
def projwfc_job(
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    parallel_info: dict[str] | None = None,
    test_run: bool = False,
    **calc_kwargs,
) -> RunSchema:
    """
    Function to carry out a basic projwfc.x calculation.
    It is mainly used to extract the charge density and wavefunction from a previous pw.x calculation.
    It can generate partial dos, local dos, spilling parameter and more. Fore more details please see
    https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html

    Parameters
    ----------
    copy_files
        Source directory or directories to copy files from. If a `SourceDirectory` or a
        list of `SourceDirectory` is provided, this interface will automatically guess
        which files have to be copied over by looking at the binary and `input_data`.
        If a dict is provided, the mode is manual, keys are source directories and values
        are relative path to files or directories to copy. Glob patterns are supported.
    prev_outdir
        The output directory of a previous calculation. If provided, Quantum Espresso
        will directly read the necessary files from this directory, eliminating the need
        to manually copy files. The directory will be ungzipped if necessary.
    parallel_info
        Dictionary containing information about the parallelization of the
        calculation. See the ASE documentation for more information.
    **calc_kwargs
        Additional keyword arguments to pass to the Espresso calculator. Set a value to
        `quacc.Remove` to remove a pre-existing key entirely. See the docstring of
        `ase.io.espresso.write_fortran_namelist` for more information.

    Returns
    -------
    RunSchema
        Dictionary of results from [quacc.schemas.ase.summarize_run][].
        See the type-hint for the data structure.
    """
    return run_and_summarize(
        template=EspressoTemplate("projwfc", test_run=test_run, outdir=prev_outdir),
        calc_defaults=None,
        calc_swaps=calc_kwargs,
        parallel_info=parallel_info,
        additional_fields={"name": "projwfc.x Projects-wavefunctions"},
        copy_files=copy_files,
    )