SMTG-Bham / sumo

Heavyweight plotting tools for ab initio calculations
https://smtg-bham.github.io/sumo/
MIT License
192 stars 78 forks source link

sumo-dosplot showing error ValueError: invalid literal for int() with base 10: '!' #242

Open ihtishamqabid opened 4 months ago

utf commented 4 months ago

Please can you provide more information on exactly what command you're running and if possible provide the vasprun.xml

ihtishamqabid commented 4 months ago

vasprun.zip Thank you very much for your response. I am sorry. Actually, I was in a hurry so didn't write in detail; thought maybe if someone responds then .... Anyway, I used the command "sumo-dosplot". I am attaching the vasprun.xml file. sumo-bandplot works fine. Also, when I used the sumo-dosplot command for a vasp official tutorial vasprun.xml file, it worked like a charm but it is not working for my personal project. Also, I could use the plotdos.sh script to plot the dos and there were no issues. So, I don't know what's going on. Note: I am new to VASP so I might make silly mistakes.

utf commented 4 months ago

I'm not able to reproduce your error. When I run sumo-dosplot on your vasprun.xml file, I get the following plot. dos.pdf

ihtishamqabid commented 4 months ago

Wow! Thank you very much. Maybe I have not been able to properly install sumo :(

ihtishamqabid commented 4 months ago

Here is the complete output on the screen in case it illustrates my problem better:

sumo-dosplot Traceback (most recent call last): File "/home/iq/.local/bin/sumo-dosplot", line 8, in sys.exit(main()) ^^^^^^ File "/home/iq/.local/pipx/venvs/sumo/lib/python3.11/site-packages/sumo/cli/dosplot.py", line 645, in main dosplot( File "/home/iq/.local/pipx/venvs/sumo/lib/python3.11/site-packages/sumo/cli/dosplot.py", line 207, in dosplot dos, pdos = load_dos( ^^^^^^^^^ File "/home/iq/.local/pipx/venvs/sumo/lib/python3.11/site-packages/sumo/electronic_structure/dos.py", line 102, in load_dos band = vr.get_band_structure() ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/iq/.local/pipx/venvs/sumo/lib/python3.11/site-packages/pymatgen/io/vasp/outputs.py", line 904, in get_band_structure kpoint_file = Kpoints.from_file(kpoints_filename) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/iq/.local/pipx/venvs/sumo/lib/python3.11/site-packages/pymatgen/io/vasp/inputs.py", line 1360, in from_file return cls.from_str(file.read()) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/iq/.local/pipx/venvs/sumo/lib/python3.11/site-packages/pymatgen/io/vasp/inputs.py", line 1387, in from_str kpts = tuple(int(i) for i in lines[3].split()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/iq/.local/pipx/venvs/sumo/lib/python3.11/site-packages/pymatgen/io/vasp/inputs.py", line 1387, in kpts = tuple(int(i) for i in lines[3].split()) ^^^^^^ ValueError: invalid literal for int() with base 10: '!'

utf commented 4 months ago

Ah, please can you also send your KPOINTS file too?

ihtishamqabid commented 4 months ago

I really appreciate your effort. Here is the KPOINTS file. KPOINTS.zip

ihtishamqabid commented 4 months ago

I found the specific issue. The issue is related to file path. Usually I run the sumo-dosplot command where the vasprun.xml file is and that is a deep directory like /home/iq/Jobs/VASP/Na2Cr3As3/Encut 300/sigma 0.1 6x6x12/DOS and it contains "space" which causes the issue. I just copied the vasprun.xml file I shared with you in the Home folder and executed the sumo-dosplot command with no issue.

By the way, the sumo-bandplot command works fine even in such deep directories.

I guess, once someone starts using computers/phones, s/he should not name any file/folder containing "space".

And thank you very much @utf for your time you spent looking into my issue. Should I close this now?

[So many things to learn: writing space inside angular brackets acts like a code and the text does not appear in comments here.]

ajjackson commented 4 months ago

It's good to hear that this isn't blocking your work any more 😄

I would be interested to know exactly where things go awry: with proper use of pathlib etc. we shouldn't have to encounter problems like this.

ihtishamqabid commented 4 months ago

Update/Edit: Things are way more complicated than my novice mind could think of. Maybe "space" is not actual issue. It seems that in my pc sumo-dosplot only works with vasprun.xml file in the Home directory. Any other location - I encounter the issue. This is most problematic when I want to execute sumo-bandplot --dos . I couldn't do it.

ajjackson commented 4 months ago

Strange, the error message seems to blame the formatting of the KPOINTS file (finding "!" where it expected a number). But the one you uploaded looks fine. I wonder if somehow it decided to look at the KPOINTS in your current directory, rather than the one next to the vasprun.xml? (Looking at the code, this should not happen, but...) Do you have another KPOINTS sitting around which might be corrupt?

("Corrupt" in this case could be a perfectly correct KPOINTS file that uses some new/unusual features or keywords...)

ihtishamqabid commented 4 months ago

OK. Insha'Allah I will look into it. I will try removing the comments altogether first. I remember I had an INCAR file which looked fine to me but VASP reported error and I did a workaround by removing the comments and still do not know what wrong was there. Maybe some issue of similar type is present here. Actually, I write so many comments 😊 because I tend to forget what the tags mean, what are their default values and so forth and each time I have to look into vasp wiki; so irritating. Anyway, Insha'Allah I will look into it. And, I can't thank you enough @utf, @ajjackson for the time you spent on my issue.

ihtishamqabid commented 2 months ago

If I remove the comments altogether from the KPOINTS file then it works fine. As soon as I add comments the issue emerges again. And, earlier I mentioned that if I copy the vasprun.xml file to the Home directory then there is no problem - that is so because I do not copy the KPOINTS file, containing comments, there.