I would like to put construction of  ampo in a separate sub function  
to  make the main function clear and simple.
One may take the following lines as an example
for(int j = 1; j < N; ++j)
    {
    ampo += 0.5,"S+",j,"S-",j+1;
    ampo += 0.5,"S-",j,"S+",j+1;
    ampo +=     "Sz",j,"Sz",j+1;
    }
The other thing is   measuring quantities such as  magnetization
Real Szj = (psi.A(j)* sites.op("Sz",j) * dag(prime(psi.A(j),Site))).real();
I measured a lof of quantities but I would like to put them in a separate
 function either.
Thanks you very much.
Wz