summaryrefslogtreecommitdiff
path: root/sim/src/tests/scripts/testmmppotential
blob: cc2f01e5e423fb94a3b44178419e9d591f484000 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl

# usage:
#
# testmmppotential initial increment limit input.mmp > output

# Loops with a parameter value starting at initial, adding increment
# each time, until limit is reached.  For each parameter value, the
# file input.mmp has the parameter substituted in with mmpsubstitute,
# and the result is fed to the command "simulator -E result.mmp".  The
# parameter and resulting potential from the simulator output are
# printed to stdout.

$initial = $ARGV[0];
$increment = $ARGV[1];
$limit = $ARGV[2];
$input = $ARGV[3];

$tmp = "/tmp/testmmppotential$$.mmp" ;

for ($i = $initial; $i < $limit; $i += $increment) {
    system "mmpsubstitute $i < $input > $tmp";
    $result = `simulator -m -E $tmp`;
    $result =~ s/.Potential.*//;
    unlink $tmp;
    print "$i $result";
}