{"id":8497,"library":"pymatgen-io-validation","title":"Pymatgen I/O Validation","description":"Pymatgen-io-validation is a Python library, currently at version 0.1.2, that extends the pymatgen framework to provide comprehensive I/O validation for electronic structure calculations. It primarily focuses on ensuring VASP calculations are compliant with the stringent standards required for integration with the Materials Project database. The library helps identify discrepancies between a calculation and a provided input set, flags known bugs related to parameter combinations, and performs other critical checks. Its release cadence typically involves minor updates to address dependencies and improve validation logic.","status":"active","version":"0.1.2","language":"en","source_language":"en","source_url":"https://github.com/materialsproject/pymatgen-io-validation","tags":["materials science","VASP","validation","DFT","electronic structure","pymatgen"],"install":[{"cmd":"pip install pymatgen-io-validation","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"This library is an extension of pymatgen and requires it for core materials objects and I/O functionalities.","package":"pymatgen","optional":false}],"imports":[{"symbol":"VaspValidator","correct":"from pymatgen.io.validation import VaspValidator"}],"quickstart":{"code":"import os\nfrom pymatgen.io.validation import VaspValidator\n\n# Assuming 'path_to_vasp_calculation_directory' contains VASP input/output files (e.g., INCAR, KPOINTS, POSCAR, OUTCAR)\n# For a runnable example, we'll create a dummy directory and files.\n# In a real scenario, this path would point to your actual VASP calculation directory.\n\ndummy_vasp_dir = \"./dummy_vasp_calc\"\nos.makedirs(dummy_vasp_dir, exist_ok=True)\n\nwith open(os.path.join(dummy_vasp_dir, \"INCAR\"), \"w\") as f:\n    f.write(\"ENCUT = 520\\nISIF = 2\\nISYM = 2\\nPREC = Accurate\\nALGO = Fast\\n\")\nwith open(os.path.join(dummy_vasp_dir, \"POSCAR\"), \"w\") as f:\n    f.write(\"Dummy structure\\n1.0\\n1.0 0.0 0.0\\n0.0 1.0 0.0\\n0.0 0.0 1.0\\nFe\\n1\\nDirect\\n0.0 0.0 0.0\\n\")\n# Add other necessary dummy files (KPOINTS, POTCAR) for a full run if needed, \n# but the example focuses on VaspValidator usage structure.\n\n# Validate a VASP calculation from its directory\nvalidation_doc = VaspValidator.from_directory(dummy_vasp_dir)\n\nprint(f\"Calculation is valid: {validation_doc.valid}\")\nif not validation_doc.valid:\n    print(\"Reasons for invalidation:\")\n    for reason in validation_doc.reasons:\n        print(f\"- {reason}\")\nif validation_doc.warnings:\n    print(\"Warnings:\")\n    for warning in validation_doc.warnings:\n        print(f\"- {warning}\")\n\n# Clean up dummy files\nos.remove(os.path.join(dummy_vasp_dir, \"INCAR\"))\nos.remove(os.path.join(dummy_vasp_dir, \"POSCAR\"))\nos.rmdir(dummy_vasp_dir)\n","lang":"python","description":"This quickstart demonstrates how to instantiate `VaspValidator` from a VASP calculation directory and check its validity, reasons for invalidation, and any warnings. The `from_directory` class method automatically parses the necessary VASP input and output files to perform the checks. The `valid`, `reasons`, and `warnings` attributes of the returned `validation_doc` object provide a comprehensive report."},"warnings":[{"fix":"Consult the Materials Project documentation or the pymatgen-io-validation source code (especially the Rationale section in the GitHub README) for detailed parameter requirements. Ensure your VASP input files align with these standards to pass validation.","message":"The validator enforces strict adherence to Materials Project (MP) standards for VASP input parameters (e.g., INCAR tags like ADDGRID, ISIF, ISYM, IVDW, PREC, NBANDS, ALGO, LORBIT, LREAL, ICHARG, IBRION). Calculations not meeting these specific requirements will be flagged as invalid or generate warnings, even if VASP itself runs successfully.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your VASP executable version is compatible with the Materials Project standards. Update VASP to a supported version if necessary (e.g., 5.4.4 or above 6.0.0).","message":"The validator explicitly checks for allowed VASP versions. For instance, VASP versions <= 5.4.3 are not allowed, while 5.4.4 or >6.0.0 are accepted. Using an unsupported VASP version will lead to validation failure.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review and reduce the SIGMA parameter in your VASP INCAR file to a more appropriate value. Version 0.0.3 improved the detection logic for this specific issue.","message":"Calculations might generate a warning related to 'Electronic entropy too large (SIGMA too high)'. This indicates that the SIGMA parameter in the INCAR file is set too high, potentially leading to inaccurate results or numerical issues.","severity":"gotcha","affected_versions":"<=0.0.2 (detection logic improved in 0.0.3), but still a warning for higher versions if SIGMA is high"},{"fix":"If encountering import errors with related `pymatgen` components, ensure your `pymatgen` installation is recent (>=2022.0.3) and update import statements to explicitly reference subpackages (e.g., `from pymatgen.io.vasp import Poscar` instead of `from pymatgen import Poscar` if such a pattern was ever used).","message":"Pymatgen itself underwent a significant architectural change (v2022.0.3 onwards) by adopting namespace packages, which affects how some modules are imported. While `pymatgen-io-validation` is designed as a namespace package, older client code that directly imported from `pymatgen` for functionalities now residing in separate add-ons (including `pymatgen.io` components) might break if not updated to use explicit subpackage imports.","severity":"breaking","affected_versions":"Pymatgen versions prior to 2022.0.3"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Modify your INCAR file to include `ADDGRID = False`. This parameter can affect forces, and MP calculations require it to be false for compatibility.","cause":"The VASP INCAR file contains `ADDGRID = True` or `ADDGRID` is not explicitly set (which might default to True in some VASP versions or setups), violating Materials Project standards.","error":"Calculation invalid: ADDGRID must be set to False."},{"fix":"Adjust the `ISIF` parameter in your INCAR file to `-1` (no relaxation), `1` (cell shape and volume fixed), or `2` (cell shape fixed, volume allowed to change).","cause":"The VASP INCAR file specifies `ISIF` as a value other than -1, 1, or 2, which are the only values compatible with Materials Project standards for structural relaxations.","error":"Calculation invalid: ISIF values must be one of: -1, 1, 2."},{"fix":"Install the package using pip: `pip install pymatgen-io-validation`. Ensure your Python environment is active if using a virtual environment.","cause":"The `pymatgen-io-validation` package has not been installed, or the Python environment is not correctly configured.","error":"ModuleNotFoundError: No module named 'pymatgen.io.validation'"}]}