pyprocar
pyprocar copied to clipboard
spd_orb in ProcarParser truncates ions instead of orbitals
I noticed in ProcarParser, it has a property spd_orb which, according to comments, takes the 5D spd array and trims out the indices and total from the orbital axis.
def spd_orb(self):
# indices: ikpt, iband, ispin, iion, iorb
# remove indices and total from iorb
return self.spd[:, :, :, 1:-1]
However, as written, it instead removes the entries for the first atom and the ion totals, leaving the orbital axis unaffected. To make the code do what it claims to do, I think it should instead be
return self.spd[:, :, :, :, 1:-1]
(that is, add the missing slice)
In the mean time, a work-around would be to access self.spd directly
Dear @bfield1,
Thank you for reaching out to us!
Yes, the spd_orb function is a remnant from a previous version of the procarparser and is currently not used in parsing. Sorry if that was misleading.
Best, Uthpala
Dear @uthpalaherath ,
Thank you for your quick reply.
No worries there. (I had a feeling it might have been a vestigial feature.) I'll just use spd
instead.
Regards,
Bernard
Dear Bernard,
No problem. It's great to have a user community that helps with reporting bugs and provides feedback which leads to making PyProcar better.
Yeah, the spd array would have all the projection data after the parsing. Its true form is:
[kpoints, bands, spins, atoms+1, orbitals+2]
For example, in a system with 320 k-points, 46 bands, 1 spin, 5 atoms, and 9 orbitals it's shape would be (320, 46, 1, 6, 11). It would be similar in the VASP spin non-collinear case where you would have 4 blocks of spin.
However, in the spin collinear case you would have 46x2 = 92 bands. This was to originally comply with the way VASP wrote its PROCAR files for different cases (Might make a bit more sense in https://romerogroup.github.io/pyprocar/bands.html#spin-projection).
The actual filtering of the projections are done using procarselect that strips the spd array.
Hope that helps.
Best, Uthpala