CP2K: Introduction and Orientation: 4 CECAM CP2K Tutorial, 31 Aug - 4 Sep 2015 Iain Bethune Ibethune@epcc - Ed.ac - Uk
CP2K: Introduction and Orientation: 4 CECAM CP2K Tutorial, 31 Aug - 4 Sep 2015 Iain Bethune Ibethune@epcc - Ed.ac - Uk
INTRODUCTION AND
ORIENTATION
4th CECAM CP2K Tutorial, 31 Aug – 4 Sep 2015
Iain Bethune
[email protected]
Outline
• CP2K Overview
• Project History
• CP2K Features
• CP2K Information
• Obtaining CP2K
• CP2K exercises
CP2K Overview
• 14 years on…
• 1m lines of code, ~16k commits
• 25 developers + many contributors
• 100s of users
• Fully open-source (GPL) Image from Jürg Hutter
CP2K Features
Gaussian basis:
• QUICKSTEP DFT: Gaussian and Plane WavesofMethod
The sparsity H and S
(VandeVondele et al, Comp. Phys. Comm.,S 2005)
=∫ ϕ (r)ϕ (r )dr
αβ α Gaussian basis:
β
• Efficient mapping between basis sets The overlap (integral of the product) rapidly
decays with the spatial separation of the basis
• -> Construction of the KS Matrix is ~O(n) functions.
The overlap (integral of the product) rapidly
decays with the spatial separation of the basis
functions.
http://www.cp2k.org/version_history
• SVN trunk version 2.7
+ latest features, fixes, performance improvements
+ actively developed
- bugs may exist (see dashboard.cp2k.org)
- must be obtained from SVN and compiled from source
Obtaining CP2K
• CP2K download contents:
• README, COPYRIGHT, INSTALL
• src – source code (mostly Fortran 03, a little C++)
• makefiles – To build CP2K
• arch – machine-specific options files
• data – standard data files (basis sets, PPs …)
• tests – over 2700 input files!
• tools – mostly for developers + cubecruncher
• After building:
• lib – CP2K internal libraries
• obj – compiled object files
• exe – CP2K binaries
CP2K Exercises
• Various exercises are available from:
• http://www.cp2k.org/exercises
• See “CECAM 4th CP2K Tutorial” for this week
• Also older exercises
• Mostly ‘worked examples’ from system setup and calculations to
analysis / visualisation of results
• WARNING:
• Tests are designed to run quickly so may not produce converged or
accurate outputs! Check parameters for your system…
CP2K: Introduction and Orientation
Questions?
BASICS OF CP2K
CALCULATIONS
Iain Bethune ([email protected])
Overview
• How to run CP2K
• CP2K Output
• Controlling what gets written
• Overview of an output file
• Restarting a calculation
How to run CP2K
• CP2K binaries:
• cp2k.version where version is usually one of:
• sopt – Serial, optimised
• ssmp – Single process + symmetric multiprocessor (OpenMP)
• popt – Parallel (MPI), optimised
• psmp – Parallel (MPI) + symmetric multiprocessor (OpenMP)
• Keywords
KEYWORD value
KEYWORD [ON|OFF] [YES|NO] [TRUE|FALSE] …
KEYWORD
• Nesting
• Sections may others sections and keywords
CP2K Input file: The Basics
• Basic pre-processing syntax
@INCLUDE ‘filename’ – copy in text from file
@SET VAR value – define a variable
$VAR – replaced with variable value
@IF / @ENDIF – simple logic
! or # – comments
• Units
• Numerical entries have a default unit (see manual)
• Specify other units by hand e.g.
ABC [nm] 100 100 100 (or bohr, default is angstrom)
EMAX_SPLINE [eV] 50 (or Ry, joule, default is hartree)
• Also combinations e.g. [hartree*bohr^-2]
CP2K Input file: The Basics
• GLOBAL section (required)
&GLOBAL
PROJECT H2O-32
RUN_TYPE MD
PRINT_LEVEL HIGH
&TIMINGS
THRESHOLD 0.000001
&END
WALLTIME 3600
&END GLOBAL
CP2K Input file: The How
• FORCE_EVAL section (required)
&FORCE_EVAL
METHOD QS (or FIST, QMMM …)
&DFT
…
&END DFT
&SUBSYS
…
&END SUBSYS
&END FORCE_EVAL
CP2K Input file: The How
&DFT
BASIS_SET_FILE_NAME GTH_BASIS_SETS Basis and PP library files
POTENTIAL_FILE_NAME POTENTIAL
&MGRID
CUTOFF 280
REL_CUTOFF 30 Parameters for the realspace multi-grids
&END MGRID
&QS
EPS_DEFAULT 1.0E-12
WF_INTERPOLATION PS
Quickstep options
EXTRAPOLATION_ORDER 3
&END QS
&SCF
SCF_GUESS ATOMIC Control of SCF procedure, including
&OT ON
MINIMIZER DIIS minimisation scheme
&END OT
&PRINT
&RESTART OFF
&END
&END
&END SCF
&XC Exchange-Correlation Functional (LDA)
&XC_FUNCTIONAL Pade
&END XC_FUNCTIONAL
&END XC
&END DFT
CP2K Input file: The How
&SUBSYS
&CELL Cell definition
ABC 9.8528 9.8528 9.8528
&END CELL
# 32 H2O (TIP5P,1bar,300K) a = 9.8528 Particle coordinates
&COORD
O 2.280398 9.146539 5.088696
O 1.251703 2.406261 7.769908 Could also @include an external file
O 1.596302 6.920128 0.656695 or parse other formats via
...
H 0.837635 8.186808 8.987268
&TOPOLOGY
H 8.314696 10.115534 2.212519 COORD_FILE_NAME
H 8.687134 8.667252 2.448452 &END TOPOLOGY
&END COORD
&KIND H
BASIS_SET TZV2P-GTH
POTENTIAL GTH-PADE-q1 Definitions of atomic kinds
&END KIND
&KIND O
BASIS_SET TZV2P-GTH
Could specify charge, mass …
POTENTIAL GTH-PADE-q6
&END KIND
&END SUBSYS
CP2K Input file: The What
• MOTION section
&MOTION
&MD
ENSEMBLE NVE
STEPS 10
TIMESTEP 0.5
TEMPERATURE 300.0
&END MD
&END MOTION
• POTENTIAL, GTH_POTENTIALS
• Wide range of PPs for at many elements - LDA (PADE), PBE, BLYP …
Questions?
BUILDING CP2K
Iain Bethune ([email protected])
Overview
• Machine Access
• Prerequisites
• Environment
• Libraries
• Optional Libraries
• Functionality
• Performance
• Testing CP2K
Machine Access
• Where can you run CP2K?
• Own Laptop
• Serial / OpenMP build
• Build tools
• GNU Make, Python 2.x (or later)
• Compilers
• GNU gcc / gfortran 4.6 (or later)
• Intel ifort 15.x
• IBM XLF 14.1
Prerequisites - Libraries
• BLAS & LAPACK (required)
• Vendor-tuned libraries preferred (MKL, ACML, ESSL)
• Free auto-tuned libraries (GotoBLAS, ATLAS)
• Reference BLAS + LAPACK from Netlib (last resort, very slow!)
• Libint
• Required for all Hartree-Fock Exchange calculations
• Version 1.1.4 only
• -D__LIBINT
Optional Libraries
• ELPA
• Optimised diagonalisation routines
• Build process optimises for specific architecture
• < June 2014 version : -D__ELPA
• >= June 2014 version : -D__ELPA2
• To build CP2K
• in the cp2k/makefiles directory:
corresponding to arch file
• Quick test
• in the cp2k/tests/QS directory:
../../exe/ARCH/cp2k.sopt C.inp
Testing CP2K
• CP2K comes with a suite of >2600 test input files
Questions?