zerothi / sisl

Electronic structure Python package for post analysis and large scale tight-binding DFT/NEGF calculations
https://zerothi.github.io/sisl
Mozilla Public License 2.0
198 stars 60 forks source link

Inconsistency fatbandsplot polarized and spin-orbit case #853

Open rreho opened 2 hours ago

rreho commented 2 hours ago

Describe the bug I tested the FatBandsPlot for polarized and spin-orbit calculation on the same system. The spin-orbit case seems to work correctly, while for polarized calculation it appears as the bands and the projection are shifted by a constant value (which might be the Fermi).

Code to reproduce problem

Emin, Emax = -10,10
fatbands_soc = band_struct_soc.plot.fatbands(bands_style= {'color': 'black', 'opacity': 1, 'width': 1},Erange=[Emin,Emax],fatbands_scale=0.2,fatbands_mode='area_line',backend='matplotlib')
fatbands_soc.update_settings(
    groups = [
    {"species": "O", "color": "red"},
    ]
)
data_soc = fatbands_soc.nodes['bands_data'].get()

Emin, Emax = -10,10
fatbands_pol = band_struct_pol.plot.fatbands(bands_style= {'color': 'black', 'opacity': 1, 'width': 1},Erange=[Emin,Emax],fatbands_scale=0.2,fatbands_mode='area_line',backend='matplotlib')
fatbands_pol.update_settings(
    groups = [
    {"species": "O", "color": "red"},
    ]
)
data_pol = fatbands_pol.nodes['bands_data'].get()

With this code I can produce the following two plots (first one with SOC, second polarized) with internal sisl.viz routines : STO_soc_bands

STO_collinear_bands

Thanks for your help

Version details Run the below code and add to bug-report:


[sys]
3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:45:13) [Clang 16.0.6 ]
version                       0.15.0
path                          /Users/Reho0001/opt/anaconda3/envs/aiida-2024/lib/python3.11/site-packages/sisl
CC                            /Library/Developer/CommandLineTools/usr/bin/clang
CFLAGS                        -O3 -DNDEBUG
C version                     12.0.0.12000032
FC                            /usr/local/bin/gfortran
FFLAGS                        -O3
FC version                    11.3.0
cython build version          Cython version 3.0.11
numpy build version           2.1.2
[cmake_args]
CMAKE_BUILD_TYPE              Release
WITH_FORTRAN                  ON
WITH_COVERAGE                 OFF
WITH_LINE_DIRECTIVES          OFF
WITH_ANNOTATE                 OFF
WITH_GDB                      OFF
NO_COMPILATION                
[runtime modules]
numpy                         1.26.4
scipy                         1.14.0
xarray                        2024.7.0
netCDF4                       1.7.1.post2
pandas                        2.2.2
matplotlib                    3.9.2
dill                          0.3.8
pathos                        0.3.2
skimage                       0.24.0
plotly                        5.23.0
ase                           3.23.0
pymatgen                      not found
                              module 'pymatgen' has no attribute '__version__'
[env]
pip                           numpy==1.26.4 scipy==1.14.0 xarray==2024.7.0 netCDF4==1.7.1.post2 pandas==2.2.2 matplotlib==3.9.2 dill==0.3.8 pathos==0.3.2 scikit-image==0.24.0 plotly==5.23.0 ase==3.23.0
conda                         numpy==1.26.4 scipy==1.14.0 xarray==2024.7.0 netCDF4==1.7.1.post2 pandas==2.2.2 matplotlib==3.9.2 dill==0.3.8 pathos==0.3.2 scikit-image==0.24.0 plotly==5.23.0 ase==3.23.0
zerothi commented 2 hours ago

Could you try the development version of sisl, this should have been fixed in: https://github.com/zerothi/sisl/pull/833

rreho commented 1 hour ago

thanks @zerothi. The problem mentioned has been fixed with the latest development version of the code. However, I can say that fatbands_mode = "scatter/line" don't produce a plot. I am aware that this was already a problem in the past, not sure if we plan to fix it in the future or if it has been fixed already.

zerothi commented 1 hour ago

So you are saying that the problem in #799 hasn't fully been fixed? @pfebrer can perhaps fill in some details here...