Hi Yuhao
> In the system I use two lattices to represent spin up and down. > > lat_u = kwant.lattice.honeycomb(a=1, name='up') > lat_d = kwant.lattice.honeycomb(a=1, name='down') > > When I obtain the scattering wave functions from > wf=kwant.wave_function(sys, en), > it contains the value for both lat_u and lat_d. On 11/01/2018 01:33 PM, Abbout Adel wrote: > Dear Yuhao, > > The order of the wavefunction elements is the same as that of the > sites. Since you know the order of sites from sys.sites the task > becomes very simple. > > In the following example, you can check the family of the sites in > sys.sites and notice that you have the electrons first and then the > holes. The wavefunction order becomes straightforward. > Adel's answer is correct, however I wanted to point out that there's little need to separate internal degrees of freedom onto separate lattices in modern Kwant. You can define your system much more concisely using matrix-valued onsites, not to mention you can use more advanced functionality such as the kwant.operator module to get spatially resolved spin currents etc. Historically the only reason to separate internal degrees of freedom (e.g. spin) onto separate lattices was to force Kwant to choose a certain mode basis in the leads, e.g. modes with spin up and spin down, which would mean that the scattering matrix blocks could be more easily interpreted (e.g. reflection from spin up channel into spin down channel). In modern Kwant you can declare that your lead satisfies a certain conservation law (e.g. spin conservation), as illustrated in the documentation [1], which forces Kwant to use a mode basis that is compatible with the conservation law. For example, if your on-site degrees of freedom are (spin up, spin down) and your lead Hamiltonian conserves spin, then you could declare your lead like so: sigma_z = np.array([[1, 0], [0, -1]]) lead = kwant.Builder(lead_symmetry, conservation_law=-sigma_z) ... This will guarantee that each of the lead modes has a well-defined spin, i.e. that a mode wavefunctions are non-zero only on the spin up or spin down degrees of freedom. Happy Kwanting, Joe [1]: https://kwant-project.org/doc/1/tutorial/superconductors