Commit 77b2153f authored by Joseph Weston's avatar Joseph Weston

Merge branch 'patch-13' into 'master'

use the shift-inverse method for finding sparse eigenvalues
in the finite system tutorial.

See merge request kwant/kwant!265
parents 4076779d 4699d600
Pipeline #14170 passed with stages
in 17 minutes and 28 seconds
......@@ -71,7 +71,8 @@
ham_mat = syst.hamiltonian_submatrix(args=[B], sparse=True)
# we only calculate the 15 lowest eigenvalues
ev = sla.eigsh(ham_mat, k=15, which='SM', return_eigenvectors=False)
ev = sla.eigsh(ham_mat.tocsc(), k=15, sigma=0,
return_eigenvectors=False)
energies.append(ev)
......@@ -105,7 +106,7 @@
+
# Calculate the wave functions in the system.
ham_mat = syst.hamiltonian_submatrix(sparse=True, args=[B])
evals, evecs = sorted_eigs(sla.eigsh(ham_mat, k=20, which='SM'))
evals, evecs = sorted_eigs(sla.eigsh(ham_mat.tocsc(), k=20, sigma=0))
# Plot the probability density of the 10th eigenmode.
- kwant.plotter.map(syst, np.abs(evecs[:, 9])**2,
......@@ -124,7 +125,7 @@
+
# Calculate the wave functions in the system.
ham_mat = syst.hamiltonian_submatrix(sparse=True, args=[B])
evals, evecs = sorted_eigs(sla.eigsh(ham_mat, k=20, which='SM'))
evals, evecs = sorted_eigs(sla.eigsh(ham_mat.tocsc(), k=20, sigma=0))
# Calculate and plot the local current of the 10th eigenmode.
J = kwant.operator.Current(syst)
......
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