c print *,'Gen_Rand_Conf: i=',i,' it=',it,' it1=',it1,' it2=',it2,
c & ' nit=',nit,' niter=',niter,' maxgen=',maxgen
phi(i+1)=gen_phi(i+1,it1,it)
if (back) then
phi(i)=gen_phi(i+1,it2,it1)
print *,'phi(',i,')=',phi(i)
c print *,'Gen_Rand_Conf: i=',i,' it=',it,' it1=',it1,' it2=',it2,
c & ' nit=',nit,' niter=',niter,' maxgen=',maxgen
phi(i+1)=gen_phi(i+1,it1,it)
if (back) then
phi(i)=gen_phi(i+1,it2,it1)
print *,'phi(',i,')=',phi(i)