plot eigenvectors of a closed system

Dear all, I note in Tutorial 2.4.1. and 2.7.1 that we can plot eigenvectors of a closed system using the code: def plot_data(sys, n): import scipy.linalg as la sys = sys.finalized() ham = sys.hamiltonian_submatrix() evecs = la.eigh(ham)[1] wf = abs(evecs[:, n])**2 kwant.plotter.map(sys, wf, oversampling=10, cmap='gist_heat_r') plot_data(sys, 225) I want to consider a system with spin, so the hopping is a matrix. How to change the the kwant code to plot the eigenvectors of system that spin is considered. Thanks in advances, Weiyuan

Hi Weiyuan,
I want to consider a system with spin, so the hopping is a matrix. How to change the the kwant code to plot the eigenvectors of system that spin is considered.
The short answer is that you can't do it using `kwant.map`. `kwant.map` plots a _scalar_ field defined over sites, whereas your wavefunction with spin degree of freedom is a _spinor_ field over sites. If you just want to plot, say, the spin up / down _components_ of the (absolute squared) wavefunction this is certainly possible: evecs = la.eigh(ham)[1] wf_up = np.abs(evecs[::2, n])**2 wf_down = np.abs(evecs[1::2, n])**2 ... The degrees of freedom in the wavefunction are ordered first by site, and then by internal degree of freedom. Assuming that all your sites have the 2x2 matrix structure, this means that all the even-numbered degrees of freedom are the spin-up ones and the odd-numbered are the spin-down ones. The slices `::2` and `1::2` in the above snippet allow us to access these two parts of the wavefunction array. Hope that helps, Joe

Dear Joe, The reply is very useful for me. Thanks for your help. Best, Weiyuan On Thu, Dec 10, 2015 at 5:15 PM, Joseph Weston <joseph.weston08@gmail.com> wrote:
Hi Weiyuan,
I want to consider a system with spin, so the hopping is a matrix. How to change the the kwant code to plot the eigenvectors of system that spin is considered.
The short answer is that you can't do it using `kwant.map`. `kwant.map` plots a _scalar_ field defined over sites, whereas your wavefunction with spin degree of freedom is a _spinor_ field over sites. If you just want to plot, say, the spin up / down _components_ of the (absolute squared) wavefunction this is certainly possible:
evecs = la.eigh(ham)[1]
wf_up = np.abs(evecs[::2, n])**2 wf_down = np.abs(evecs[1::2, n])**2
...
The degrees of freedom in the wavefunction are ordered first by site, and then by internal degree of freedom. Assuming that all your sites have the 2x2 matrix structure, this means that all the even-numbered degrees of freedom are the spin-up ones and the odd-numbered are the spin-down ones. The slices `::2` and `1::2` in the above snippet allow us to access these two parts of the wavefunction array.
Hope that helps,
Joe
participants (2)
-
Joseph Weston
-
Weiyuan Tong