Search found 12 matches

by mariocat
22 May 2025, 16:37
Forum: HowTos and FAQ for TeNPy
Topic: Finding sum of expectation values
Replies: 1
Views: 35524

Finding sum of expectation values

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 ops = ['Bd'] * model_params['L'] and opss=['B']*model_params['L'] And to find N_a I wrote def Na...
by mariocat
17 Apr 2025, 20:51
Forum: HowTos and FAQ for TeNPy
Topic: Correlation function
Replies: 3
Views: 45526

Re: Correlation function

More: what should I write to evaluate\(<e^{i\pi(1-n_{4})}...e^{i\pi(1-n_{30})}>\) in a \(N=36\) Bose-Hubbard model. Basically I want to arbitrarly choose the first and last site of the product. Thanks!
by mariocat
17 Apr 2025, 20:40
Forum: HowTos and FAQ for TeNPy
Topic: Correlation function
Replies: 3
Views: 45526

Re: Correlation function

Hello, thanks for the long answer and clarification!
I was wondering if

Python: Select all

i=psi.sites[0].Id
ni = psi.sites[0].N
expi_ni=expm(1j*np.pi*(i-ni))
P=psi.expectation_value_multi_sites([expm(1j*np.pi*(i-ni))],i0=4)
Could be used to evaluate \(<e^{(i\pi(1-n_4)}...e^{(i\pi(1-n_{36}))}>\)
by mariocat
13 Apr 2025, 09:59
Forum: HowTos and FAQ for TeNPy
Topic: Correlation function
Replies: 3
Views: 45526

Correlation function

Hello all, I am trying to implement <e^{\sum_{i<j}(\mathbb{1}-n_i)}> . For instance for j=36 . I am trying to do it using Bose-Hubbard model and tried to write it as: N=36 model_params = { "L": N, "t": 1.0, "U": 0.0, "n_max": 4, "bc_MPS": "finit...
by mariocat
12 Apr 2025, 07:23
Forum: HowTos and FAQ for TeNPy
Topic: Correlation function
Replies: 1
Views: 43692

Correlation function

Hello all, I am trying to implemente the correlation function $$<b_{i}^\dagger b_{j}>-<b_{i}^\dagger><b_{j}>$$ (with i=4 and j goes from 4 to 46) where the last number is the value of L in model_params like this: model=BoseHubbarModel(model_params) init_state = ['1'] * model.lat.N_sites psi = MPS.fr...
by mariocat
06 Apr 2025, 16:08
Forum: HowTos and FAQ for TeNPy
Topic: Changing Bose-Hubbard model
Replies: 9
Views: 738421

Re: Changing Bose-Hubbard model

Hey, still sorry for bothering! Actually there's something I am not really getting: 1) alpha = model_params.get('alpha', np.pi, 'real') N_diag = np.arange(site.Nmax + 1) site.add_op('P_alpha', np.diag(np.exp(1.j * alpha * N_diag)), permute_dense=True) Could you please explain me what these 3 lines d...
by mariocat
03 Apr 2025, 20:58
Forum: HowTos and FAQ for TeNPy
Topic: Changing Bose-Hubbard model
Replies: 9
Views: 738421

Re: Changing Bose-Hubbard model

Thanks, it works!
by mariocat
03 Apr 2025, 15:07
Forum: HowTos and FAQ for TeNPy
Topic: Changing Bose-Hubbard model
Replies: 9
Views: 738421

Re: Changing Bose-Hubbard model

Thanks again! I do appreciate your help! Just one last thing: how would you implement something like $$-\tau \sum_{\langle i,j \rangle i<j} e^{i \alpha\, n_i}\left( b_i^\dagger b_j + b_j^\dagger b_i \right)$$ where alpha is just a generic number. So basically this accounts to taking the BH Hamiltoni...
by mariocat
02 Apr 2025, 16:25
Forum: HowTos and FAQ for TeNPy
Topic: Changing Bose-Hubbard model
Replies: 9
Views: 738421

Re: Changing Bose-Hubbard model

Hello, thanks for the answer. Actually I do not want to add a new term in the Hamiltonian but simply modify the first one by putting the parity operator just after the sum symbol and before b_i+bj +h.c.
I dont know if I've been clear!
by mariocat
02 Apr 2025, 07:36
Forum: HowTos and FAQ for TeNPy
Topic: Changing Bose-Hubbard model
Replies: 9
Views: 738421

Changing Bose-Hubbard model

Hello, I would like to change the Bose-Hubbard Model such that in the first sum in can add \exp{(j*\pi*n_{i})} , where ni is the number operator acting on the i site. How can I do this? I was thinking about working on this part of the classe: def init_terms(self, model_params): # 0) Read and set par...
by mariocat
02 Apr 2025, 07:26
Forum: HowTos and FAQ for TeNPy
Topic: Obtainin expectation value of number operator in BH model
Replies: 3
Views: 87345

Re: Obtainin expectation value of number operator in BH model

Hello, thanks for your reply.
Yes, I meant in the ground state! What would be the complete code line?
by mariocat
10 Mar 2025, 09:20
Forum: HowTos and FAQ for TeNPy
Topic: Obtainin expectation value of number operator in BH model
Replies: 3
Views: 87345

Obtainin expectation value of number operator in BH model

Hello everyone,
I have a simple question (I guess). I'm trying to find the expectation value of the number operatore using the BH model but I'm really stuck. Does anyone know how to do it? Thanks!