forked from sandialabs/MatMCNP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatmcnp-PC.pl
57 lines (48 loc) · 1.12 KB
/
matmcnp-PC.pl
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/local/bin/perl
#
# usage: matmcnp.pl {job}
# matmcnp program execution
#
#
$cpx = "copy";
$rm = "del";
$mv = "move";
$ar = 0;
$nar = 1;
$job = $ARGV[$ar];
if ($job =~ /(\S+).inp$/) {$job = $1} # Remove .inp, if user added it at command-line.
$numarg = $#ARGV + 1;
if ($numarg != $nar) {
print "\n\n illegal number of arguments, arguments = $numarg \n";
print " usage: $0 {job} \n";
die " try again $!\n";
}
#
# cleanup files
#
if( -e "matmcnp.inp" ) {
system("$rm matmcnp.inp");
}
if( -e "matmcnp.out" ) {
system("$rm matmcnp.out");
}
$file = ${job}.".inp";
$filout = "matmcnp.inp";
if (-r $file ) {
rename ($file, $filout);
}
else {
print " \n \n ERROR ${file} file does not exist \n \n";
die " try again $!\n";
}
#
# run MatMCNP
#
#
system("MatMCNP");
system("$mv matmcnp.out ${job}.out");
system("$mv $filout ${job}.inp");
#
#
#
exit 0;