Dear Chan,

Yes indeed, kwant has a section about Spatially varying operators. If this doesn't work for you, you need to write what you want in a mathematical way, probably someone will see how to do it or give suggestions about it.

Regards,

On Mon, Jul 27, 2020 at 4:21 PM Prof. CHAN Kwok Sum <apkschan@cityu.edu.hk> wrote:
Thank you for your quick reply. My problem is not about calculating the current in a specific region in the sample. I want to calculate a current which has an operator depends on the direction of the bond. This is similar to the spin current projected on a position-dependent spin-axis  as in section 2.7 in the manual. The position-dependent spin-axis depends on one site only, according to my understanding. I would like to know if it is possible to have position-dependent spin-axis depending on two sites of a bond.
Regards
KS

Dear Chan,

The current is calculated along a hopping for a kwant system. This means that it is calculated on any couple of sites hop=(site1,site2).

So if you provide a list of hoppings  L=[(site1,site2), (site3,site4),(site6, site73)], the kwant module will return the currents for those hoppings.

I hope this helps,

On Mon, Jul 27, 2020 at 3:36 PM Prof. CHAN Kwok Sum <apkschan@cityu.edu.hk> wrote:
Dear Kwant developer,
I want to define a spatially varying current operator which depends on the two sites of a bond. Can this be done giving the “onsite” a function in the current operator definition. According to the manual, the function for onsite has the signature of a Hamiltonian on-site function, does it mean the function can only have one site as its input and cannot have two sites of a bond as input? If “onsite” cannot do the job, any suggestion of how to solve the problem?
Regards,
KS Chan

Disclaimer: This email (including any attachments) is for the use of the intended recipient only and may contain confidential information and/or copyright material. If you are not the intended recipient, please notify the sender immediately and delete this email and all copies from your system. Any unauthorized use, disclosure, reproduction, copying, distribution, or other form of unauthorized dissemination of the contents is expressly prohibited.

--