#!/usr/bin/env perl

use warnings;

open (O, ">n.dat") or die;

print O "# delta n\n";

for ($delta = -1 ; $delta <= 1; $delta += 0.02) {
    # m4 is a macro processor. It replaces FIELD with the value of $b
    system "m4 -DDELTA=$delta param.m4 >param";
    # Run the NRG
    system "nrginit ; nrgrun";
    # Extract <n_d> at the lowest temperature
    $nd = `extractcolumn custom n_d | tail -n 1`;
    chomp($nd);
    print "$delta $nd\n";
    print O "$delta $nd\n";
}
