CSC Spring School 2014

Quantum Chemistry Workshop Basics

- Orca & Gabedit -

Michael Patzschke University of Helsinki

The Codes

● Orca – general purpose QC code

– Free (download from http://cec.mpg.de/forum/) – Developed by F.Neese et al. in C++ – Precompiled binaries (no sources)

● Gabedit

– Free (download from https://sites.google.com/site/allouchear/Home/gabedit/download) – Developed by A.-R. Allouche – Sources and Binaries available

● Both codes available for Mac, Linux & Windows

– Good combination for research & teaching

Learning Outcome

● Draw and import molecular structures

● Pre-optimization

● Creating input files using the GUI

● Writing simple input files

● Comparing QC methods (quality and timing)

● Running constraint optimizations

● Visualizing results

– More on Friday using VMD

Gabedit

● Assuming you have gabedit in your $PATH

● Open a terminal mkdir qc_lab cd qc_lab gabedit

● Have a look around

● Open the structur editor

Editing Structures

● Press the pen tool to add atoms

● Press the periodic-table button to change the atom (C is standard)

● Press the button below that to toggle adding hydrogens

● Pre-optimizing self-drawn structures

– Important for speedup of real calculation – Avoid for transition metals, lanthanides & actinides – Two methods available: MM or semiempirical calculations

● Press “M” button or right-click in drawing window

– Choose “Molecular Mechanics” “Optimization”

Editing Structures – Further Points

● Fragments can be used to draw structures

● Parts of the molecule can be selected

● Atoms and parts of the molecule can be removed

● And moved

● Structural parameters can be measured and changed

● Measurements can be shown or removed

● For Semiempirical methods:

– Interface to Mopac, Orca & Firefly

Drawing Formaldehyde

● Please try to draw formaldehyde

– “Menu-Edit-Delete Molecule” – Add Carbon – Choose Oxygen from periodic table – Replace one hydrogen – Click on the bond to make double bond – Pre optimize using MM

● The result should look like this

● Close the drawing window (“Menu-Close”) (saving possible – not necessary here)

Setting up an Orca calculation

● Gabedit generates input for different QC codes

● Choose Orca from the top menu

● The pop-up menu lets you set up the calculation

● Change “Job Type” to “Equilibrium Structure Search”

● Change “Type of method” to “Meta-GGA and hybrid meta GGA's”

● Change “Method” to “TPSS”

● Change “Type” to “def2 Ahlrichs basis sets”

Setting up an Orca calculation

● “Basis” will change, leave that choice

● Press “Ok”

Orca input files

● Inspect the generated input file # Lines are comments ! Lines contain keywords % Lines start key blocks end lines end key blocks * starts and ends the geometry block

● Comments can be inserted like this: ! Opt # this will be ignored # TPSS

● The “output” block is added by gabedit for visualisation, but not necessary

● The “geom” block is wrong, remove it

Running Orca

● Input files can be saved (“File” menu)

● QC codes can be run by Gabedit

– Set up run commands in “Settings”-“Preferences” on the “Commands” tab – Press cogwheels to start a job – Choose “Orca” – Press “Ok” – Click on “NoName.out” tab to see the output

Interlude

● Congratulations, you have hopefully just run your Orca calculation

● A few considerations:

– Gabedit is great for drawing simple structures – Good to remember basic input file structure – Excellent for visualizing results – The input file can be changed in gabedit – A simple editor might be easier to use ...

● We will visualize the results

● Then an editor will be used to set up some more advanced calculations

Looking at results

● During a run you can

– Look at the output file – Update it – Look at geometry convergence – Visualize MO's & Densities from the first step of the calculation – Get data from remote calculations

● After the calculation has finished, press the visualize button

Visualizing Orbitals

● In the window click “M” or right-click

● Choose “Orbitals” from the menu

● Choose “Orca output file”

● Read the “NoName.out” file

● An MO selection should appear

– Select an orbital – The right part shows its participating AO's – Change cut-off value here – Click “Ok”

Visualising Orbitals

● Orbitals are calculated in a cube

– Select position here – Select size here – Select quality here – Standard choices are ok – Press “Ok”

● After the calculation is finished you can

– Change the iso-value – 0.1 should be a good choice – Get a proposition for a certain size – Press “Ok”

Other Things to Visualize

● Take a few moments to look around the menu (“M” or right-click”)

● Geometry optimizations can be visualized from the .trj files

● Choose “Animation” and load the .trj file

● Press “Play”

● A movie can be made for presentation purposes

Orca Input Help

● Have the orca manual ready (532 pages including theory...)

● Have a look at “https://sites.google.com/site/orcainputlibrary/home”

– a very good input library

● Under “http://cec.mpg.de/forum/” you can join the forum

– Very active, fast help – Please read the manual and forum first!

More Advanced Calculations

● Close gabedit (Press “File”-“Exit” from the main window)

● Open your input file using your favourite editor

● Edit it to look like this:

● Change the functional

– For a list see next page

● Change the basis set

– For a list see further down

● Save the input file under a new name

● Start orca by issuing at the prompt: “orca filename.inp > filename.out &”

Orca List of DFT functionals

● Some functionals:

● Double hybrids are available (MP2 calculation will be performed!)

● DFT tries to use the RI approach automatically (NORI to witch of)

● Dispersion correction with keywords vdw10 or vdw10bj

Basis Sets in Orca

● Many different basis sets available some examples:

● Ahlrich's good for DFT

● Dunning's good for CC

● Basis set can be changed for an element: %basis newgto Element "def2-TZVPP" # Specifying the basis set on "Element" end

● Or for a specific atom in the geometry section: H 0.0 0.0 1.0 newgto "def2-TZVP" end

● To try MP2 use the following line: !Opt RI-MP2 def2-TZVPP def2-TZVPP/J def2-TZVPP/C TightSCF RIJCOSX

● For test purposes here you might want to replace TZVPP by SVP

You task

● Make a small table for the C-O bond length of formaldehyde and computational timings using two or three different methods and two or three different basis sets

● Run calculations, fill in the table and compare with experimental data

SVP TZVPP QZVPP Exp. r(CO) = r(CO) = r(CO) = BP86 t= t= t= r(CO) = r(CO) = r(CO) = TPSS t= t= t= r(CO) = r(CO) = r(CO) = r(CO) = PBE0 t= t= t= 120,5 pm r(CO) = r(CO) = r(CO) = HF t= t= t= r(CO) = r(CO) = r(CO) = MP2 t= t= t=

Remarks on task

● The table is a suggestion only

● To run HF simply do: ! Opt def2-SVP

● MP2 TZVPP took 2 min on my laptop,

● MP2 QZVPP could take too long

Constraints

● Useful for optimisations:

● Freeze parts of the molecule during optimisation:

● Wildcards to freeze all bonds/angles/torsions to certain atoms

● Giving no value takes that value from the geometry section

● Just optimize hydrogens (good for structures):

Hydrogen Optimisation - Example

● Simple example:

Constrained Scans - Example

● Scan energy along bond expansion, optimise all steps:

● Took 2 min on my laptop

● File filename.allxyz contains optimized geometries for all steps

● File filename.relaxscanact.dat contains energy data (visualize with e.g. gnuplot)

Energy Extrapolation

● We would like to know energies at the basis set limit

– Computationally not feasible – Extrapolation procedures exist for e.g. Dunning's and ANO basis sets – Orca uses for HF:

– And for the correlation part:

– Look at a simple example: ! RHF MP2 CCSD(T) Extrapolate(2/3,cc) TightSCF Conv Bohrs * int 0 1 O 0 0 0 0 0 0 H 1 0 0 1.81975 0 0 H 1 2 0 1.81975 105.237 0 *

Visualising Without Gabedit

● Orca can produce input files

● After the calculation is finished, write at the prompt: orca_2mkl basename -molden

● Orca has an “interactive” program to produce cube files

– Orbitals and densities are available – Excited state density differences possible – Different formats available

● Start at the prompt with: orca_plot filename.gbw -i

MEP and Densities

● Use keyword “KeepDens”

● Mapped electrostatic potentials can be done with Gabedit

– Warning: the faster methods don't work well – The slow method is very slow – Alternative: python script mep.py (get from: https://gist.github.com/mretegan/5501553)

– Usage: python mep.py basename npoints – Basename: name of the files .gbw and .scfp (both needed) – Npoints number of points per side in the cube file – Scales as npoints^3...

The End

● Have Fun Using Orca

● And thank you for your attention!