Problemm calculating H bonds

How do I use this algorithm? What does that parameter do?
Post Reply
Ivan Huarte
Posts: 4
Joined: 06 Oct 2023, 14:37
Location: Zaragoza, Spain

Problemm calculating H bonds

Post by Ivan Huarte »

I'm trying to build a cavity array with a spin coupled to one of them in the middle of the array. This is the Hamiltonian:
Imagen2.png
Imagen2.png (12.5 KiB) Viewed 15670 times
, where the two first terms are the energy and hopping for the photons in cavities and the last two represents the energy and coupling of the spin to the cavity in single excitation and two-level-system regime.

The model is a Bosonsite array and a SpinHalfSite added in the middle with IrregularLattice, in index 1 of that unit cell. I made the couplings with add_local_term as it follows:
Imagen1.png
Imagen1.png (42.82 KiB) Viewed 15670 times
...and there is no errors. Everything seems to be ok, but when I try to calculate the H bonds via calc_H_bond(), gives me this error:
Imagen3.png
Imagen3.png (73.86 KiB) Viewed 15670 times
I give you URL's if you want to try to figure out where is the problem:

calc_H_bond(): https://github.com/tenpy/tenpy/blob/mai ... l.py#L1618
to_nn_bond_Arrays(): https://github.com/tenpy/tenpy/blob/mai ... #L707-L742
to_TermList(): https://github.com/tenpy/tenpy/blob/mai ... ms.py#L441

I made a piece of code trying to see the output of to_TermList() applied to my case, and I don't really understand what it makes. It seems that it takes the category string from each opname in onsite_terms and creates one term for each character in it.

I know it is so complicated to follow my explanation, but I would appreciate any kind of help.
Thank you
Ivan Huarte
Posts: 4
Joined: 06 Oct 2023, 14:37
Location: Zaragoza, Spain

Re: Problemm calculating H bonds

Post by Ivan Huarte »

I have finally found where the problem lies. When introducing a SpinHalfSite in the middle of the BosonSite chain, site 0 (BosonSite) of that unit cell containing it, and just the next one are separated when mapping the IrregularLattice graph into a MPO. Therefore, hopping couplings occur between sites 4 and 6, which are not NearestNeighbors. Here is a schematic of the chain (with the spin in the middle):
AtomCavityArray.png
AtomCavityArray.png (8.95 KiB) Viewed 15635 times

Code: Select all

print(Caa.Cm.all_coupling_terms().to_TermList(),'\n\n')
-0.30000 * B_0 Bd_1 +
-0.30000 * Bd_0 B_1 +
-0.30000 * B_1 Bd_2 +
-0.30000 * Bd_1 B_2 +
-0.30000 * B_2 Bd_3 +
-0.30000 * Bd_2 B_3 +
-0.30000 * B_3 Bd_4 +
-0.30000 * Bd_3 B_4 +
0.50000 * B_4 Sp_5 +
-0.30000 * B_4 Bd_6 +
0.50000 * Bd_4 Sm_5 +
-0.30000 * Bd_4 B_6 +
-0.30000 * B_6 Bd_7 +
-0.30000 * Bd_6 B_7 +
-0.30000 * B_7 Bd_8 +
-0.30000 * Bd_7 B_8 +
-0.30000 * B_8 Bd_9 +
-0.30000 * Bd_8 B_9
It seems that all couplings need to be between nearest neighbours to calculate the Hbonds (as shown in the previous error). Does anyone know how to fix this problem and make these become nearest neighbours? Or is there a way to calculate the Hbonds considering next_nearest_neighbors or nn_nearest_neighbors?

Another solution would be to use another time evolution method that doesn't require the use of calc_H_bonds(), but I haven't found anything yet.
Sorry for my clumsiness, but I've only been using this library for a month and I'm finding it hard :)
User avatar
Johannes
Site Admin
Posts: 428
Joined: 21 Jul 2018, 12:52
Location: TU Munich

Re: Problemm calculating H bonds

Post by Johannes »

Indeed, by adding the extra spin site on the center, you get a next-nearest neighbor hopping, so you can't use a NearestNeighborModel anymore.

There's two ways to proceed:
1) Drop the inheritance from the NearestNeighborModel to not generate the H_bond. This means you can't use TEBD anymore, but there's other time evolution methods available, namely TDVP and ExpMPOTimeEvolution, that work with the H_MPO instead.
2) If you insist on using TEBD, you could replace the a_0 site with a GroupedSite of the BosonSite and SpinHalfSite, such that couplings become local again. Note that this comes at a much larger local hilbert space dimension (the product of the two local site dimensions), so the update on this site might be particularly slow and CPU/memory expensive - TEBD CPU time scales with O(chi^3 d^3), so d-> 2d can give you a factor of 8 in the run time!
Ivan Huarte
Posts: 4
Joined: 06 Oct 2023, 14:37
Location: Zaragoza, Spain

Re: Problemm calculating H bonds

Post by Ivan Huarte »

Thank you very much for the reply Johannes. Both methods work very well, although I will finally choose to use TDVP with separate Sites to be able to make couplings that are not nearest neighbors. I would also like to congratulate you for this library, it is very versatile and has a lot of potential.
In fact, I'm using TenPy for my master thesis about a Spin-Boson Cavity Array model to study the emission and communication between emitters in non-analytical regimes, so it is indispensable for me to use these numerical methods.

When I finish the project and optimize the model I can send it to you so that you can add it to the others as an example model (if you want it, of course).
Post Reply