How to apply corrections to SCAN energy calculations?

Hello all, I am currently calculating the decomposition energy using the code below. At the moment, I am simply using the suggested decomposition fraction and I input self-calculated, uncorrected SCAN energies to obtain the decomposition energy. I understand that this is not necessarily correct, and I’d like to know to what extent if someone with more experience could share their insight.

I have two questions:

  1. Where can I look for the parameters used for the R2SCAN calculations/the INCAR file format? I have checked the R2SCAN calculation parameters site, but the github page is deprecated.
  2. How do I apply the R2SCAN/SCAN correcting scheme to the Python code below so that I’d only need to input the target structure’s energies?

I’d appreciate some suggestions. Thank you for your time!

!pip install pymatgen
from pymatgen.ext.matproj import MPRester
from pymatgen.analysis.phase_diagram import PhaseDiagram, PDPlotter, PDEntry
from pymatgen.entries.computed_entries import ComputedEntry # Import ComputedEntry
from pymatgen.core import Composition # Import Composition

# Set your API key
api_key = "G6pdzeKR62X3CIJvfqRbNyAzZUStiYOI"
m = MPRester(api_key)

entries = m.get_entries_in_chemsys(["La", "Ti", "O", "N"])

my_entry = ComputedEntry(Composition("LaTiO2N"), -18.83607524)
entries.append(my_entry)

decomp, e_above_hull = pd.get_decomp_and_e_above_hull(my_entry)

if e_above_hull == 0:
    print(f"{my_entry.composition.reduced_formula} is stable on the convex hull.")
else:
    print(f"{my_entry.composition.reduced_formula} is metastable with an energy above the hull of {e_above_hull:.4f} eV/atom.")
    print("It decomposes into:")
    for comp, frac in decomp.items():
        print(f"  - {comp.composition.reduced_formula}: {frac:.4f}")

# Build the phase diagram
pd = PhaseDiagram(entries)
plotter = PDPlotter(pd)
plotter.show()

Hey @rputra17, first thing: please treat your API key like a password and don’t share it. You can regenerate an API key on the website. If that’s not working, let me know

  1. Thanks for finding the broken link in the docs, that’s been fixed! For compatibility with current MP r2SCAN data, use the MPScanRelaxSet for relaxations, and MPScanStaticSet for single points / statics

  2. We don’t apply corrections to r2SCAN or SCAN data (these are separate functionals, keep that in mind too - only r2SCAN data is used in the MP hull). However we do adjust r2SCAN energies to merge the r2SCAN and PBE GGA hulls using the MaterialsProject2020Compatibility compatibility scheme

1 Like

Dear @Aaron_Kaplan,

Right, thank you for the warning! I’ll regenerate it as soon as I can.

  1. Thank you for fixing the links! I found the MPScanRelaxSet.yaml, but I didn’t find the MPScanStaticSet, only MatPESStaticSet.yaml. Is that the one to use, but I replace/adjust the inputs for an R2SCAN run? Also, the yaml file shows the usage of PBE_.54. Should I use PBE_54 as well, or is it okay to use PBE_64 as long as I use the same pseudopotential type?
  2. I see. Is the adjustment here to directly input the r2SCAN-calculated energy into the Materials Project convex hull scheme? For example, if I would like to know how much energy-above-hull my added input has? If possible, is there a YouTube tutorial on how to apply adjustments on the r2SCAN energies?

Thank you for your time!

  1. MPScanStaticSet is a class from pymatgen, you can import them like this:
from pymatgen.io.vasp.sets import MPScanRelaxSet, MPScanStaticSet

You can explore how these sets are configured by giving them a structure:

vasp_input_set = MPScanRelaxSet(structure=< some pymatgen structure>)
print(vasp_input_set.incar)
print(vasp_input_set.kpoints)
print(vasp_input_set.potcar)

The MatPES static set is for generating ML training datasets

  1. No youtube tutorial for this, but you would apply it to a ComputedEntry or ComputedStructureEntry (search pymatgen for these):
from mp_api.client import MPRester

from pymatgen.entries.mixing_scheme import MaterialsProjectDFTMixingScheme

chemsys = "La-Ti-O-N"
with MPRester() as mpr:
    entries = mpr.get_entries_in_chemsys(chemsys,additional_criteria={"thermo_types": ["GGA_GGA+U"]})

corrected_entries = MaterialsProjectDFTMixingScheme(run_type_2="r2SCAN").process_entries(entries)

After that runs, you can create a PhaseDiagram with corrected_entries. To supply your own calculations, you would just add their representation as ComputedEntry or ComputedStructureEntry obejcts to entries