Skip to content

core

Core recipes for espresso.

BASE_SET_METAL module-attribute

BASE_SET_METAL = {
    "input_data": {
        "system": {
            "occupations": "smearing",
            "smearing": "cold",
            "degauss": 0.01,
        },
        "electrons": {
            "conv_thr": 1e-08,
            "mixing_mode": "local-TF",
            "mixing_beta": 0.35,
        },
    },
    "kspacing": 0.033,
}

BASE_SET_NON_METAL module-attribute

BASE_SET_NON_METAL = {
    "input_data": {
        "system": {
            "occupations": "smearing",
            "smearing": "gaussian",
            "degauss": 0.005,
        },
        "electrons": {
            "conv_thr": 1e-08,
            "mixing_mode": "local-TF",
            "mixing_beta": 0.35,
        },
    },
    "kspacing": 0.045,
}

ase_relax_job

ase_relax_job(
    atoms: Atoms,
    preset: str | None = "sssp_1.3.0_pbe_efficiency",
    autorestart: bool = True,
    relax_cell: bool = False,
    parallel_info: dict[str] | None = None,
    opt_params: OptParams | None = None,
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    **calc_kwargs
) -> RunSchema

Function to carry out a structure relaxation with pw.x using ASE external optimizers.

Parameters:

  • atoms (Atoms) –

    The Atoms object.

  • preset (str | None, default: 'sssp_1.3.0_pbe_efficiency' ) –

    The name of a YAML file containing a list of parameters to use as a "preset" for the calculator. quacc will automatically look in the ESPRESSO_PRESET_DIR (default: quacc/calculators/espresso/presets).

  • autorestart (bool, default: True ) –

    Whether to automatically turn on the restart flag after the first calculation. This avoids recomputing everything from scratch at each step of the optimization.

  • relax_cell (bool, default: False ) –

    Whether to relax the cell or not.

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

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

  • opt_params (OptParams | None, default: None ) –

    Dictionary of custom kwargs for the optimization process. For a list of available keys, refer to quacc.runners.ase.run_opt.

  • 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.

  • **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 quacc.calculators.espresso.espresso.Espresso for more information.

Returns:

Source code in quacc/recipes/espresso/core.py
@job
def ase_relax_job(
    atoms: Atoms,
    preset: str | None = "sssp_1.3.0_pbe_efficiency",
    autorestart: bool = True,
    relax_cell: bool = False,
    parallel_info: dict[str] | None = None,
    opt_params: OptParams | None = None,
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    **calc_kwargs,
) -> RunSchema:
    """
    Function to carry out a structure relaxation with pw.x using ASE
    external optimizers.

    Parameters
    ----------
    atoms
        The Atoms object.
    preset
        The name of a YAML file containing a list of parameters to use as
        a "preset" for the calculator. quacc will automatically look in the
        `ESPRESSO_PRESET_DIR` (default: quacc/calculators/espresso/presets).
    autorestart
        Whether to automatically turn on the restart flag after the first
        calculation. This avoids recomputing everything from scratch at each
        step of the optimization.
    relax_cell
        Whether to relax the cell or not.
    parallel_info
        Dictionary containing information about the parallelization of the
        calculation. See the ASE documentation for more information.
    opt_params
        Dictionary of custom kwargs for the optimization process. For a list
        of available keys, refer to [quacc.runners.ase.run_opt][].
    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.
    **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
        [quacc.calculators.espresso.espresso.Espresso][] for more information.

    Returns
    -------
    RunSchema
        Dictionary of results from [quacc.schemas.ase.summarize_run][].
        See the type-hint for the data structure.
    """
    is_metal = check_is_metal(atoms)

    calc_defaults = BASE_SET_METAL if is_metal else BASE_SET_NON_METAL
    calc_defaults["input_data"]["control"] = {
        "calculation": "scf",
        "tstress": relax_cell,
        "tprnfor": True,
    }

    opt_defaults = {"optimizer": BFGSLineSearch, "relax_cell": relax_cell}

    return run_and_summarize_opt(
        atoms,
        preset=preset,
        template=EspressoTemplate("pw", autorestart=autorestart, outdir=prev_outdir),
        calc_defaults=calc_defaults,
        calc_swaps=calc_kwargs,
        opt_defaults=opt_defaults,
        opt_params=opt_params,
        parallel_info=parallel_info,
        additional_fields={"name": "pw.x ExternalRelax"},
        copy_files=copy_files,
    )

non_scf_job

non_scf_job(
    atoms: Atoms,
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    preset: str | None = "sssp_1.3.0_pbe_efficiency",
    parallel_info: dict[str] | None = None,
    test_run: bool = False,
    **calc_kwargs
) -> RunSchema

Function to carry out a basic NSCF calculation with pw.x.

Parameters:

  • atoms (Atoms) –

    The Atoms object.

  • 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.

  • preset (str | None, default: 'sssp_1.3.0_pbe_efficiency' ) –

    The name of a YAML file containing a list of parameters to use as a "preset" for the calculator. quacc will automatically look in the ESPRESSO_PRESET_DIR (default: quacc/calculators/espresso/presets).

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

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

  • test_run (bool, default: False ) –

    If True, a test run is performed to check that the calculation input_data is correct or to generate some files/info if needed.

  • **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 quacc.calculators.espresso.espresso.Espresso for more information.

Returns:

Source code in quacc/recipes/espresso/core.py
@job
def non_scf_job(
    atoms: Atoms,
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    preset: str | None = "sssp_1.3.0_pbe_efficiency",
    parallel_info: dict[str] | None = None,
    test_run: bool = False,
    **calc_kwargs,
) -> RunSchema:
    """
    Function to carry out a basic NSCF calculation with pw.x.

    Parameters
    ----------
    atoms
        The Atoms object.
    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.
    preset
        The name of a YAML file containing a list of parameters to use as
        a "preset" for the calculator. quacc will automatically look in the
        `ESPRESSO_PRESET_DIR` (default: quacc/calculators/espresso/presets).
    parallel_info
        Dictionary containing information about the parallelization of the
        calculation. See the ASE documentation for more information.
    test_run
        If True, a test run is performed to check that the calculation input_data is correct or
        to generate some files/info if needed.
    **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
        [quacc.calculators.espresso.espresso.Espresso][] for more information.

    Returns
    -------
    RunSchema
        Dictionary of results from [quacc.schemas.ase.summarize_run][].
        See the type-hint for the data structure.
    """
    calc_defaults = {"input_data": {"control": {"calculation": "nscf"}}}

    return run_and_summarize(
        atoms,
        preset=preset,
        template=EspressoTemplate("pw", test_run=test_run, outdir=prev_outdir),
        calc_defaults=calc_defaults,
        calc_swaps=calc_kwargs,
        parallel_info=parallel_info,
        additional_fields={"name": "pw.x Non SCF"},
        copy_files=copy_files,
    )

post_processing_job

post_processing_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 pp.x calculation (post-processing). It is mainly used to extract the charge density from a previous pw.x calculation. and perform simple to complex post-processing on it. Fore more details please see https://www.quantum-espresso.org/Doc/INPUT_PP.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 quacc.calculators.espresso.espresso.Espresso for more information.

Returns:

Source code in quacc/recipes/espresso/core.py
@job
def post_processing_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 pp.x calculation (post-processing).
    It is mainly used to extract the charge density from a previous pw.x calculation.
    and perform simple to complex post-processing on it. Fore more details please see
    https://www.quantum-espresso.org/Doc/INPUT_PP.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
        [quacc.calculators.espresso.espresso.Espresso][] for more information.

    Returns
    -------
    RunSchema
        Dictionary of results from [quacc.schemas.ase.summarize_run][].
        See the type-hint for the data structure.
    """
    calc_defaults = {
        "input_data": {
            "inputpp": {"plot_num": 0},
            "plot": {
                "iflag": 3,
                "output_format": 6,
                "fileout": "pseudo_charge_density.cube",
            },
        }
    }

    return run_and_summarize(
        template=EspressoTemplate("pp", test_run=test_run, outdir=prev_outdir),
        calc_defaults=calc_defaults,
        calc_swaps=calc_kwargs,
        parallel_info=parallel_info,
        additional_fields={"name": "pp.x post-processing"},
        copy_files=copy_files,
    )

relax_job

relax_job(
    atoms: Atoms,
    preset: str | None = "sssp_1.3.0_pbe_efficiency",
    relax_cell: bool = False,
    parallel_info: dict[str] | None = None,
    test_run: bool = False,
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    **calc_kwargs
) -> RunSchema

Function to carry out a structure relaxation with pw.x.

Parameters:

  • atoms (Atoms) –

    The Atoms object.

  • preset (str | None, default: 'sssp_1.3.0_pbe_efficiency' ) –

    The name of a YAML file containing a list of parameters to use as a "preset" for the calculator. quacc will automatically look in the ESPRESSO_PRESET_DIR (default: quacc/calculators/espresso/presets).

  • relax_cell (bool, default: False ) –

    Whether to relax the cell or not.

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

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

  • test_run (bool, default: False ) –

    If True, a test run is performed to check that the calculation input_data is correct or to generate some files/info if needed.

  • 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.

  • **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 quacc.calculators.espresso.espresso.Espresso for more information.

Returns:

Source code in quacc/recipes/espresso/core.py
@job
def relax_job(
    atoms: Atoms,
    preset: str | None = "sssp_1.3.0_pbe_efficiency",
    relax_cell: bool = False,
    parallel_info: dict[str] | None = None,
    test_run: bool = False,
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    **calc_kwargs,
) -> RunSchema:
    """
    Function to carry out a structure relaxation with pw.x.

    Parameters
    ----------
    atoms
        The Atoms object.
    preset
        The name of a YAML file containing a list of parameters to use as
        a "preset" for the calculator. quacc will automatically look in the
        `ESPRESSO_PRESET_DIR` (default: quacc/calculators/espresso/presets).
    relax_cell
        Whether to relax the cell or not.
    parallel_info
        Dictionary containing information about the parallelization of the
        calculation. See the ASE documentation for more information.
    test_run
        If True, a test run is performed to check that the calculation input_data is correct or
        to generate some files/info if needed.
    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.
    **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
        [quacc.calculators.espresso.espresso.Espresso][] for more information.

    Returns
    -------
    RunSchema
        Dictionary of results from [quacc.schemas.ase.summarize_run][].
        See the type-hint for the data structure.
    """
    is_metal = check_is_metal(atoms)

    calc_defaults = BASE_SET_METAL if is_metal else BASE_SET_NON_METAL
    calc_defaults["input_data"]["control"] = {
        "calculation": "vc-relax" if relax_cell else "relax"
    }

    return run_and_summarize(
        atoms,
        preset=preset,
        template=EspressoTemplate("pw", test_run=test_run, outdir=prev_outdir),
        calc_defaults=calc_defaults,
        calc_swaps=calc_kwargs,
        parallel_info=parallel_info,
        additional_fields={"name": "pw.x Relax"},
        copy_files=copy_files,
    )

static_job

static_job(
    atoms: Atoms,
    preset: str | None = "sssp_1.3.0_pbe_efficiency",
    parallel_info: dict[str] | None = None,
    test_run: bool = False,
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    **calc_kwargs
) -> RunSchema

Function to carry out a basic SCF calculation with pw.x.

Parameters:

  • atoms (Atoms) –

    The Atoms object.

  • preset (str | None, default: 'sssp_1.3.0_pbe_efficiency' ) –

    The name of a YAML file containing a list of parameters to use as a "preset" for the calculator. quacc will automatically look in the ESPRESSO_PRESET_DIR (default: quacc/calculators/espresso/presets).

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

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

  • test_run (bool, default: False ) –

    If True, a test run is performed to check that the calculation input_data is correct or to generate some files/info if needed.

  • 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.

  • **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 quacc.calculators.espresso.espresso.Espresso for more information.

Returns:

Source code in quacc/recipes/espresso/core.py
@job
def static_job(
    atoms: Atoms,
    preset: str | None = "sssp_1.3.0_pbe_efficiency",
    parallel_info: dict[str] | None = None,
    test_run: bool = False,
    copy_files: (
        SourceDirectory
        | list[SourceDirectory]
        | dict[SourceDirectory, Filenames]
        | None
    ) = None,
    prev_outdir: SourceDirectory | None = None,
    **calc_kwargs,
) -> RunSchema:
    """
    Function to carry out a basic SCF calculation with pw.x.

    Parameters
    ----------
    atoms
        The Atoms object.
    preset
        The name of a YAML file containing a list of parameters to use as
        a "preset" for the calculator. quacc will automatically look in the
        `ESPRESSO_PRESET_DIR` (default: quacc/calculators/espresso/presets).
    parallel_info
        Dictionary containing information about the parallelization of the
        calculation. See the ASE documentation for more information.
    test_run
        If True, a test run is performed to check that the calculation input_data is correct or
        to generate some files/info if needed.
    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.
    **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
        [quacc.calculators.espresso.espresso.Espresso][] for more information.

    Returns
    -------
    RunSchema
        Dictionary of results from [quacc.schemas.ase.summarize_run][].
        See the type-hint for the data structure.
    """
    is_metal = check_is_metal(atoms)

    calc_defaults = BASE_SET_METAL if is_metal else BASE_SET_NON_METAL
    calc_defaults["input_data"]["control"] = {"calculation": "scf"}

    return run_and_summarize(
        atoms,
        preset=preset,
        template=EspressoTemplate("pw", test_run=test_run, outdir=prev_outdir),
        calc_defaults=calc_defaults,
        calc_swaps=calc_kwargs,
        parallel_info=parallel_info,
        additional_fields={"name": "pw.x Static"},
        copy_files=copy_files,
    )