pwscf 聲子計算

1) 聲子譜的計算原理;

2) PWSCF計算聲子譜的步驟;

3) 高對稱性點的插入及後處理步驟。


聲子譜計算步驟小結:以下兩個步驟寫入prun_phon腳本文件一次執行

1) pw.x進行電子密度的自洽計算;

2) ph.x對小的q網格點進行動力學矩陣元的計算; 【得到fildyn='$name.dyn'動力學矩陣文件,在後處理中需要對該文件處理】

 

以下步驟可以看做是後處理步驟,統一寫入phonon_spectra_3.2腳步文件,一次執行

3)q2r.x計算實空間力常數矩陣;【輸入fildyn='$name.dyn',產生flfrc='$name.fc' (用來設置輸出力常數矩陣的文件);$name.fcmatdyn.x程序調用

4)matdyn.x計算出聲子色散曲線;【調用flfrc='Sc444.fc',得到flfrq='$name.freq'(用來輸出頻率的文件)】

5)matdyn.x計算聲子態密度。【調用flfrc='Sc444.fc', flfrq='Sc444.freq',得到fldos='$name.dos'用來存儲聲子態密度的文件

 


以下轉載自Valenhou: PWSCF計算晶體的聲子色散曲線和態密度

    pwscf 是採用線性響應的方法來進行晶格動力學性質的計算。在計算晶體的聲子色散和態密度時的步驟:

i)用pw.x進行自洽計算;

ii)用ph.x對小的q點網格進行計算,得到這些q點的動力學矩陣元;


iii)用q2r.x計算出實空間中的力常數矩陣;

iv)用matdyn.x計算聲子色散曲線;

v) 用matdyn.x計算聲子態密度。


下面以Sc爲例子並針對pwscf的最新版本3.2.1來說明(早期版本在計算聲子色散曲線較麻煩,因爲它不能自動處理q點網格,然後對每個q點一次性計算,而是需要手動產生這些點,一個個計算)。


1) 用pw.x進行電子密度的自洽計算
&control
title='Sc, hexagonal cell'
calculation = 'scf'
restart_mode='from_scratch',
prefix='sc',
pseudo_dir = './',
outdir='./tmp'
tprnfor=.true.
/
&system  
ibrav=4,
celldm(1)=6.05606,
celldm(3)=1.71298,
nat=2,
ntyp=1, nbnd= 30,
ecutwfc=30.0,
occupations ='smearing', degauss =0.01
smearing ='mp'
/
&electrons
diagonalization='cg'
diago_cg_maxiter= 60
mixing_mode = 'plain'
mixing_beta = 0.5
conv_thr = 1.0d-6
/
ATOMIC_SPECIES
Sc 44.955910 Sc.pw91-nsp-van.UPF
ATOMIC_POSITIONS (crystal)
Sc 0.3333333333333286 0.6666666666666714 0.2500000000000000
Sc 0.6666666666666714 0.3333333333333286 0.7500000000000000
K_POINTS (automatic)
8 8 6 0 0 0
注 意Sc是金屬,在此例子中,我們選用MP方法來確定電子的佔有數(見occupations ='smearing', smearing ='mp'),這裏未經測試而選用了展寬係數爲0.01 Ry (見degauss=0.01)。在進行聲子色散曲線的計算時,不必需對 calculation設置爲'phonon',在新版本中,直接設置爲scf。這一步計算產生勢以及電荷密度供一下的計算中利用到。【何處用到?】

2)用ph.x對小的q網格點進行動力學矩陣元的計算
phonon for Sc
&inputph
tr2_ph=1.0d-10,
prefix='sc',
fildvscf='scdv',   #File where the the potential variation is written (for later use in electron-phonon calculation).
amass(1)=44.955910,
outdir='./tmp',
fildyn='sc.dyn',
elph=.false.,
trans=.true.,
ldisp=.true.
nq1=4, nq2=4, nq3=2
/
注 意這裏trans和ldisp必須設置爲.true.。其中trans爲.true.表示要計算聲子相關的性質,ldisp設置爲.true.表示要計算 聲子色散曲線。另外 prefix和outdir的設置儘量與上一步自洽計算中的設置一致,以能讀入上一步計算得到的數據。另外nq1,nq2和nq3是用來設置q網格點的。 爲了得到實空間的力常數矩陣,這裏採用的是先計算出q空間中小的q網格點的動力矩陣元,然後採用fft變換得到實空間的力常數矩陣。因此在這一步計算中需 設置小的q網格點的網格大小。【爲什麼要設置成小的,多小算小?】

3)用q2r.x計算實空間力常數矩陣  【輸入name.dyn

name.fc】
&input
zasr='simple', fildyn='sc.dyn', flfrc='Sc444.fc', la2F=.false.
/
在q2r.x的輸入文件中需指定
fildyn: 用來設置包含了q網格點的動力學矩陣元的文件,與上一步的 fildyn設置一致;
flfrc:用來設置輸出力常數矩陣的文件;
la2F:用來設置是否計算出實空間中電-聲耦合係數;針對計算材料的超導性質;
zasr:如何處理‘聲學支求和規則“,該規則是用在處理Born有效電荷的,要求Born有效電荷的總和是零。可賦的值有:
no,表示不處理聲學支求和問題
simple, 表示通過對力常數矩陣的對角元素進行修正來考慮3支聲學橫模的求和處理;
crystal,
one-dim,
zero-dim
這裏我們設置爲simple。

4)用matdyn.x計算出聲子色散曲線
&input
asr='simple', amass(1)=44.955910,
flfrc='Sc444.fc', flfrq='Sc444.freq', la2F=.false., dos=.false.
/
131
0.000000 0.000000 0.000000 0.00
0.000000 0.016667 0.000000 0.00
0.000000 0.033333 0.000000 0.00
0.000000 0.050000 0.000000 0.00
0.000000 0.066667 0.000000 0.00
0.000000 0.083333 0.000000 0.00
0.000000 0.100000 0.000000 0.00
0.000000 0.116667 0.000000 0.00
0.000000 0.133333 0.000000 0.00
0.000000 0.150000 0.000000 0.00
0.000000 0.166667 0.000000 0.00
0.000000 0.183333 0.000000 0.00
0.000000 0.200000 0.000000 0.00
0.000000 0.216667 0.000000 0.00
0.000000 0.233333 0.000000 0.00
0.000000 0.250000 0.000000 0.00
0.000000 0.266667 0.000000 0.00
....
這裏要輸入131個特殊q點的座標。與計算能帶結構時一樣,需先選出要計算的高對稱q點的走向以及高對稱點的座標,然後產生這些線上的q點的座標。

計算出來的每一個q點的本徵頻率可按上一個blog中提到的方法處理一下後畫圖。

5),用matdyn.x計算聲子態密度
&input
asr='simple', amass(1)=44.955910,
flfrc='Sc444.fc', flfrq='Sc444.freq', la2F=.false., dos=.true.
fldos='phonon.dos', nk1=10, nk2=10, nk3=10, ndos=50
/

要計算聲子態密度,dos必須設置爲.true.另外fldos用來設置輸出的態密度值,計算態密度時要用更密的q點網格,這需設置nk1, nk2, nk3。另外還有態密度的能量刻度上的點的數目,由ndos來設置。



手冊5.0.2例子1解讀




This example illustrates how to use pw.x and ph.x to calculate phonon frequencies at Gamma and X for Si and C in the diamond structure and  for fcc-Ni.


The calculation proceeds as follows (for the meaning of the cited input variables see the appropriate INPUT_* file)


1) make a self-consistent calculation (input=si.scf.in, output=si.scf.out)


2) make a phonon calculation for gamma point (input=si.phG.in,output=si.phG.out). Note that outdir and prefix have the same   values as in the input for scf calculation.

  Note that the q-point (the Gamma point in this case) is read   after the namelist inputph.

  Dynamical matrix will be saved for further analysis in fildyn (whose  default name is 'matdyn', here overwritten to si.dynG)


  The Gamma point is the ONLY one for which the phonon code can be run  directly after the scf run (provided save file was defined).

  For all other points in the BZ a non-scf preparatory run is needed, as it is shown here for the X point. 【對於其他非gamma點還是要進行非自洽計算】


3) make a phonon calculation for X point (input=si.phX.in, output=si.phX.out). Note the option "lnscf=.true.": this instructs   the code to perform a needed non-scf calculation first.

  Note that the q-point (the X point in this case) is read after the namelist inputph.

  Dynamical matrices will be saved for further analysis in fildyn  (whose default name is 'matdyn', here overwritten to si.dynX).

  The fildyn file contains the dynamical matrices for q-points that are equivalent by symmetry to the q-point given in input (in this case the three X points), therefore when calculating phonons in the   whole BZ the code needs to be run only on inequivalent points.


  The phonon code can perform also a 'single-mode' calculation where   only a single atom is moved in a single direction and the corresponding column of the dynamical matrix is calculated. This may be useful when studying vibrational properties of defects and/or surfaces.【如何理解】

  This feature is illustrated in the following part of the test.


4) Perform again a scf calculation for Si. Why? because the phonon  calculation performed in the previous step has overwritten the  original wavefunctions. This step can be avoided by saving the  content of outdir and restoring it after step 3)


5) make a phonon calculation at X point for a single mode (input=si.phXsingle.in, output=si.phXsingle.out).

  Apart from the specification of the mode to be calculated   (modenum=3), the input is identical to case 4). The only difference  is that fildyn is not given a name, so the default one (matdyn) is  used. This is done in order not to overwrite the previous files.

  The total dynamical matrix is not computed and matdyn is actually   left empty.


# self-consistent calculation for Ni with US-PP

cat > ni.scf.in << EOF

&control

   calculation='scf'

   restart_mode='from_scratch',

   tprnfor = .true.

   prefix='ni',

   pseudo_dir = '$PSEUDO_DIR/',

   outdir='$TMP_DIR/'

/

&system

   ibrav=2, celldm(1) =6.65, nat=  1, ntyp= 1,

   nspin=2,

   starting_magnetization(1)=0.5,

   degauss=0.02,

   smearing='mp',

   occupations='smearing',

   ecutwfc =27.0

   ecutrho =300.0

/

&electrons

   conv_thr =  1.0d-8

   mixing_beta = 0.7

/

ATOMIC_SPECIES

Ni  58.6934  Ni.pbe-nd-rrkjus.UPF

ATOMIC_POSITIONS

Ni 0.00 0.00 0.00

K_POINTS AUTOMATIC

4 4 4 1 1 1

EOF

$ECHO "  running the scf calculation for Ni...\c"

$PW_COMMAND < ni.scf.in > ni.scf.out

check_failure $?

$ECHO " done"


# phonon calculation at X  【這是非自洽計算?】

cat > ni.phX.in << EOF

phonons of Ni at X

&inputph

 tr2_ph=1.0d-14,

 prefix='ni',

 amass(1)=58.6934,

 fildyn='nix.dyn',

 outdir='$TMP_DIR/',

/

0.0 0.0 1.0

EOF

$ECHO "  running the phonon calculation at X for Ni...\c"

$PH_COMMAND < ni.phX.in > ni.phX.out

check_failure $?

$ECHO " done"


# clean TMP_DIR

ECHO"cleaning

TMP_DIR...\c"

rm -rf $TMP_DIR/*

$ECHO " done"


$ECHO

ECHO"

EXAMPLE_DIR: done"


備註:

(1)動力學矩陣文件*.dyn0的作用:存儲需要計算的q點數

(2)聲子譜q點選擇很重要,選擇的不好,分析計算會出現q not allowed;這種情況下,可取成一樣的。一般依據:Pdos計算前 asr選項去掉

(4)聲子譜計算前自洽計算的目的,還是爲了得到電荷密度

  新版pwscf不需要進行非自洽【非自洽計算的目的,是爲了得到費米麪附近更精確的電荷密度值】;只有在計算電聲耦合常數時,纔要求加入非自洽計算

(5)PW計算聲子譜,測試gama點很重:即用不同kpoints來測gaman….

無論採用phonopy還是pw計算聲子譜前一定要在優化的過程中加入力的收斂!!!

單純的結構預測沒有必要設置力的收斂….

(6)計算聲子譜時q點如何選取,是否也應該進行測試?

爲什麼要設置q點?

 

[20:00:20] xiaoqiugood: 446k點做一下scf然後馬上殺掉,out文件裏面就有產生的k點的個數了(個數不是簡單的等於4x4x6嗎?)

[20:01:25] lv Jian: 不等於,考慮對稱性以後有很多K點事等價的,所以實際計算的要比4*4*6

[20:03:37] xiaoqiugood: 哦有道理,我說的是聲子譜中的q點設置,你的意思是說:可以將設置好的q點當成k點,放入自洽計算文件中,跑一下,得出其實際數目,對嗎?

[20:04:34] lv Jian: 對,q點和k點事一樣的,這麼跑一下,就是想看看446的格子可以產生多少個點

[20:05:24] xiaoqiugood: 有道理,我跑一下......

[20:05:46] lv Jian: 然後調整格子,使實際計算的點大概20-30左右

[20:07:30] xiaoqiugood: 好的,謝謝...這樣的設置大致可以產生多少個.dyn文件?.dyn是一個原子產生一個嗎?

[20:09:34] lv Jian: 就是你產生的q點的個數

[20:10:32] lv Jian: dyn文件的個數和你產生的q點的個數是一樣的

[20:10:59] xiaoqiugood: 哦,明白了.... (y)

[20:11:22] lv Jian: (handshake)

[20:11:53] xiaoqiugood: 34k點可以接受哈

[20:15:16] lv Jian: 稍多一點,如果計算快的還行,如果計算慢的話你就在改下網格

Fcc 4 4 2產生8k

grep number of k points *out*

number of k points=     8 gaussian broad. (Ry)=  0.0200     ngauss =  1

                      cart. coord. in units 2pi/a_0

      k(    1) = (   0.0000000  0.0000000   0.0000000), wk =   0.0625000

      k(    2) = (   0.5000000 -0.5000000   0.5000000), wk =   0.2500000

      k(    3) = (   0.2500000  0.2500000   0.2500000), wk =   0.2500000

      k(    4) = (   0.7500000 -0.2500000   0.7500000), wk =   0.7500000

      k(    5) = (   0.0000000 -1.0000000   0.0000000), wk =   0.1875000

      k(    6) = (   0.0000000  0.0000000   0.5000000), wk =   0.1250000

      k(    7) = (   0.5000000 -0.5000000   1.0000000), wk =   0.2500000

      k(    8) = (   0.0000000 -1.0000000   0.5000000), wk =   0.1250000

 

Q值設定網格,按該設定網格計算完聲子譜後,採用tools包中的小工具處理,得到高對稱性點和聲子譜。

a)       klist.ini  文件

該文件,可通過xcrysden選點產生,文件格式如下:

b)     ./cry-to-car.x  klist.iniklist.out

轉換成晶體座標

c)      ./kpath-30.x  

在高對稱性點中插入的點數?

d)     ./kband.x

klist.out中找出高對稱性點,並標註出來

 

e)      klist.out中點放入phon-spectru….

執行後得到所要處理的聲子譜文件


其他摘錄:

具體步驟可細分爲:

1)  計算得到.dyn文件;pw.x自洽,ph.x聲子,得到的dyn文件數量等於產生的q點數量

2)  以下都是後處理:

3)  準備高對稱性k點,按格式寫入klist.ini文件

4)  執行cry-to-car.x程序,將klist.ini文件中的k點座標由晶體座標轉換爲笛卡爾座標,得到相應的klist.out文件

5)   在各高對稱性k點間插入間隔k點數:即,執行 ./kpath_30.x

6)  運行./kband.x,在各k點加加入逗號(供後續程序讀取數據方便)

7)  klist.out文件內容放入phonon_spectra2.1.5文件中,按格式修改相關參數,執行程序,得到….  運行read_phonon.x,得到可用於繪圖的.dat文件【注意採用該程序提取的頻率的單位爲cm-1,不是THz


1. pw.x 和ph.x腳本

#!/bin/bash

####################################################################

 

./home/xiaoqiugood/pwscf/pw/environment/environment_1

 

exportPARA_PREFIX='mpirun  -np 12 '

# or   export PARA_PREFIX='mpirun' ,export  PARA_POSTFIX= -np 3

exportTMP_DIR=/home/xiaoqiugood/pwscf/pw/tmp/tmp3

rm -r $TMP_DIR/*.save

rm $TMP_DIR/*

 

export name='a225'

 

for a in 1000

do

cat >name.scf.in_

a << EOF

 

&control

   calculation = 'scf'

   restart_mode='from_scratch',

   prefix='$name',

   pseudo_dir = '$PSEUDO_DIR/',

   outdir='$TMP_DIR/'

   tstress=.t.,

   tprnfor=.t.

/

&system

ibrav=2,

celldm(1)=7.836769829,

 nat= 4, ntyp= 2

  ecutwfc =60,

  nbnd= 30,

 occupations ='smearing',

 smearing ='mp',

degauss =0.01

/

&electrons

   mixing_beta = 0.7

   conv_thr = 1.0d-8

/

ATOMIC_SPECIES

H     1.008     H.pbe-van_ak.UPF

Sc    44.9559   Sc.pbe-nsp-van.UPF

ATOMIC_POSITIONS(crystal)  #必須用pwscf優化後的原子位置,不能直接VASP優化後的原子位置

H  0.750000000000.75000000000  0.75000000000

      H  0.250000000000.25000000000  0.25000000000

      H 0.500000000000.50000000000  0.50000000000

     Sc 0.00000000000 0.00000000000 0.00000000000

K_POINTS {automatic}

24 24 24  0 0 0

EOF

PARAPREFIX

PW_ROOT/pw.x  <name.scf.in_a >name.scf.out_

a

done

 

# occupations用來設置確定電子佔有數的方法賦值爲'smearing'表示採用smearing的方法來確定電子的佔有數隨後須設置smearingdegauss關鍵詞。 smearing用來指明確定電子佔有數的一種具體的smearing方法賦值爲'gaussian'表示採用Gaussian函數來確定電子佔有數賦值 'mp'即表示採用 Methfessel-Paxton first-orderspreading (see PRB 40, 3616 (1989))方法或函數來確定電子佔有數。

degauss用來確定smearing方法中有關函數的展寬參數,賦值爲0.05表示設置上面函數中的展寬參數爲0.05degauss 0,相當於fixed-occupation的計算,即每個態的電子佔有數是固定的。當體系爲半導體或絕緣體時,可以設置degauss=0,其他情況下不能

# Variable: nbnd;Type:  INTEGER  Default:        for an insulator, nbnd = number of valence bands (nbnd=nelec/2,see below for nelec); for a metal, 20% more (minimum 4 more)  Description: number of electronic states(bands) to be calculated. Note that in spin-polarized calculations the numberof k-point, not the number of bands per k-point, is doubled


 

cat>$name.ph.in << EOF

phonon of$name  at Gamma

&inputph

tr2_ph=1.0d-12,

prefix='$name',

amass(1)=1.008

amass(2)=44.955910,

trans=.true.,

ldisp=.true.,

outdir='$TMP_DIR',

fildyn='$name.dyn',

nq1=4,nq2=4,nq3=4 ##該參數如何設置?   不只是gamma點,那是哪些點,高對稱性點包含了嗎?

 

# 本部分重點設置參數:tr2_ph(頻率收斂截斷), fildyn動力學矩陣文件), amass(原子質量)。如果是絕緣體還要考慮加入玻恩有效電荷的計算參數:epsil=true

# tr2_ph . Threshold forselfconsistency.Default: 1e-10.可以調高些,計算量增加的不多,但是能夠提高聲子的計算精確度。

#注意這裏transldisp必須設置爲.true.。其中trans.true.表示要計算聲子相關的性質,ldisp設置爲.true.表示要計算聲子色散曲線。

手冊解釋:Description: if .true. the phonons are computed. if trans .and. epsil effective charges are calculated.  Default: .true.

手冊解釋ldispDefault:  .false. Description:   If .TRUE. the runcalculates phonons for a grid of  q-points specified by nq1, nq2, nq3  - for direct calculation of the entire phonon dispersion.  The pw.x data file should not be producedusing "calculation='phonon'" in this case.

 # fildyn='$name.dyn'這個是輸出的動力學矩陣文件,在後處理中需要對該文件處理,大家可以看看裏面是什麼內容。手冊介紹:File where the dynamical matrix is written. Default:        'matdyn'.

# 另外 prefixoutdir的設置儘量與上一步自洽計算中的設置一致,以能讀入上一步計算得到的數據【哪一個參數是讀入上一步數據】。

#nq1,nq2nq3是用來設置q網格點的。爲了得到實空間的力常數矩陣,這裏採用的是先計算出q空間中小的q網格點的動力矩陣元,然後採用fft變換得到實空間的力常數矩陣。因此在這一步計算中需設置小的q網格點的網格大小。【q點選擇依據,怎麼不見設置高對稱性q點,高對稱性q點與k點是一致的嗎?<20手冊解釋:Variables:  nq1, nq2, nq3. Default: 0.  Description: Parameters of the Monkhorst-Pack grid (no offset) used when ldisp=.true.Same meaning as for nk1, nk2, nk3 inthe input of pw.x.  【用ldisp=.true.自動產生q?

# 注意Variables: xq(1)  xq(2)  xq(3)設置在inputph namelist之外;而iq1, iq2, iq3 nq1nq2nq3均設置在namelist之內。These (iq1, iq2, iq3)go together with nq1, nq2, nq3 and allow to choose just one point out of theMonkhorst-Pack grid with ldisp=.true. Note the the actual point chosen is something like  (iq1-1)/nq1, (iq2-1)/nq2, (iq3-1)/nq3 (so, check the outputfor what you get). Also make sure that PW left *.wfc)

#手冊解釋Variables:xq(1)  xq(2)  xq(3). Decription:    The phonon wavevector; must be equal to the one usedin the non-selfconsistent calculation (not read if ldisp is true).  

# 關於高對稱性點,與計算能帶類似,要自己先選定一些高對稱點,併產生這些高對稱點之間其他點。


/

EOF

PARAPREFIX

PW_ROOT/ph.x < name.ph.in>

name.ph.out


2.   後處理步驟腳本

 

cat > matdyn.in<< EOF

&input

   asr='simple',  amass(1)=1.008, amass(2)=44.955910

   flfrc='a225.fc', flfrq='a225.freq'

/

151

 -1.000000      0.5000000      0.0000000E+00           1

-0.9833333      0.5000000      1.6666669E-02           2

-0.9666667      0.5000000      3.3333331E-02           3

.......()

-0.7666667      0.7333333      0.0000000E+00         149

-0.7583333      0.7416667      0.0000000E+00         150

-0.7500000      0.7500000      0.0000000E+00         151

EOF

$PW_ROOT/matdyn.x < matdyn.in> matdyn.out

#這麼多k點來自產生k點的小腳本

# flfrc用來設置輸出力常數矩陣的文件;  

 

# flfrq:用來輸出頻率的文件

#這裏要輸入151個特殊q點的座標。與計算能帶結構時一樣,需先選出要計算的高對稱q點的走向以及高對稱點的座標,然後產生這些線上的q點的座標。計算出來的每一個q點的本徵頻率可按上一個blog中提到的方法處理一下後畫圖。

#聲子譜q點選擇很重要,選擇的不好,分析計算會出現q not allowed;這種情況下,可取成一樣的。一般依據:pdos計算前 asr選項去掉;聲子譜計算前自洽計算的目的,還是爲了得到電荷密度。新版pwscf不需要進行非自洽【非自洽計算的目的,是爲了得到費米麪附近更精確的電荷密度值】;只有在計算電聲耦合常數時,纔要求加入非自洽計算。

# dynmat.x applies various kinds of Acoustic SumRule (ASR), calculates LO-TO splitting at q = 0 in insulators, IR and Raman crosssections

(if the coefficients have been properlycalculated), from the dynamical matrix produced by ph.x.  Notice again that asr='simple' makes the frequency ofacoustic phonons vanish but has no effect on the other modes

 

 

 

cat > phdos.in<<EOF

&input

   asr='simple',

   dos=.true.,

   amass(1)=1.008,

   amass(2)=44.955910,

   flfrc='a225.fc',

   nk1=20,nk2=10,nk3=10,

   deltaE=1.0,

   fldos='a225.dos'

ndos=50

/

EOF

$PW_ROOT/matdyn.x < phdos.in> phdos.out

 

#要計算聲子態密度,dos必須設置爲.true.另外fldos用來設置輸出的態密度值(文件)計算態密度時要用更密的q點網格,這需設置nk1, nk2, nk3另外還有態密度的能量刻度上的點的數目,可由ndos來設置(非必須)

# fldos用來存儲聲子態密度的文件;

# deltaE表示energy grid step (eV)


例子文件:

# job script for quantum espresso

# the name of queue, should be cscore or csnode

APP_NAME="cscore"


# number of processes

NP=16


# fix command style

RUN="RAW"


# current directory

CURDIR=$PWD


# build .nodelist

rm -rf $CURDIR/.nodelist >& /dev/null

for i in `echo $LSB_HOSTS`

do

echo i>>

CURDIR/.nodelist

done


# directory for quantum espresso

EXEDIR=$HOME/bin/espresso502/bin


# directory for mpi (mvapich)

MPIDIR=/home/compiler/mpi/mvapich/1.0/icc.ifort-11.1/bin


# start calculation (scf)

#MPIDIR/mpirunnp

NP -machinefile CURDIR/.nodelist

EXEDIR/pw.x -in scf.in > scf.out


# start calculation (nscf)

#MPIDIR/mpirunnp

NP -machinefile CURDIR/.nodelist

EXEDIR/pw.x -in nscf.in > nscf.out


# start calculation (phonon)

#MPIDIR/mpirunnp

NP -machinefile CURDIR/.nodelist

EXEDIR/pw.x -in ph.in > ph.out


#PARA_PREFIX='MPIDIR/mpirunnp

NP -machinefile $CURDIR/.nodelist'


#export PARA_PREFIX



####################################################################

PW_ROOT=/home/users/spclibtt/bin/espresso502/bin

PSEUDO_DIR=/home/users/spclibtt/home/yexq/shanghai-opt/pw-work/pseudo

TMP_DIR=/home/users/spclibtt/home/yexq/shanghai-opt/pw-work/environment/tmp


#export PARA_PREFIX='mpirun -np 2'

# or   export PARA_PREFIX='mpirun' ,export  PARA_POSTFIX= -np 3

export PATH=/home/compiler/mpi/mvapich/1.0/icc.ifort-11.1/bin:$PATH

export PARA_PREFIX='mpirun -np 16'





export PW_ROOT PSEUDO_DIR TMP_DIR

export name='sch4-i4mm'


rm -r $TMP_DIR/*.save

rm $TMP_DIR/*


###########self-consistent calculation ######################


for a in 2500

do

cat > name.scf.in_

a << EOF


&control

   calculation = 'scf'

   restart_mode='from_scratch',

   prefix='$name',

   pseudo_dir = '$PSEUDO_DIR/',

   outdir='$TMP_DIR/'

   tstress=.t.,

   tprnfor=.t.

/

&system

 ibrav=0,

 nat=10,

 ntyp=2,

 ecutwfc=90.0, ecutrho = 760.0

 nbnd= 30,

 occupations ='smearing', degauss =0.01

 smearing ='mp'

/

&electrons

   mixing_beta = 0.7

   conv_thr =  1.0d-8

/

ATOMIC_SPECIES

H     1.008      H.pbe-van_ak.UPF

Sc    44.9559    Sc.pbe-nsp-van.UPF


CELL_PARAMETERS {bohr}

4.745568648     -4.27115E-08    0

-4.27115E-08    4.745568539     -9.49146E-09

4.74573E-09     -1.89829E-08    8.842464528


ATOMIC_POSITIONS {crystal}

H        0.499999965   0.500000040   0.370850743

H        0.499999950   0.500000054   0.629149579

H       -0.000000022   0.000000030   0.870851011

H       -0.000000027   0.000000036   0.129148779

H       -0.000000013   0.500000019   0.249999381

H       -0.000000012   0.500000019   0.750000700

H        0.499999968   0.000000027   0.249999365

H        0.499999976   0.000000024   0.750000717

Sc      -0.000000006  -0.000000010   0.499999832

Sc       0.500000021   0.500000003   0.000000162



K_POINTS {automatic}

16 16 9 0 0 0

EOF


MPIDIR/mpirunnp

NP -machinefile CURDIR/.nodelistEXEDIR/pw.x  < name.scf.in_a >name.scf.out_

a

done



cat >$name.ph.in << EOF

phonon of $name  at  X

&inputph

tr2_ph=1.0d-12,

prefix='$name',

fildvscf='$name.dv',

amass(1)=1.008

amass(2)=44.955910,

trans=.true.,

ldisp=.true.,

outdir='$TMP_DIR',

fildyn='$name.dyn',

nq1=4,nq2=4,nq3=2

/

EOF

MPIDIR/mpirunnp

NP -machinefile CURDIR/.nodelistEXEDIR/ph.x  < name.ph.in>

name.ph.out



完整的後處理程序


#!/bin/bash

####################################################################

. ../../../../../environment/environment_1


# export PARA_PREFIX='mpirun  -np 6 '

# or   export PARA_PREFIX='mpirun' ,export  PARA_POSTFIX= -np 3

export  TMP_DIR=../../../../../tmp/tmp5

rm -r $TMP_DIR/*.save

rm $TMP_DIR/*


export name='c225'


#############色散曲線#############

cat > q2r.in << EOF

&input

  fildyn='c225.dyn', zasr='simple', flfrc='c225.fc'

/

EOF

$PW_ROOT/q2r.x < q2r.in > q2r.out


cat > matdyn.in << EOF

&input

   asr='simple',  amass(1)=1.008,amass(2)=44.955910

   flfrc='c225.fc', flfrq='c225.freq'

/

151

 -1.000000      0.5000000      0.0000000E+00           1

-0.9833333      0.5000000      1.6666669E-02           2

-0.9666667      0.5000000      3.3333331E-02           3

.......

-0.7500000      0.7500000      0.0000000E+00         151

EOF

$PW_ROOT/matdyn.x < matdyn.in > matdyn.out


###################dos##########################

cat > phdos.in <<EOF

&input

   asr=.true.,

   dos=.true.,

   amass(1)=1.008

   amass(2)=44.955910,

   flfrc='c225.fc',

   nk1=20,nk2=10,nk3=10,

   deltaE=1.0,

   fldos='c225.dos'

/

EOF

$PW_ROOT/matdyn.x < phdos.in > phdos.out

 

 原作者:葉小球   

http://blog.sciencenet.cn/home.php?mod=space&uid=567091


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章