-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgt-logn2com.pl
65 lines (48 loc) · 1.36 KB
/
gt-logn2com.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
58
59
60
61
62
63
64
65
#!/usr/bin/perl -w
# Takes two arguments, the filename and cardinal number of STO
@element = (
" H",
" H", "He",
"Li", "Be", " B", " C", " N", " O", " F", "Ne",
"Na", "Mg", "Al", "Si", " P", " S", "Cl", "Ar",
"Ca", "Sc", "Ti", " V", "Cr", "Mn", "Fe", "Co",
"Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr"
);
my @allines;
#my $file = $ARGV[0];
#my $number = $ARGV[1];
my ($file, $number) = @ARGV;
if (not defined $file) {
die "Need file\n";
}
else{
open(MYFILE,"<$file") or die "Couldnt open file $!";
}
if (not defined $number) {
$number = 1000
}
my $j = 0;
while ( $lines=<MYFILE> )
{
if ( $lines =~ m/Standard orientation:/ )
{
$j = $j + 1;
if ( $j == $number || $number == 1000) {
$i = 0;
while ( $i++ < 4 )
{
$lines=<MYFILE>;
}
@allines=();
while ( ( $lines = <MYFILE> ) && !( $lines =~ m/---/ ) )
{
my @line;
@line= split (/\s+/, $lines);
push (@allines, \@line);
}
}
}
}
foreach my $temp (@allines) {
print "$element[$$temp[2]] $$temp[4] $$temp[5] $$temp[6]\n";
}