A (rough around the edges) perl script for pulling data out of Gaussian torsion driver calculations.

Use it from the commandline like: scriptName GaussianOutput TorsionNumber1 TorsionNumber2
The output will be a comma separated list of torsion angles and energies.


#!/usr/bin/perl -w

#USAGE: gScan filename t1 t2 output
# if not arguments prompt for filename and torsions

#parameters from the commandline
my $file = $ARGV[0]; # the name of the logfile
my $torsion1string = $ARGV[1];
my $torsion2string = $ARGV[2];
my @torsion1s;
my @torsion2s;
my $files;
my @energies;
my $energyTemp;
my @scfDone;
my $energy;
my $torsion1temp;
my @torsion1temparray;
my $torsion1;
my $torsion2temp;
my @torsion2temparray;
my $torsion2;

 

open( GLOG, "<", $file);

@gauss_output = <GLOG>; # put each line into an array

close(GLOG);

foreach(@gauss_output){

if ( $_ =~ /SCF Done/ ) {
$energyTemp = $_;
@scfDone = split /\s+/, $energyTemp;
$energy = $scfDone[6];
}
if ( $_ =~ /! $torsion1string/ ) {
$torsion1temp = $_;
@torsion1temparray = split /\s+/, $torsion1temp;
$torsion1 = $torsion1temparray[4];
}#else{$torsion1="not found";}

if ( $_ =~ /! $torsion2string/ ) {
$torsion2temp = $_;
@torsion2temparray = split /\s+/, $torsion2temp;
$torsion2 = $torsion2temparray[4];

}#else{$torsion2="not found";}

if ( $_ =~ / -- Stationary point found./ ) {
print "$torsion1, $torsion2, $energy\n";

}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s