Page 1 of 1

Matrix representation of dN operator

Posted: 29 Feb 2024, 14:05
by jper30
Hello,
Is there an easy way to access the matrix representation of the dN operator for fermion sites? Specifically if the filling is 0.5, and so dN = n - 0.5, how can this be represented as a matrix?

Thank you

Re: Matrix representation of dN operator

Posted: 10 Apr 2024, 12:45
by Jakob
Yes, you can have a look at the operator in the site

Code: Select all

In [3]: import tenpy as tp

In [4]: site = tp.FermionSite(filling=0.5)

In [5]: site.dN
Out[5]: <npc.Array shape=(2, 2) labels=['p', 'p*']>

In [6]: site.dN.to_ndarray()
Out[6]: 
array([[-0.5,  0. ],
       [ 0. ,  0.5]])

In[7]: # The basis is { |empty> , |full> } as we can check by looking at the state_labels:

In [8]: site.state_labels
Out[8]: {'empty': 0, 'full': 1}