Commit 794dd08c authored by Kloss's avatar Kloss Committed by Joseph Weston

remove explicit sorting of the energies

np.linalg.eigvalsh returns eigenvalues already in ascending order
parent 5486af00
...@@ -117,11 +117,12 @@ class Bands: ...@@ -117,11 +117,12 @@ class Bands:
h0 = mat + mat.conjugate().transpose() + self.ham h0 = mat + mat.conjugate().transpose() + self.ham
# compute energies and if required eigenvectors # compute energies and if required eigenvectors
# numpy routines eigh and eigvalsh return eigenvalues in ascending order
if return_eigenvectors or derivative_order > 0: if return_eigenvectors or derivative_order > 0:
energies, eigenvectors = np.linalg.eigh(h0) energies, eigenvectors = np.linalg.eigh(h0)
else: else:
energies = np.sort(np.linalg.eigvalsh(h0).real) energies = np.linalg.eigvalsh(h0)
output = (energies,) output = (energies.real,)
if derivative_order >= 1: # compute velocities if derivative_order >= 1: # compute velocities
h1 = 1j*(- mat + mat.conjugate().transpose()) h1 = 1j*(- mat + mat.conjugate().transpose())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment