Upload
evita
View
36
Download
1
Tags:
Embed Size (px)
DESCRIPTION
The Nuts and Bolts of First-Principles Simulation. 4: The New CASTEP. Durham, 6th-13th December 2001. CASTEP Developers’ Group with support from the ESF k Network. Lecture 4:. New CA mbridge S erial T otal E nergy P ackage. An introduction…. - PowerPoint PPT Presentation
Citation preview
The Nuts and Bolts of First-Principles Simulation
Durham, 6th-13th December 2001
4: The New CASTEP
CASTEP Developers’ Groupwith support from the ESF k Network
New CAmbridge
Serial
Total
Energy Package
An introduction…The Nuts and Bolts of First-Principles Simulation
Durham, 6th-13th December 2001
Lecture 4:
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
3
What New CASTEP is not
It’s not just CAmbridge
It’s not just Serial
It’s doesn’t just calculate Total
Energies
However, it is still a Package!
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
4
So, What is it Then?
Introduction to the CASTEP Developer’s Group
The goals of the New CASTEP project A brief history of New CASTEP The features of the package How to use the code (command line) Philosophy and design of the code The future of New CASTEP
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
5
The CASTEP Developers Group Mike Payne (Cambridge) Matt Probert (York) Chris Pickard (Cambridge) Stewart Clark (Durham) Phil Hasnip (Cambridge) Phil Lindan (Kent at Canterbury) Matt Segall (Cambridge, Camitro UK
Ltd.)
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
6
The Goals of New CASTEP
Ease of maintenance Ease of future development Portability Efficiency
These goals are sometimes conflicting, therefore a compromise must be found
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
7
A Brief History of New CASTEP July ‘99: A meeting of interested parties. Is
there a need for a new PW pseudopotential code?
July ’99 -> Jan. ’00: Informal specification group outlines the spec. of a new code.
Feb. ’00: Implementation of new code begins. CDG formed.
May ’01: Agreement reached with MSI (Now Accelrys) to commercialise New CASTEP.
Dec. ’01: Code freeze on first version of New CASTEP.
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
8
New CASTEP Features
Parallel, portable code Geometry Optimisation
BFGS Damped MD
Molecular Dynamics NVE NVT
Linear Response for Phonon spectra
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
9
CASTEP Features Continued Transition state search
LST/QST Electronic properties
Optical Spectra DOS Population Analysis
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
10
CASTEP Technical Features Ultrasoft/Norm-conserving
pseudopotentials Pseudopotential generation on-the-fly
Double grid technique for charge/potential grid
Multiple electronic minimisers All-bands CG RMM/DIIS
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
11
Technical Features Cont…
Metals treated by Density mixing Ensemble DFT
Exchange-Correlation Potentials LDA Perdew-Wang `91 GGA PBE/RPBE GGA
Non-linear core corrections
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
12
How to Use the Code: The Cell File! Example cell file for primitive SiC
%block LATTICE_ABC3.074500 3.074500 3.07450060.0 60.0 60.0
%endblock LATTICE_ABC
%block POSITIONS_FRACSi 0.0000 0.0000 0.0000C 0.2500 0.2500 0.2500
%endblock POSITIONS_FRAC
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
13
More Cell File Keywords
KPOINTS_MP_GRID 4 4 4
%block SYMMETRY_OPS
…
%endblock SYMMETRY_OPS
%block SPECIES_POT
C my_C_pot.usp
%endblock SPECIES_POT
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
14
Controlling the Calculation:The Parameter FileTask : GeometryOptimization
XC_functional PW91
Basis_precision Precise
Electronic_minimiser CG
Elec_energy_tol = 0.000001 eV
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
15
More Parameters…
Geom_method BFGS
Geom_force_tol : 0.01 hartree/bohr
Fix_occupancies = TRUE
Continuation = my_last_run.check
Energy_unit = kcal/mol
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
16
Example Output
[Summary of cell and parameters input]
----------------------------------------------------------------------- <-- SCFSCF loop Energy Energy gain Timer <-- SCF per atom (sec) <-- SCF----------------------------------------------------------------------- <-- SCFInitial 6.99675047E+002 4.22 <-- SCF 1 -8.56371636E+002 1.94505835E+002 23.70 <-- SCF 2 -8.57260747E+002 1.11138925E-001 42.59 <-- SCF 3 -8.57286394E+002 3.20580434E-003 62.00 <-- SCF 4 -8.57286462E+002 8.55207285E-006 80.91 <-- SCF 5 -8.57286463E+002 3.12287085E-008 98.20 <-- SCF----------------------------------------------------------------------- <-- SCF
[Forces, stresses, Gemoetry optimisation, MD run…]
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
17
Design Philosophy of New CASTEP Written specification, prior to coding! Implemented in FORTRAN90 Modular approach (F90 not truly object
oriented) Data abstraction using derived data
types Overloading for simple, clear
subroutine names
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
18
Why FORTRAN90?
A language for numerical codes ‘Designed’ with optimisation in mind
good numerical efficiency ‘Modern’ high level language
Modules (classes) Interfaces (prototypes) Memory allocation Derived types
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
19
Code Structure (Overview)
Functional Modules•The ‘Physics’•High-level
Fundamental Modules•The building blocks•Define types and operations
Utility Modules•Machine-dependant•Low-level algorithms
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
20
Utility Modules
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
21
Utility modules provide:
Fundamental constants API for parallel execution I/O
Basic operations, e.g. opening and closing files
Freeform file I/O Generic algorithms
FFTs Matrix inversion Random numbers
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
22
Fundamental Modules
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
23
Example type: Wavefunctiontype, public :: wavefunction
integer :: nbands ! Max no. bands integer :: nkpts ! No. of kpts integer :: nspins ! No. of spins represented
complex(kind=dp), dimension(:,:,:,:), pointer :: coeffs logical :: paged ! Is the wavefn paged to disc? ! Iff paged:- integer :: page_unit ! the unit no. of the pagefile
...end type wavefunction
N.B. This has been simplified for illustrative purposes!
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
24
Example Operations:
wavefunction_allocate(wvfn)wavefunction_deallocate(wvfn)wavefunction_initialise(wvfn,method)wavefunction_copy(wvfn1,wvfn2)wavefunction_add(wvfn2,wvfn2,wvfn_out)wavefunction_dot(wvfn1,wvfn2,products)wavefunction_orthogonalise(wvfn)wavefunction_recip_to_real(wvfn,nb,nk,ns,real_bnd)
Overloading:wavefunction_add(wvfn1,wvfn2,wvfn_out,c1,c2)wavefunction_add(bnd,wvfn,nb,nk,ns)
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
25
Functional Modules
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
26
Use of Fundamental Building Blocks (e.g. Calculating H)! Apply kinetic energy operator to wvfncall wave_kinetic_energy(wvfn,ek,H_wvfn)! Calculate the charge densitycall density_calculate(wvfn,occ,dens)! Calculate the local potentialcall locpot_calculate(dens,local_pot)! Apply the local potential to the wavefunctioncall pot_apply(local_pot,wvfn,wvfn_temp)! Add Vloc|psi> to kinetic energy contributioncall wave_add(wvfn_temp,H_wvfn)! Apply the non-local potential to the wavefunctioncall nlpot_apply(wvfn,…,wvfn_temp)! Add Vnl|psi> to get final H|psi>call wave_add(wvfn_temp,H_wvfn)
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
27
Coding Style
Clear code Meaningful variable and subroutine names Lots of comments Good structure
Care with performance issues Some features of FORTRAN90 sub-optimal Use BLAS/LAPACK where applicable
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
28
Example problem with F90! Finding the trace of a sub-array
real, dimension(N,N) :: A
! Pass a sub-array of A of dimension m
tr = bad_trace(A(1:m,1:m),m)
!Pass the whole array with dimension of sub-array
tr = good_trace(A,m,N)
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
29
Timings for bad_trace
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
30
Timings for good_trace
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
31
The Future of New CASTEP NPT Molecular Dynamics Free-energy integration for reaction
barriers New non-local XC functionals NMR chemical shifts EELS Raman spectroscopy Self-consistent pseudopotentials Etc…
Nuts and Bolts 2001
Lecture 4: Introduction to New CASTEP
32
Summary
New CASTEP code designed and implemented by an academic group
Sound software design Modern implementation State-of-the-art features Good performance The future is bright!