본문 바로가기

DFT/Calculation

9. Relaxing (2023.08.03 오타 및 내용 수정 완료)

본 매뉴얼은 리눅스(UBUNTU 20.04)환경에서 Terminal에 명령을 내리는 방식으로 작성되었습니다.
사용자는 UBUNTU 20.04 이상의 환경에서 리눅스 환경에 익숙해지는 과정을 거치면서 매뉴얼을 사용하시기 바랍니다.

https://sites.google.com/view/seoulqmt

 

University of Seoul QMT

Quantum materials theory at the University of Seoul

sites.google.com

 
이제부터는 원자들을 relax하도록 할 것이다. Relaxing 이 필요한 이유에 대해서 Quauntum  Espresso 공식 홈페이지에서는 다음과 같은 설명을 하고 있다.

“Once your system is in the GS(Ground State), depending on how you have prepared the starting atomic configuration:
 
1.      If you have set the atomic positions "by hand" and/or from a classical code, check the forces on atoms, and if they are large ( 0.1 ÷ 1.0 atomic units ), you should perform an ionic minimization, otherwise the system could break up during the dynamics.
 
2.      If you have taken the positions from a previous run or a previous ab-initio simulation, check the forces, and if they are too small (10-4 atomic units), this means that atoms are already in equilibrium positions and, even if left free, they will not move. Then you need to randomize positions a little bit (see below)  ”
 
이 정도가 우리가 Relax를 하여야 하는 이유가 되겠다.

이제 코드를 넣어 보도록 하자.

&control
    calculation = 'relax'
    restart_mode='from_scratch'
    prefix='MoS2'
    etot_conv_thr = 1.0D-8
    forc_conv_thr = 1.0D-4
    tstress = .true.
    tprnfor = .true.
    pseudo_dir = '/(당신의 pseudopotential 폴더 위치)'
    outdir='./tmp'
 /
 &system
    ibrav=  4
    A=3.161
    C = 20
    nat=  3
    ntyp= 2
    ecutwfc = 80
    occupations='smearing'
    smearing='gaussian'
    degauss=0.020000
 /
 &electrons
    conv_thr =  1.0d-10
    mixing_beta = 0.3
 /
 /
 &ions
 /
ATOMIC_SPECIES
Mo 95.94  Mo_ONCV_PBE-1.2.upf
S    32.065 S_ONCV_PBE-1.2.upf
ATOMIC_POSITIONS (crystal)
Mo    0.666666619         0.333333314         0.750000039
S     0.333333360         0.666666714         0.627500011
S     0.333333360         0.666666714         0.872499989
 
K_POINTS automatic
 8 8 1 0 0 0

이제는 calculation 을 ‘relax’로 바꾼다. 그리고 electrons 밑에 ‘ions’ 를 추가한다.

 

mpirun을 이용해 실행한다

mpirun -np (프로세서 개수) (pw.x프로그램 위치) <(Relax input 파일명.in) > (Relax input 파일명.out) 
 
그리고 이제는 Lattice 에서도 relax시킨 뒤, 이제부터 Band Energy를 그릴 것이다.

&control
    calculation = 'vc-relax'
    restart_mode='from_scratch'
    prefix='MoS2'
    etot_conv_thr = 1.0D-8
    forc_conv_thr = 1.0D-4
    tstress = .true.
    tprnfor = .true.
    pseudo_dir = '/(당신의 pseudopotential 폴더 위치)'
    outdir='./tmp'
 /
 &system
    ibrav=  4
    A=3.161
    C = 20
    nat=  3
    ntyp= 2
    ecutwfc = 80
    occupations='smearing'
    smearing='gaussian'
    degauss=0.020000
 /
 &electrons
    conv_thr =  1.0d-10
    mixing_beta = 0.3
 /
 /
 &ions
 /
 /
 &Cell
 Cell_dofree =2Dxy
 Press_conv_thr = 0.005D0
 /
ATOMIC_SPECIES
Mo 95.94  Mo_ONCV_PBE-1.2.upf
S  32.065 S_ONCV_PBE-1.2.upf
ATOMIC_POSITIONS (crystal)
Mo    0.666666619         0.333333314         0.750000039
S     0.333333360         0.666666714         0.627500011
S     0.333333360         0.666666714         0.872499989
 
K_POINTS automatic
 16 16 1 0 0 0
 

Calculation 을 ‘vc-relax’로 변경하고, & Cell 코드를 입력한다. 이 코드는 vc-relax혹은 vc-md 에서만 사용한다.
Cell_dofree = 2Dxy 라는 의미는 x,y 성분을 바꾸는 것만을 허용한다는 의미이다. (우리는 2차원 물질을 다루고 있다.)
K point 옆에 automatic 이 붙어있는 이유는 자동으로 균질한 kpoint 의 grid  를 생성한다는 의미이다.   
이렇게 해서 Relaxing 이 끝났다.

+) 만일 relaxing 계산이 끝났는데 output file을 살펴보니 다음과 같이 'eigenvalues not converged'가 나왔다면 inputfile에서 Kpoint를 키우거나 conv_thr 값을 더 낮춰보세요.

++ ) K point는 전자 구조 계산에서 Brillouin zone을 샘플링하는데 사용되는 기준점들의 그리드이므로, vc-relax에서와 relax에서의 K point값을 서로 같게 선택하여 전자 구조 최적화를 수행하는 것이 좋습니다.
구조 최적화의 과정에서 전자 구조가 크게 변하지 않을 수 있지만, 기하 구조 최적화에 사용되는 Κ-point는 전체 Brillouin zone을 적절히 샘플링해야 하기 때문입니다.