126 II Numerical Analysis for Material Science II

  • Slides: 26
Download presentation
1/26 物質科学のための計算数理 II Numerical Analysis for Material Science II 9 th: Density Functional Theory

1/26 物質科学のための計算数理 II Numerical Analysis for Material Science II 9 th: Density Functional Theory (2) Dec. 7 (Fri) Lecturer: Mitsuaki Kawamura (河村光晶)

2/26 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13.

2/26 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. Schedule (This semester W 1, W 2) Sep. 28 Oct. 5 Oct. 12 Oct. 19 Oct. 26 Nov. 2 Nov. 9 Nov. 30 Dec. 7 Dec. 14 Dec. 21 Dec. 25 Jan. 11 (Fri) (Fri) (Fri) (Tue) (Fri) Guidance Y Monte Carlo method O Exact diagonalization Y Molecular dynamics O (1 st report problem will be announced. ) Standard DFT code K Density functional theory K (2 nd)Report problem K (遠隔講義室) Density functional theory K ※ Lecturers: Y … Yamaji, K … Kawamura, O… Ohgoe

3/26 Schedule in this section (DFT) 1. Nov. 30 (Fri) Standard DFT code •

3/26 Schedule in this section (DFT) 1. Nov. 30 (Fri) Standard DFT code • First-principles calculation and Density functional theory (Lecture) • One-body Schrödinger eq. for periodic system and Bloch theorem (L) • Numerical solution of Kohn-Sham (one-body Schrödinger) eq. (L) • Hands-on DFT code (Tutorial) • Version control system : Git (T) 2. Dec. 7 (Fri) Kohn-Sham eq. • Plane-wave basis and Pseudopotentials (L) • Iterative eigenvalue solution method (L & T) 3. Dec. 14 (Fri) Self-Consistent loop • Hartree potential (Poisson eq. ) • Brillouin-zone integral (Tetrahedron method) • Visualization (T) 4. Dec. 21 (Fri) Total Energy • Coulomb potential for periodic point charge (Ewald sum) 5. Dec. 25 (Tue) (2 nd)Report problem K (遠隔講義室) 6. Jan. 11 (Fri) Density functional theory K

4/26 Today’s Schedule Kohn-Sham eq. in periodic system Plane-wave representation Iterative diagonalization Matrix-vector product

4/26 Today’s Schedule Kohn-Sham eq. in periodic system Plane-wave representation Iterative diagonalization Matrix-vector product Kinetic energy term Potential term Visualize

5/26 last week Kohn-Sham method Self-consistent field (SCF)

5/26 last week Kohn-Sham method Self-consistent field (SCF)

6/26 last week Kohn-Sham eq. for periodic system (1) Unit lattice vectors (Not unique)

6/26 last week Kohn-Sham eq. for periodic system (1) Unit lattice vectors (Not unique) Equation to solve in the whole region of bulk crystal Unit cell

7/26 last week Kohn-Sham eq. for periodic system (2) Bloch’s theorem Equation to solve

7/26 last week Kohn-Sham eq. for periodic system (2) Bloch’s theorem Equation to solve only in the unit cell Band structure Unit reciprocal lattice vectors

8/26 last week How to solve Kohn-Sham eq. : Basis

8/26 last week How to solve Kohn-Sham eq. : Basis

9/26 Unit in this lecture Input and output : Length : Angstrom Energy :

9/26 Unit in this lecture Input and output : Length : Angstrom Energy : Electron volt Useful to read by VESTA Inside program code: Length : Atomic unit (Bohr radius). 1 [Bohr] = 0. 529177249 [Å] Energy : Atomic unit (Hartree). 1 [Eh] = 27. 21138456 [e. V] [Bohr-1] [Eh]

10/26 Fourier Transformation Discretize (considering one dimension) We do not detail in this lecture.

10/26 Fourier Transformation Discretize (considering one dimension) We do not detail in this lecture. We just use FFT numerical library.

11/26 Cutoff frequency

11/26 Cutoff frequency

12/26 $ $ $ $ Very simple plane-wave DFT program cd ~ git clone

12/26 $ $ $ $ Very simple plane-wave DFT program cd ~ git clone git: //git. osdn. net/gitroot/educational-pwdft/pwdft. git cd pwdft &CONTROL calculation = 'direct' cp make. inc. mac make. inc / make &SYSTEM cd sample/Al/ nbnd = 10. . /src/pwdft. x < direct. in nat = 1 Aluminum • Face centered cubic (fcc) • Metal • Almost free electron • keep "ecutrho" ≧ 4*ecutwfc Only perform first SCF step Initial density is uniform ntyp = 1 ecutwfc = 60. 000000 ecutrho = 240. 000000 / &ELECTRONS / CELL_PARAMETERS 0. 000000 2. 024700 0. 000000 ATOMIC_SPECIES Al al. lda. lps ATOMIC_POSITIONS Al 0. 000000 K_POINTS 1 0. 0

13/26 direct@diag_direct. F 90 http: //mitsuaki 1987. github. io/pwdft/index. html lwork = -1 allocate(work(1))

13/26 direct@diag_direct. F 90 http: //mitsuaki 1987. github. io/pwdft/index. html lwork = -1 allocate(work(1)) call zheev('V', 'U', npw, ham, npw, eval_full, work, lwork, rwork, info) lwork = nint(dble(work(1))) deallocate(work) allocate(work(lwork)) call zheev('V', 'U', npw, ham, npw, eval_full, work, lwork, rwork, info) deallocate(work) Workspace (memory size) query : Do not need to care. Diagonalize Hamiltonian matrix "ham" keep ecutrho ≧ 4*ecutwfc Changing "ecutrho" and "ecutwfc" and see "Kohn-Sham Time" in Standard output We only need lower energy (occupied) band.

14/26 Locally Optimal Block Preconditioned Conjugate Gradient (LOBPCG) method One of the iterative eigen

14/26 Locally Optimal Block Preconditioned Conjugate Gradient (LOBPCG) method One of the iterative eigen solution methods A. V. Knyazev, SIAM J. Sci. Compute. 23, 517 (2001). 山田進 他, 日本計算 学会論文集, 20060027 (2006). Diagonalize with direct method

15/26 Algorithm of LOBPCG method lobpcg_main@lobpcg. F 90 do iteration end do iteration

15/26 Algorithm of LOBPCG method lobpcg_main@lobpcg. F 90 do iteration end do iteration

16/26 Hamiltonian vector product h_psi@hamiltonian. F 90 Done in subroutine hpsi in hamiltonian. F

16/26 Hamiltonian vector product h_psi@hamiltonian. F 90 Done in subroutine hpsi in hamiltonian. F 90

17/26 Running iterative method $ cd ~/pwdft/sample/Al/ $. . /src/pwdft. x < iterative. in

17/26 Running iterative method $ cd ~/pwdft/sample/Al/ $. . /src/pwdft. x < iterative. in See "Kohn-Sham Time" in Standard output keep ecutrho ≧ 4*ecutwfc &CONTROL calculation = 'iterative' / &SYSTEM nbnd = 10 nat = 1 ntyp = 1 ecutwfc = 60. 000000 ecutrho = 240. 000000 / &ELECTRONS / CELL_PARAMETERS 0. 000000 2. 024700 0. 000000 ATOMIC_SPECIES Al al. lda. lps ATOMIC_POSITIONS Al 0. 000000 K_POINTS 1 0. 0

18/26 Report problem 1 (1) Compare the computational time of direct method and LOBPCG

18/26 Report problem 1 (1) Compare the computational time of direct method and LOBPCG method by changing ecutrho and ecutwfc. Time [sec] keep ecutrho ≧ 4*ecutwfc [Ry]

19/26 What is the command "git" $ git clone ssh: //user-name@133. 11. 72. 58:

19/26 What is the command "git" $ git clone ssh: //user-name@133. 11. 72. 58: /home/Student/Public/pwdft • • • Backup code Port program in any system Merge modifications Compare diff Log each modification with comment Etc.

20/26 Considered case 1 System C Laptop PC PC cluster Labo PC System B

20/26 Considered case 1 System C Laptop PC PC cluster Labo PC System B Home PC ・ Where is the latest source code ? ・ We need to update source code easily.

21/26 Considered case 2 Program System A System B Speed up with symmetry Program

21/26 Considered case 2 Program System A System B Speed up with symmetry Program System A Open. MP+MPI Program System A System B ・ We need to trace when was it broken. ・ We need to be available to return the stable (no error) code.

22/26 Version control Program (commit 1) Repository server $ git pull update modification Program

22/26 Version control Program (commit 1) Repository server $ git pull update modification Program (commit 2) Program (commit 3) Program (commit 10) Latest Program (commit 11) $ git commit $ git push $ git pull Update latest version local repository Logging : Who When What modified local repository Modify

23/26 When modified simultaneously Program (commit 1) Repository server Program (commit 2) Program(commit 3)

23/26 When modified simultaneously Program (commit 1) Repository server Program (commit 2) Program(commit 3) $ git push Program (commit 10) Program (commit 11) Latest commit 10+ $ git pull Program (commit 12) commit 11+ local repo commit $ git push local repo

24/26 Tutorial $ $ $ $ $ cd ~/pwdft/ git branch -a git config

24/26 Tutorial $ $ $ $ $ cd ~/pwdft/ git branch -a git config --global user. name "user-name" git config --global user. email "user-name@bkks" git checkout -b user-name echo "Hello, I am user-name. " > user-name. txt git add user-name. txt git commit (vi is used) git push --set-upstream origin user-name git branch -a

25/26 Example of branches Master V 0. 1 V 0. 2 Hotfix (Bug fix)

25/26 Example of branches Master V 0. 1 V 0. 2 Hotfix (Bug fix) Release Develop Feature (new features) "A successful branch in git" V 1. 0

26/26 l l Today's summary Plane-wave representation of Kohn-Sham eq. Direct method and LOBPCG

26/26 l l Today's summary Plane-wave representation of Kohn-Sham eq. Direct method and LOBPCG method Hamiltonian-vector product with FFT Git