+1 vote
asked by (280 points)
edited by

Hi,

I was wondering if you could give me some help on this: suppose I want to add one single ancilla to an MPS, and let's say it's somewhere in the middle of the chain. Is there a way for doing this?

In other words, do I need to add a single site to the current MPS or do I define a new MPS with just one more site and copy all the information into it?

Could you also comment on when I have quantum numbers as well?

Thank you,
Kasra

1 Answer

0 votes
answered by (70.1k points)
selected by
 
Best answer

Hi, so this is definitely something you can do, but needs to be done “manually” by manipulating MPS tensors. The procedure I would use is this:

Say you have an original MPS psi with length(psi)==N.

  1. define a new MPS with one more tensor than before:
    M = MPS(N+1)

  2. copy most of the MPS tensors unchanged, such as M[1] = psi[1]; M[2] = psi[2]; etc.

  3. wherever you want to add the ancilla, make the tensor there be the outer product of an identity matrix connecting the virtual or link index from the previous MPS tensor to the next MPS tensor. Outer product into this the tensor defining the state of the ancilla site. Graphically it would look like this:

           |
           O
        ———————
    

Hope that gives you enough to get started on it.

For quantum numbers, you would need the identity matrix to have the appropriate arrows to match the link indices of the neighboring MPS tensors.

An alternative to all of this is to define your original MPS on the enlarged system from the very beginning, with the ancilla already there, and just ignore or skip over the ancilla in your original calculation or preparation that makes the MPS (such as a DMRG calculation, but with a Hamiltonian that skips over the ancilla site). Then later it will still be there and you can couple to it.

Miles

commented by (280 points)
Thanks for your answer Miles, a basic question:

When I use for example the phrase MPS(10) I get the following error:
"UndefRefError: access to undefined reference"
(The documentation says:
"MPS(N::Int)
Construct an MPS with N sites with default constructed ITensors.")

Could you please let me know what I'm doing wrong?
commented by (280 points)
Also, do you have a code example for doing something similar to this:
"For quantum numbers, you would need the identity matrix to have the appropriate arrows to match the link indices of the neighboring MPS tensors."
commented by (14.1k points)
Here is a short example code following the outline Miles gave:

    using ITensors

    N = 4
    s = siteinds("S=1/2", N; conserve_qns=true)
    psi = randomMPS(s, n -> isodd(n) ? "Up" : "Dn"; linkdims=3)

    n = 3 # New site location
    sn = siteind("S=1/2", n; conserve_qns=true)
    ln = linkind(psi, 2)
    ln_sim = sim(ln)
    psin = onehot(sn => 1) * delta(dag(ln), ln_sim)
    psi[n] *= delta(dag(ln_sim), ln)
    insert!(psi.data, n, psin)

-Matt
Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...