Finding sum of expectation values

How do I use this algorithm? What does that parameter do?
Post Reply
mariocat
Posts: 12
Joined: 10 Mar 2025, 09:17

Finding sum of expectation values

Post by mariocat »

Hello, I am trying to evaluate these quantities here: \(N_a=<\sum_{i}b_{i}^{\dagger}b_{i+1}> ; N_d= <\sum_{i}(b_{i}^{\dagger})^{2}(b_{i+1})^{2}>\)
I have obtained the operators \(b_{i}^{\dagger}; b_{i+1}\) using

Python: Select all

ops = ['Bd'] * model_params['L']
and

Python: Select all

opss=['B']*model_params['L']


And to find \(N_a\) I wrote

Python: Select all

def Na(psi):
    K = 0.0
    L = psi.L
    for i in range(L - 1):                       
        corr = psi.correlation_function("Bd", "B",
                                        sites1=[i],
                                        sites2=[i + 1])[0, 0]
        K += corr                                
    return K.real                                
K = Na(psi)
But I do not know how to evaluate \(N_d\), do you have any ideas? Thanks a lot!
Post Reply