pybinding icon indicating copy to clipboard operation
pybinding copied to clipboard

Bug in KPM method

Open BertJorissen opened this issue 3 years ago • 1 comments

https://github.com/dean0x7d/pybinding/blob/ec1128aaa84a1b43a74fb970479ce4544bd63179/cppcore/src/kpm/OptimizedHamiltonian.cpp#L112 has the expression of a vector where the index is taken from using an other vector. However, if the Hamiltonian is block-diagonal, the index_queue doesn't contain all the indices to connect all the sites to each other. In essence, you could only reorder for one 'block'. If the matrix is block-diagonal, is would be faster to treat the system in separate calculations. However, this can create strange segmentation errors if for example the hopping parameter between two different systems is changed and goes through zero.

An easy fix is to assign the value of 'row' to the first nonzero integer not in index_queue, and also add this integer to the slice_border_indices-vector. This fix works, and will be added in a future release.

BertJorissen avatar Jan 11 '23 18:01 BertJorissen

Currenlty, all the bug related to the KPM method are solved. The bugs originated from block-diagonal systems, and systems where there were rows/columns with zeros or where the first diagonal-element of a block-diagonal section was zero.

Also, the function KPM.calc_spatial_ldos now works with multi-orbital models.

To install this updated version, please use pip uninstall pybinding and pip install git+https://github.com/BertJorissen/pybinding.

BertJorissen avatar Jan 30 '23 09:01 BertJorissen