Pw Tutorial

download Pw Tutorial

of 65

Transcript of Pw Tutorial

  • 7/28/2019 Pw Tutorial

    1/65

    HANDS-ON TUTORIAL ON THE

    PWscf/FPMD/CP PACKAGE

    CINECA March 3 rd 2004

    S. Fabris and C. Sbraccia

    Setting up the input files

    Post Processing Structural Relaxations Molecular Dynamics

  • 7/28/2019 Pw Tutorial

    2/65

    Select the appropriate unit-cell

    Input the atomic coordinates

    Choose and download the pseudopotentials Determine a suitable k-point sampling & smearing

    Select the size of the basis set

  • 7/28/2019 Pw Tutorial

    3/65

    bulk Al: cubic fcc and sc bravais lattice

  • 7/28/2019 Pw Tutorial

    4/65

    defective Al:

    sc bravais lattice

  • 7/28/2019 Pw Tutorial

    5/65

    Al surfaces

    t bravais lattice

  • 7/28/2019 Pw Tutorial

    6/65

    &system ibrav= 2,

    celldm(1) =7.50,

    nat= 1, ntyp=1,

    ecutwfc =15.0,

  • 7/28/2019 Pw Tutorial

    7/65

    ibrav structure celldm(2)-celldm(6)

    0 "free", see above not used

    1 cubic P (sc) not used

    2 cubic F (fcc) not used

    3 cubic I (bcc) not used4 Hexagonal and Trigonal P celldm(3)=c/a

    5 Trigonal R celldm(4)=cos(aalpha)

    6 Tetragonal P (st) celldm(3)=c/a

    7 Tetragonal I (bct) celldm(3)=c/a

    (see file INPUT_PW in O-sesame/pwdocs/)

  • 7/28/2019 Pw Tutorial

    8/65

    Edit the script file

    run-al.sc

    modifying the variables IBRAV and NAT so that to obtain asimple cubic supercell with 4 atoms

    IBRAV=?, , NAT=?

    Exercise 1: cubic supercell Run a self-consistent calculation for bulk Al (al.fcc.in)

    run-al.fcc

    run-al.fcc is a script containing the input file al.fcc.inand producing the output file al.fcc.out Write down the total energy: it will be used in the following as

    reference

  • 7/28/2019 Pw Tutorial

    9/65

    Exercise 1: cubic supercellAdd the atomic coordinates in theATOMIC_POSITION field

    Al 0.0 0.0 0.0

    Al ?? ?? ??

    Al ?? ?? ?? Al ?? ?? ??

    Run a self-consistent calculation (input= al.sc.in)run-al.sc

    Compare the total energy (file al.sc.out) with the reference one infile al.fcc.out: do they differ? Why?

  • 7/28/2019 Pw Tutorial

    10/65

    ATOMIC_POSITIONSAtomic positions in the supercell can be defined in 4 ways:

    1. in units of ALAT (this is the default) (alat)2. in crystal coordinates (crystal)

    3. In bohr (bohr)

    4. In Angstrom (angstrom)

    The unit is defined by specifying the right flag as

    ATOMIC_POSITIONS (crystal)

  • 7/28/2019 Pw Tutorial

    11/65

    aa

    c

    Tetragonal supercell

  • 7/28/2019 Pw Tutorial

    12/65

    Exercise 2: tetragonal supercell Have a look at the script file run-al.tet

    Modify the variables IBRAV and NAT so that to obtain atetragonal supercell with 2 atoms

    IBRAV=??, celldm(1) =5.3033,

    celldm(3) = ??, NAT=?? Specify the (alat) instruction

    ATOMIC_POSITIONS (alat)

    Add the coordinates of the second atom in units of alat

    Al ?? ?? ??

  • 7/28/2019 Pw Tutorial

    13/65

    aa

    c

    a= sqrt(2)/2 * ac= ac/a= sqrt(2)

    Al1

    Al2

    celldm(3)= 1.41421356237

    Al 0.0 0.0 0.0

    Al 0.5 0.5 0.707107

    ATOMIC_POSITIONS (alat)

  • 7/28/2019 Pw Tutorial

    14/65

    Exercise 2: tetragonal supercell Run the self consistent calculation (input= al.tet.in)

    run-al.tet

    Compare the total energy (output in al.tet.out) with thereference one calculated in Example1 (al.fcc.out)

    grep ! ../Ex1/al.fcc.outgrep ! al.tet.out

    why do they differ? What can you learn from the energy

    difference between the two?

  • 7/28/2019 Pw Tutorial

    15/65

    Exercise 3: crystal coordinates Have a look at the script

    run-al.tet2

    Specify the (crystal) instruction

    ATOMIC_POSITIONS (crystal)

    Add the coordinates of the second atom in crystal units: Al ??? ??? ???

  • 7/28/2019 Pw Tutorial

    16/65

    aa

    c

    a= sqrt(2)/2 * ac= ac/a= sqrt(2)

    Al1

    Al2

    Al 0.0 0.0 0.0 Al 0.5 0.5 0.5

    ATOMIC_POSITIONS (alat)

  • 7/28/2019 Pw Tutorial

    17/65

    Exercise 3: tetragonal supercells Run the self consistent calculation (input= al.tet.in)

    run-al.tet2

    Compare the total energy in al.tet2.out with the onecalculated in Example2 (al.tet.out)

    grep ! ../Ex2/al.tet.outgrep ! al.tet2.out

    Do they differ? Why (or why not)?

  • 7/28/2019 Pw Tutorial

    18/65

    K-POINTS Periodic system Wave function and Hamiltonian expanded in PW

    The electron states in the BZ are naturally classified by the points k in the Brillouin Zone

    The number of the k points is proportional to the number of repeatedunit cells N With periodic boundaries conditions N infinity & N k infinity

    !!WF and H can not be calculated at each k point!!

    SOLUTION:WF and H are sampled on a suitable set of representable k points

    in the BZ

  • 7/28/2019 Pw Tutorial

    19/65

    K-POINT SAMPLINGThe choice of the k-point mesh is system dependent.

    Examples:1. Non-cubic supercells2. Surfaces3. Molecules isloated in vacuum

  • 7/28/2019 Pw Tutorial

    20/65

    Exercise 4: elongated supercell Have a look at the script file

    run-al.tet3

    Modify the variables IBRAV , NAT, celldm(3), so that todouble the size of the tetragonal supercell in the z direction (doublethe c/a ratio and double the number of atoms).

  • 7/28/2019 Pw Tutorial

    21/65

    Exercise 4: elongated supercell

    Run the scf calculation again (be careful not to overwrite thefiles ). Fill up the following table. Comment the difference in

    the total energies (per atom) of the 4 set of calculations:al.fcc.out al.tet.out al.tet3.out (12 12 10) al.tet3.out (12 12 5)

    -4.18739 ????? ????? ?????

    Run the scf calculation (input=al.tet3.in) and check the total energy

    run-al.tet3

    Reduce the size of the k-point mesh along k_z:

    K_POINTS (automatic)

    12 12 5 1 1 1

    -4.18739 -4.187028 -4.186958 -4.187028

  • 7/28/2019 Pw Tutorial

    22/65

    Exercise 5: Al (001) surface Working input file: run-al001 Modify the variables IBRAV and NAT so that to obtain

    a tetragonal supercell with 7 atoms

    Specify the (alat) instruction ATOMIC_POSITIONS (alat)

    Add the coordinates of the other 7 atoms in units of alat: Al ?? ?? ?? .. Al 0.0 0.0 0.0

    Al 0.5 0.5 0.707107 Al 0.0 0.0 1.414213 Al 0.5 0.5 2.121320

    . And symmetric with respect to xy plane Check the structure with Xcrysden:

    xcrysden pwi al.001.in

    Run the self-consistent calculation:

    ./run-al001

  • 7/28/2019 Pw Tutorial

    23/65

    Exercise 6: isolated moleculeSimulation of a CO molecule isolated in vacuum

    How many k-points are needed? Why? Have a look at the script file run-co.scf and run the calculation:

    run-co.scf

  • 7/28/2019 Pw Tutorial

    24/65

    Energy cut-off WF is expanded on a finite basis of plane waves. The size of the basis is controlled by the energy cut off ecut

    Checking convergence of results towards the basis size

    WHICH RESULTS? Total energy? Structural parameters?

  • 7/28/2019 Pw Tutorial

    25/65

    Exercise 7: energy-volume

  • 7/28/2019 Pw Tutorial

    26/65

    Exercise 7: energy-volumeCalculation of an energy-volume curve for bulk Si

    Working input file: run-si.scf

    Set the energy cutoff to 20 Ry: ecut=20Set the lattice parameter to 9.8 a.u.: celldm(1)=9.8

    Run the scf calculation:run-si.scf Save the output file: cp si.scf.out si-e20-a9.8.outRepeat the procedure for the lattice parameters:

    Lattice parameter Energy9.8 ???10.0 ???10.2 ???10.4 ???

  • 7/28/2019 Pw Tutorial

    27/65

    Exercise 7: energy-volume

    Write table on file: envol-ecut20.dat9.8 ???10.0 ???10.2 ???10.4 ???

    Plot the results:

  • 7/28/2019 Pw Tutorial

    28/65

    Exercise 7: energy-volume

    Recalculate the energy-volume curve with a larger cutoff:ecut=40

    Collect the results in file envol-ecut40.dat9.8 ???10.0 ???10.2 ???10.4 ???

    Plot the two files together: what do you learn?Is the total energy converged?Are the structural parameter converged?Which cutoff would you choose for scientific production?

  • 7/28/2019 Pw Tutorial

    29/65

    Exercise 7: energy-volume

  • 7/28/2019 Pw Tutorial

    30/65

    Pseudopotentials Where to get the psudopotential files?

    1. From the PWscf web site: http://www.pwscf.org

  • 7/28/2019 Pw Tutorial

    31/65

    Pseudopotentials

    You get psudopotential files ready-to-use with PWscf

  • 7/28/2019 Pw Tutorial

    32/65

    Pseudopotentials Where to get the psudopotential files?

    2. From other databases:

    i.e. Vanderbilt ultra-soft pseudopotential sitehttp://www.physics.rutgers.edu/~dhv/uspp/

  • 7/28/2019 Pw Tutorial

    33/65

    Pseudopotentials! Different xc functionals !

  • 7/28/2019 Pw Tutorial

    34/65

    Pseudopotentials Where to get the psudopotential files?

    2. From other databases:

    i.e. Vanderbilt ultra-soft pseudopotential sitehttp://www.physics.rutgers.edu/~dhv/uspp/

    You get psudopotential files not compatible with PWscf

    Convert them in the UPF format:

    O-sesame/upftools/uspp2upf xxx.uspp

  • 7/28/2019 Pw Tutorial

    35/65

    Pseudopotentials Where to get the psudopotential files?

    3. Generate your own PP see Paolo Giannozzi Lecture

  • 7/28/2019 Pw Tutorial

    36/65

    Cc BAD CHOICE

    Linear mixing

    Self consistency: mixing

    Advanced mixing schemes

    It is more flexible to mix the density instead of the potentialPWscf mix the density by default

  • 7/28/2019 Pw Tutorial

    37/65

    Example 8: improving convergency

    Run the scf calculation for an elongated supercell of 16 Fe atomsrun-fe16.scf &

    During the run check the convergency of the total energygrep e scf e total energy fe16.scf.out

    What do you notice??

    SUGGESTION Try to decrease the mixing parameter: mixing_beta = 0.1

  • 7/28/2019 Pw Tutorial

    38/65

    Exercise 8

    OTHER SUGGESTIONS FOR DIFFICOULT CASES: Increase the number of calculated bands: nbnd=80 Change the mixing method mixing_mode or the size of history mixing_ndim

  • 7/28/2019 Pw Tutorial

    39/65

    Exercise 9: DOS Run the scf calculation for bulk Nirun-ni.scf

    What happens? Why does the program stop? Add the required inputstarting_magnetization(1)=0.0 run again the simulation. Copy the output file:

    cp ni.scf.out ni.scf.out-0magn Modify the starting magnetization in run-ni.scf

    starting_magnetization(1)=0.7

    run again the simulation.run-ni.scf Compare the total energies of the two simulations: do theydiffer? Why? What about the magnetization?

  • 7/28/2019 Pw Tutorial

    40/65

    Exercise 9: DOS Run the nscf calculation for bulk Ni:

    increase the number of bands to 8: nbnd=8and the set a denser k-point mesh: 12 12 12 0 0 0

    Have a look at the input file for the DOS calculation: more run-ni.dos

    &inputppoutdir=$TMP/DIR'

    prefix='ni'fildos='ni.dos'Emin=5.0, Emax=25.0, DeltaE=0.1

    / and run the DOS calculation:

    run-ni.dos

    in eV!

  • 7/28/2019 Pw Tutorial

    41/65

    Exercise 9: DOS

    # E (eV) dosup(E) dosdw(E) Int dos(E)5.749 0.0000E+00 0.0000E+00 0.0000E+005.849 0.9326E-03 0.4531E-03 0.1386E-03

    5.949 0.3730E-02 0.2685E-02 0.7801E-036.049 0.1327E-01 0.6781E-02 0.2785E-026.149 0.1422E-01 0.1859E-01 0.6066E-026.249 0.1686E-01 0.1600E-01 0.9352E-02

    6.349 0.1969E-01 0.1876E-01 0.1320E-01

    Have a look at the output file containing the DOS: ni.dos more ni.dos

  • 7/28/2019 Pw Tutorial

    42/65

    Exercise 9: DOS Plot the density of states and notice the difference in the spinup and spin down components:

  • 7/28/2019 Pw Tutorial

    43/65

    Exercise 10: PDOS Have a look at the input file for the PDOS calculation:

    more run-pdos.in

    &inputppoutdir=$TMP_DIR/'

    prefix='ni'io_choice='both'Emax=25.0, DeltaE=0.1, smoothing=0.3

    /

    and run the PDOS calculation ( projwfc.x) :run-ni.pdos

  • 7/28/2019 Pw Tutorial

    44/65

    Exercise 10: PDOS Have a look at the output files containing the s and dcomponents of the PDOS: more ni.pdos_atm#1(Ni)_wfc#1(s) more ni.pdos_atm#1(Ni)_wfc#2(d)

    # E (eV) dosup(E) dosdw(E)

    4.249 0.151E-13 0.545E-144.349 0.379E-12 0.146E-124.449 0.761E-11 0.314E-114.549 0.122E-09 0.541E-10

    4.649 0.158E-08 0.746E-094.749 0.163E-07 0.824E-084.849 0.136E-06 0.731E-07

  • 7/28/2019 Pw Tutorial

    45/65

    Exercise 10: PDOS Plot the s and d components of the density of states : interpretthe total density of states.

  • 7/28/2019 Pw Tutorial

    46/65

    Exercise 11: STM imagesSimulating the STM image of the AlAs (110) surface

    Run the scf calculation for the AlAs (110) surfacerun-alas.scf

    Run the non scf calculation for the AlAs (110) surface:

    run-alas.nscf

  • 7/28/2019 Pw Tutorial

    47/65

    Set up the input file for the post processing(see run-AlAs.ppstm ):&inputpp

    prefix = 'AlAs110'outdir='$TMP_DIR/',filplot = 'AlAs-1.0'sample_bias=-0.0735d0,

    stm_wfc_matching=.false., plot_num= 5/ see O-sesame/pwdocs/INPUT_PP

    How to choose the sample_bias ?

  • 7/28/2019 Pw Tutorial

    48/65

    Exercise 11: STM images How to choose the sample_bias?

    Run the post processing simulation:run-AlAs.ppstm

    Redo the STM simulation, imaging empty states

  • 7/28/2019 Pw Tutorial

    49/65

    Exercise 11: STM images Producing a 3D file comptatible with the XCrysDen package: more run-AlAs.chdens&input

    nfile=1filepp(1)='AlAsresm-1.0'

    weight(1)=1.0iflag=3

    plot_out=1output_format=5e1(1)=7.0, e1(2)=0.0, e1(3)=0.0e2(1)=0.0, e2(2)=7.07107, e2(3)=0.0

    x0(1)=0.0, x0(2)=-0.18, x0(3)=3.25nx=36 ,ny=56fileout='AlAs110-1.0.xsf'

    /

    3D plot

    XCrysDen format

  • 7/28/2019 Pw Tutorial

    50/65

    Exercise 11: STM images Producing a 3D file comptatible with the XCrysDen package:

    run-AlAs.chdens

    Visualizing the output file with the XCrysDen package:xcrysdens xsf AlAs110-1.0.xsf

    E i 11 STM i

  • 7/28/2019 Pw Tutorial

    51/65

    Exercise 11: STM images Visualizing the output file with the XCrysDen package:

    xcrysdens xsf AlAs110-1.0.xsf

    S l l i

  • 7/28/2019 Pw Tutorial

    52/65

    Structural relaxation

    The Potential Energy Surface

    Given the ionic configuration, the total energy of the system is

    obtained with the Density Functional Theory.

    Total Energy E[X I 3N , (X I 3N )] is a function of ionic configurations and

    defines a 3N-dim surface called Potential Energy Surface.

    The problem of identifing stable ionic configurations (where forces

    are zero) is thus equivalent to the identification of the minima on the

    PES.

  • 7/28/2019 Pw Tutorial

    53/65

    Ionic relaxationSteepest Descent minimization :

    X

    discretization

    gradient versor

  • 7/28/2019 Pw Tutorial

    54/65

    Ionic relaxationSteepest Descent minimization :

    discretization

    gradient versor

  • 7/28/2019 Pw Tutorial

    55/65

    Ionic relaxationSteepest Descent minimization :

    discretization

    gradient versor

  • 7/28/2019 Pw Tutorial

    56/65

    Ionic relaxationSteepest Descent minimization :

    discretization

    gradient versor

  • 7/28/2019 Pw Tutorial

    57/65

    Ionic relaxationSteepest Descent minimization :

    discretization

    gradient versor

  • 7/28/2019 Pw Tutorial

    58/65

    Ionic relaxationSteepest Descent minimization :

    discretization

    gradient versor

  • 7/28/2019 Pw Tutorial

    59/65

    Ionic relaxationSteepest Descent minimization :

    discretization

    gradient versor

  • 7/28/2019 Pw Tutorial

    60/65

    Ionic relaxationSteepest Descent minimization :

    The minimum is reached !!!

    discretization

    gradient versor

    E i 12 f l ti

  • 7/28/2019 Pw Tutorial

    61/65

    Exercise 12: surface relaxationStructural relaxation of the Al(001) surface

    Run the self-consistent calculation for the Al (001) slab:

    run-al001.scf Scroll to the end of the output file and analyze the forces: whatdo you notice? Are the atomic forces pointing outward or inward?more al.scf.out

    Modify the input file so that to perform a structural relaxation:(see O-sesame/pwdocs/INPUT_PW)&control

    calculation=???.&ions/

    E i 12 f l i

  • 7/28/2019 Pw Tutorial

    62/65

    Exercise 12: surface relaxation Analyze the output file: how are the forces evolving during therelaxation?

    How are the atoms relaxing? How much does the interlayer distances change with respect to the bulk value?

    Xcrysden does not work!!

    ( eventually rerun the calculation in parallel distributing over the3 k points)

    Exercise 13: molecular relaxation

  • 7/28/2019 Pw Tutorial

    63/65

    Exercise 13: molecular relaxation Finding the equilibrium structure of the CO molecule

    Run the self consistent calculation for an isolated CO molecule:run-co.scf

    Check the output file: what is the direction of the forces?

    Modify the input file, relax the structure and find the equilibriumC-O bond length.

    Exercise 14: molecular dinamics

  • 7/28/2019 Pw Tutorial

    64/65

    Exercise 14: molecular dinamics Molecular dynamics for bulk Si

    Run the self consistent calculation for bulk Si:run-si.md

    During the run, check the evolution of the total energy: md_analizer.sh

    what do you notice? How does it change?

    Exercise 14: molecular dinamics

  • 7/28/2019 Pw Tutorial

    65/65

    Exercise 14: molecular dinamics