Post on 14-Apr-2018
transcript
7/29/2019 Narasimha Nle c 2
1/69
How To Do Simple Calculations
WithQuantum ESPRESSO
Shobhana Narasimhan
Theoretical Sciences Unit
JNCASR, Bangaloreshobhana@jncasr.ac.in
7/29/2019 Narasimha Nle c 2
2/69
Shobhana Narasimhan, JNCASR2
I. About The Quantum
ESPRESSODistribution
7/29/2019 Narasimha Nle c 2
3/69
Quantum ESPRESSO
www.quantum-espresso.org
Shobhana Narasimhan, JNCASR3
7/29/2019 Narasimha Nle c 2
4/69
The Quantum ESPRESSO Software Distribution
Shobhana Narasimhan, JNCASR4
P. Giannozzi
7/29/2019 Narasimha Nle c 2
5/69
Why Quantum ESPRESSO?!
Shobhana Narasimhan, JNCASR5
7/29/2019 Narasimha Nle c 2
6/69
Licence for Quantum ESPRESSO
Shobhana Narasimhan, JNCASR6
P. Giannozzi
7/29/2019 Narasimha Nle c 2
7/69
Quantum ESPRESSO: Organization
Shobhana Narasimhan, JNCASR7
P. Giannozzi
7/29/2019 Narasimha Nle c 2
8/69
Quantum ESPRESSO as a distribution
Shobhana Narasimhan, JNCASR8
P. Giannozzi
7/29/2019 Narasimha Nle c 2
9/69
Quantum ESPRESSO as a distribution
Shobhana Narasimhan, JNCASR9
OTHER PACKAGES
WANNIER90: Maximally localized Wannier functions
Pwcond: Ballistic conductance
WanT: Coherent Transport from Maximally LocalizedWannier Functions
Xspectra: Calculation of x-ray near edge absorptionspectra
GIPAW: EPR and NMR Chemical Shifts
Coming Soon:GWW: GW Band Structure with Ultralocalized Wannier Fns.
TD-DFT: Time-Dependent Density Functional Pert. Theory
7/29/2019 Narasimha Nle c 2
10/69
What Can Quantum ESPRESSO Do?
Shobhana Narasimhan, JNCASR10
Both point and k-point calculations.
Both insulators and metals, with smearing.
Any crystal structure or supercell form.
Norm conserving pseudopotentials, ultrasoft PPs, PAW.
LDA, GGA, DFT+U, hybrid functionals, exact exchange,meta GGA, van der Waals corrected functionals.
Spin polarized calculations, non-collinear magnetism,spin-orbit interactions.
Nudged elastic band to find saddle points.
7/29/2019 Narasimha Nle c 2
11/69Shobhana Narasimhan, JNCASR
11
II. Doing a
Total Energy
Calculationwith the
PWscf Package of QE:
The SCF Loop
7/29/2019 Narasimha Nle c 2
12/69Shobhana Narasimhan, JNCASR
12
The Kohn-Sham problem
Want to solve the Kohn-Sham equations:
Note that self-consistent solution necessary, asHdepends on solution:
Convention:
)()()]([)]([)(2
1 2rrrrr
iiiXCHnucnVnVV
H
Hrni )(}{
1e
me
7/29/2019 Narasimha Nle c 2
13/69
Shobhana Narasimhan, JNCASR13
Self-consistent Iterative Solution
Vnuc known/constructed
Initial guess n(r)
Calculate VH[n] &VXC[n]
Veff(r)= Vnuc(r) + VH(r) + VXC(r)
H i(r) = [-1/22 + Veff(r)] i(r) = i i(r)
Calculate new n(r) = i| i(r)|2
Self-consistent?
Problem solved! Can now calculate energy, forces, etc.
Generate
new
n(r)
Yes
No
How to solve theKohn-Sham eqns.
for a set of fixed
nuclear (ionic)
positions.
7/29/2019 Narasimha Nle c 2
14/69
Shobhana Narasimhan, JNCASR14
Plane Waves & Periodic Systems
For a periodic system:
The plane waves that appear in this expansion can
be represented as a grid in k-space:
rGk
G
Gkkr
)(
,
1)( iec
where G = reciprocal
lattice vector
kx
ky Only true for periodic
systems that grid is
discrete.
In principle, still needinfinite number of
plane waves.
7/29/2019 Narasimha Nle c 2
15/69
Shobhana Narasimhan, JNCASR15
Truncating the Plane Wave Expansion
In practice, the contribution from higher Fouriercomponents (large |k+G|) is small.
So truncate the expansion at some value of|k+G|.
Traditional to express this cut-off in energy units:
cutE
m2
|| 22 Gk
kx
E=Ecutky
Input parameterecutwfc
7/29/2019 Narasimha Nle c 2
16/69
Shobhana Narasimhan, JNCASR16
Checking Convergence wrt ecutwfc
Must always check.
Monotonic (variational).
7/29/2019 Narasimha Nle c 2
17/69
Step 0:
Defining the (periodic) system
Namelist SYSTEM
Shobhana Narasimhan, JNCASR
7/29/2019 Narasimha Nle c 2
18/69
Shobhana Narasimhan, JNCASR18
How to Specify the System
All periodic systems can be specified by a BravaisLattice and an atomic basis.
+ =
7/29/2019 Narasimha Nle c 2
19/69
Shobhana Narasimhan, JNCASR19
How to Specify the Bravais Lattice / Unit Cell
- Gives the type ofBravais
lattice (SC, BCC, Hex, etc.)
Input parameteribrav
Input parameters {celldm(i)}
- Give the lengths [&
directions, if necessary] of
the lattice vectors a1, a2, a3
Note that one can choose a non-primitive unit cell(e.g., 4 atom SC cell for FCC structure).
a1
a2
7/29/2019 Narasimha Nle c 2
20/69
Shobhana Narasimhan, JNCASR20
Atoms Within Unit CellHow many, where?
Input parameternat
- Initial positions of atoms (may vary when relax done).-Can choose to give in units of lattice vectors (crystal)
or in Cartesian units (alat or bohr or angstrom)
- Number of atoms in the unit cell
Input parameterntyp
- Number of types of atoms
FIELDATOMIC_POSITIONS
7/29/2019 Narasimha Nle c 2
21/69
Shobhana Narasimhan, JNCASR21
What if the system is not periodic?
Example 1: Want to studyproperties of a system with a
surface.
Presence of surface No
periodicity alongz.
x
z
Surface atom
Bulk atom
7/29/2019 Narasimha Nle c 2
22/69
Shobhana Narasimhan, JNCASR22
What if the system is not periodic?
Example 1: Want to studyproperties of a system with a
surface.
Presence of surface No
periodicity alongz. Use a supercell: artificial
periodicity alongz by
repeating slabs separated by
vacuum. Have to check convergence
w.r.t. slab thickness & vacuum
thickness. x
z
7/29/2019 Narasimha Nle c 2
23/69
Shobhana Narasimhan, JNCASR23
What if the system is not periodic?
Example 2: Want to studyproperties of a nanowire.
Example 3: Want to studyproperties of a cluster
y
z
7/29/2019 Narasimha Nle c 2
24/69
Shobhana Narasimhan, JNCASR24
What if the system is not periodic?
Example 2: Want to studyproperties of a nanowire
introduce artificial periodicity
alongy &z.
Example 3: Want to studyproperties of a cluster
introduce artificial periodicity
alongx, y &z.
y
z
7/29/2019 Narasimha Nle c 2
25/69
Shobhana Narasimhan, JNCASR25
What if the system is not periodic?
Example 4: Want to study a system with a defect,e.g., a vacancy or impurity:
7/29/2019 Narasimha Nle c 2
26/69
Shobhana Narasimhan, JNCASR26
What if the system is not periodic?
Example 4: Want to study a system with a defect,e.g., a vacancy or impurity:
7/29/2019 Narasimha Nle c 2
27/69
Shobhana Narasimhan, JNCASR27
What if the system is not periodic?
Example 5: Want to study an amorphous orquasicrystalline system.
7/29/2019 Narasimha Nle c 2
28/69
Shobhana Narasimhan, JNCASR28
What if the system is not periodic?
Example 5: Want to study an amorphous orquasicrystalline system: approximate by a periodic
system (with large unit cell).
7/29/2019 Narasimha Nle c 2
29/69
Shobhana Narasimhan, JNCASR29
Artificially Periodic Systems Large Unit Cells
Note: In all these cases, to minimize the effects ofthe artificially introduced periodicity, need a large
unit cell.
Long a1, a2, a3 (primitive lattice vectors)
Short b1, b2, b3 (primitive reciprocal lattice vectors)
Many Gs will fall withinEcut sphere!
7/29/2019 Narasimha Nle c 2
30/69
Shobhana Narasimhan, JNCASR30
Step 1: Obtaining Vnuc
Vnuc known/constructed
Initial guess n(r)
Calculate VH[n] &VXC[n]
Veff(r)= Vnuc(r) + VH(r) + VXC(r)
H i(r) = [-1/22 + Veff(r)] i(r) = i i(r)
Calculate new n(r) = i| i(r)|2
Self-consistent?
Problem solved! Can now calculate energy, forces, etc.
Generate
new
n(r)
Yes
No
7/29/2019 Narasimha Nle c 2
31/69
Shobhana Narasimhan, JNCASR31
Nuclear Potential
Electrons experience a Coulomb potential due to thenuclei.
This has a known and simple form:
But this leads to computational problems!
r
ZVnuc
7/29/2019 Narasimha Nle c 2
32/69
Shobhana Narasimhan, JNCASR32
Problem for Plane-Wave Basis
Core wavefunctions:sharply peaked nearnucleus.
High Fourier components present
i.e., need largeEcut
Valence wavefunctions:lots of wiggles nearnucleus.
7/29/2019 Narasimha Nle c 2
33/69
Shobhana Narasimhan, JNCASR33
Solutions for Plane-Wave Basis
Core wavefunctions:sharply peaked nearnucleus.
High Fourier components present
i.e., need largeEcut
Valence wavefunctions:lots of wiggles nearnucleus.
Dont solve for thecore electrons!
Remove wiggles fromvalence electrons.
7/29/2019 Narasimha Nle c 2
34/69
Shobhana Narasimhan, JNCASR 34
Pseudopotentials
Replace nuclear potential by pseudopotential
This is a numerical trick that solves these problems
There are different kinds of pseudopotentials
(Norm conserving pseudopotentials, ultrasoft
pseudopotentials, etc.)
Which kind you use depends on the element.
7/29/2019 Narasimha Nle c 2
35/69
Shobhana Narasimhan, JNCASR 35
Pseudopotentials for Quantum Espresso - 1
Go to http://www.quantum-espresso.org; Click on PSEUDO
7/29/2019 Narasimha Nle c 2
36/69
Shobhana Narasimhan, JNCASR 36
Pseudopotentials for Quantum Espresso - 2
Click on element for which pseudopotential wanted.
7/29/2019 Narasimha Nle c 2
37/69
Shobhana Narasimhan, JNCASR 37
Pseudopotentials for Quantum-ESPRESSO
Pseudopotentials name
gives information about :
type of exchange-
correlation functional
type of pseudopotential
e.g.:
7/29/2019 Narasimha Nle c 2
38/69
Shobhana Narasimhan, JNCASR 38
Element & Vion for Quantum-ESPRESSO
ATOMIC_SPECIES
Ba 137.327 Ba.pbe-nsp-van.UPF
Ti 47.867 Ti.pbe-sp-van_ak.UPF
O 15.999 O.pbe-van_ak.UPF
ecutwfc, ecutrho depend on type ofpseudopotentials used (should test).
When using ultrasoft pseudopotentials, set
ecutrho = 8-12 ecutwfc !!
e.g, for calculation on BaTiO3:
7/29/2019 Narasimha Nle c 2
39/69
Shobhana Narasimhan, JNCASR 39
Element & Vion for Quantum-ESPRESSO
Should have same exchange-correlation functional for
all pseudopotentials.
input
output
oops!
St 2 I iti l G f ( )
7/29/2019 Narasimha Nle c 2
40/69
Shobhana Narasimhan, JNCASR 40
Step 2: Initial Guess forn(r)
Vion known/constructed
Initial guess n(r)
Calculate VH[n] &VXC[n]
Veff(r
)= Vion(r) + VH(
r) + VXC(
r)
H i(r) = [-1/22 + Veff(r)] i(r) = i i(r)
Calculate new n(r) = i| i(r)|2
Self-consistent?
Problem solved! Can now calculate energy, forces, etc.
Generate
new
n(r)
Yes
No
7/29/2019 Narasimha Nle c 2
41/69
Shobhana Narasimhan, JNCASR 41
Starting Wavefunctions
startingwfc atomic
random
file
Superposition of atomic orbitals
The closer your starting wavefunction is to the true
wavefunction (which, of course, is something you dontnecessarily know to start with!), the fewer the scf iterations
needed.
The beginning is the most important part of the work - Plato
St 3 & 4 Eff ti P t ti l
7/29/2019 Narasimha Nle c 2
42/69
Shobhana Narasimhan, JNCASR 42
Steps 3 & 4: Effective Potential
Vion known/constructed
Initial guess n(r) or i(r)
Calculate VH[n] &VXC[n]
Veff(r)= Vnuc(r) + VH(r) + VXC(r)
H i(r) = [-1/22 + Veff(r)] i(r) = i i(r)
Calculate new n(r) = i| i(r)|2
Self-consistent?
Problem solved! Can now calculate energy, forces, etc.
Generate
new
n(r)
Yes
No
Note that typeof exchange-
correlation chosen
while specifying
pseudopotential
7/29/2019 Narasimha Nle c 2
43/69
Shobhana Narasimhan, JNCASR 43
Exchange-Correlation Potential
VXC EXC/ n contains all the many-body information. Known [numerically, from Quantum Monte Carlo ;
various analytical approximations] forhomogeneouselectron gas.
Local Density Approximation:Exc[n] = n(r) Vxc
HOM[n(r)] dr
-surprisingly successful!
Generalized Gradient Approximation(s): Includeterms involving gradients ofn(r)
Replace
pz
pw91,pbe
(in name of pseudopotential)
(in name of pseudopotential)
Step 5: Diagonalization
7/29/2019 Narasimha Nle c 2
44/69
Shobhana Narasimhan, JNCASR
44
Step 5: Diagonalization
Vion known/constructed
Initial guess n(r)
Calculate VH[n] &VXC[n]
Veff(r
)= Vion(r) + VH(
r) + VXC(
r)
H i(r) = [-1/22 + Veff(r)] i(r) = i i(r)
Calculate new n(r) = i| i(r)|2
Self-consistent?
Problem solved! Can now calculate energy, forces, etc.
Generate
new
n(r)
Yes
No
Expensive!
7/29/2019 Narasimha Nle c 2
45/69
Shobhana Narasimhan, JNCASR
45
Diagonalization
Need to diagonalize a matrix of size NPW NPW
NPW>> Nb = number of bands required =Ne/2 or alittle more (for metals).
OK to obtain lowest few eigenvalues.
Exact diagonalization is expensive!
Use iterative diagonalizers that recastdiagonalization as a minimization problem.
Input parameterdiagonalization
Input parameternbnd
-which algorithm used for iterative diagonalization
-how many eigenvalues computedfor metals, choose depending on value ofdegauss
Step 6: New Charge Density
7/29/2019 Narasimha Nle c 2
46/69
Shobhana Narasimhan, JNCASR
46
Step 6: New Charge Density
Vion known/constructed
Initial guess n(r)
Calculate VH[n] &VXC[n]
Veff(r
)= Vion(r) + VH(
r) + VXC(
r)
H i(r) = [-1/22 + Veff(r)] i(r) = i i(r)
Calculate new n(r) = i| i(r)|2
Self-consistent?
Problem solved! Can now calculate energy, forces, etc.
Generate
new
n(r
)
Yes
No
7/29/2019 Narasimha Nle c 2
47/69
Shobhana Narasimhan, JNCASR
47
0Brillouin Zone Sums
Many quantities (e.g., n,Etot) involve sums overk. In principle, need infinite number ofks. In practice, sum over a finite number: BZ Sampling. Number needed depends on band structure. Typically need more ks for metals. Need to test convergence wrt k-point sampling.
k
F
BZ
wP
N
P
k
k
k
k)(1
7/29/2019 Narasimha Nle c 2
48/69
Shobhana Narasimhan, JNCASR
48
0
nk1, nk2, nk3, k1, k2, k3
K_POINTS { tpiba | automatic | crystal | gamma }
Types of k-point meshes
Special Points: [Chadi & Cohen]Points designed to give quick convergence for particularcrystal structures.
Monkhorst-Pack:Equally spaced mesh in reciprocal space.
May be centred on origin [non-shifted] or not [shifted]
b1
1stBZb2
If automatic, use M-P mesh:
nk1=nk2=4
shift
7/29/2019 Narasimha Nle c 2
49/69
Shobhana Narasimhan, JNCASR
49
0
Input parameternosym
Irreducible Brillouin Zone
IBZ depends on symmetries of system. Can save computational time by using appropriately
weighted k-points from IBZ alone. For automatic k-points, code will reduce to IBZ.
May not want to maintain symmetries in relaxation/MD.
b1
b21stBZ
b1
7/29/2019 Narasimha Nle c 2
50/69
50
Convergence wrt BZ sampling
Note: Differences in energy usually converge faster than
absolute value of total energy because of error cancellation
(if supercells & k-points are identical or commensurate).
Madhura Marathe
Shobhana Narasimhan, JNCASR
7/29/2019 Narasimha Nle c 2
51/69
51
Problems with Metals
Recall:
For metals, at T=0, this corresponds to (for
highest band) an integral over all wave-vectors
contained within the Fermi surface, i.e., forhighest band, sharp discontinuity in k-space
between occupied and unoccupied
statesneed many k-points to reproduce this
accurately.
Also can lead to scf convergence problems
because of band-crossings above/below Fermi
level.
Solve by smearing.
occn BZ
n kdPP
3
3 )()2( k
Fermi Surface of Cuiramis.cea.fr
Shobhana Narasimhan, JNCASR
S i i Q S SSO
7/29/2019 Narasimha Nle c 2
52/69
52
Smearing in Quantum-ESPRESSO
occupations smearing
smearing gaussian
methfessel-paxton
marzari-vanderbilt
fermi-dirac
Instruction: use smearing
Type of
smearing
degauss Smearing width
Methfessel & Paxton, Phys. Rev. B 40, 3616 (1989).
Marzari & Vanderbilt, Phys Rev. Lett. 82, 3296 (1999).
Shobhana Narasimhan, JNCASR
Step 7: Check if Convergence Achieved
7/29/2019 Narasimha Nle c 2
53/69
Shobhana Narasimhan, JNCASR
53
Step 7: Check if Convergence Achieved
Vion known/constructed
Initial guess n(r) or i(r)
Calculate VH[n] &VXC[n]
Veff(r)= Vnuc(r) + VH(r) + VXC(r)
H i(r) = [-1/22 + Veff(r)] i(r) = i i(r)
Calculate new n(r) = i| i(r)|2
Self-consistent?
Problem solved! Can now calculate energy, forces, etc.
Generate
new
n(r)
Yes
No
T ti f f
7/29/2019 Narasimha Nle c 2
54/69
Shobhana Narasimhan, JNCASR
54
Testing for scf convergence
Compare nth and (n-1)th approximations for
density, and see if they are close enough that self-consistency has been achieved.
Examine squared norm of difference between thecharge density in two successive iterationsshouldbe close to zero.
Input parameterconv_thr
Step 8: Mixing
7/29/2019 Narasimha Nle c 2
55/69
Shobhana Narasimhan, JNCASR
55
Step 8: Mixing
Vion known/constructed
Initial guess n(r) or i(r)
Calculate VH[n] &VXC[n]
Veff(r)= Vnuc(r) + VH(r) + VXC(r)
H i(r) = [-1/22 + Veff(r)] i(r) = i i(r)
Calculate new n(r) = i| i(r)|2
Self-consistent?
Problem solved! Can now calculate energy, forces, etc.
Generate
new
n(r)
Yes
No
Can take a long
time to reach
self-consistency!
Mi i
7/29/2019 Narasimha Nle c 2
56/69
Shobhana Narasimhan, JNCASR
56
Mixing
Iterations n of self-consistent cycle:
Successive approximations to density:
nin(n) nout(n) nin(n+1).
nout(n) fed directly as nin(n+1) ?? No, usually doesnt
converge.
Need to mix, take some combination of input and output
densities (may include information from several previous
iterations).
Goal is to achieve self consistency (nout= nin ) in as few
iterations as possible.
Mi i i Q t ESPRESSO
7/29/2019 Narasimha Nle c 2
57/69
Shobhana Narasimhan, JNCASR
57
Mixing in Quantum-ESPRESSO
Input parametermixing_mode
Input parametermixing_beta
-How much of new density is used at each step
-Typically use value between 0.1 & 0.7
-Prescription used for mixing.
O t t Q titi T t l E
7/29/2019 Narasimha Nle c 2
58/69
Shobhana Narasimhan, JNCASR
58
Output Quantities: Total Energy
Perhaps the most
important output
quantity is the TOTAL
ENERGY
Can use, e.g., to
optimize structure
e.g., for a cubic
crystal, where the
structure can be
specified by a singleparameter (side of
cube):
7/29/2019 Narasimha Nle c 2
59/69
Shobhana Narasimhan, JNCASR
59
III. Forces
&
GeometryOptimization
F
7/29/2019 Narasimha Nle c 2
60/69
Shobhana Narasimhan, JNCASR
60
Forces
Need forgeometry optimization and molecular dynamics.
Could get as finite differences of total energy - too
expensive!
Use force (Hellmann-Feynman) theorem:
- Want to calculate the force on ion I:
- Get three terms:
When is an eigenstate,
-Substitute this...
Forces (contd )
7/29/2019 Narasimha Nle c 2
61/69
Shobhana Narasimhan, JNCASR
61
Forces (contd.)
The force is now given by
Note that we can now calculate the force from acalculation at ONE configuration alone huge savings intime.
If the basis depends upon ionic positions (not true forplane waves), would have extra terms = Pulay forces.
should be exact eigenstate, i.e., scf well-converged!
0
0
Input parametertprnfor
An Outer Loop: Ionic Relaxation
7/29/2019 Narasimha Nle c 2
62/69
Shobhana Narasimhan, JNCASR
62
An Outer Loop: Ionic Relaxation
Forces =0?
Move
ions
Structure Optimized!
Inner SCF loop
for electronic
iterations
Outer loopfor ionic
iterations
Geometry Optimization With Forces
7/29/2019 Narasimha Nle c 2
63/69
Shobhana Narasimhan, JNCASR
63
Geometry Optimization With Forces
Especially useful for optimizing internal degrees offreedom, surface relaxation, etc.
Choice of algorithms for ionic relaxation, e.g., steepestdescent, BFGS.
0
calculation = relax
NAMELIST &IONS
Input parameter ion_dynamics
7/29/2019 Narasimha Nle c 2
64/69
Shobhana Narasimhan, JNCASR
64
IV. Structure of
PWscf Input Files
f i t fil
7/29/2019 Narasimha Nle c 2
65/69
Shobhana Narasimhan, JNCASR
65
PWscf input file
For documentation about input parameters for PWscf,read INPUT_PW.html in the Doc subdirectory.
The PWscf input file is structured intoNAMELISTS andINPUT_CARDS.
PW f NAMELISTS i I t Fil
7/29/2019 Narasimha Nle c 2
66/69
Shobhana Narasimhan, JNCASR
66
PWscf NAMELISTS in Input File
There are three mandatory NAMELISTS:
&CONTROL input variables that control the type ofcalculation performed and the amount of I/O.
&SYSTEMinput variables that specify the system.
&ELECTRONS input variables that control the algorithmsused to reach a self-consistent solution of the Kohn-
Sham equations.
There are other (optional) namelists...
PW f INPUT CARDS i I t Fil
7/29/2019 Narasimha Nle c 2
67/69
Shobhana Narasimhan, JNCASR
67
PWscf INPUT_CARDS in Input File
There are three mandatory INPUT_CARDS:
ATOMIC_SPECIES name, mass and pseudopotentialused for each species in system.
ATOMIC_POSITIONS coordinates of each atom in unitcell.
K_POINTS coordinates and weights of the k-points used
for BZ sums..
There are other (optional) INPUT_CARDS...
Other Features / Types of Calculations
7/29/2019 Narasimha Nle c 2
68/69
Shobhana Narasimhan, JNCASR
68
0Other Features / Types of Calculations
Spin Polarized Calculations (Magnetism) Density Functional Perturbation Theory (Phonons) Nudged Elastic Band (Barriers) Molecular Dynamics and much, much more!
Its not a bird
Its notSuperman
Its aPlane Wave !
The End!
7/29/2019 Narasimha Nle c 2
69/69
69
The End!
Have fun with Quantum-ESPRESSO!