-
Notifications
You must be signed in to change notification settings - Fork 2
/
chkfail
89 lines (84 loc) · 2.35 KB
/
chkfail
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/perl
if (@ARGV < 2) { die "Syntax: chkfail list/filetype fileset outfileprefix\n" }
$type = $ARGV[0];
$files = $ARGV[1];
$pre = $ARGV[2];
if ($type =~ "list") {
$listfile = $files;
}
else {
@FS = split(/\~/,$files);
$listfile = "list";
`ls *$FS[0]*$FS[1]*$FS[2]*$FS[3]* > $listfile`;
}
$goodfile = "$pre.goodopt.list";
$nconfile = "$pre.notconverged.list";
$tsfile = "$pre.notmin.list";
$failfile = "$pre.jobdied.list";
open (GOOD, ">$goodfile") || die "couldn't open $goodfile for writing\n";
open (NCON, ">$nconfile") || die "couldn't open $nconfile for writing\n";
open (TS, ">$tsfile") || die "couldn't open $tsfile for writing\n";
open (FAIL, ">$failfile") || die "couldn't open $failfile for writing\n";
open (LST, "<$listfile") || die "couldn't open $listfile for reading\n";
while (<LST>) {
chomp;
if ($type =~ "list") {
$_ = "$_.log";
}
$filename = $_;
# print "$filename\n";
local $/;
open(LOG, $_) || die "Can't open $_ for reading.\n";
undef $/;
$ncon = "Y";
$fail = "Y";
@file = split(/\n\n+/,<LOG>,-1);
close(LOG)||die "Can't close $_.\n";
for ($i = 0; $i <= $#file; $i++){
if ($file[$i] =~ /Stati/){
# print " $i $file[$i]\n";
# print "sp\n";
$ncon = "N";
}
if ($file[$i]=~/GINC(.+?)@/s){
$ts = "N";
$fail = "N";
$file[$i] =~ s/ //g;
$file[$i] =~ s/\n//g;
$file[$i] =~ s/\r//g;
$file[$i] =~ s/\\/\n/g;
$file[$i] =~ s/,/ /g;
$file[$i] =~ s/ / /g;
$file[$i] =~ s/ -/ -/g;
# print "$file[1]\n";
if ($file[$i] =~ "NImag=0") {
# print "NImag=0\n";
$ts = "N";
}
elsif ($file[$i] =~ "NImag") {
# print "NImag!=0\n";
$ts = "Y";
}
else {
# print "no NImag\n";
$fail = "Y";
}
}
}
# print "$fail $ncon $ts\n";
if ($fail =~ /Y/) {
print FAIL "$filename\n";
}
elsif ($ncon =~ /Y/) {
print NCON "$filename\n";
}
elsif ($ts =~ /Y/) {
print TS "$filename\n";
}
elsif (($ncon =~ /N/) && ($ts =~ /N/)) {
print GOOD "$filename\n";
}
else {
print "$filename\n";
}
}