Hi Joe,

Thanks for the reply. I am running a simple QPC simulation in B field like
the QHE example, but with a realistic potential (with compressible and
incompressible strips). I will try using the current operator from the
bleeding edge version.

Thanks,
Harshad

On Tue, Jan 10, 2017 at 4:18 AM, Joseph Weston <[email protected]>
wrote:

> Hi Harshad,
>
> > I am trying to calculate current density from the wavefunctions using the
> > following code:
> >
> > for i in range(Np):
> >     for j in range(Nc):
> >         lat_idx_i = i-floor(Np/2)
> >         lat_idx_j = j-floor(Nc/2)
> >         site_i = lat(lat_idx_i, lat_idx_j)
> >         idx_i = sys.sites.index(site_i)
> >
> >         if i < Np-1:
> >             site_j = lat(lat_idx_i+1, lat_idx_j)
> >             idx_j = sys.sites.index(site_j)
> >             H_ij = sys.hamiltonian(idx_i, idx_j, V, peierls_phase_factor)
> >             current_density_bond_x[i][j] = -2 *
> (wf_orb[idx_i].conjugate() \
> >                                                 * H_ij *
> wf_orb[idx_j]).imag
> >
> >         if j < Nc-1:
> >             site_j = lat(lat_idx_i, lat_idx_j+1)
> >             idx_j = sys.sites.index(site_j)
> >             H_ij = sys.hamiltonian(idx_i, idx_j, V, peierls_phase_factor)
> >             current_density_bond_y[i][j] = -2 *
> (wf_orb[idx_i].conjugate() \
> >                                                 * H_ij *
> wf_orb[idx_j]).imag
> >
> > However, this code snippet takes about one and a half hours to run. The
> > total number of sites in the system is about 201000. Is there any other
> way
> > to write the code so that it runs faster?
>
> There are a number of things that could be done, however in the next
> release of Kwant (1.3) there will be direct support for calculating
> currents from wavefunctions. We hope to have this release before the end
> of the
> month.
>
> In the meantime you can use the bleeding-edge version
> of Kwant available on the Kwant Gitlab [1] (although this will require
> building the package as described in the "contribute" documentation
> [2]).
>
> If you decide to go this route, could you post a complete example
> script for your problem, so that I can test the performance of our
> implementation of current calculation? In any case you can post
> back in this thread with additional questions/updates.
>
> Thanks,
>
> Joe
>
> Links
> -----
> [1]: https://gitlab.kwant-project.org/kwant/kwant
> [2]: https://kwant-project.org/contribute
>

Reply via email to