romerogroup / pyprocar

A Python library for electronic structure pre/post-processing
GNU General Public License v3.0
165 stars 72 forks source link

Spin Texture Example giving ValueError: need at least one array to concatenate #120

Closed vandan-revanur closed 10 months ago

vandan-revanur commented 11 months ago

I am following the example to plot spin texture from the official documentation: here And I get a ValueError (full error trace given below). I am using Pyprocar v6.0.0.

Here is the entire error stack trace:

____        ____
|  _ \ _   _|  _ \ _ __ ___   ___ __ _ _ __ 
| |_) | | | | |_) | '__/ _ \ / __/ _` | '__|
|  __/| |_| |  __/| | | (_) | (_| (_| | |   
|_|    \__, |_|   |_|  \___/ \___\__,_|_|
       |___/
A Python library for electronic structure pre/post-processing.

Version 6.0.0 created on Jun 10th, 2021

Please cite:
 Uthpala Herath, Pedram Tavadze, Xu He, Eric Bousquet, Sobhit Singh, Francisco Muñoz and Aldo Romero.,
 PyProcar: A Python library for electronic structure pre/post-processing.,
 Computer Physics Communications 251 (2020):107080.

Developers:
- Francisco Muñoz
- Aldo Romero
- Sobhit Singh
- Uthpala Herath
- Pedram Tavadze
- Eric Bousquet
- Xu He
- Reese Boucher
- Logan Lang
- Freddy Farah

dirname         :  /content/Fe/vasp/non-colinear/fermi
bands           :  None
atoms           :  [-1]
orbitals        :  [-1]
spin comp.      :  None
energy          :  None
rot. symmetry   :  1
origin (trasl.) :  [0, 0, 0]
rotation        :  [0, 0, 0, 1]
save figure     :  None
spin_texture    :  True
no_arrows       :  False
_____________________________________________________
Useful band indices for spin-0 : [4 5 6 7 8 9]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
[<ipython-input-21-47c2161e20c0>](https://localhost:8080/#) in <cell line: 1>()
----> 1 pyprocar.fermi2D(code = 'vasp',
      2                dirname=data_dir,
      3                spin_texture=True,
      4                 arrow_projection='x',
      5                arrow_size=3,

[/usr/local/lib/python3.10/dist-packages/pyprocar/scripts/scriptFermi2D.py](https://localhost:8080/#) in fermi2D(code, dirname, mode, band_indices, band_colors, lobster, spins, atoms, orbitals, energy, k_z_plane, rot_symm, translate, rotation, savefig, spin_texture, arrow_projection, arrow_size, arrow_color, arrow_density, no_arrow, cmap, color_bar, add_axes_labels, add_legend, exportplt, repair)
    233         fs.plot(mode=mode, interpolation=300)
    234     else:
--> 235         fs.spin_texture(sx=symm.sx, 
    236                         sy=symm.sy,
    237                         sz=symm.sz,

[/usr/local/lib/python3.10/dist-packages/pyprocar/core/fermisurface.py](https://localhost:8080/#) in spin_texture(self, sx, sy, sz, arrow_projection, spin, no_arrow, interpolation, arrow_color, arrow_size, arrow_density, color_bar)
    342             paths = contour.collections[0].get_paths()
    343             verts = [xx.vertices for xx in paths]
--> 344             points = np.concatenate(verts)
    345             self.log.debug("Fermi surf. points.shape: " + str(points.shape))
    346 

/usr/local/lib/python3.10/dist-packages/numpy/core/overrides.py in concatenate(*args, **kwargs)

ValueError: need at least one array to concatenate
lllangWV commented 11 months ago

Hey,

I finally had time to look into this error. So the issue was paths would sometimes be empty, which np.concatenate did not like.

I added to the main branch of pyprocar. Sometime this week I will update pypi and anaconda.

Let me know, if there are any more issues.

Logan Lang

vandan-revanur commented 11 months ago

Could you please update here once you have updated pypi? @lllangWV

lllangWV commented 10 months ago

Hey,

sorry it took so long. I updated pypi to version 6.1.1

Logan Lang

vandan-revanur commented 10 months ago

I tried out the latest version. The numpy ValueError is resolved.