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

Support parsing of NBANDS from a VASP OUTCAR file #3843

Open
Andrew-S-Rosen opened this issue May 21, 2024 · 1 comment · May be fixed by #4195
Open

Support parsing of NBANDS from a VASP OUTCAR file #3843

Andrew-S-Rosen opened this issue May 21, 2024 · 1 comment · May be fixed by #4195
Labels
enhancement A new feature or improvement to an existing one

Comments

@Andrew-S-Rosen
Copy link
Member

Feature Requested

In VASP, the NBANDS parameter describes the number of bands. It can be modified on-the-fly by VASP, potentially even overriding the setting chosen by the user. This is done based on the number of cores requested for the calculation. Therefore, knowing the NBANDS VASP actually uses is quite useful. This information is available in the OUTCAR but is not currently parsed. We should add support for this as an attribute of pymatgen.io.vasp.outputs.Outcar (see below).

Proposed Solution

In Custodian, we have a block of code that looks like:

nbands = None
with open(os.path.join(directory, "OUTCAR")) as file:
    for line in file:
        # Have to take the last NBANDS line since sometimes VASP
        # updates it automatically even if the user specifies it.
        # The last one is marked by NBANDS= (no space).
        if "NBANDS=" in line:
            try:
                d = line.split("=")
                nbands = int(d[-1].strip())
                break
            except (IndexError, ValueError):
                pass

We can basically port this over to Pymatgen's pymatgen.io.vasp.outputs.Outcar class as a .nbands attribute (and then remove the code block from Custodian).

Relevant Information

No response

@Andrew-S-Rosen Andrew-S-Rosen added the enhancement A new feature or improvement to an existing one label May 21, 2024
@DanielYang59
Copy link
Contributor

DanielYang59 commented Nov 9, 2024

Thanks for suggesting this, I'm currently working on this.

@DanielYang59 DanielYang59 linked a pull request Nov 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or improvement to an existing one
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants