29
Introduction to CASTEP Introduction The CDG Castep’s functionality History Development Getting CASTEP Design Running CASTEP The basics Output files Finer control CASTEP ex- ample Band Structure Input Band Structure Output Parameters Phonons Phonon Input Phonon Output CASTEP Help Introduction to CASTEP Stewart Clark University of Durham 17 September 2012

Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Introduction to CASTEP

Stewart Clark

University of Durham

17 September 2012

Page 2: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

The CASTEP developers group (CDG)

The CDGStewart Clark (Durham)Keith Refson (STFC-RAL)Matt Probert (York)Chris Pickard (UCL)Phil Hasnip (York)Jonathan Yates (Oxford)

Current post-docs writing new functionalityPaul Tulip (Durham)Dominik Jochym (STFC-RAL)Daniel Jones (Oxford)

Others closely involved with CASTEP developmentMatt Segall (Industry/Cambridge)Mike Payne (Cambridge)

Page 3: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

What is CASTEP?

First principles electronic structure code for predictingproperties of materialsIncomplete summary includes:

Total energies (forces, stresses, elastic constants)Electronic structure (electronic charge, potential, bandstructure, DOS, atomic populations)Geometry Optimisation (atomic positions, cellparameters, external pressure/stress)Molecular dynamics (finite temperature properties)Transition state searches (chemical reaction pathways,diffusion barriers)Phonons (IR and Raman spectroscopy)Electric field response (polarisability, dielectricconstants, Born charges LO/TO splitting)Magnetic Response (NMR, Chemical shifts)Core level spectroscopy (EELS, ELNES)

Page 4: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

A brief history of CASTEP

The beginnings

Mike Payne’s code (“Old CASTEP”) had been furtherdeveloped by may researchers in an undocumentedfashion leaving. Impossible to add new functionality.July 1999: A meeting of interested parties to write anew code from scratchJuly 1999 to Jan. 2000: Informal specification groupoutlines the spec. of a new code.Feb. 2000: Implementation of new code begins. CDGformed. “Inherit the name CASTEP” from Mike Payne.Many meetings, train journeys, late nights, discussions,beer/curry, 5 new jobs...Dec. 2001: First release with “standard functionality”and first CASTEP workshop (Durham)

Page 5: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

New funtionality added continuously

2002: Castep phonon linear response calculations2003: Castep on-the-fly pseudopotentials2003: Castep electric field responses2004: NMR2005: Wannier functions, Non-local XC functionals2006: Finite difference phonons2007: Gamma-point speed enhancements2008: Core level spectroscopy2009: Raman spectroscopy2010: Many new hybrid functionals and vdW (and OEP,not in main release yet)2011: Phonons (perturbation theory) for metals2012: TD-DFT (not in main release yet)On the way: GW, 3rd order perturbations, fast Raman,non-collinear spin, spin-orbit, ...

Page 6: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Get the CASTEP source code

If you do not already have the source code for Castep then:

You work in UK institutionDownload the license (see http://www.castep.org) andfollow the instructions

You’re at a European academic institutionGet the source code athttp://accelrys.com/micro/academic/index.html#second

You work elsewhere in the worldTalk to one of the CDG

Page 7: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Design philosophy of CASTEP

Written specification prior to coding (recently: newscience, write code, deeper understanding, writeagain!)Implemented in F95 (and now some F2003 features)Modular approachData abstraction using derived data typesOverloading and simple, clear subroutine namesEasy(!!) to add new functionality

Page 8: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Coding Style

Clear code

Meaningful variable and subroutine namesLots of commentsGood structure

Care with performance issues

Some features of F95 sub-optimalUse BLAS/LAPACK where applicable

This gives optimal speedCan link in machine specific BLAS/LAPACK

FFT can dominateGeneric FFTVendor FFTFFTW (in tests, FFTW3 is usually the fastest)

Page 9: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Now for the important bit

Running CASTEP

By example using the unix command line

(CASTEP can also run within Materials Studio, but we’llconcentrate on the stand-alone package.)

Page 10: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

The basics

2 input files

<name>.cell

<name>.param

Run with “castep <name>”

Page 11: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

The .cell file

Contains details of the unit cell of the material that you wantto do a calculation on

Atomic positions (required)Lattice parameters (required)k-points (optional)Symmetry (optional)Pseudopotentials (optional)etc...(optional!)

Page 12: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

The .param file

Instructions to CASTEP on what properties you would liketo calculate for the material given in the .cell file

Single point energyGeometryBand StructurePhononsNMRetc...

Page 13: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Input files

All input parameters have a sensible default (exceptcrystal structure)Input files contain keywords to control the behaviourof your CASTEP calculationYou just need to specify anything that is different fromthe defaultInput files can be very sparse

Page 14: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Example of a .cell file

%block lattice_abc5.4 5.4 5.490.0 90.0 90.0%endblock lattice_abc

%block positions_fracSi 0.00 0.00 0.00Si 0.50 0.50 0.00Si 0.50 0.00 0.50Si 0.00 0.50 0.50Si 0.25 0.25 0.25Si 0.75 0.75 0.25Si 0.75 0.25 0.75Si 0.25 0.75 0.75%endblock positions_frac

Page 15: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

The .castep output file

The .castep file contains

The header (version number, references)A summary of the parameters usedA summary of the cell usedA summary of the results of the calculation

Page 16: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Other output files

In all calculations

The .check file which is the restart fileA .err file is produced if the calculation aborts (eg.error in input files)

Other output files depend on the task

.geom contains geometry relaxation data

.bands constains band structure eigenvalues

.phonon contains phonon frequencies, eigenvaluesand spectroscopic information.magres contains data on magnetic response (NMR)etc...

Page 17: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

More .cell file keywords

Specify your own k-point gridkpoints_mp_grid nx ny nz

Get CASTEP to find symmetry operationssymmetry_generate

Specify your own pseudopotentials%block species_potSi Si_00.recpot%endblock species_pot

Page 18: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Take control: the param file

There are keywords that allow control over your calculation

Choose a tasktask : BandStructure

Choose an exchange-correlation functionalxc_functional : PBE

Choose a minimiser for the electronic structurecalculationelectronic_minimizer : SD

Choose a different total energy convergence toleranceelec_energy_tol : 0.000000001 eV

Choose the number of empty bands in a band structurebs_nextra_bands : 73

Page 19: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Example: Band Structure of Silicon (.cell)

%block lattice_cart2.7 2.7 0.02.7 0.0 2.70.0 2.7 2.7%endblock lattice_cart

%block positions_fracSi 0.00 0.00 0.00Si 0.25 0.25 0.25%endblock positions_frac

kpoints_mp_grid 4 4 4

symmetry_generate

%block bs_kpoint_path0.500 0.500 0.5000.000 0.000 0.0000.500 0.000 0.5000.500 0.250 0.7500.375 0.375 0.750%endblock bs_kpoint_path

Page 20: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Example: Band Structure of Silicon (.param)

task : BandStructure

Page 21: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Example: Band Structure Result

To runthe calculation (I’ve calledthe files Si_BS.celland Si_BS.param)

castep Si_BS

You can useone of CASTEP’s analysistools to view the result

dispersion.pl -xg Si_BS.bands

Page 22: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

More parameters for .param

Do a phonon plus electric field calculationtask : Phonon+Efield

Change a geometry force tolerancegeom_force_tol : 0.01 hartree/bohr

Retsart a previous calculation (.check file)continuation : default

Change output unitsenergy_unit : kcal/mol

I want an ascii formated charge density filewrite_formatted_density : true

Page 23: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Another Example: Phonons in Si (.cell)

%block lattice_cart2.7 2.7 0.02.7 0.0 2.70.0 2.7 2.7%endblock lattice_cart

%block positions_fracSi 0.00 0.00 0.00Si 0.25 0.25 0.25%endblock positions_frac

kpoints_mp_grid 5 5 5

symmetry_generate

%block species_potSi Si_00.recpot%endblock species_pot

Page 24: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Another Example: Phonons in Si (.param)

task : Phonon+Efieldfix_occupancy : true

Page 25: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Another Example: Phonons in Si (DoS)

The previousrun calculated phononmodes at wavevectorson a 5 × 5 × 5 grid. Someclever interpolation allowsus more at no extra cost:

Add to .param filecontinuation : defaultphonon_fine_method : interpolate

Add to .cell filephonon_fine_kpoint_mp_grid 40 40 40

Page 26: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Another Example: Phonons in Si (Dispersion)

And using the same trick we can takethe original run and get a dispersion curve too

Add to .param file

continuation : defaultphonon_fine_method : interpolate

Add to .cell file

phonon_fine_kpoint_path_spacing 0.01

%block phonon_fine_kpoint_path0.500000 0.500000 0.5000000.000000 0.000000 0.0000000.500000 0.000000 0.5000000.500000 0.250000 0.7500000.375000 0.375000 0.750000%endblock phonon_fine_kpoint_path

Page 27: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

CASTEP’s help function

To search for all keywords containing the phrase<string> usecastep -help search <string>

This will print a summary of each of the keywordscontaining that phraseTo get help with a particular keyword usecastep -help keyword

This will print a detailed help message about thatkeyword, including the default value

Page 28: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Test input files (dryrun)

You can tell CASTEP to read the input files and writethe header information into the .castep file and thenstopThis is called a dryrunDo this on the command-line withcastep <name> -dryrun

Always to this before submitting to a batch queueIt’ll save wait-time lost in batch queue due to syntaxerrors.castep file will contain the number of k-points: usefulfor choosing numnber of compute cores

Page 29: Introduction to CASTEP · Introduction to CASTEP Stewart Clark University of Durham 17 September 2012. Introduction to CASTEP Introduction The CDG Castep’s functionality History

Introduction toCASTEP

IntroductionThe CDG

Castep’s functionality

History

Development

Getting CASTEP

Design

RunningCASTEPThe basics

Output files

Finer control

CASTEP ex-ampleBand Structure Input

Band StructureOutput

Parameters

PhononsPhonon Input

Phonon Output

CASTEP Help

Thanks for listening

Questions?