use strict; # Find the lowest-energy geometry # Prepare array EDRvars0 containg the EDR at each u from that geometrr +y open(F,">results.txt"); print F "# Bond_length Delocalization_length EDR \n"; # Loop over all log files foreach my $f (<*log>){ my $c=`grep -c "Normal term" $f`; chomp($c); # Avoid files that do +dn't converge if($c>0){ # Find the bond length. We assume this is built into the file +name my $R = $f; $R=~s/.log//; $R=~s/.*_//; # Find the U valnes my $Ustr = `grep -A37 "EDR alpha" $f | tail -n35|awk "{print \ +\\$3}"`; my @Uvars = split(/\n/,$Ustr); # Convert them into an array my $NU = scalar(@Uvars); # That array has $NU elements # Find the and sum alpha and beta my $EDRstr = `grep -A37 "EDR alpha" $f | tail -n35|awk "{print + \\\$4+\\\$5}"`; my @EDRvars = split(/\n/,$EDRstr); # Print the outputs foreach my $i(0..$NU-1){ print F sprintf("%8.3E %12.6E %12.6E\n",$R,$Uvars[$i],$EDR +vars[$i]); } } } close(F);