-
Notifications
You must be signed in to change notification settings - Fork 868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add VASP input set MatPESStaticSet
#3254
Conversation
prev: incar = Incar(self.prev_incar) if self.prev_incar is not None else Incar(parent_incar)
MatPESStaticSet
to VASP input set
MatPESStaticSet
to VASP input setMatPESStaticSet
e045029
to
e5cf479
Compare
# using the Regularized-Restored Strongly Constrained and Appropriately | ||
# Normed functional (PBE, PBE+U or r2SCAN). | ||
INCAR: | ||
ALGO: ALL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default ALGO should be Normal for PBE. R2SCAN uses All. But our input set is written with PBE as a default.
W: 5 | ||
Yb3+: 1 | ||
POTCAR_FUNCTIONAL: PBE_54 | ||
POTCAR: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should be hard coding POTCARs or U values in this input set. The VASP input sets support inheritance. E.g., VASPIncarBase defines U values. We should write a base for PBE54 that incorporates things we feel would be common across all calculations. E.g., POTCAR_FUNCTIONAL, POTCAR and maybe the U values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt confused about how we make sure all the MatPES static calculations have the same PSP, so that's why I incorporate the POTCAR values here. When you mentioned write a base for PBE54, do you mean to include another PBE54Base.yaml
used for all the PBE54 POTCARs, POTCAR_FUNCTIONAL, and U values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
tests/io/vasp/test_sets.py
Outdated
@@ -750,6 +751,116 @@ def test_grid_size_from_struct(self): | |||
assert matched | |||
|
|||
|
|||
class TestMatPESStaticSet(PymatgenTest): | |||
def setUp(self): | |||
self.tmp = tempfile.mkdtemp() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed, just use self.tmp_path
inherited from PymatgenTest
.
tests/io/vasp/test_sets.py
Outdated
assert vis.incar["NSW"] == 0 | ||
assert vis.incar["NELM"] == 200 | ||
assert vis.incar["ENCUT"] == 680 | ||
assert vis.incar["ENAUG"] == 1360 | ||
assert vis.incar["EDIFF"] == 1.0e-05 | ||
assert vis.incar["LREAL"] is False | ||
assert vis.incar["LORBIT"] == 11 | ||
assert vis.incar["LVHAR"] | ||
assert vis.incar["ISMEAR"] == 0 | ||
assert vis.incar["KSPACING"] == 0.22 | ||
assert vis.incar["GGA"] == "PE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to assert keys one by one. If you want to make sure they match the values in pymatgen/io/vasp/MatPESStaticSet.yaml
, you can load that file into a dict and compare vis.incar
against that dict.
@SophiaRuan This looks good. But I would like @JiQi535 to go through it carefully and make sure everything is correct. |
A few remarks given the updates to MP's GGA and r2SCAN WFs:
If you want to contribute the statics to MP-core, then unfortunately you need LAECHG, LCHARG, and LOCPOT set to true for consistency with the r2SCAN WF. It'll just slow things down slightly with the file I/O We're working on independently testing the differences in energies / forces / stresses for ISMEAR = 0 and -5. We may ultimately stay with ISMEAR = -5 for DOS / bandstructures / thermo properties, but that does mean incorrect forces for metals |
@esoteric-ephemera this input set is for MatPES (as the name implies). While we are happy to contribute to MPstatics if MP wants them, forces are a priority here. Perhaps more so than even energies. I am unsure why MP would want to stick to ISMEAR -5 for all statics. The evidence is quite conclusive than 0 works as well for insulators and certainly better for metals. So what is the advantage of sticking with -5? |
@shyuep I saw the work from your group for these differences, my only concern is that the average absolute energy differences between the two smearing methods is ~1 eV, which can be large on the scale of energy differences relevant for thermoprops (~5-10 meV/atom). Would be good to see these differences in eV/atom instead of eV I'm also not sure what the effect of ISMEAR is on the DOS / KS eigenvalues / bandgap. We usually assume ISMEAR = -5 gives a better description of the actual electronic structure, but we're testing this now |
@esoteric-ephemera ok. Would be good to have independent validation. |
-5 should give a much better band gap based on DOS. |
@esoteric-ephemera This is just my intuition. But if you use a small enough SIGMA, the DOS effect is small. After all, a smearing of 0.02 can't lead to more than a 0.04 eV error in band edges. In the grand scheme of DFT errors in band gaps, it is practically nothing. |
I have checked @SophiaRuan's implementation of MatPESStaticSet, and it looks nice to me. I have below questions.
|
Just adding this paper here for my comment on the DOS computations (a smearing of 0.05 was used): |
@JiQi535 They were copied from
No. |
LMIXTAU: True | ||
LORBIT: 11 | ||
LREAL: Auto | ||
LVTOT: True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should be removed. The LOCPOT file is going to consume storage space.
def __init__( | ||
self, | ||
structure: str, | ||
functional: Literal["R2SCAN", "R2SCAN+U", "PBE", "PBE+U"] = "PBE", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SophiaRuan Here, I think we should have PBE+U as default, inline with default of MPRelaxSet and MPStaticSet. Also, I don't think we should distinguish PBE and PBE+U as two functionals. Instead, +U can be disabled in the same way as in MPRelaxSet and MPStaticSet with user_incar_settings={"LDAU": False}
.
@shyuep Please kindly comment if you agree.
No. PBE default. U and r2scan as options. This is not MP. |
The lint and test failures are unrelated to the PR. I am merging. |
They're not unrelated. The 1st pytest tests/io/vasp/test_sets.py -k TestMatPESStaticSet -vv _____________________________ TestMatPESStaticSet.test_init ______________________________
self = <tests.io.vasp.test_sets.TestMatPESStaticSet testMethod=test_init>
def test_init(self):
prev_run = f"{TEST_FILES_DIR}/relaxation"
vis = MatPESStaticSet.from_prev_calc(prev_calc_dir=prev_run)
# Check that INCAR settings were load from yaml, check the default functional is PBE.
CONFIG = _load_yaml_config("MatPESStaticSet")
> assert vis.incar == CONFIG["INCAR"]
E AssertionError: assert {'PREC': 'acc...ORBIT': False} == {'ALGO': 'Nor...5, 'Yb3+': 1}}
E Omitting 3 identical items, use -vv to show
E Differing items:
E {'PREC': 'accurate'} != {'PREC': 'Accurate'}
E {'ISMEAR': -5} != {'ISMEAR': 0}
E {'MAGMOM': [0.6]} != {'MAGMOM': {'Ce': 5, 'Ce3+': 1, 'Co': 0.6, 'Co3+': 0.6, 'Co4+': 1, 'Cr': 5, 'Dy3+': 5, 'Er3+': 3, 'Eu': 10, 'Eu2+': 7,...4+': 3, 'Mo': 5, 'Nd3+': 3, 'Ni': 5, 'Pm3+': 4, 'Pr3+': 2, 'Sm3+': 5, 'Tb3+': 6, 'Tm3+': 2, 'V': 5, 'W': 5, 'Yb3+': 1}}
E {'SIGMA': 0.2} != {'SIGMA': 0.05}
E {'LORBIT': False} != {'LORBIT': 11}... |
I just noticed one problem. Why is the INCAR written as |
Summary
Major changes:
Todos
If this is work in progress, what else needs to be done?
Checklist
ruff
.mypy
.duecredit
@due.dcite
decorators to reference relevant papers by DOI (example)Tip: Install
pre-commit
hooks to auto-check types and linting before every commit: