12 January 2017

632. How to set up a few different types of jobs in Gaussian 09 (D/E)

I haven't posted anything for a long time. Partly because with each post I have one fewer issue to solve in the future, and partly because I'm busy, which is a good thing to be if you're an academic.

Either way, I've been doing a lot of fun computational stuff during the past year. Because I have the memory of a goldfish (not as bad as they claim) I'll post some of the techniques here. Nothing fancy, but still handy stuff.

Let's start with the easiest. I'll also have to disappoint by not actually going through the inputs (I don't have the time) -- but at least it gives you something to dissect.


Paramagnetic systems
You should always do a fragment guess when doing computations on a paramagnetic system. There used to be pretty decent example on the gaussian website, but the link's dead.
So, here's an example using MnII(H2O)72+:
%nprocshared=6
%Mem=800000000
%Chk=Mn_heptaaqua_fragmentguess-1.chk
#P uPBE1PBE/def2svp 5D 7F Punch=(MO) Pop=() guess=(fragment=8,only) nosymm

Mn_heptaaqua_fragmentguess

2 6 2 6 0 1 0 1 0 1 0 1 0 1 0 1 0 1! charge and multiplicity
 Mn(fragment=1)    -0.00562000     -0.159820     -0.00534000
 O(fragment=2)    0.806850     2.92945     0.648110
 H(fragment=2)    0.517800     2.22992     1.19065
 H(fragment=2)    0.710610     2.64504     -0.251480
 O(fragment=3)    -2.27505     2.01043     -0.829720
 H(fragment=3)    -1.61846     1.53635     -1.35764
 H(fragment=3)    -2.16217     1.69798     0.0680700
 O(fragment=4)    1.25719     0.434100     -2.53776
 H(fragment=4)    1.44642     -0.489420     -2.38016
 H(fragment=4)    1.93095     0.912890     -2.06836
 O(fragment=5)    -0.763700     -0.365100     2.64881
 H(fragment=5)    -1.25350     0.434770     2.55458
 H(fragment=5)    0.142800     -0.109660     2.78161
 O(fragment=6)    2.85799     -0.0152600     0.774460
 H(fragment=6)    2.85234     -0.657260     0.0556300
 H(fragment=6)    2.56047     -0.559630     1.50359
 O(fragment=7)    -2.58701     -1.35998     -0.392700
 H(fragment=7)    -2.33975     -1.98479     0.179520
 H(fragment=7)    -2.25366     -1.27355     -1.16844
 O(fragment=8)    0.506670     -2.98431     -0.354720
 H(fragment=8)    0.314610     -2.83412     0.445580
 H(fragment=8)    0.228450     -2.74784     -1.07163

--Link1--
%nprocshared=3
%Mem=800000000
%Chk=Mn_heptaaqua_fragmentguess-1.chk
#P uPBE1PBE/chkbasis 5D 7F Opt=() SCRF=(PCM,Solvent=water)  Punch=(MO) Pop=() guess=read geom=allcheck nosymm
The keys here are: 1) everything is divided into fragments (Mn and each H2O are individual fragments). 2) The spin state for the total system is given, followed by the multiplicities and charges of each fragment and 3) the first calculation is just used to generate a fragment guess ( guess=(fragment=8,only) ). 4) The first job is then immediately followed by a second job defined in link1, and it reads in the fragment guess, the geometry and the basis set from the first job. NOTE: fragment guesses can't use SCRF.

Freezing atoms
This is pretty basic, but useful. The example uses Mg(H2O)62+.
%nprocshared=6
%Mem=800000000
%Chk=Mg6aq_b3pw91.chk
#P rPBE1PBE/gen 5D Opt=(readopt)  Punch=(MO) Pop=() 

Mg6aq_b3pw91

2 1 ! charge and multiplicity
 Mg     0.00000     0.00000     0.00000
 O     0.00000     2.09000     0.00000
 H     -0.691981     2.65500     -0.691981
 H     0.691981     2.65500     0.691981
 O     1.47785     2.22045e-16     1.47785
 H     1.87737     0.978609     1.87737
 H     1.87737     -0.978609     1.87737
 O     -1.47785     -1.11022e-16     1.47785
 H     -1.18539     7.33956e-09     2.56935
 H     -2.56935     -7.33957e-09     1.18539
 O     0.00000     -2.09000     0.00000
 H     -0.691981     -2.65500     0.691981
 H     0.691981     -2.65500     -0.691981
 O     -1.47785     2.22045e-16     -1.47785
 H     -1.87737     -0.978609     -1.87737
 H     -1.87737     0.978609     -1.87737
 O     1.47785     -1.11022e-16     -1.47785
 H     1.18539     -2.20187e-08     -2.56935
 H     2.56935     2.20187e-08     -1.18539

noatoms atoms=Mg,O

Mg H O 0
6-31G
****

Keys: 1) use opt=(readopt) to make gaussian look for more instructions immediately noatoms makes all atoms inactive. Then make Mg and O active again using 'atoms'. You can also give a numerical range, e.g. atoms=1-2,5,8 etc. You can also use notatoms, which specifies atoms to make inactive (instead of noatoms which makes all inactive).

I defined the basis set at the bottom only to show what order things come in i.e. readopt input comes before basis gen.

NOTE: if you do opt=(readopt) and freq=() in the same job those atoms will be frozen in the Hessian

Mixing basis sets
What if you have a large cluster and want to use a triple-zeta basis set for some oxygens, and a double-zeta for others that are less 'important'?
%nprocshared=6
%Mem=800000000
%Chk=Mg6aq_b3pw91.chk
#P rPBE1PBE/gen 5D Opt=(readopt)  Punch=(MO) Pop=() 

Mg6aq_b3pw91

2 1 ! charge and multiplicity
 Mg     0.00000     0.00000     0.00000
 O     0.00000     2.09000     0.00000
 O     -1.47785     -1.11022e-16     1.47785
 O     0.00000     -2.09000     0.00000
 O     -1.47785     2.22045e-16     -1.47785
 O     1.47785     2.22045e-16     1.47785
 O     1.47785     -1.11022e-16     -1.47785
 H     -0.691981     2.65500     -0.691981
 H     0.691981     2.65500     0.691981
 H     1.87737     0.978609     1.87737
 H     1.87737     -0.978609     1.87737
 H     -1.18539     7.33956e-09     2.56935
 H     -2.56935     -7.33957e-09     1.18539
 H     -0.691981     -2.65500     0.691981
 H     0.691981     -2.65500     -0.691981
 H     -1.87737     -0.978609     -1.87737
 H     -1.87737     0.978609     -1.87737
 H     1.18539     -2.20187e-08     -2.56935
 H     2.56935     2.20187e-08     -1.18539

Mg 0
6-311G
****
O 0
def2svp
****
8-12 0
6-31G
****
13-19 0
6-311+G(2d,2p)
****



In this case Mg uses 6-311G, O uses def2svp, and some of the H use 6-31G while others use 6-311+G(2d,2p). The input obviously doesn't make any chemical sense, but it works as an example. To add ECP, put in an empty space after the last basis set, and then define the ECPs like you would basis sets (but use e.g. def2 instead of def2tzvp, since def2 contains the ecps).

Partial Charges in DFT input
I'm not 100% sure about this one, but I've checked against nwchem and it gives the same output as using 'charge' in nwchem input.
%nprocshared=6
%Mem=800000000
%Chk=Mg6aq_b3pw91.chk
#P rPBE1PBE/GEN 5D Opt=()  Punch=(MO) Pop=() 

Mg6aq_b3pw91

2 1 ! charge and multiplicity
 Mg    0.00000     0.00000     0.00000
 O     0.00000     2.09000     0.00000
 O     1.47785     2.22045e-16     1.47785
 O     -1.47785     -1.11022e-16     1.47785
 O     0.00000     -2.09000     0.00000
 O     -1.47785     2.22045e-16     -1.47785
 O     1.47785     -1.11022e-16     -1.47785
 H(znuc=.91666666666666666666)   -0.691981     2.65500     -0.691981
 H(znuc=.91666666666666666666)   0.691981     2.65500     0.691981
 H(znuc=.91666666666666666666)   1.87737     0.978609     1.87737
 H(znuc=.91666666666666666666)   1.87737     -0.978609     1.87737
 H(znuc=.91666666666666666666)   -1.18539     7.33956e-09     2.56935
 H(znuc=.91666666666666666666)   -2.56935     -7.33957e-09     1.18539
 H(znuc=.91666666666666666666)   -0.691981     -2.65500     0.691981
 H(znuc=.91666666666666666666)   0.691981     -2.65500     -0.691981
 H(znuc=.91666666666666666666)   -1.87737     -0.978609     -1.87737
 H(znuc=.91666666666666666666)   -1.87737     0.978609     -1.87737
 H(znuc=.91666666666666666666)   1.18539     -2.20187e-08     -2.56935
 H(znuc=.91666666666666666666)   2.56935     2.20187e-08     -1.18539

Mg O H 0
6-31G
****

Again, it's an artificial example. I've set the charges of the H to 11/12ths, so that the charge of the entire complex is 1, and not 2+ anymore. Confusingly, I can only get it to work properly if I set the charge to 2+ in the input i.e. ignoring the changed charges for different atoms. Either way, it gives the same result as nwchem (although in nwchem I'd set the total charge to +1 in recognition of the change atomic charges).

03 August 2016

631. Small linux installation in virtualbox on windows for formchk usage

This post is for windows users (it's written for a colleague).

In https://verahill.blogspot.com.au/2016/08/630-making-mo-figures-in-gabedit-using.html I mentioned that g09w doesn't seem to handle my .chk files for linux (G09D).

If you have gaussian for linux (e.g. G09D), then you can set up a small linux installation on windows, install gaussian there and run formchk in the linux environment.

The guide assumes that you don't really know much about linux, or virtual machines. There are plenty of screenshot -- probably too many -- but if you work through them one by one it should be easy to get set up.


1. Install virtualbox
Go to https://www.virtualbox.org/wiki/Downloads

Download "VirtualBox 5.1.2 for Windows hosts"

Download the "VirtualBox 5.1.2 Oracle VM VirtualBox Extension Pack" as well.

It doesn't have to be version 5.1.2. Download whatever the latest version is.

Run the installation file for virtual box.
















2. Install linux in the virtual machine
Assuming that you have cheap and fast internet, download the netinst version of debian.
https://www.debian.org/CD/netinst/

You'll want the AMD64 iso file: http://cdimage.debian.org/debian-cd/8.5.0/amd64/iso-cd/debian-8.5.0-amd64-netinst.iso

You can also download this via bittorrent: http://cdimage.debian.org/debian-cd/8.5.0/amd64/bt-cd/debian-8.5.0-amd64-netinst.iso.torrent

Start virtualbox and set up a new machine.












Then install linux: Note that at no point are any changes made to your Windows harddrive. All changes are made to a file that virtualbox uses as a harddrive for the virtual machine (i.e. your linux installation)









































NO changes are made to your 'real' harddrive, so don't panic.






3. Install gaussian in the linux virtual machine
For this you will need to figure out how to transfer files between the machines. The easiest, most dependable way is via sftp.

To do this you will need to download and install filezilla: https://filezilla-project.org/download.php?type=client
Do that. It's easy.

Next, configure your virtual machine to set up port forwarding.

Start your linux installation (e.g. hit the Start button in VirtualBox)
First figure out what your IP address is. Log in using the username and password you created when you installed linux.

 Then type ip addr
ip addr
The output you're looking for is the ip address for interface eth0 -- look for the value after inet, i.e. 10.0.2.15

Next configure virtualbox: (leave linux running in the background)



Now start Filezilla:
 You want to connect to sftp:/127.0.0.1 and port 2222. Use the username and password you set up for linux.
Hit connect

Sure
Yes

Create a new directory on the linux computer


It should now look like this (look at the right column)

Transfer your files (navigate to the correct directory in the left column, select files and drag them across)
Select and drag
We're only copying formchk here. That's all we need.
Copied
 In the linux computer, change to the correct directory e.g.
cd ~/g09

Then run
chmod ug+x formchk

Check




4. Transfer .chk files from windows host to linux guest

You'll transfer the files using filezilla as shown before. Connect to sftp://127.0.0.1, port 2222, and go to the g09 directory where your formchk file is.

Like so



5. Convert .chk files to .fchk files
In the linux computer, change directory to g09 and run formchk
./formchk example.chk
4. Transfer .chk files from windows host to linux guestThe ./ before formchk is important

running formchk


Then transfer the file back using filezilla:

refresh



See the files





6. Shutdown linux
E.g. by running
sudo shutdown -h now

shutdown

All in all the linux install takes about 1.1 Gb -- this could probably be cut down to 100-200 Mb, and the set up can be improved quite easily. However, this is the most straightforward set-up that I can think of without having to do customisation.

+1.1 Gb