#!/usr/bin/env perl
# Copy the (processed) results of the current NRG iteration.
# Rok Zitko, zitko@theorie.physik.uni-goettingen.de, Oct 2008

use File::Copy;

my $iter = `getiter`;

sub cp {
    my $fn = shift;
    copy("res/$fn", "dmft/$iter-$fn") 
      or die "Copying $fn failed: $!, stopped";
}

sub cp1 {
    my $fn = shift;
    copy("1/$fn", "dmft/$iter-$fn")
      or warn "Warning: Copying solverlog failed: $!";
}

# Whatever spectral functions we are interested in.
cp("c-imG.dat");
cp("c-self.dat");

# The following are *required* for the DMFT loop
cp("imsigma.dat");
cp("resigma.dat");
cp("imaw.dat");
cp("reaw.dat");

# NRG iteration logs, etc.
cp1("solverlog");
cp1("solverlogneg");
cp1("custom");
cp1("log");
cp1("td");

copy("Delta.dat", "dmft/$iter-Delta.dat")
  or warn "Warning: Copying Delta failed: $!";
