mailhexu / TB2J

a python package for computing magnetic interaction parameters
BSD 2-Clause "Simplified" License
67 stars 29 forks source link

ValueError: operands could not be broadcast together with shapes (4,4) (3,3) #30

Closed unworker closed 1 year ago

unworker commented 1 year ago

I encountered an error, plz tell me how to solve it.

$ wann2J.py --spinor --groupby spin --posfile POSCAR --efermi -0.21 --kmesh 6 6 1 --elements Cr --prefix_spinor wannier90 --emin -5.3 --emax 2.21

TB2J version 0.7.4.5 Copyright (C) 2018-2020 TB2J group. This software is distributed with the 2-Clause BSD License, without any warranty. For more details, see the LICENSE file delivered with this software.

Reading atomic structure from file ./POSCAR. Reading Wannier90 hamiltonian: non-colinear spin. Starting to calculate exchange.

Green's function Calculation started. 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:45<00:00, 2.22it/s] Traceback (most recent call last): File "/soft/anaconda3/envs/TB2J/bin/wann2J.py", line 186, in run_wann2J() File "/soft/anaconda3/envs/TB2J/bin/wann2J.py", line 181, in run_wann2J orb_decomposition=args.orb_decomposition File "/soft/anaconda3/envs/TB2J/lib/python3.6/site-packages/TB2J/manager.py", line 234, in gen_exchange exchange.run(path=output_path) File "/soft/anaconda3/envs/TB2J/lib/python3.6/site-packages/TB2J/exchange.py", line 775, in run self.calculate_all() File "/soft/anaconda3/envs/TB2J/lib/python3.6/site-packages/TB2J/exchange.py", line 727, in calculate_all self.get_rho_atom() File "/soft/anaconda3/envs/TB2J/lib/python3.6/site-packages/TB2J/exchange.py", line 583, in get_rho_atom [np.trace(x) * 2 for x in pauli_block_all(tmp)]) File "/soft/anaconda3/envs/TB2J/lib/python3.6/site-packages/TB2J/pauli.py", line 131, in pauli_block_all MI = (M[::2, ::2] + M[1::2, 1::2]) / 2.0 ValueError: operands could not be broadcast together with shapes (4,4) (3,3)

mailhexu commented 1 year ago

Hi, This is usually because the Wannier functions are not well localized around the atoms to which they "belong". Here 7 wannier functions are found around 1 atom, which should be equally split into spin up and down but 7 is not dividable by 2. Another possibility is that the wrong --groupby option is used. Best, HeXu

unworker commented 1 year ago

thx, I made it