aiida-vasp / parsevasp

A general parser for VASP
MIT License
13 stars 13 forks source link

Conflicted number of lines to map from DOSCAR to dtype #96

Closed lan496 closed 2 years ago

lan496 commented 2 years ago

If I understand correctly, DTYPES_PDOS in "doscar.py" represents the number of columns in pDOS. If so, I find inconsistency in keys "17" and "35" by using the below script.

from parsevasp.doscar import DTYPES_PDOS

def _check(dtype_pdos):
    count = 0
    for name in dtype_pdos.names:
        shape = dtype_pdos[name].shape
        if shape is tuple():
            count += 1
        else:
            count += shape[0]
    return count

for key, dtype_pdos in DTYPES_PDOS.items():
    assert _check(dtype_pdos) == key

https://github.com/aiida-vasp/parsevasp/blob/7b39b9936d9ef5435aba5f09d018a4da095d8a68/parsevasp/doscar.py#L35-L38 https://github.com/aiida-vasp/parsevasp/blob/7b39b9936d9ef5435aba5f09d018a4da095d8a68/parsevasp/doscar.py#L42-L46

Then, non-collinear l-decomposed pDOS up to f-electrons and collinear lm-decomposed pDOS up to f-electrons give the same number of lines, 17. In these cases, it seems we cannot distinguish them from only DOSCAR.

espenfl commented 2 years ago

Yes, indeed, thanks for noticing this. Let us add a few more DOSCAR to the test so that we span the whole schema here. Do you want to submit a PR? I think we have the flags we need from DOSCAR to determine which it is.

lan496 commented 2 years ago

Actually, I encounter an error caused by "35" key in DTYPES_PDOS, so I can submit a PR to fix it and add a test.

An extra flag like collinear=True in DosParser.__init__ will solve this issue, but I am not sure how to set this flag in aiida-vasp.