Extracting torsion driver data from Gaussian

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



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";




Molecules in DAE format for iBooks.

I wanted to import molecules easily into iBooks format.

After googling, I found several options. One option, mentioned here, uses Blender: http://www.gravitropic.net/2012/07/pdb-to-collada/ uses a plugin for Blender (ePMV). I haven’t investigated this but it looks nice. It is downloadable from the Olsen group at Scripps. (http://epmv.scripps.edu/)

There is, however, a very simple way illustrated here using Pymol and Blender: http://vimeo.com/53674695. However, for small molecules, the small number of polygons means that they look a little blocky (you can subdivide the polygons in Blender, but this doesn’t alter the Collada output).  For most purposes, I suspect that this isn’t going to be a problem. (Instructions as per the video are shown below)

Blender can be downloaded from the Blender.org website, and free academic version of Pymol can be downloaded on Ubuntu linux using apt-get (apt-get install pymol). Similarly on mac you can use Homebrew. The steps are shown below:

1. Open (or create) your molecule in Pymol. If it’s a protein and in the PDB, you can use ‘fetch’ along with the PDB code.

Screen Shot 2014-04-11 at 16.25.39

2. I wanted ball and sticks, so in the command terminal enter

set_bond stick_radius, 0.14, (all)

set sphere_scale, 0.25, (all)

show sticks, (all)

3. Save the image as VRML.

Screen Shot 2014-04-11 at 16.25.48

4. Open Blender and delete the cube object.

Screen Shot 2014-04-11 at 16.29.02

5. Import the VRML file.

Screen Shot 2014-04-11 at 16.29.10

6. Here is your molecule.

Screen Shot 2014-04-11 at 16.29.20

7. Check the camera view.

Screen Shot 2014-04-11 at 16.29.40

8. Export as COLLADA DAE file.

Screen Shot 2014-04-11 at 16.35.20

9. On a mac you can preview in either Preview or Quicklook.

Screen Shot 2014-04-11 at 16.37.30

10. Drag-and-Drop it into your iBook Author document. Screen Shot 2014-04-11 at 16.36.53



If you don’t have access to a VPN connection, but you want to tunnel your internet connection through an external server, you can use the SOCKS proxy settings.

  • In the Terminal app, open a tunnel:
ssh -D 8080  -f -C -N username@address.of.server
  • You will be prompted for your password
  • Then go to System Preferences and create a new location
  • Click on advanced and then click on ‘Socks Proxy’
Image of Network Settings
Network Settings
  • Enter (the localhost IP address) followed by port 8080 (internet)
  • Click apply
  • Your web traffic will now be routed through your server.

Welcome to Buenos Aires

I have arrived in Buenos Aires. Travel was pretty simple, and the flight proceeded without much turbulence (thank goodness). Unfortunately, I had a seat between windows (and over the wing) so I didn’t have much of a view. While we flew over Brazil, I thought I saw Rio and Sao Paolo in the distance (I’m not sure if this is geographically possible). I also thought I saw a huge island at one point until I realized I was staring at the engine in the early morning light.

Once I was at the airport, with help from the research group PA, I got a taxi into the city. The cost was ARS$250 ($ are Argentinian pesos) and the journey, at rush hour, took about an hour. Cell coverage is pretty good despite the high rise nature of the city, and my phone automatically connected to the Claro cell network with a full set of bars (remembering to turn off data roaming). The roads are very wide and marked with lane markings, although this seems to mean very little here (but perhaps that was just my taxi driver). The outer barrios look pretty bleak from the road, but on arriving in the city itself, Capital Federal, everything becomes more closely packed. The buildings get gradually more impressive and taller and taller with overpasses crossing over smaller buildings.

My first impression of the city is that it is like a cross between every European city you’ve ever visited crossed and an apocalyptic film version of New York. We drove past a park that was full of dogs; some tied to trees and others just wandering about; I’m not sure what they were doing there. We passed a market on the side of the road with a huge basket of sweet potatoes and yams. As we pulled up to my building, I noticed building work opposite the building: the scaffolding is best not scrutinized, and I think anyone working for the HSE would probably have had a fit of apoplexy.

I arrived and met my flatmate, Peto, showed me around the apartment. I am living in an area called Palermo (although, I was in error when I wrote that, and it is, in fact, Barrio Norte). It is fairly central; about half way between the microcentro and the chemistry faculty. After I had unpacked, I took a walk around the city. With no real plan, I just wandered and ended up at the Plaza de Republica de Chile. I sat in the park looking at the huge trees (Jacaranda), and watching the planes from the nearby Jorge Newberry airport taking off (a mildly terrifying sight). I wandered along Avenida del Libertador towards the centre of the city, passing the Academy of Arts and the Faculty of Law and Social Science (an incredibly impressive building). Walking further, towards Avenida Alvear, where there are some upscale shops, I passed through a small park with huge trees (Ficus) with the most incredible root systems and birds making the most extraordinary noises. I wandered further to Avenida Callao in search of a shop to buy a SIM card for my phone. I stopped in a Starbucks (yes, I know, but I was pretty tired by this point, and I needed free WIFI) for a quick break and to check the map.

I found myself in Avenida Santa Fe and wandered aimlessly along it. Occasionally walking into shops and having a look around. I stumbled across ‘El Ateneo’, which is an old theatre converted into an amazing bookshop. I bought a SIM from a kiosk. I needed a micro SIM, but it turns out you can just cut off the card around the chip and turn a regular sized SIM card into a micro SIM; it cost $10. After lots more wandering, I found my way back to Calle AgĂĽero and went into a branch of Carrefour to buy some provisions: food is surprisingly expensive.

Back at the apartment, I made some supper (an exciting dish of pasta with butter and an egg) and had a chat with my other flatmate, Milena. I was feeling pretty tired after all of the walking, so I had a quiet, and early, night. My sleep was rather ruined by the fact that I woke up at 0530 (0930 UK time). I have a meeting with my boss this morning, (in an hour) to try and sort some things out.

So, my first impressions.

  • The city is huge (and I mean huge).
  • There are dogs everywhere.
  • There are no rules of the road.
  • A green man doesn’t mean it’s safe to cross just that maybe, just maybe, it’s slightly safer to cross.
  • People actually queue here.
  • Opening times are weird.
  • I’m so glad I brought some Marmite with me.
  • It’s pretty beautiful in a very odd and unique way.

Dispersion correction for Schrödinger Jaguar Results

I am sharing here the perl scripts that I have used for the calculation of the dispersion corrected energy of Jaguar optimised structures. I confess that I haven’t looked at these scripts for a while and there may (will) be errors. The scripts are certainly very rough and I really ought to tidy them up. The general usage for the script is to call multiple results files through a bash script (below), which then calls the Perl script on each file. The results are then printed to an output file.

At some point, I had intended to make this accept multiple input formats and to act interactively, but as Stefan Grimme has provided his own program, DFTD3, which you can download from here, I am not sure that it is necessary. The main reason for this program is that Stefan’s program accepts XYZ coordinates, and we had multiple files in jaguar format. Also, we wanted to tie a script into Gaussian ’03 in order to carry out dispersion corrected optimisation, athough, this is largely a moot point because Gaussian ’09 includes Grimme’s dispersion correction for optimisation (for some functionals).


Grimme, S. (2006). Semiempirical gga-type density functional constructed with a long-range dispersion correction. Journal of Computational Chemistry, 27(15):1787–1799.

Grimme, S., Ehrlich, S., and Goerigk, L. (2011). Effect of the damping function in dispersion corrected density functional theory. Journal of Computational Chemistry, 32(7):1456–1465.

Continue reading


I’m off to Argentina

For those of you who don’t know I will be off to Argentina to start a new job at the end of the month. For those of you who do know it then you will know that this has been a long time coming. I was due to start my job, at the Universidad de Buenos Aires in the Faculty of Natural Sciences, in April but, due to various bureaucratic meanderings,* I have only just been issued a Visa. I now have both a flight date and a valid visa so I am set to depart the UK on the 29th August at about ten in the evening from Heathrow.

What am I going to do there? Well, I applied for a postdoctoral fellowship last year with my soon-to-be-bosses to CONICET (Consejo Nacional de Investigaciones Científicas y Técnicas), which is like the EPSRC in the UK and funds scientific research in Argentina, the project involves crystal engineering of iridium nitrosyl complexes so there will be synthesis (yay/eek), lots of crystallography (hopefully), computational chemistry (woo!) and some electrochemistry (my favourite¡).

I still haven’t sorted out minor details (such as where I am going to live) but I will trying to keep things updated on here and Facebook.

*Although the application was made in June 2012 the decision regarding the grant was only made in December 2012 and the start date was April 2013 but there was a delay with immigration and then various delays with the Argentine Consulate in London.