Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Nuts and Bolts of First-Principles Simulation Durham, 6th-13th December 2001 4: The New CASTEP CASTEP Developers’ Group with support from the ESF 

Similar presentations


Presentation on theme: "The Nuts and Bolts of First-Principles Simulation Durham, 6th-13th December 2001 4: The New CASTEP CASTEP Developers’ Group with support from the ESF "— Presentation transcript:

1 The Nuts and Bolts of First-Principles Simulation Durham, 6th-13th December 2001 4: The New CASTEP CASTEP Developers’ Group with support from the ESF  k Network

2 New CA mbridge S erial T otal E nergy P ackage An introduction… The Nuts and Bolts of First-Principles Simulation Durham, 6 th -13 th December 2001 Lecture 4:

3 Nuts and Bolts 2001 Lecture 4: Introduction to New CASTEP 3 What New CASTEP is not  It’s not just CA mbridge  It’s not just S erial  It’s doesn’t just calculate T otal E nergies  However, it is still a P ackage!

4 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

5 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.)

6 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

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

8 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

9 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

10 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

11 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

12 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_ABC 3.074500 3.074500 3.074500 60.0 60.0 60.0 %endblock LATTICE_ABC %block POSITIONS_FRAC Si0.00000.00000.0000 C0.25000.25000.2500 %endblock POSITIONS_FRAC

13 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 Cmy_C_pot.usp %endblock SPECIES_POT

14 Nuts and Bolts 2001 Lecture 4: Introduction to New CASTEP 14 Controlling the Calculation: The Parameter File Task : GeometryOptimization XC_functional PW91 Basis_precision Precise Electronic_minimiser CG Elec_energy_tol = 0.000001 eV

15 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

16 Nuts and Bolts 2001 Lecture 4: Introduction to New CASTEP 16 Example Output [Summary of cell and parameters input] ----------------------------------------------------------------------- <-- SCF SCF loop Energy Energy gain Timer <-- SCF per atom (sec) <-- SCF ----------------------------------------------------------------------- <-- SCF Initial 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…]

17 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

18 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

19 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

20 Nuts and Bolts 2001 Lecture 4: Introduction to New CASTEP 20 Utility Modules

21 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

22 Nuts and Bolts 2001 Lecture 4: Introduction to New CASTEP 22 Fundamental Modules

23 Nuts and Bolts 2001 Lecture 4: Introduction to New CASTEP 23 Example type: Wavefunction type, 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!

24 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)

25 Nuts and Bolts 2001 Lecture 4: Introduction to New CASTEP 25 Functional Modules

26 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 wvfn call wave_kinetic_energy(wvfn,ek,H_wvfn) ! Calculate the charge density call density_calculate(wvfn,occ,dens) ! Calculate the local potential call locpot_calculate(dens,local_pot) ! Apply the local potential to the wavefunction call pot_apply(local_pot,wvfn,wvfn_temp) ! Add Vloc|psi> to kinetic energy contribution call wave_add(wvfn_temp,H_wvfn) ! Apply the non-local potential to the wavefunction call nlpot_apply(wvfn,…,wvfn_temp) ! Add Vnl|psi> to get final H|psi> call wave_add(wvfn_temp,H_wvfn)

27 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

28 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)

29 Nuts and Bolts 2001 Lecture 4: Introduction to New CASTEP 29 Timings for bad_trace

30 Nuts and Bolts 2001 Lecture 4: Introduction to New CASTEP 30 Timings for good_trace

31 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…

32 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!


Download ppt "The Nuts and Bolts of First-Principles Simulation Durham, 6th-13th December 2001 4: The New CASTEP CASTEP Developers’ Group with support from the ESF "

Similar presentations


Ads by Google