File : run_upsiaux.adb


with Reps, Messages, Fouriers_Init;
use Reps, Messages, Fouriers_Init;
with RG_Ops;

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

procedure Run_UpsiAux is

  subtype Scalar is Interval;

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

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

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

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

  Iname: constant String := "40-16-8";    -- name stem for input
  Oname: constant String := "40-16-8";    -- name stem for output
  HDec: constant Boolean := False;        -- use decimal IO for Hamiltonians
  Err:   constant Radius := 1.0E-15;      -- precision for NumFixComp3 etc.

  Rs: Weights;

begin
  Trace;                                  -- activate TraceEnter/TraceLeave
  ShowParam;
  Rs := (Up(R.Q),Up(R.P));                -- for range of RG
  Show(" Rs =",Rs);
  Show("Err =",Err);
-- Show(Dminus);                          -- uncomment this to see Dminus

  declare
    H1,Hdq,Hdp: Hamilton;
  begin
    Read("Fix-" & Iname & ".nh",0,(Two,One),H1,HDec);
    Show("Computing derivatives of H1");
    Gradient(Rs,H1,Hdq,Hdp);

    Write( "Hdq-" & Oname & ".nh",Hdq,HDec); -- save Hdq for other programs
    Write( "Hdp-" & Oname & ".nh",Hdp,HDec); -- save Hdp for other programs
  end;

  declare
    Psi0,Hq,Hzp: Hamilton;
  begin
    Read("Psi-" & Iname & ".nh",0,(Two,One),Psi0,HDec);
    Show("Computing canonical transformation for Psi0");
    UpsiAux(Err,Rs,Psi0,Hq,Hzp);

    Write("Hq-" & Oname & ".nh", Hq,HDec);  -- save Hq for other programs
    Write("Hzp-" & Oname & ".nh",Hzp,HDec); -- save Hzp for other programs
  end;

end Run_UpsiAux;