File : run_tilder.adb


with Reps, Messages, Fouriers_Init, Lin, Lin.IO;
use Reps, Messages, Fouriers_Init, Lin, Lin.IO;
with RG_Ops;

with Intervals, Intervals.Ops, Intervals.IO;
use Intervals, Intervals.Ops, Intervals.IO;
pragma Elaborate_All(Intervals.Ops, Intervals.IO);

procedure Run_TildeR is

  subtype Scalar is Interval;

  Lmax: constant Positive := 40;
  Wmax: constant Positive := 40;
  Pdeg: constant Positive := 16;
  Dho:  constant Natural  :=  6;

  Sigma: constant Rep := 0.85001;
  Kappa: constant Rep := Sigma/0.4;

  package Run_TildeR_Ops is new RG_Ops (Lmax => Lmax, Wmax => Wmax, Pdeg => Pdeg, Dho => Dho,
                                        Sigma => Sigma, Kappa => Kappa, Scalar => Scalar);
  use Run_TildeR_Ops;
  use Scal_Fou, Scal_Fou_Ops, Scal_Fou_IO;

  R: constant Weights := (0.85,0.15);      -- for domain of RG

  RBall: constant Radius := 3.0E-12;       -- for contraction MM

  Iname: constant String := "40-16-8";     -- name stem for input Hamiltonians
  Yname: constant String := "85B04";       -- name stem for input matrices
  HDec:  constant Boolean := False;        -- use decimal IO for Hamiltonians

  Nyy:  constant Positive := 294911;       -- maximum number of entries in sparse matrix W
  Fac:  constant Integer  := GetArg(1);    -- 1 or 2, multiplies RBall

  B3: Radius;
  Rs: Weights;
  Hb: HBall;
  H1,Hq,Hzp,Ht: Hamilton;
  W: Sparse(0 .. Nyy);

begin
  Trace;                                   -- activate TraceEnter/TraceLeave
  Show("argument: Fac =",Fac);
  ShowParam;
  Show(" R  =",R);
  Rs := (Up(R.Q),Up(R.P));                 -- for range of RG
  Show(" Rs =",R);

  Read("W-" & Yname & ".tdr",W);

  Read("Fix-" & Iname & ".nh",0,(Two,One),H1,HDec);
  Read("Hzp-" & Iname & ".nh",0,(Two,One),Hzp,HDec);
  B3 := Sup(Norm(Rs,Hzp));
  Read("Hq-"  & Iname & ".nh",1,(Rs.Q,B3),Hq,HDec);

  Hb.R := R;
  Hb.E := Scal(Rep(Fac)*RBall);
  Show("Ball:",Sup(Hb.E));

  Show("Computing ~R(H1,M*Ball)");
  TildeRoM(Rs,W,Hq,Hzp,H1,Hb,Ht);        -- TildeSoM eats domain before HoToU
  Show("Norm:",Sup(Norm(Rs,Ht)));

end Run_TildeR;