Hello,
I am trying to implement a $Z4$ symmetry in the electron site, similar to the $Z3$ symmetry in the Z3 site. I created a new site in which I have a $Z_4$ QN, and all operators are equal to the electron site.
Z4pSite(Args const& args = Args::global())
{
auto ts = TagSet("Site,Z4p");
if( args.defined("SiteNumber") )
ts.addTags("n="+str(args.getInt("SiteNumber")));
if(args.getBool("ConserveQNs",true))
{
s = Index(QN({0,4}),1,
QN({1,4}),1,
QN({2,4}),1,
QN({3,4}),1,Out,ts);
}
else
{
s = Index(4,ts);
}
}
When I use this Z4 site, I can measure the totalQN of an MPS that I define
auto sites = Z4p(N,{"ConserveQNs",true});
auto state = InitState(sites);
for(int i = N; i >= 1; --i)
{
state.set(i,"Emp");
}
state.set(1,"Up");
state.set(2,"UpDn");
auto psi = MPS(state);
Print(totalQN(psi));
and it gives me the expected QN. However when I try to make an Hamiltonian that conserves $Z_4$ QN , I aways get the error "From line 173, file itdata/qdense.cc
Setting Tensor element non-zero would violate its symmetry.
Setting Tensor element non-zero would violate its symmetry.
Aborted (core dumped)", no matter how simple the Hamiltonian is, even if it is just a nearest neighbour hopping:
#include "itensor/all.h"
using namespace itensor;
int main()
{
int N = 16;
auto J1=1;
auto sites = Z4p(N,{"ConserveQNs",true});
auto ampo = AutoMPO(sites);
for(int b = 1; b < N; ++b)
{
ampo += -J1,"Cdagup",b,"Cup",b+1;
ampo += -J1,"Cdagup",b+1,"Cup",b;
ampo += -J1,"Cdagdn",b,"Cdn",b+1;
ampo += -J1,"Cdagdn",b+1,"Cdn",b;
}
auto H = toMPO(ampo);
return 0;
}
I'm wondering that could be the problem, as I tried to implement the $Z_3$ symmetry in the tJ siteset and it worked without any problems.
Regards,
Raphael L R C Teixeira