pyprocar icon indicating copy to clipboard operation
pyprocar copied to clipboard

Plotting the Fermi surface in spin-polarized calculations

Open streltsovsergey opened this issue 5 months ago • 5 comments

We use 6.4.5. While previous one could easily plot Fermi surfaces in spin polarized GGA/GGA+U with two different colors. Now PyProcar can only plot their sum.

Traceback (most recent call last): File "/Users/streltsov/LMTO/Ba3MA2O9/Ba3CoIr2O9/gga+u/997/Fermi_surface_3D_pyprocar_new.py", line 10, in fermiHandler.plot_fermi_surface(mode="plain", spins = spins, spin_colors = ("blue","red"), show=True, print_plot_opts=True) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/pyprocar/scripts/scriptFermiHandler.py", line 224, in plot_fermi_surface visualizer.add_surface(fermi_surface) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/pyprocar/plotter/fermi3d_plot.py", line 453, in add_surface for spin_index in surface.point_data["spin_index"]: ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/pyvista/core/datasetattributes.py", line 246, in getitem return self.get_array(key) ~~~~~~~~~~~~~~^^^^^ File "/usr/local/lib/python3.13/site-packages/pyvista/core/datasetattributes.py", line 535, in get_array raise KeyError(msg) KeyError: 'spin_index'

Indeed, list surface.point_data.keys() does NOT have key "spin_index" anymore, only ['band_index', 'bands']

It has to be noted that plotter.fermi3d_plot reads everything correctly [INFO] 2025-07-28 15:02:07 - pyprocar.plotter.fermi3d_plot[115][_determine_bands_near_fermi] - Determining bands near fermi [INFO] 2025-07-28 15:02:07 - pyprocar.plotter.fermi3d_plot[132][_determine_bands_near_fermi] - Bands Near Fermi : [110, 111, 112] [INFO] 2025-07-28 15:02:07 - pyprocar.plotter.fermi3d_plot[133][_determine_bands_near_fermi] - _End of bands near fermi processing [INFO] 2025-07-28 15:02:07 - pyprocar.plotter.fermi3d_plot[60][_determine_spin_projections] - Determining spin projections [INFO] 2025-07-28 15:02:07 - pyprocar.plotter.fermi3d_plot[61][_determine_spin_projections] - Initial spins: [0, 1] [INFO] 2025-07-28 15:02:07 - pyprocar.plotter.fermi3d_plot[77][_determine_spin_projections] - Final spins: [0, 1]. [INFO] 2025-07-28 15:02:07 - pyprocar.plotter.fermi3d_plot[78][_determine_spin_projections] - Final spin_pol: [0, 1]. This is intented [INFO] 2025-07-28 15:02:07 - pyprocar.plotter.fermi3d_plot[79][_determine_spin_projections] - _End of spin projections processing

streltsovsergey avatar Jul 28 '25 10:07 streltsovsergey

Hey,

Interesting. Could you send me the data so I can check what is going on?

lllangWV avatar Jul 30 '25 16:07 lllangWV

Hi!

Thanks! Hope this is enough.

Fermi_surface_3D_pyprocar_new.py.gz

POSCAR.gz

KPOINTS.gz

PROCAR.gz

streltsovsergey avatar Aug 05 '25 13:08 streltsovsergey

Hey @streltsovsergey,

could you also send the OUTCAR as well?

Also, I find the issue I removed adding the spin_index when I made some changes to the Fermi Surface code a few months back. I pushed the fix to the main branch so you can try it out.

pip uninstall pyprocar
pip install --pre pyprocar

Logan Lang

lllangWV avatar Aug 06 '25 13:08 lllangWV

Dear Logan Lang,

Thank a lot!!! I'll try tomorrow. Please see OUTCAR

OUTCAR.gz

streltsovsergey avatar Aug 06 '25 13:08 streltsovsergey

Dear Logan,

let me confirm, that the issue is fixed. Thank you so much!

streltsovsergey avatar Aug 07 '25 09:08 streltsovsergey