Resgrp:utilities
This is a share place for utilities, scripts, and Linux tricks (DMT).
Bash shell
jump command (DMT)
The space quota for the $HOME directory is considerably smaller that $WORK. So, one should save input files in $HOME and save all large files (i.e. output, checkpoint files,...) in $WORK. Then, it is quite convenient to branch the folder directories identically in $HOME and $WORK, so they mirror each other.
The following command "jump" changes directory from $HOME to $WORK and vice-versa assuming that these are identically branched (use dirsync for this). Just add the following lines to your .bashrc profile.
#! /bin/bash jump () { unset dname unset jname dname=$(pwd) jname=$(echo $dname | cut -f 2 -d '/') if [ "$jname" = "work" ] ; then jname="${dname/work/home}" echo "cd $jname" else jname="${dname/home/work}" echo "cd $jname" fi cd $jname }
opt command
Allows you to view convergence criteria and step number from a Gaussian Log file.
#!/bin/bash egrep ' out of| SCF Don| Converged| NO | YES| exceeded' $1 | grep -v '\\\\'
freq command
Prints out the first few frequencies, both in the 3N coordinates and the 3N-6 coordinates.
#!/bin/bash egrep ' Low frequencies --| Frequencies --' $1 | grep -v '\\\\' | head -5
dirsync command
Makes two directories, one in home, one in work. Useful to ensure your two directory trees are equivalent (use jump to go between them). if either directory tree is missing a portion you will get an error from the shell. you can also add commands to automatically generate files in a particular folder, here I create a file to add notes and the jobscript file I use in the home directory.
#!/bin/bash # creates directory in both home and work and copies gdvh13_118.sh to home dir var1=$1; name=$(pwd) mkdir $name/${var1} dname=$(pwd) jname=$(echo $dname | cut -f 2 -d '/') if [ "$jname" = "work" ] ; then jname="${dname/work/home}" mkdir $jname/${var1} else jname="${dname/home/work}" mkdir $jname/${var1} fi path=$(echo $dname | cut -f 4- -d '/') cp /home/lmt09/bin/gdvh13_118.sh /home/lmt09/$path/${var1}/gdvh13_118.sh touch /home/lmt09/$path/${var1}/${var1}notes.txt
cas command
View the MCSCF iterations to check convergence and also check any orbital rotations.
#! /bin/awk -f / Step number/{ print; } /WARNING/{ line=$0; getline; line=line $0 ; print line; } /ITN/{ print; }
C shell
jump command
Same as the bash version but works for the c shell.
#!/bin/csh unset dname unset jname set dname="$PWD" set jname=(`echo $dname | cut -f 2 -d '/'`) switch ( $jname ) case work: set jname=(`echo $dname | sed 's/work/home/'`) echo "cd $jname" breaksw case home: set jname=(`echo $dname | sed 's/home/work/'`) echo "cd $jname" breaksw endsw cd $jname exit
Perl script
gregap
graphically displays gaussian results from the log file using gnuplot (so you will need to be using X forwarding).
1. Download file
2. tar -xvzf gregap.tar.gz
3. ./install.sh (ensure this is executable -> chmod 755 install.sh)
Python
checkparallel (G16)
This script will print out the total time that Gaussian 16 spends on a particular link within a file, as well as the average CPU usage. This allows you to find bottlenecks in calculations and quickly determine how well parallelised the link is.
Note that additional printing (#p) is required for this to work, and it is only available for G16. Numerical errors are expected for short running times: the measurements for parallelisation become more precise for longer running times.
#!/usr/bin/python import numpy as np import sys def check_parallel(filename): link_dict = {} with open(filename, 'r') as f: for line in f: l = line.strip() #Data is printed when a link is left if l.startswith("Leave Link"): l = l.split() link = int(l[2]) cpu = float(l[12]) elap = float(l[14]) #Avoid division and numerical errors if elap != 0: if link not in link_dict: link_dict[link] = [] link_dict[link].append([cpu, elap]) #Get number of processors elif l.startswith("Will use up to"): l = l.split() procs = int(l[4]) print("Processors: {:d}".format(procs)) for link in sorted(link_dict.keys()): para = link_dict[link] cpu = [p[0] for p in para] elap = [p[1] for p in para] cpu_ave = np.average(cpu) elap_ave = np.average(elap) para_ave = cpu_ave / elap_ave print("Link: {:4d} Total Time: {:12.1f} CPU/Elap: {:6.2f}".format(link, sum(elap), para_ave)) if __name__ == "__main__": args = sys.argv[1:] check_parallel(args[0])
Contacts
Here there is useful information and people to get in touch with:
Chief Service Technician (Mr. Peter Sulsh): p.sulsh@imperial.ac.uk
ICT Service Desk: service.desk@imperial.ac.uk
Allowances (Mrs. Althea Hartley-Forbes): a.hartley-forbes@imperial.ac.uk
HPC Systems Support Specialist (Mr. Matt Harvey): m.j.harvey@imperial.ac.uk
Printing posters: get in touch with Dr. Ian R. Gould (i.gould@imperial.ac.uk). More information: http://www3.imperial.ac.uk/people/i.gould/poster%20printing1