Dear community,

I want to add random potentials on graphene. Within each unit cell, I want A 
site have the oppsite value to B site. 
That is, random across unit cells, but symmetric respect to zero within every 
unit cell. How to achieve this? I have tried to do so, but cannot find a way.

Below is my code:

```
import numpy as np
import kwant

low = 0
high = 1
def make_syst(a=1):
    syst = kwant.Builder()
    lat = kwant.lattice.honeycomb(a, norbs=1, name=['a', 'b'])
    
    r = 10
    
    def circle(pos):
        x, y = pos
        return x ** 2 + y ** 2 < r ** 2
    
    def onsite(site, low, high):
        return np.random.uniform(low, high)
    
    # first attempt using function, not working, also cannot gurantee a, b are 
truly opposite in value
#     syst[lat.a.shape(circle, (0, 0))] = onsite
#     syst[lat.b.shape(circle, (0, 0))] = -1*onsite  # wrong
    
    # second attempt, still not right
    m = np.random.uniform(low, high)
    syst[lat.a.shape(circle, (0, 0))] = m
    syst[lat.b.shape(circle, (0, 0))] = -m
    
    syst[lat.neighbors()] = 1
    return syst.finalized()


fsyst = make_syst()
# kwant.plot(fsyst)
H = fsyst.hamiltonian_submatrix(params=dict(high=high, low=low))
Es = np.linalg.eigvalsh(H)
plt.plot(Es, '.')
plt.show()
```

Thanks for help!

Reply via email to