13.07.2015 Views

HANDS-ON TUTORIAL ON THE PWscf/FPMD/CP ... - democritos

HANDS-ON TUTORIAL ON THE PWscf/FPMD/CP ... - democritos

HANDS-ON TUTORIAL ON THE PWscf/FPMD/CP ... - democritos

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>HANDS</strong>-<strong>ON</strong> <strong>TUTORIAL</strong> <strong>ON</strong> <strong>THE</strong><strong>PWscf</strong>/<strong>FPMD</strong>/<strong>CP</strong> PACKAGE• Setting up the input files• Post Processing• Structural Relaxations• Molecular DynamicsS. Fabris and C. SbracciaCINECA – March 3 rd 2004


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


ulk Al: cubic fcc and sc bravais lattice


defective Al:sc bravais lattice


Al surfacest bravais lattice


&systemibrav= 2,celldm(1) =7.50,nat= 1, ntyp=1,ecutwfc =15.0,…


ibrav structure celldm(2)-celldm(6)0 "free", see above not used1 cubic P (sc) not used2 cubic F (fcc) not used3 cubic I (bcc) not used4 Hexagonal and Trigonal P celldm(3)=c/a5 Trigonal R celldm(4)=cos(aalpha)6 Tetragonal P (st) celldm(3)=c/a7 Tetragonal I (bct) celldm(3)=c/a… (see file INPUT_PW in O-sesame/pwdocs/)


• Edit the script filerun-al.scmodifying the variables IBRAV and NAT so that to obtain asimple cubic supercell with 4 atomsIBRAV=?, …,Exercise 1: cubic supercell• Run a self-consistent calculation for bulk Al (al.fcc.in)run-al.fccrun-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 asreferenceNAT=?


Exercise 1: cubic supercell•Add the atomic coordinates in theATOMIC_POSITI<strong>ON</strong> fieldAl 0.0 0.0 0.0Al ?? ?? ??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?


ATOMIC_POSITI<strong>ON</strong>SAtomic 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 asATOMIC_POSITI<strong>ON</strong>S (crystal)


Tetragonal supercellc’a’a


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 atomsIBRAV=??, celldm(1) =5.3033,celldm(3) = ??, NAT=??• Specify the (alat) instructionATOMIC_POSITI<strong>ON</strong>S (alat)• Add the coordinates of the second atom in units of alatAl ?? ?? ??


ATOMIC_POSITI<strong>ON</strong>S (alat)c’Al2a’Al1celldm(3)= 1.41421356237Al 0.0 0.0 0.0Al 0.5 0.5 0.707107aa’=sqrt(2)/2 * ac’= ac’/a’= sqrt(2)


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.outwhy do they differ? What can you learn from the energydifference between the two?


Exercise 3: crystal coordinates• Have a look at the scriptrun-al.tet2• Specify the (crystal) instructionATOMIC_POSITI<strong>ON</strong>S (crystal)• Add the coordinates of the second atom in crystal units:Al ??? ??? ???


ATOMIC_POSITI<strong>ON</strong>S (alat)c’Al2Al 0.0 0.0 0.0Al 0.5 0.5 0.5a’Al1aa’=sqrt(2)/2 * ac’= ac’/a’= sqrt(2)


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.outDo they differ? Why (or why not)?


K-POINTS• Periodic system Wave function and Hamiltonian expanded in PW• The electron states in the BZ are naturally classified by the points kin the Brillouin Zone• The number of the k points is proportional to the number of repeatedunit cells N• With periodic boundaries conditions Ninfinity & N k infinity!!WF and H can not be calculated at each k point!!SOLUTI<strong>ON</strong>:WF and H are sampled on a suitable set of representable k pointsin the BZ


K-POINT SAMPLINGThe choice of the k-point mesh is system dependent.Examples:1. Non-cubic supercells2. Surfaces3. Molecules isloated in vacuum


Exercise 4: elongated supercell• Have a look at the script filerun-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).


Exercise 4: elongated supercell• Run the scf calculation (input=al.tet3.in) and check the total energyrun-al.tet3• Reduce the size of the k-point mesh along k_z:K_POINTS (automatic)12 12 5 1 1 1• Run the scf calculation again (be careful not to overwrite thefiles …). Fill up the following table. Comment the difference inthe 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 -4.187028 ????? ????? -4.186958 ????? -4.187028


Exercise 5: Al (001) surface• Working input file: run-al001• Modify the variables IBRAV and NAT so that to obtaina tetragonal supercell with 7 atoms• Specify the (alat) instructionATOMIC_POSITI<strong>ON</strong>S (alat)• Add the coordinates of the other 7 atoms in units of alat:Al ?? Al ?? 0.0 ?? 0.0 ….. 0.0Al 0.5 0.5 0.707107Al 0.0 0.0 1.414213Al 0.5 0.5 2.121320…. And symmetric with respect to xy plane …•Check• Run the the self-consistent structure withcalculation:Xcrysden:xcrysden ./run-al001–pwial.001.in


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


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 ecutChecking convergence of results towards the basis sizeWHICH RESULTS?• Total energy?• Structural parameters?• …


Exercise 7: energy-volume


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=20•Set 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.out•Repeat the procedure for the lattice parameters:Lattice parameter Energy9.8 ???10.0 ???10.2 ???10.4 ???


Exercise 7: energy-volume•Write table on file: envol-ecut20.dat9.8 ???10.0 ???10.2 ???10.4 ???•Plot the results:


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?


Exercise 7: energy-volume


Pseudopotentials• Where to get the psudopotential files?1. From the <strong>PWscf</strong> web site: http://www.pwscf.org


PseudopotentialsYou get psudopotential files ready-to-use with <strong>PWscf</strong>


Pseudopotentials• Where to get the psudopotential files?2. From other databases:i.e. Vanderbilt ultra-soft pseudopotential sitehttp://www.physics.rutgers.edu/~dhv/uspp/


Pseudopotentials! Different xc functionals !


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 <strong>PWscf</strong>Convert them in the UPF format:O-sesame/upftools/uspp2upf xxx.uspp


Pseudopotentials• Where to get the psudopotential files?3. Generate your own PP… see Paolo Giannozzi Lecture


Self consistency: mixing• Cc BAD CHOICE• Linear mixing• Advanced mixing schemes …It is more flexible to mix the density instead of the potential<strong>PWscf</strong> mix the density by default


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??SUGGESTI<strong>ON</strong>• Try to decrease the mixing parameter: mixing_beta = 0.1


Exercise 8O<strong>THE</strong>R SUGGESTI<strong>ON</strong>S FOR DIFFICOULT CASES:• Increase the number of calculated bands: nbnd=80• Change the mixing method mixing_mode or the size ofhistory mixing_ndim


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


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!


Exercise 9: DOS• Have a look at the output file containing the DOS: ni.dosmore ni.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-035.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-026.349 0.1969E-01 0.1876E-01 0.1320E-01… … … …


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


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


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-104.649 0.158E-08 0.746E-094.749 0.163E-07 0.824E-084.849 0.136E-06 0.731E-07


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


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


• Set up the input file for the post processing(see run-AlAs.ppstm):&inputppprefix = '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?


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


Exercise 11: STM images• Producing a 3D file comptatible with the XCrysDen package:more run-AlAs.chdens&inputnfile=1filepp(1)='AlAsresm-1.0'weight(1)=1.0/iflag=3plot_out=1output_format=5 3D plot XCrysDen formate1(1)=7.0, e1(2)=0.0, e1(3)=0.0e2(1)=0.0, e2(2)=7.07107, e2(3)=0.0x0(1)=0.0, x0(2)=-0.18, x0(3)=3.25nx=36 ,ny=56fileout='AlAs110-1.0.xsf'


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


Exercise 11: STM images• Visualizing the output file with the XCrysDen package:xcrysdens –xsf AlAs110-1.0.xsf


Structural relaxationThe Potential Energy SurfaceGiven the ionic configuration, the total energy of the system isobtained with the Density Functional Theory.Total Energy E[X3NI ,ρ(X3NI )] is a function of ionic configurations anddefines a 3N-dim surface called Potential Energy Surface.The problem of identifing stable ionic configurations (where forcesare zero) is thus equivalent to the identification of the minima on thePES.


Ionic relaxationSteepest Descent minimization :Xdiscretizationgradient versor


Ionic relaxationSteepest Descent minimization :discretizationgradient versor


Ionic relaxationSteepest Descent minimization :discretizationgradient versor


Ionic relaxationSteepest Descent minimization :discretizationgradient versor


Ionic relaxationSteepest Descent minimization :discretizationgradient versor


Ionic relaxationSteepest Descent minimization :discretizationgradient versor


Ionic relaxationSteepest Descent minimization :discretizationgradient versor


Ionic relaxationSteepest Descent minimization :discretizationThe minimum is reached !!!gradient versor


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)&controlcalculation=‘???‘….&ions/


Exercise 12: surface relaxation• Analyze the output file: how are the forces evolving during therelaxation?• How are the atoms relaxing? How much does the interlayerdistances 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 relaxationFinding 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 dinamicsMolecular 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.shwhat do you notice? How does it change?


Exercise 14: molecular dinamics

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!