## How to calculate particular correlation function only between the nearest neighbors sites in my lattice?

How do I use this algorithm? What does that parameter do?
Ozaru9000
Posts: 3
Joined: 01 Nov 2019, 18:29

### How to calculate particular correlation function only between the nearest neighbors sites in my lattice?

Hi! I am trying to calculate some correlation functions ONLY between nearest neighbors in a Honeycomb lattice. If I use the "correlation_function()" from the "MPS" class I get an array of given correlation function between all sites in an MPS. How can I extract only the values that correspond to nearest neighbors of my lattice? I wanted to use lattice.pairs['nearest_neighbors'], but it returns as an output a list of (u1, u2, dx) values and I don't know, how can I use these to get the information that I want.

Johannes
Posts: 159
Joined: 21 Jul 2018, 12:52
Location: UC Berkeley

### Re: How to calculate particular correlation function only between the nearest neighbors sites in my lattice?

You need to do some postprocessing, there is currently no function for that in TeNPy.
However, I agree that it would be very useful to have it. If you write the function, it would be great if you could post it here such that we can include it in TeNPy (or you just submit a pull request on github).

You can call the function possible_couplings for each of the (u1, u2, dx) in the nearest neighbor pairs to get an explicit list of all the pairs of MPS indices (i,j) corresponding to the nearest neighbors (from the returned mps1, mps2).
However, I'm not sure if this enough for your purpose.

Are you using finite or infinite boundary conditions?

Ozaru9000
Posts: 3
Joined: 01 Nov 2019, 18:29

### Re: How to calculate particular correlation function only between the nearest neighbors sites in my lattice?

Hi! Thank you for the hint. I came up with the following function:

Code: Select all

# Returns list of MPS indices corresponding to coupled sites in the lattice
def get_nearest_neighbors(lattice):
neighbors = []
for u1, u2, dx in lattice.pairs['nearest_neighbors']:
possible_couplings = lattice.possible_couplings(u1, u2, dx)
for i in range(len(possible_couplings)):
neighbors.append((possible_couplings[i], possible_couplings[i]))
return neighbors

It gets as a parameter some lattice, but it can be easily modified so that it can be a method in the Lattice class.

Johannes
Posts: 159
Joined: 21 Jul 2018, 12:52
Location: UC Berkeley

### Re: How to calculate particular correlation function only between the nearest neighbors sites in my lattice?

Looks good!
May I ask how for an example what you calculated in the end (roughly)?
It probably suffices for terms with the same operators on both sites (e.g. density-density correlations "N_i N_j"),
but might not be enough for more complicated pair correlations with different operators (e.g. for "Cd_i C_j" terms).

Ozaru9000
Posts: 3
Joined: 01 Nov 2019, 18:29

### Re: How to calculate particular correlation function only between the nearest neighbors sites in my lattice?

Hi! Sorry for the long delay with my answer. I was just calculating something like $$\langle S_i^{+} S_j^{-}\rangle$$ for the nearest neighbors in a spin system 