# How to create a new QN

+1 vote

Hi Miles,

I ran into some problems when defining a new QN.
Let me first explain what I want to do:
I wanted to study a two-component Hardcore-Boson model, i.e. on each site, there are two kinds of bosons, say, A and B. In this model, the number of boson A and B both conserve.
I thought a way to do this is use the "hubbard.h" as a template, because there we also have two conserved quantum numbers "Sz" and "Nf".
What I actually did is to substitute "Sz"and "Nf" with "Nb" in hubbard.h , as well as rewriting correspondent operators. However, dmrg program does not work. I printed the Hamiltonian and state tensors, I found their indices QN only has one value.
So I guess maybe program can not recognize two same type of QN. In another word, if I write:
site_.at(j) = IQIndex(nameint("site=", j), Index(nameint("Emp ",j), 1, Site), QN("Nb=", 0, "Nb=", 0), Index(nameint("A ", j), 1, Site), QN("Nb=", 1, "Nb=", 0), Index(nameint("B ", j), 1, Site), QN("Nb=", 0, "Nb=", 1), Index(nameint("AB ", j), 1, Site), QN("Nb=", 1, "Nb=", 1));
the program will only see one "Nb=" slot, right?

If this is true, I think there could still be one solution, i.e. defining two types of slots with new names. So here comes the next question: how to make it?
I tried in the following way: in the "qn.h" and "qn.cc" whenever I see "Nb", I duplicate that line of code only changing "Nb" into new names "Nba" and "Nbb", and back to the site file, I rewrite:
site_.at(j) = IQIndex(nameint("site=", j), Index(nameint("Emp ",j), 1, Site), QN("Nba=", 0, "Nbb=", 0), Index(nameint("A ", j), 1, Site), QN("Nba=", 1, "Nbb=", 0), Index(nameint("B ", j), 1, Site), QN("Nba=", 0, "Nbb=", 1), Index(nameint("AB ", j), 1, Site), QN("Nba=", 1, "Nbb=", 1));

I think in this way I should have create two kind of new slots "Nba","Nbb"with the same property as that of "Nb". But it still cannot work. Again, I print the tensors, but it shows "QN()", which means it still cannot recognize the new names of QN slots. So could you please show me what else should I do when I want to define a new QN slot with new name?

Thank you.
Best,
Zhiyu

+1 vote
answered Mar 5 by (18,230 points)
selected Mar 14 by Zhiyu

Hi Zhiyu,
We just put the "named slot" feature into the QN system for convenience when making very common types of QNs. I think your best bet here is to instead just use the "manual" way of making QNs where you specify the value and mod factor of each slot. So for two separately conserved types of hardcore bosons (without spin) I would just do:

QN({na,1},{nb,1})

where na and nb are integers (0 or 1) indicating how many of each type of boson you have.

Does that work for your problem?

Miles

commented Mar 10 by (280 points)
Hi Miles,
It works! Thank you:)

Zhiyu