You are on page 1of 35

CSC Spring School 2015

Quantum Chemistry Workshop


Basics
Orca & Gabedit
Michael Patzschke
Institute for Resource Ecology
HZDR

11.03.2015

Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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

Page 2

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Learning Outcome

Draw and import molecular structure


Pre-optimization
Creating input files using the GUI
Writing simple input files
Comparing QC methods (quality and timing)
Running constraint optimizations
Relativistic effect
An example follows on Friday
Visualizing results
Much more on Thursday using VMD

Page 3

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Gabedit
Assuming you have the gabedit executable in your $PATH
Please open a terminal:
mkdir qc_lab
cd qc_lab
gabedit
Have a look around
Open the structure
editor

Page 4

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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 calculations
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

Page 5

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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

Page 6

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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)

Page 7

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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
Page 8

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Setting up an Orca calculation


Basis will change,
leave that choice

Press Ok

Page 9

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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 (more later)
Please remove it!
Page 10

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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

Page 11

Press cogwheels to start a job


Choose Orca
Press Ok
Click on NoName.out tab
to see the output

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Interlude
Congratulations, you have hopefully just run your Orca calculation
A few considerations:
Gabedit is useful for drawing simple structures
many alternatives exist (have a look at Avogadro)
Good to remember basic input file structure
Excellent for visualizing results
The input file can be changed in gabedit
A simple text editor might be easier to use ...
We will visualize the results
Then an editor will be used to set up some more advanced calculations

Page 12

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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

Page 13

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Visualizing Orbitals
In the visualization 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 AOs
Change cut-off value here
Click Ok

Page 14

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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

Page 15

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Other Things to Visualise


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 (using ImageMagick)

Page 16

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Orca Input Help


Have the orca manual ready (532 pages including theory...)
Actually a rather useful textbook as well

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 consult the forum before complaining!

Page 17

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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:
!Opt TPSS Def2-SV(P)
* xyz 0 1
Change the functional
C -1.182146 -0.191818 -11.887076
H -1.567738 0.546391 -12.590258
For a list see next page
H -1.864597 -0.714867 -11.217165
Change the basis set
O 0.022990 -0.429026 -11.844415
*
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 &

Page 18

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Orca List of
DFT functionals
Available 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

Page 19

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Basis Sets in Orca

Page 20

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

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Your Task Just an Idea


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
BP86
TPSS
PBE0
HF
MP2
Page 21

TZVPP

QZVPP

r(CO) =

r(CO) =

r(CO) =

t =

t =

t =

r(CO) =

r(CO) =

r(CO) =

t =

t =

t =

r(CO) =

r(CO) =

r(CO) =

t =

t =

t =

r(CO) =

r(CO) =

r(CO) =

t =

t =

t =

r(CO) =

r(CO) =

r(CO) =

t =

t =

t =

Exp

r(CO) =
120.5 pm

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Remarks on the Task


The table is a suggestion only
To run HF simply do:
! Opt def2-SVP

MP2 TZVPP took 30 s on my laptop
MP2 QZVPP should be feasible
If you want to have fun, try:
!Opt def2-TZVPP def2-TZVPP/J def2-TZVPP/C TightSCF RIJCOSX
!DLPNO-CCSD(T) NumGrad
%maxcore 2000

This does a numerical CCSD(T) optimisation
Needs a lot of memory
Useful for optimising certain structural parameters
Page 22

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Further Remarks

Defining charge and multiplicity first line of geometry block:


* int 0 1
first word = form of geometry data (xyz or int)
first number = charge, second number = multiplicity (1 for singlet, 2 for doublet)
or reading an external file with:
* xyzle 1 2 lename.xyz
One can add dummies (DA), ghosts (Mg:), point charges (Qn.nn) and many more

Orca does not use symmetry to speed up calculations


Symmetry can be used to classify MOs
To do this, add the keyword UseSym

To run orca in parallel add the keyword PalN where N


is the number of cores
Alternatively use the block:
%pal nprocs 4 # any number (posidve integer)
end
Do not use more than 16 cores

Page 23

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Properties
Vibrational frequencies are available for HF, MP2, GGA and hybrid GGA
functionals through:
!Opt Freq

Speedup through much memory, give per core with the extra line:
%maxcore 1000

For all other methods numerical frequencies possible:


!Opt NumFreq

Using at least TightSCF is recommended for frequency runs


Thermochemistry for different temperatures with:
%freq Temp 290, 295, 300
end

Many other properties available (electronic absorption, NMR, ESR (!))


Not part of the basic tutorial

Page 24

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Solvent Effects
Solvent effects on structures and frequencies through COSMO
Treatment differs for MP2 from Turbomole, different results possible
Two ways to specify,
in command line: ! COSMO(solvent)
As input block:
! COSMO
%cosmo
epsilon 78
end

The more recent SMD (solvent model density)


is also available:
%cosmo
smd true
solvent DMF
end

Page 25

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Relativity
Two ways to include scalar relativistic effects (no SO!):
For elements heavier than Kr one can include ECPs with:
! BP def2-SVP def2-SVP/J ECP{def2-SVP,def2-SVP/J} printbasis
where printbasis prints the basis, in order to check that ECP and basis set fit
Manually define ECPs for certain elements:
! ECP{TZVP=Hf-Hg}
! ECP{TZVP=[Ag,Pt,Au]}

All electron ZORA or DKH2 calculations:
! BP86 ZORA def2-SVP def2-SVP/J TIGHTSCF printbasis
! BP86 DKH2 def2-SVP def2-SVP/J TIGHTSCF printbasis
Very important: ZORA/DKH2 and basis set definitions have to be on the
same line!
Defining a special basis set requires:
U 0.0 0.0 1.0 newgto "ZORA-def2-TZVP" end
Page 26

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Constraints
Useful for optimisations
Freeze parts of the molecule
during optimisation:

%geom Constraints
{ B 0 1 1.25 C }
{ A 2 0 3 120.0 C }

end
end

Constraining bond distances : { B N1 N2 value C }


Constraining bond angles : { A N1 N2 N1 value C }
Constraining dihedral angles : { D N1 N2 N3 N4 value C }
Constraining cartesian coordinates : { C N1 C }

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


Giving no value takes that value from the geometry section
Just optimize hydrogens (useful for crystal structures):
%geom opdmizehydrogens true
end

Page 27

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Hydrogen Optimisation
A simple example
One hydrogen is moved

Page 28

! TPSS KeepDens PrintBasis Def2-SV(P) Opt


%geom opdmizehydrogens true
end
* xyz 0 1
C -1.137634 0.702379 0.000000
C -1.137634 -0.702379 0.000000
N 0.000002 -1.415106 0.000000
C 1.137633 -0.702378 0.000000
C 1.137633 0.702380 0.000000
N -0.000001 1.415106 0.000000
H -2.180421 1.269265 0.000000
H -2.080418 -1.269269 0.000000
H 2.080422 -1.269260 0.000000
H 2.080419 1.269264 0.000000
*

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Constrained Scans
Scan energy along bond expansion, optimise all steps:
! RKS BP SV(P) TightSCF Opt
%geom Scan
B 0 1 = 1.35, 1.10, 12 # scan C-O distance
end
end
* int 0 1
C 0 0 0 0.0000 0.000 0.00
O 1 0 0 1.3500 0.000 0.00
H 1 2 0 1.1075 122.016 0.00
H 1 2 3 1.1075 122.016 180.00
*

Took 1,5 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)

Page 29

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

An Advanced Example
Reminder: static vs. dynamic correlation
For static correlation Orca offers CASSCF or MRCI calculations
Try this example, rotation of the double bond in ethylene:
! RHF SV(P) SV/C SmallPrint NoPop NoMOPrint
%casscf nel = 2
norb = 2
mult = 1,3
nroots = 2,1
TrafoStep RI
switchstep nr
end
%paras R= 1.3385
Alpha=0,180,37
end
* int 0 1
C 0 0 0 0 0 0
C 1 0 0 {R} 0 0
H 1 2 0 1.07 120 0
H 1 2 3 1.07 120 180
H 2 1 3 1.07 120 {Alpha}
H 2 1 3 1.07 120 {Alpha+180}
*
Page 30

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

An Advanced Example
With UHF the lowest singlet and triplet look like this:
Things to note around 0:
Singlet energy too high
Triplet energy too low
Around 90:
Singlet convergence issues
Orca reuses orbitals from
previous runs

Page 31

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

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
*
Page 32

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Visualising Without Gabedit


Orca can produce molden 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 lename.gbw -i
Page 33

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

Calculating other Properties


Different programs can be interfaced
Common file format molden
Molden input files can be converted to .wfn files for AIM, MultiWFN,
NCIplot
More on Friday

Page 34

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de

The End
Have fun with Orca
Thank you for your attention!

Page 35

Member of the Helmholtz Association


Dr. Michael Patzschke I Institute for Resource Ecology I www.hzdr.de