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

[Feature Request]: Vasprun.xml needs to be updated to be compatible vasp > 6.3 #3455

Open
Jeff-oakley opened this issue Nov 4, 2023 · 6 comments

Comments

@Jeff-oakley
Copy link

Jeff-oakley commented Nov 4, 2023

Problem

The new vasp allows to provide KPOINTS_OPT so that a non-self-consistent run will be done automatically after self-consisten run on KPOINTS file. This is the new feature starting from vasp.6.3. As a result, the vasprun.xml will generate two "band structures" rather than just one, can anyone update this feature? More description can be found in vasp documentation:

https://www.vasp.at/wiki/index.php/KPOINTS_OPT
https://www.vasp.at/wiki/index.php/Band-structure_calculation_using_hybrid_functionals

Proposed Solution

Just add the decision whether there is KPOINTS_OPT?

Alternatives

No response

@shyuep
Copy link
Member

shyuep commented Nov 5, 2023

For us to work on this, I need an example vasprun.xml with 6.3 and the two band structures. Just a simple one for say Si will do.

@Jeff-oakley
Copy link
Author

Jeff-oakley commented Nov 6, 2023

Thanks. Here is the zip file for a calculation with Si. Multiple output files have different formats, e.g. vasprun.xml (has both band structures from KPOINTS and KPOINTS_OPT), OUTCAR (additional outputs).
si_two_bandstructures.zip

@dhoulek
Copy link

dhoulek commented Nov 14, 2023

Let me follow up on this. The current Vasprun parser does not parse the stresses from the MD (ML_LMLFF) steps. The data is available in the vasprun.xml. This can be easily achieved by adding

elif tag == "varray" and elem.attrib.get("name") == "stress":
    md_data[-1]["stress"] = _parse_varray(elem)

between lines 404 and 405 in the present version of the Vasprun._parse() function.

At least in my present runs this seems to work, because the info about the stress is otherwise provided only for the DFT steps (via Vasprun.ionic_steps). Here is an example: vasprun.tar.gz

bfield1 added a commit to bfield1/pymatgen that referenced this issue Dec 10, 2023
From issue materialsproject#3455 , dataset supplied by Jeff-oakly materialsproject#3455 (comment)
Although, for some reason, even though LORBIT = 11, vasprun.xml doesn't have projected eigenvalues for kpoints_opt. Wierd.
janosh added a commit that referenced this issue Feb 23, 2024
* Add KPOINTS_OPT reading functionality to Vasprun

Allow reading in KPOINTS_OPT data from vasprun.xml. Also get band structure from KPOINTS_OPT data, if requested. (May change that to the default behaviour.)

I've tested it separately, but still need to test integration into the pymatgen code, once I get a working development build of pymatgen.

* Update docstrings, fix names in Vasprun

projected_magnetism_kpoints_opt -> projected_magnetisation_kpoints_opt

* Test case for Vasprun kpoints_opt

From issue #3455 , dataset supplied by Jeff-oakly #3455 (comment)
Although, for some reason, even though LORBIT = 11, vasprun.xml doesn't have projected eigenvalues for kpoints_opt. Wierd.

* Bandstructure test for kpoints_opt vasprun.xml

* Ran my own calculation, so have projected data

It was with VASP 6.4 rather than 6.3, if that makes a difference. And more CPUs so it snuck in more bands, which slightly changed some energy.

* Unittest for projected kpoints_opt

* Change use_kpoints_opt to be default behaviour

if KPOINTS_OPT data is present.

* Update borg test to account for new test documents

* Rename new test file directory to kpoints_opt

Prior name was not descriptive of the tests being done.

* pre-commit auto-fixes

* Code linting from ruff (whitespace, line length)

* Support for KPOINTS_OPT in BSVasprun

* as_dict now reads KPOINTS_OPT parameters

in both Vasprun and BSVasprun

* tweak Vasprun Attributes: doc str

improve test err message on bad vbm/cbm kpoint labels

* Replace vasprun.xml for kpoints_opt with smaller file

* refactor get_band_structure

tweak var names

* Explanatory comment on parser restructure

#3509

* Stick all KPOINTS_OPT properties in a container

Now they're referenced as attributes of that container (kpoints_opt_properties) rather than being top-level quantities in Vasprun.

* rename _ElectronicPropertiesContainer to KpointOptProps and turn into dataclass

which have 1st class MSONable support

* rename Vasprun.kpoints_opt_properties to kpoint_opt_props

* fix typo kpoint_opt_props -> kpoints_opt_props

* fix mypy

---------

Signed-off-by: Bernard Field <51108483+bfield1@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
@bfield1
Copy link
Contributor

bfield1 commented Feb 26, 2024

This should now be resolved since pull request #3509 has been merged.

@Jeff-oakley
Copy link
Author

Yes. I have tried with the example and it works greatly!

@Jeff-oakley
Copy link
Author

Jeff-oakley commented Mar 9, 2024

I realize the implementation still have the following issue:

When save the Vasprun object with dumpfn, it calls the as_dict() method with new parameter vasp_version. However, when load the mson file using loadfn, it shows that vasp_verison key can not be recognized.

vp = Vasprun('vasprun.xml')
dumpfn(vp,'vp.mson')
data = loadfn('vp.mson')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bouyang/miniconda3/envs/new_vprun/lib/python3.12/site-packages/monty/serialization.py", line 74, in loadfn
    return json.load(fp, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bouyang/miniconda3/envs/new_vprun/lib/python3.12/json/__init__.py", line 293, in load
    return loads(fp.read(),
           ^^^^^^^^^^^^^^^^
  File "/home/bouyang/miniconda3/envs/new_vprun/lib/python3.12/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/bouyang/miniconda3/envs/new_vprun/lib/python3.12/site-packages/monty/json.py", line 626, in decode
    return self.process_decoded(d)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bouyang/miniconda3/envs/new_vprun/lib/python3.12/site-packages/monty/json.py", line 553, in process_decoded
    return cls_.from_dict(data)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/bouyang/miniconda3/envs/new_vprun/lib/python3.12/site-packages/monty/json.py", line 235, in from_dict
    return cls(**decoded)
           ^^^^^^^^^^^^^^
TypeError: Vasprun.__init__() got an unexpected keyword argument 'vasp_version'

Similar to the vasp_version tag, "has_vasp_completed", "unit_cell_formula", "has_vasp_completed", "pretty_formula" and many other tags have the initialization issue

@Jeff-oakley Jeff-oakley reopened this Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants