-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgetE-scan
61 lines (55 loc) · 1.91 KB
/
getE-scan
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
#!/usr/bin/perl
if (@ARGV < 2) { die "Syntax: getE-scan filename identifier [nstates]\nPulls all the optimised energies out of a PES scan.\nidentifier is anything that will pull out the value of the parameter being scanned.\nUse nstates to pull out more than one excited state and calculate actual energies for TD-DFT PES scans.\n" }
$file = $ARGV[0];
$id = $ARGV[1];
$nstates = $ARGV[2];
$read = "n";
$npt = 0;
open (FILE, "<$file") || die "couldn't open $file for reading\n";
while ($line = <FILE>) {
# print "$line $read\n";
if ($line =~ / Optimization completed./) {
$read = "y";
printf "%-3i ", $npt;
}
if (($line =~ /$id/) && ($line =~ /-DE\/DX/) && ($read =~ /y/)) {
@tmp = split(/\s+/,$line);
if ($tmp[3] =~/\d+\.\d+/) {
$r[$npt] = $tmp[3];
}
else {
$r[$npt] = $tmp[4];
}
printf "%6.4f ", $r[$npt];
if ($nstates == 0) {
printf "%12.6f ", $E[$npt][0];
$npt++;
$read = "n";
print "\n";
}
}
if ($line =~ /SCF Done/) {
@tmp = split(/\s+/,$line);
$E[$npt][0] = $tmp[5];
}
if (($line =~ / Excited State/) && ($read =~ /y/)) {
for ($i = 1; $i <= $nstates-1; $i++) {
if ($line =~ / Excited State $i/) {
@tmp = split(/\s+/,$line);
$E[$npt][$i] = $E[$npt][0] + $tmp[5]/27.211;
printf "%12.6f ", $E[$npt][0];
printf "%12.6f ", $E[$npt][$i];
}
}
}
if (($line =~ / Excited State $nstates/) && ($read =~ /y/)) {
@tmp = split(/\s+/,$line);
$E[$npt][$nstates] = $E[$npt][0] + $tmp[5]/27.211;
printf "%12.6f ", $E[$npt][0];
printf "%12.6f ", $E[$npt][$nstates];
$npt++;
$read = "n";
print "\n";
}
}
close (FILE);