Graphite c-axis PES scans with Quantum ESPRESSO

../_images/relative_energy_vs_interlayer_distance_20d4df76.png

Graphite interlayer binding curves from four density-functional setups.

Requires: AMS2026 or later

Related documentation

This report combines two non-optimizing PES scan segments per functional for graphite, scanning the c lattice parameter and plotting the relative energy against the interlayer distance c/2.

Conclusion

All curves are referenced to the energy at the longest sampled c value for each functional. The plot order is the reverse order of minimum energy so the legend follows the visible stacking order of the plotted curves.

Relative-energy plot

Relative energy versus interlayer distance

Summary table

Functional

Min at c/2 (A)

Min rel. energy (meV/atom)

Ref. point c/2 (A)

r2SCAN-D4 / Dojo

3.350000

-57.165492

8.000000

B86bPBE-XDM / pslibrary-PAW

3.350000

-53.810884

8.000000

r2SCAN / Dojo

3.550000

-20.923848

8.000000

PBE / pslibrary-PAW

4.250000

-1.820954

8.000000

Provenance

  • pbe_psl_paw_seg1: Short-range scan for PBE with pslibrary-PAW.

  • pbe_psl_paw_seg2: Long-range continuation for PBE with pslibrary-PAW.

  • b86bpbe_xdm_psl_paw_seg1: Short-range scan for B86bPBE with QE XDM dispersion and pslibrary-PAW.

  • b86bpbe_xdm_psl_paw_seg2: Long-range continuation for B86bPBE with QE XDM dispersion and pslibrary-PAW.

  • r2scan_dojo_seg1: Short-range scan for r2SCAN with Dojo pseudopotentials.

  • r2scan_dojo_seg2: Long-range continuation for r2SCAN with Dojo pseudopotentials.

  • r2scan_d4_dojo_seg1: Short-range scan for r2SCAN with Dojo pseudopotentials and the AMS D4 add-on.

  • r2scan_d4_dojo_seg2: Long-range continuation for r2SCAN with Dojo pseudopotentials and the AMS D4 add-on.

Calculation inputs

pbe_psl_paw_seg1

Reason: Short-range scan for PBE with pslibrary-PAW.

PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 6 9
    nPoints 31
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family pslibrary-PAW
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft pbe
    occupations Smearing
    smearing Gaussian
  End
EndEngine

pbe_psl_paw_seg2

Reason: Long-range continuation for PBE with pslibrary-PAW.

PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 9 16
    nPoints 15
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family pslibrary-PAW
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft pbe
    occupations Smearing
    smearing Gaussian
  End
EndEngine

b86bpbe_xdm_psl_paw_seg1

Reason: Short-range scan for B86bPBE with QE XDM dispersion and pslibrary-PAW.

PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 6 9
    nPoints 31
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family pslibrary-PAW
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft b86bpbe
    occupations Smearing
    smearing Gaussian
    vdw_corr XDM
  End
EndEngine

b86bpbe_xdm_psl_paw_seg2

Reason: Long-range continuation for B86bPBE with QE XDM dispersion and pslibrary-PAW.

PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 9 16
    nPoints 15
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family pslibrary-PAW
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft b86bpbe
    occupations Smearing
    smearing Gaussian
    vdw_corr XDM
  End
EndEngine

r2scan_dojo_seg1

Reason: Short-range scan for r2SCAN with Dojo pseudopotentials.

PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 6 9
    nPoints 31
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family Dojo
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft r2scan
    occupations Smearing
    smearing Gaussian
  End
EndEngine

r2scan_dojo_seg2

Reason: Long-range continuation for r2SCAN with Dojo pseudopotentials.

PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 9 16
    nPoints 15
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family Dojo
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft r2scan
    occupations Smearing
    smearing Gaussian
  End
EndEngine

r2scan_d4_dojo_seg1

Reason: Short-range scan for r2SCAN with Dojo pseudopotentials and the AMS D4 add-on.

EngineAddons
  D4Dispersion
    Enabled yes
    Functional R2SCAN
  End
End

PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 6 9
    nPoints 31
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family Dojo
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft r2scan
    occupations Smearing
    smearing Gaussian
  End
EndEngine

r2scan_d4_dojo_seg2

Reason: Long-range continuation for r2SCAN with Dojo pseudopotentials and the AMS D4 add-on.

EngineAddons
  D4Dispersion
    Enabled yes
    Functional R2SCAN
  End
End

PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 9 16
    nPoints 15
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family Dojo
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft r2scan
    occupations Smearing
    smearing Gaussian
  End
EndEngine

Prompts and Python scripts

Prompt (instruction for AI agent)
Use $ams2026

Run non-optimizing PES scans where the C coordinate is scaled (LatticeCRange)
from 6.0 to 9.0 in steps of 0.1 angstrom, and then another run where it is
continued from 9.0 to 16.0 in steps of 0.5 angstrom.

Initial graphite system:

```
System
   Atoms
      C 0 0 1.5
      C 0 0 4.5
      C 0 1.4202816622064793 1.5
      C 1.23 0.7101408311032397 4.5
   End
   Lattice
      2.46 0 0
      -1.23 2.130422493309719 0
      0 0 6
   End
End
```

Use QuantumESPRESSO with 12x12x4 k-points, gaussian smearing 0.001 Ry, energy
cutoff 100 Ry, density cutoff 1000 Ry.

Set `input_dft` explicitly.

Functionals:

- PBE with pslibrary-PAW
- BP86bPBE with pslibrary-PAW and XDM dispersion correction
- r2scan with Dojo
- r2scan with Dojo and D4 Engine addon dispersion correction.

In the report plot a figure with relative energy in meV/atom vs c/2 in angstrom
(c/2 = half c length, this is the interlayer graphite distance), where the
relative energy is energy relative to the energy of the longest c parameter. The
figure should have the plot for all tested functionals, and plot lines and small
points.

Plot the curves in the reverse order of minimum energy so that the order of the
colored lines in the legend matches the order in which they are shown in the
plot.
01-run.py
#!/usr/bin/env amspython
from __future__ import annotations

from dataclasses import dataclass

from scm.base import ChemicalSystem
from scm.input_classes import AMS
from scm.plams import AMSJob, Settings, config, init


SYSTEM_BLOCK = """
System
   Atoms
      C 0 0 1.5
      C 0 0 4.5
      C 0 1.4202816622064793 1.5
      C 1.23 0.7101408311032397 4.5
   End
   Lattice
      2.46 0 0
      -1.23 2.130422493309719 0
      0 0 6
   End
End
"""


@dataclass(frozen=True)
class FunctionalSpec:
    key: str
    label: str
    input_dft: str
    pp_family: str
    pp_functional: str
    qe_vdw_corr: str | None = None
    d4_functional: str | None = None


FUNCTIONALS: tuple[FunctionalSpec, ...] = (
    FunctionalSpec(
        key="pbe_psl_paw",
        label="PBE / pslibrary-PAW",
        input_dft="pbe",
        pp_family="pslibrary-PAW",
        pp_functional="PBE",
    ),
    FunctionalSpec(
        key="b86bpbe_xdm_psl_paw",
        label="B86bPBE-XDM / pslibrary-PAW",
        input_dft="b86bpbe",
        pp_family="pslibrary-PAW",
        pp_functional="PBE",
        qe_vdw_corr="XDM",
    ),
    FunctionalSpec(
        key="r2scan_dojo",
        label="r2SCAN / Dojo",
        input_dft="r2scan",
        pp_family="Dojo",
        pp_functional="PBE",
    ),
    FunctionalSpec(
        key="r2scan_d4_dojo",
        label="r2SCAN-D4 / Dojo",
        input_dft="r2scan",
        pp_family="Dojo",
        pp_functional="PBE",
        d4_functional="R2SCAN",
    ),
)


SCAN_SEGMENTS: tuple[tuple[str, float, float, float], ...] = (
    ("seg1", 6.0, 9.0, 0.1),
    ("seg2", 9.0, 16.0, 0.5),
)


def npoints(start: float, stop: float, step: float) -> int:
    return int(round((stop - start) / step)) + 1


def build_settings(spec: FunctionalSpec, c_start: float, c_stop: float, step: float) -> Settings:
    settings = Settings()
    settings.input.ams.Task = "PESScan"
    settings.input.ams.PESScan.Optimize = "No"
    settings.input.ams.PESScan.CalcPropertiesAtPESPoints = "No"
    settings.input.ams.PESScan.ScanCoordinate.nPoints = npoints(c_start, c_stop, step)
    settings.input.ams.PESScan.ScanCoordinate.LatticeCRange = f"{c_start:.10g} {c_stop:.10g}"

    settings.input.QuantumESPRESSO.Pseudopotentials.Family = spec.pp_family
    settings.input.QuantumESPRESSO.Pseudopotentials.Functional = spec.pp_functional
    settings.input.QuantumESPRESSO.System.input_dft = spec.input_dft
    settings.input.QuantumESPRESSO.System.occupations = "Smearing"
    settings.input.QuantumESPRESSO.System.smearing = "Gaussian"
    settings.input.QuantumESPRESSO.System.degauss = 0.001
    settings.input.QuantumESPRESSO.System.ecutwfc = 100.0
    settings.input.QuantumESPRESSO.System.ecutrho = 1000.0
    if spec.qe_vdw_corr is not None:
        settings.input.QuantumESPRESSO.System.vdw_corr = spec.qe_vdw_corr

    settings.input.QuantumESPRESSO.K_Points._h = "automatic"
    settings.input.QuantumESPRESSO.K_Points._1 = "12 12 4 0 0 0"

    if spec.d4_functional is not None:
        settings.input.ams.EngineAddons.D4Dispersion.Enabled = "Yes"
        settings.input.ams.EngineAddons.D4Dispersion.Functional = spec.d4_functional

    AMS.from_settings(settings)
    return settings


def main() -> None:
    init(folder="01-run_workdir")
    config.log.stdout = 1

    system = ChemicalSystem(SYSTEM_BLOCK)

    for spec in FUNCTIONALS:
        for segment_name, c_start, c_stop, step in SCAN_SEGMENTS:
            job_name = f"{spec.key}_{segment_name}"
            settings = build_settings(spec, c_start, c_stop, step)
            job = AMSJob(molecule=system, settings=settings, name=job_name)
            print(f"Running {job_name}: {spec.label}, c = {c_start} -> {c_stop} A, step {step} A")
            result = job.run()
            if not result.ok():
                raise RuntimeError(f"Job failed: {job_name}")


if __name__ == "__main__":
    main()
report.py
#!/usr/bin/env amspython
from __future__ import annotations

from dataclasses import dataclass
from pathlib import Path
import shutil

import matplotlib.pyplot as plt
import pandas as pd

from scm.base import Units
from scm.plams import AMSJob


ROOT = Path(__file__).resolve().parent
WORKDIR = ROOT / "01-run_workdir"
REPORT_MD = ROOT / "report.md"
REPORT_BK = ROOT / "report.md.bk"
PLOT_PNG = ROOT / "relative_energy_vs_interlayer_distance.png"

N_ATOMS = 4
HARTREE_TO_MEV = Units.conversion_factor("hartree", "eV") * 1000.0


@dataclass(frozen=True)
class JobRef:
    name: str
    label: str
    justification: str


JOB_REFS: tuple[JobRef, ...] = (
    JobRef("pbe_psl_paw_seg1", "PBE / pslibrary-PAW, 6.0-9.0 A", "Short-range scan for PBE with pslibrary-PAW."),
    JobRef("pbe_psl_paw_seg2", "PBE / pslibrary-PAW, 9.0-16.0 A", "Long-range continuation for PBE with pslibrary-PAW."),
    JobRef(
        "b86bpbe_xdm_psl_paw_seg1",
        "B86bPBE-XDM / pslibrary-PAW, 6.0-9.0 A",
        "Short-range scan for B86bPBE with QE XDM dispersion and pslibrary-PAW.",
    ),
    JobRef(
        "b86bpbe_xdm_psl_paw_seg2",
        "B86bPBE-XDM / pslibrary-PAW, 9.0-16.0 A",
        "Long-range continuation for B86bPBE with QE XDM dispersion and pslibrary-PAW.",
    ),
    JobRef("r2scan_dojo_seg1", "r2SCAN / Dojo, 6.0-9.0 A", "Short-range scan for r2SCAN with Dojo pseudopotentials."),
    JobRef("r2scan_dojo_seg2", "r2SCAN / Dojo, 9.0-16.0 A", "Long-range continuation for r2SCAN with Dojo pseudopotentials."),
    JobRef(
        "r2scan_d4_dojo_seg1",
        "r2SCAN-D4 / Dojo, 6.0-9.0 A",
        "Short-range scan for r2SCAN with Dojo pseudopotentials and the AMS D4 add-on.",
    ),
    JobRef(
        "r2scan_d4_dojo_seg2",
        "r2SCAN-D4 / Dojo, 9.0-16.0 A",
        "Long-range continuation for r2SCAN with Dojo pseudopotentials and the AMS D4 add-on.",
    ),
)


def load_job(job_name: str) -> AMSJob:
    return AMSJob.load_external(WORKDIR / job_name)


def build_curve(job_names: tuple[str, str], label: str) -> pd.DataFrame:
    frames: list[pd.DataFrame] = []
    for job_name in job_names:
        job = load_job(job_name)
        pes = job.results.get_pesscan_results(molecules=False)
        c_index = pes["RaveledScanCoords"].index("c")
        c_unit = pes["RaveledUnits"][c_index]
        c_conversion = Units.conversion_factor(c_unit, "angstrom")
        c_values = pd.Series(pes["RaveledPESCoords"][c_index], dtype=float) * c_conversion
        energies = pd.Series(pes["PES"], dtype=float)
        frames.append(pd.DataFrame({"c_angstrom": c_values, "energy_hartree": energies}))

    curve = pd.concat(frames, ignore_index=True)
    curve = curve.drop_duplicates(subset="c_angstrom", keep="first").sort_values("c_angstrom").reset_index(drop=True)
    reference_energy = curve.loc[curve["c_angstrom"].idxmax(), "energy_hartree"]
    curve["c_over_2_angstrom"] = curve["c_angstrom"] / 2.0
    curve["relative_mev_per_atom"] = (curve["energy_hartree"] - reference_energy) * HARTREE_TO_MEV / N_ATOMS
    curve["functional"] = label
    curve["minimum_relative_mev_per_atom"] = curve["relative_mev_per_atom"].min()
    return curve


def plot_curves(curves: list[pd.DataFrame]) -> None:
    curves_to_plot = sorted(curves, key=lambda df: float(df["minimum_relative_mev_per_atom"].iloc[0]), reverse=True)

    plt.figure(figsize=(7.2, 4.8))
    for curve in curves_to_plot:
        label = str(curve["functional"].iloc[0])
        plt.plot(
            curve["c_over_2_angstrom"],
            curve["relative_mev_per_atom"],
            marker="o",
            markersize=3,
            linewidth=1.4,
            label=label,
        )

    plt.xlabel("c/2 (angstrom)")
    plt.ylabel("Relative energy (meV/atom)")
    plt.legend(frameon=False)
    plt.tight_layout()
    plt.savefig(PLOT_PNG, dpi=200)
    plt.close()


def build_summary_table(curves: list[pd.DataFrame]) -> pd.DataFrame:
    rows: list[dict[str, float | str]] = []
    for curve in curves:
        minimum_row = curve.loc[curve["relative_mev_per_atom"].idxmin()]
        rows.append(
            {
                "Functional": str(curve["functional"].iloc[0]),
                "Min at c/2 (A)": float(minimum_row["c_over_2_angstrom"]),
                "Min rel. energy (meV/atom)": float(minimum_row["relative_mev_per_atom"]),
                "Ref. point c/2 (A)": float(curve["c_over_2_angstrom"].max()),
            }
        )
    table = pd.DataFrame(rows)
    return table.sort_values("Min rel. energy (meV/atom)").reset_index(drop=True)


def render_report(curves: list[pd.DataFrame]) -> None:
    if REPORT_MD.exists():
        shutil.copy2(REPORT_MD, REPORT_BK)

    summary_table = build_summary_table(curves)
    provenance_lines: list[str] = []
    input_sections: list[str] = []

    for job_ref in JOB_REFS:
        job = load_job(job_ref.name)
        provenance_lines.append(f"- `{job_ref.name}`: {job_ref.justification}")
        input_sections.append(f"### `{job_ref.name}`\n\nReason: {job_ref.justification}\n\n```text\n{job.get_input().strip()}\n```")

    report_text = "\n".join(
        [
            "# Graphite c-axis PES scans with QuantumESPRESSO",
            "",
            "This report combines two non-optimizing PES scan segments per functional for graphite, scanning the c lattice parameter and plotting the relative energy against the interlayer distance c/2.",
            "",
            "## Conclusion",
            "",
            "All curves are referenced to the energy at the longest sampled c value for each functional. The plot order is the reverse order of minimum energy so the legend follows the visible stacking order of the plotted curves.",
            "",
            "## Relative-energy plot",
            "",
            f"![Relative energy versus interlayer distance]({PLOT_PNG.name})",
            "",
            "## Summary table",
            "",
            summary_table.to_markdown(index=False, floatfmt=".6f"),
            "",
            "## Provenance",
            "",
            *provenance_lines,
            "",
            "## Calculation inputs",
            "",
            *input_sections,
            "",
        ]
    )

    REPORT_MD.write_text(report_text)


def main() -> None:
    curves = [
        build_curve(("pbe_psl_paw_seg1", "pbe_psl_paw_seg2"), "PBE / pslibrary-PAW"),
        build_curve(("b86bpbe_xdm_psl_paw_seg1", "b86bpbe_xdm_psl_paw_seg2"), "B86bPBE-XDM / pslibrary-PAW"),
        build_curve(("r2scan_dojo_seg1", "r2scan_dojo_seg2"), "r2SCAN / Dojo"),
        build_curve(("r2scan_d4_dojo_seg1", "r2scan_d4_dojo_seg2"), "r2SCAN-D4 / Dojo"),
    ]
    plot_curves(curves)
    render_report(curves)


if __name__ == "__main__":
    main()
Original Markdown report
# Graphite c-axis PES scans with QuantumESPRESSO

This report combines two non-optimizing PES scan segments per functional for graphite, scanning the c lattice parameter and plotting the relative energy against the interlayer distance c/2.

## Conclusion

All curves are referenced to the energy at the longest sampled c value for each functional. The plot order is the reverse order of minimum energy so the legend follows the visible stacking order of the plotted curves.

## Relative-energy plot

![Relative energy versus interlayer distance](relative_energy_vs_interlayer_distance.png)

## Summary table

| Functional                  |   Min at c/2 (A) |   Min rel. energy (meV/atom) |   Ref. point c/2 (A) |
|:----------------------------|-----------------:|-----------------------------:|---------------------:|
| r2SCAN-D4 / Dojo            |         3.350000 |                   -57.165492 |             8.000000 |
| B86bPBE-XDM / pslibrary-PAW |         3.350000 |                   -53.810884 |             8.000000 |
| r2SCAN / Dojo               |         3.550000 |                   -20.923848 |             8.000000 |
| PBE / pslibrary-PAW         |         4.250000 |                    -1.820954 |             8.000000 |

## Provenance

- `pbe_psl_paw_seg1`: Short-range scan for PBE with pslibrary-PAW.
- `pbe_psl_paw_seg2`: Long-range continuation for PBE with pslibrary-PAW.
- `b86bpbe_xdm_psl_paw_seg1`: Short-range scan for B86bPBE with QE XDM dispersion and pslibrary-PAW.
- `b86bpbe_xdm_psl_paw_seg2`: Long-range continuation for B86bPBE with QE XDM dispersion and pslibrary-PAW.
- `r2scan_dojo_seg1`: Short-range scan for r2SCAN with Dojo pseudopotentials.
- `r2scan_dojo_seg2`: Long-range continuation for r2SCAN with Dojo pseudopotentials.
- `r2scan_d4_dojo_seg1`: Short-range scan for r2SCAN with Dojo pseudopotentials and the AMS D4 add-on.
- `r2scan_d4_dojo_seg2`: Long-range continuation for r2SCAN with Dojo pseudopotentials and the AMS D4 add-on.

## Calculation inputs

### `pbe_psl_paw_seg1`

Reason: Short-range scan for PBE with pslibrary-PAW.

```ams
PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 6 9
    nPoints 31
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family pslibrary-PAW
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft pbe
    occupations Smearing
    smearing Gaussian
  End
EndEngine
```
### `pbe_psl_paw_seg2`

Reason: Long-range continuation for PBE with pslibrary-PAW.

```ams
PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 9 16
    nPoints 15
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family pslibrary-PAW
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft pbe
    occupations Smearing
    smearing Gaussian
  End
EndEngine
```
### `b86bpbe_xdm_psl_paw_seg1`

Reason: Short-range scan for B86bPBE with QE XDM dispersion and pslibrary-PAW.

```ams
PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 6 9
    nPoints 31
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family pslibrary-PAW
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft b86bpbe
    occupations Smearing
    smearing Gaussian
    vdw_corr XDM
  End
EndEngine
```
### `b86bpbe_xdm_psl_paw_seg2`

Reason: Long-range continuation for B86bPBE with QE XDM dispersion and pslibrary-PAW.

```ams
PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 9 16
    nPoints 15
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family pslibrary-PAW
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft b86bpbe
    occupations Smearing
    smearing Gaussian
    vdw_corr XDM
  End
EndEngine
```
### `r2scan_dojo_seg1`

Reason: Short-range scan for r2SCAN with Dojo pseudopotentials.

```ams
PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 6 9
    nPoints 31
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family Dojo
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft r2scan
    occupations Smearing
    smearing Gaussian
  End
EndEngine
```
### `r2scan_dojo_seg2`

Reason: Long-range continuation for r2SCAN with Dojo pseudopotentials.

```ams
PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 9 16
    nPoints 15
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family Dojo
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft r2scan
    occupations Smearing
    smearing Gaussian
  End
EndEngine
```
### `r2scan_d4_dojo_seg1`

Reason: Short-range scan for r2SCAN with Dojo pseudopotentials and the AMS D4 add-on.

```ams
EngineAddons
  D4Dispersion
    Enabled yes
    Functional R2SCAN
  End
End

PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 6 9
    nPoints 31
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family Dojo
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft r2scan
    occupations Smearing
    smearing Gaussian
  End
EndEngine
```
### `r2scan_d4_dojo_seg2`

Reason: Long-range continuation for r2SCAN with Dojo pseudopotentials and the AMS D4 add-on.

```ams
EngineAddons
  D4Dispersion
    Enabled yes
    Functional R2SCAN
  End
End

PESScan
  CalcPropertiesAtPESPoints no
  Optimize no
  ScanCoordinate
    LatticeCRange 9 16
    nPoints 15
  End
End

Task PESScan

System
  Atoms
              C       0.0000000000       0.0000000000       1.5000000000
              C       0.0000000000       0.0000000000       4.5000000000
              C       0.0000000000       1.4202816622       1.5000000000
              C       1.2300000000       0.7101408311       4.5000000000
  End
  Lattice
         2.4600000000     0.0000000000     0.0000000000
        -1.2300000000     2.1304224933     0.0000000000
         0.0000000000     0.0000000000     6.0000000000
  End
End

Engine QuantumESPRESSO
  K_Points automatic
     12 12 4 0 0 0
  End
  Pseudopotentials
    Family Dojo
    Functional PBE
  End
  System
    degauss 0.001
    ecutrho 1000.0
    ecutwfc 100.0
    input_dft r2scan
    occupations Smearing
    smearing Gaussian
  End
EndEngine
```