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

dtype=int is not enough? (readWFHeader in vaspwfc) #10

Open
mr-j-s opened this issue May 25, 2020 · 3 comments
Open

dtype=int is not enough? (readWFHeader in vaspwfc) #10

mr-j-s opened this issue May 25, 2020 · 3 comments

Comments

@mr-j-s
Copy link

mr-j-s commented May 25, 2020

Method readWFHeader in vaspwfc.py uses this code (currently lines 157-160):

        self._recl, self._nspin, self._rtag = np.array(
            np.fromfile(self._wfc, dtype=np.float, count=3),
            dtype=int
        )

It seems that for large WAVECARs dtype=int is not enough. I was getting overflow errors (don't remember all the details, I can try to reproduce the behaviour if needed).
Changing from dtype=int to dtype=np.int64 fixed the issue.

@QijingZheng
Copy link
Owner

Hi

The default length of np.int on a 64-bit machine is 8 bytes, which is the same as that of np.int64. And I think it is large enough to hold the recl.

scrot_kaka

Did you use the code on a 32-bit machine?

@mr-j-s
Copy link
Author

mr-j-s commented Jun 12, 2020

Hi

The default length of np.int on a 64-bit machine is 8 bytes, which is the same as that of np.int64. And I think it is large enough to hold the recl.

scrot_kaka

Did you use the code on a 32-bit machine?

64bit machine (checked with systeminfo).
image

@QijingZheng
Copy link
Owner

Hmmm... It is strange that your numpy outputs and mine show a difference.

Anyway, I think it is wise to specifically assign np.int64 to recl in the code, which I have added to the code.

Thank you!

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

2 participants