Skip to content
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

VaspInput setter and Incar.check_params() are inconsistent #4119

Open
yantar92 opened this issue Oct 17, 2024 · 1 comment · May be fixed by #4122
Open

VaspInput setter and Incar.check_params() are inconsistent #4119

yantar92 opened this issue Oct 17, 2024 · 1 comment · May be fixed by #4122
Labels

Comments

@yantar92
Copy link
Contributor

yantar92 commented Oct 17, 2024

Python version

Python 3.12.4

Pymatgen version

2024.7.18

Operating system version

No response

Current behavior

When I set INCAR parametrs via vasp_input['INCAR']['PARAM']=value, they do not always pass Incar.check_params() checks.

Using the example below, I am getting:

...: BadIncarWarning: ENCUT: 550 is not a float
  vasp_input.incar.check_params()
...: BadIncarWarning: GGA: Cannot find Ps in the list of values
  vasp_input.incar.check_params()

Expected Behavior

Setting the parameters passes the checks.

Minimal example

from pymatgen.io.vasp.inputs import VaspInput
vasp_input = VaspInput.from_directory('.')
vasp_input['INCAR']['GGA'] = "MK"
vasp_input['INCAR']['GGA']

Relevant files to reproduce this bug

I used the following INCAR

ALGO = Normal
ENCUT = 550
ISMEAR = 0
NCORE = 16
SIGMA = 0.04
SYSTEM = C.hexagonal.191

Other requried inputs may be anything.

@yantar92 yantar92 added the bug label Oct 17, 2024
@DanielYang59
Copy link
Contributor

DanielYang59 commented Oct 17, 2024

Thanks for reporting this, I believe the warning on GGA=PS is owing to:

return val.strip().capitalize()

I.e. any keyword not included inside the following and is not boolean/float/int (str) would be capitalized:

list_keys = (
"LDAUU",
"LDAUL",
"LDAUJ",
"MAGMOM",
"DIPOL",
"LANGEVIN_GAMMA",
"QUAD_EFG",
"EINT",
)
bool_keys = (
"LDAU",
"LWAVE",
"LSCALU",
"LCHARG",
"LPLANE",
"LUSE_VDW",
"LHFCALC",
"ADDGRID",
"LSORBIT",
"LNONCOLLINEAR",
)
float_keys = (
"EDIFF",
"SIGMA",
"TIME",
"ENCUTFOCK",
"HFSCREEN",
"POTIM",
"EDIFFG",
"AGGAC",
"PARAM1",
"PARAM2",
)
int_keys = (
"NSW",
"NBANDS",
"NELMIN",
"ISIF",
"IBRION",
"ISPIN",
"ISTART",
"ICHARG",
"NELM",
"ISMEAR",
"NPAR",
"LDAUPRINT",
"LMAXMIX",
"ENCUT",
"NSIM",
"NKRED",
"NUPDOWN",
"ISPIND",
"LDAUTYPE",
"IVDW",
)
lower_str_keys = ("ML_MODE",)


The warning on ENCUT=550 should be owing to the incorrect classification of it into int_keys instead of float_keys:

int_keys = (
"NSW",
"NBANDS",
"NELMIN",
"ISIF",
"IBRION",
"ISPIN",
"ISTART",
"ICHARG",
"NELM",
"ISMEAR",
"NPAR",
"LDAUPRINT",
"LMAXMIX",
"ENCUT",

I believe it should be a float:

ENCUT = [real]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants