Page 1 of 1

MPS that is both conserved and in a superposition

Posted: 05 Oct 2018, 14:58
by Pawel
I use bose-hubbard model. I want to construct an MPS that will be in a state of a superposition of 0 and 1 boson at each site. I also want to use this state in a DMRG computation that will conserve number of particles. Here is an example of what I mean:

Code: Select all

from tenpy.models.bose_hubbard_chain import BoseHubbardChain 
from tenpy.networks.mps import MPS
import numpy as np
import matplotlib.pyplot as plt

def show_bosonic_occupation(state):
    L = state.L
    boson_site_number = np.arange(L)
    n = state.expectation_value('N')
    plt.plot(boson_site_number, n, 'k*')
    plt.title("Expectation values of occupation\n")
    plt.ylabel('$\langle n\\rangle$')
    plt.xlabel('site')
    plt.grid()

def psi_superposition(model_params):
    model_params['conserve'] = None
    M = BoseHubbardChain(model_params)
    sites = M.lat.mps_sites()
    initial_state = [0]*(model_params['L'])
    psi0 = MPS.from_product_state(sites, initial_state , bc='finite')
    initial_state = [1]*(model_params['L'])
    psi1 = MPS.from_product_state(sites, initial_state , bc='finite')
    return psi0.add(psi1, 0.5, 0.5)

""" This is a naive approach to what I want. """ 
def psi_conserved_superposition(model_params):
    model_params['conserve'] = 'N'
    M = BoseHubbardChain(model_params)
    sites = M.lat.mps_sites()
    initial_state = [0]*(model_params['L'])
    psi0 = MPS.from_product_state(sites, initial_state , bc='finite')
    initial_state = [1]*(model_params['L'])
    psi1 = MPS.from_product_state(sites, initial_state , bc='finite')
    return psi0.add(psi1, 0.5, 0.5)

def main():
    L = 40
    t=1.0
    U = 1.0
    Mu=16.0
    verbose_model = 0
    model_params = {'L': L,'n_max': 2, 'filling': 0.5, 'bc_MPS': 'finite',
                    't':  t, 'U': U, 'mu': Mu, 'verbose': verbose_model}

    psi = psi_superposition(model_params) # works great
    #psi = psi_conserved_superposition(model_params) # doesn't work
    show_bosonic_occupation(psi)
    return 0

if __name__ == '__main__':
    main()

Re: MPS that is both conserved and in a superposition

Posted: 09 Oct 2018, 22:15
by Johannes
I'm not sure I understand what you want to do.
Charge conservation can be used when your Hamiltonian commutes with the (total) particle number operator, which is the case for the usual Bose Hubbard model. In other words, the Hamiltonian is block-diagonal with a block consisting of the subspace with a given particle number. These blocks are basically independent of each other.
"Charge conservation" in DMRG means that if you start in a given charge sector (i.e. from an initial state with a given, well defined particle number), you will remain there. As a by-product, you can exploit the block-diagonal form of the (effective) Hamiltonian for faster calculations.
Thus, by running DMRG multiple times, starting from initial states in each of the symmetry sectors, you can find the "ground state" in each symmetry sector sector separately, with a corresponding "ground state energy". Note the quotation marks: seen globally there is only a single ground state (assuming that there is no degeneracy), namely the one from the sector with the overall lowest energy.
Actually, the chemical potential does nothing else than tuning the energy of the different sectors, without changing the eigen states: the \(-\mu N\) commutes with the rest of the Hamiltonian! By tuning the chemical potential, you can select which charge sector has the "true" ground state, leading to the famous "mott lobes" in the phase diagram of the Bose-Hubbard model.

Now what do you expect to get if you start from an initial state which is a superposition of the different symmetry sectors?
As DMRG aims at finding the state with lowest energy in the given variational space, you should expect to find the true, global ground state (assuming that the initial state has overlap with all charge sectors)! This is also what you get when you turn off charge conservation in DMRG (at least if your initial state has some overlap with true ground state, or if you're lucky that round-off errors give you some overlap in the correct charge sectors, and leaving aside possible convergence issues of DMRG...).

Let me also point out that the initial state which you wrote down is something like \(|\psi\rangle = |00...0\rangle + |11...1\rangle\) (up to normalization). I guess what you really want to write down is the state \(|\phi\rangle = (|0\rangle + |1\rangle)(|0\rangle + |1\rangle)...(|0\rangle + |1\rangle)\)
For the latter, you should initialize your state as follows:

Code: Select all

local_state = np.zeros(model_params['n_max'])
local_state[0] = local_state[1] = 1.
local_state /= np.linalg.norm(local_state)
initial_state = [local_state]*(model_params['L'])
psi0 = MPS.from_product_state(sites, initial_state , bc='finite')
As this state does not have a well-defined particle number, doing this works only if you set conserve=None in the model parameters.

Re: MPS that is both conserved and in a superposition

Posted: 09 Oct 2018, 22:34
by Johannes
As a side note for future readers:

The question makes more sense if you ask for doing a real-time evolution instead of DMRG.
Formally, one can decompose the state as \(|psi> = \sum_n c_n |psi_n\rangle\) where \(|\psi_n\rangle\) is a state with well defined partice number n. Evolving each of theses states separately with the hamiltonian will give the time evolution of the full state.
Doing this explicitly (i.e. writing down multiplte MPS for the psi_n) to exploit charge conservation for a speed-up will only work if there are only few charge sectors with non-zero coefficients c_n, but not if you have a superpostion of all possible particle numbers.

In TeNPy, you can use a Hack to do this, name to use "segment" instead of "finite" boundary conditions for the MPS, with a tivial left virtual leg (on the very left of the MPS), but a non-trivial right virtual leg with indices for the various possible charges. I'm not 100% sure right now, but I think this should indeed give a speed up. However, it is much harder to write down the initial state; it will not have bond dimension 1 anymore (even for the state I wrote down in the last post).

If you need this, let me know by replying to this post. I have some function for generating such an initial state lying around somewhere in my old codes, but not yet adjusted for TeNPy...

Re: MPS that is both conserved and in a superposition

Posted: 16 Oct 2018, 10:37
by Pawel
Hi Johannes, thanks for this extensive answer!

The example which I gave might not be the best one. I work in a sector of a fixed number of particles which equals half the number of sites.
I initialise my state with

Code: Select all

initial_state = [0]*(L//2) + [1]*(L//2)
wich effectively gives half a particle per site. My Hamiltonian commutes with the number of particles operator so I use the option

Code: Select all

conserve='N'
As a DMRG result I get a state which has \(\langle n_i \rangle = 0.5\) on all sites.
What I wanted to do was to check if the DMRG will work faster as I will start from the initial state that resembles the final one.

Re: MPS that is both conserved and in a superposition

Posted: 16 Oct 2018, 13:01
by Johannes
So this is the state |0...01....1> which has a fixed, well defined particle number L//2, and can be initialized with MPS.from_product_state().
This is a highly non-uniform state, with particles only on the right half.
Instead, I would highly recommend to use a more uniform initial state
|1010101...> instead, which you can simply initialise with

Code: Select all

initial_state = ([0, 1]*L)[:L] # for odd L it will have (L-1)/2 particles
(Unless you expect something like this as a final ground state, e.g. because you have a magnetic field/chemical potential gradient.)
Compared to the state |0...01...1>, the state |010101...> does not require to move particles by an extensive distance through the system, so DMRG (which makes local updates to the state only :!: ) should converge faster, i.e. with less necessary sweeps. The extreme case of |0...01...1> might even lead to convergence issues.