Hi,


> I am brginner in kwant trying to investigate a graphene ribbon with onsite Coulomb
> energy U<n>, where the electron density <n> at each site should be determined
> self-consistently.

Firstly I should point out that currently Kwant can handle non-interacting systems only.
Adding mean-field interactions to Kwant is an area of current research, and will be added to a future version (although it may take some time before this happens).


>Then, I have to put U<n> as onsite energy. But, I have a problem that, in kwant,
> the onsite energy should be set as a number or a 2x2 tiny-array. Is there any way to
> set the onsite Coulomb energy?

This is not true;  Hamiltonian matrix elements can also be provided as functions that
return scalars or matrices. As it stands you would have to implement a Schrödinger-Poisson self-consistent loop yourself. Although the mathematics of this is clear,
making a _robust_ numerical implementation is a bit more challenging, but for a
given physical case you may be able to make some approximations or calculate
some parts analytically to make things easier. I know of this paper: http://arxiv.org/abs/1511.08044 by some colleagues where they did exactly this.

Happy Kwanting,

Joe