pyprocar
pyprocar copied to clipboard
Problem with total DOS
Hello developers.
I just installed pyprocar via pip on my macOS computer. I was trying to plot the DOS but I'm getting the following error.
KeyError Traceback (most recent call last)
/usr/local/lib/python3.8/site-packages/pyprocar/scriptDosplot.py in dosplot(filename, mode, interpolation_factor, orientation, spin_colors, colors, spins, atoms, orbitals, elimit, dos_limit, cmap, vmax, vmin, grid, savefig, title, plot_total, code, labels, items, ax, plt_show, verbose) 354 vaspxml = VaspXML(filename=filename, 355 dos_interpolation_factor=interpolation_factor) --> 356 dos_plot = DosPlot(dos=vaspxml.dos, structure=vaspxml.structure) 357 if atoms is None: 358 atoms = list(np.arange(vaspxml.structure.natoms, dtype=int))
/usr/local/lib/python3.8/site-packages/pyprocar/vaspxml/vaspxml.py in dos(self) 90 @property 91 def dos(self): ---> 92 energies = self.dos_total['energies'] 93 total = [] 94 for ispin in self.dos_total:
/usr/local/lib/python3.8/site-packages/pyprocar/vaspxml/vaspxml.py in dos_total(self) 118 Returns the total density of states as a pychemia.visual.DensityOfSates object 119 """ --> 120 dos_total, labels = self._get_dos_total() 121 dos_total['energies'] -= self.fermi 122
/usr/local/lib/python3.8/site-packages/pyprocar/vaspxml/vaspxml.py in _get_dos_total(self) 53 dos_total = {'energies': energies} 54 for ispin in spins: ---> 55 dos_total[self.spins_dict[ispin]] = np.array( 56 self.data['general']['dos']['total']['array']['data'] 57 [ispin])[:, 1]
KeyError: 'spin 3'
My input is:
pyprocar.dosplot(filename='vasprun.xml', mode='plain', elimit=[-4, 4], orientation='horizontal', title=r'Total Density of States InSe-GaSe')
Best!
Dr. Wilfredo Ibarra Hernández.
Hello,
I haven't been able to reproduce your error, can you please send us your "vasprun.xml"? I'm assuming that the problem comes from the non-collinear implementation in the parser.
Appreciate your help, Best, Pedram
Hello,
I have the same problem than wibarra7. Did this issue reached a solution/conclusion? If that is not the case, we can use my case to study it.
Best, MIraola
Hi Mikel,
Is your calculation non-collinear? As Pyprocar doesn't support non-collinear yet. If not, can you please send us your vasprun.xml?
Best regards, Pedram
On Wed, Dec 2, 2020 at 4:02 AM Mikel Iraola Iñurrieta < [email protected]> wrote:
Hello,
I have the same problem than wibarra7. Did this issue reached a solution/conclusion? If that is not the case, we can use my case to study it.
Best, MIraola
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/romerogroup/pyprocar/issues/41#issuecomment-737092385, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHBQJCOEL3QNZY6ELLU5SGDSSX7DVANCNFSM4TCZPFOA .
Hi Pedram,
my calculation is non-collinear. If PyProcar doesn't support non-collinear calculations, the following issues/questions come to my mind:
-
The
bandsplot
function works properly, without setting any value forspins
(default:spin=0
). Does this mean that the routinebandsplot
implemented for non-collinear calculations? -
In the documentation of
bandsplot
, I read thatspin=0
plots the spin density (magnitude). What is the spin density exactly? If I usebandsplot
withspin=0
(default) andatoms=5
to get a parametric plot, does the color map indicate the contribution of 5th atom to bands or the so called spin density?
Thank you for your help. Best, Mikel
We are implementing the non-collinear for the DOS as we speak.
For your questions, I will ask Uthpala to respond.
Best, Pedram
On Wed, Dec 2, 2020 at 10:28 AM Mikel Iraola Iñurrieta < [email protected]> wrote:
Hi Pedram,
my calculation is non-collinear. If PyProcar doesn't support non-collinear calculations, the following issues/questions come to my mind:
The bandsplot function works properly, without setting any value for spins (default: spin=0). Does this mean that the routine bandsplot implemented for non-collinear calculations? 2.
In the documentation of bandsplot, I read that spin=0 plots the spin density (magnitude). What is the spin density exactly? If I use bandsplot with spin=0 (default) and atoms=5 to get a parametric plot, does the color map indicate the contribution of 5th atom to bands or the so called spin density?
Thank you for your help. Best, Mikel
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/romerogroup/pyprocar/issues/41#issuecomment-737302955, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHBQJCLTWSAR3BW6Q6IY5DLSSZMJ5ANCNFSM4TCZPFOA .
Dear Mikel,
Non-collinear spins for band structure plotting is implemented in PyProcar since it uses the PROCAR file to do so whereas the PyProcar DOS uses the vasprun.xml. Therefore, DOS currently supports no spin and colinear spin calculations only. As Pedram stated, the non colinear implementation is in the works.
Due to the different ways VASP writes the PROCAR file for colinear spin and non collinear spins, what the spin
flag does varies in each case, as explained in the documentation for spin projected bands (https://romerogroup.github.io/pyprocar/bands.html#spin-projection).
The PROCAR for spin colinear consists of the spin up projections followed by the spin down projects. For non-colinear, it contains 4 projection blocks for total spin, Sx, Sy and Sz. Ref: https://www.vasp.at/wiki/index.php/PROCAR. They call it " total (absolute) magnetization".
To answer your question, it is this "total spin" that is plotted for non colinear spin bands when spin=0
. If you set both atoms=5
and spin=0
this would plot the "total spin" contribution from that atom.
Hope that helps.
Best, Uthpala
Dear Uthpala,
thank you for your detailed answer, now I understand exactly what PyProcar plots in the non-collinear case.
Best regards, Mikel
You are welcome Mikel!
Best, Uthpala
Just checking on this old thread, is the non collinear DOS plotting still in the works / completed ?
I am also curious if non-collinear DOS plotting has been implemented. I am getting an error when plotting the DOS for a non-collinear result, so I opened up issue #92, but I saw this and figured I would comment here and link my issue for reference.