How to run SIESTA Víctor M. García Suárez Gollum School. MOLESCO network 20-May-2015 Partially based on a talk by Javier Junquera Gollum School. MOLESCO network Outline - Developers - General features - FDF. Input variables - How to run the code - Output files - Saving and reading information - Pseudopotential generation - Visualization tools Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Developers http://departments.icmab.es/leem/siesta Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network General features of Siesta Born-Oppenheimer approximation. Structure relaxation (CG) and molecular dynamics (MD) Density functional theory (DFT). LDA, GGA, VdW functionals Pseudopotentials. Norm-conserving Linear combination of atomic orbitals (LCAO). Numerical atomic orbitals. Order N (sparse matrices) Numerical evaluation of the matrix elements (Smn, Hmn) Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network To run Siesta you need: 1. Access to the executable file Compile Siesta with your favourite compiler Watch out for BLAS and LAPACK libraries Serial versus parallel compilation 2. An input file, called whatever.fdf Written in Flexible Data Format (A. García and J. M. Soler) Contains: Physical data of the system Variables to control the approximations 3. A pseudopotential file for all different elements in the input file Unformatted binary (.vps) Formatted ASCII (.psf) (more portable and easy to read) Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Features of the Flexible Data Format language. FDF-I Data can be given in any order Data can be omitted in favour of default values Syntax: ‘data label’ followed by its value Character string: SystemLabel h2o Integer: NumberOfAtoms 3 Real: PAO.SplitNorm 0.15 Logical: SpinPolarized .false. Physical magnitudes: LatticeConstant 5.43 Ang Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Features of the Flexible Data Format language. FDF-II Labels are case insensitive and characters -_. are ignored LatticeConstant is equivalent to lattice_constant Text following # is a comment Logical values: T, .true., true, yes F, .false., false, no Character strings, not in apostrophes Complex data structures: blocks %block label … %endblock label Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Features of the Flexible Data Format language. FDF-III Physical magnitudes: real number followed by its units Many physical units are recognized for each magnitude Length: m, cm, nm, Ang, bohr Energy: eV, Rydberg Automatic conversion to the ones internally required. Allows to ‘include’ other FDF files or redirect the search to another file block PAO.Basis < BaTiO3basis.fdf AtomicCoordinatesAndAtomicSpecies < Interface.coor Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Clasification of the basic input variables 1. General system descriptors 2. Structural and geometrical variables 3. Basis set generation 4. Solution method 5. Method to solve the Hamiltonian 6. Control of the self-consistent cycle 7. Structural relaxation or molecular dynamics 8. Analysis of the results 9. Parallelization Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network General system descriptors SystemName: descriptive name of the system SystemName Si bulk, diamond structure If properly updated, this variable might contain very useful information to know what has been run SystemLabel: nickname of the system to name output files SystemLabel Si (After a succesful run, you should have files like Si.DM : Density matrix Si.XV: Final positions and velocities Si.bands: Electronic band structure Si.DOS: Total density of states ...and many more, depending on your requests) Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Structural and geometrical variables: number of atoms and species in the simulation box NumberOfAtoms: number of atoms in the simulation box NumberOfAtoms 2 NumberOfSpecies: number of different atomic species NumberOfSpecies 1 ChemicalSpeciesLabel: spcecify the different chemical species %block ChemicalSpeciesLabel 1 14 Si %endblock ChemicalSpeciesLabel All these variables are MANDATORY Víctor M. García Suárez. Oviedo. 20-May-2015 From 1 to NumberOfSpecies Atomic number of a given species plus a label to identify Gollum School. MOLESCO network Structural and geometrical variables: lattice constant and lattice vectors LatticeConstant: real length to define the scale of the lattice vectors LatticeConstant 5.43 Ang LatticeVectors (also LatticeParameters): read as a matrix, 1 Vect. → 1 line (units of LatticeConstant) %block LatticeVectors 0.000 0.500 0.500 0.500 0.000 0.500 0.500 0.500 0.000 %endblock LatticeVectors Coordinates. Followed by the species index %block AtomicCoordinatesAndAtomicSpecies 0.000 0.000 0.000 1 Si 1 0.000 0.000 1.280 1 Si 2 %endblock AtomicCoordinatesAndAtomicSpecies Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Basis set definition Straightforward definition of the basis %block PAO.BasisSizes C SZ %endblock PAO.BasisSizes Full definition of the basis %block PAO.Basis C 2 n=2 0 2 7.0 0.0 n=2 1 2 7.0 0.0 %endblock PAO.Basis Víctor M. García Suárez. Oviedo. 20-May-2015 Number of shells Principal quantum number (n), angular quantum number (l) and number of z Gollum School. MOLESCO network Real-space and k-grids S m n m n Real-space mesh MeshCutoff 150 Ry Hmn k-grid (Monkhorst-Pack) %block kgrid_Monkhorst_Pack 1 0 0 0.0 0 1 0 0.0 0 0 90 0.0 %endblock kgrid_Monkhorst_Pack k-grid (energy cut-off) kgrid_cutoff 20 Ang Víctor M. García Suárez. Oviedo. 20-May-2015 * dr m (r )n (r ) * ˆ ˆ m H n dr m (r ) Hn (r ) Gollum School. MOLESCO network Exchange and correlation functional DFT XC.Functional XC.authors LDA CA PZ GGA PW92 PBE revPBE PBEsol RPBE WC BLYP CA Ceperley-Alder PZ Perdew-Zunger LDA Local Density Approximation PW92 Perdew-Wang-92 GGA Generalized Gradient Approximation PBE Perdew-Burke-Ernzerhof WC Wu-Cohen BLYP Becke-Lee-Yang-Parr SpinPolarized Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network The density matrix, a basic ingredient in Siesta Expansion of the eigenvectors in a basis of localized atomic orbitals n (r ) cnm m (r ) Secular equation: m The electron density is given by 2 n ( r ) n ( r ) f n ( H m n E S m n )c m n n fn is the occupation of state n n Inserting the expansion into the definition of the density * n(r ) m n m (r )n (r ) mn The density matrix is then defined as follows: m n c c fn * nm nn n Víctor M. García Suárez. Oviedo. 20-May-2015 Controls the SCF convergence Used to restart calculations n 0 Gollum School. MOLESCO network The Kohn-Sham equations must be solved self-consistently The potential (input) depends on the density (output) Initial guess n (r ), n (r ) Calculate the effective potential Veff (r ) Vext (r ) VHartree (r ) Vxc[n , n ] Solve the KS equation 1 2 2 Veff (r )n (r ) n n (r ) Calculate electron density 2 n ( r ) n ( r ) f n No Yes Self-consistent? n m n m n DM.Tolerance max mn out Víctor M. García Suárez. Oviedo. 20-May-2015 Output quantities Energy, forces, stresses… in Gollum School. MOLESCO network Control of the convergence Maximum number of iterations MaxSCFIterations 1000 Pulay mixing DM.NumberPulay DM.MixingWeight n 1 in n 1 out 5 0.1 (1 ) n in Tolerance DM.Tolerance Víctor M. García Suárez. Oviedo. 20-May-2015 1.d-4 N i n in i 1 N ( n N i ) in n ( n N i ) out i out i 1 Gollum School. MOLESCO network Relaxation of the coordinates Type of run (CG, MD) MD.TypeOfRun cg Number of steps, maximum displacement and force tolerance MD.NumCGsteps MD.MaxCGDispl MD.MaxForceTol 1000 0.2 Bohr 0.05 eV/Ang Variable cell MD.VariableCell T MD.PreconditionVariableCell 5.0 Ang MD.MaxStressTol 1.0 GPa Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Saving and reading information: restarting files Some information is stored by Siesta to restart simulations from: FDF tag to reuse Name of the file Density matrix DM.UseSaveDM SystemLabel.DM Atomic positions and Vel. MD.UseSaveXV SystemLabel.XV Conjugate gradient history MD.UseSaveCG SystemLabel.CG Localized W. Funct. (Order-N) ON.UseSaveLWF Logical variables Very useful to save a lot of time Víctor M. García Suárez. Oviedo. 20-May-2015 SystemLabel.LWF Gollum School. MOLESCO network Saving and reading information: information needed as Input for various post-processing programs For example, to visualize: FDF tag to reuse Name of the file Total charge density SaveRho SystemLabel.RHO Deformation charge density SaveDeltaRho SystemLabel.DRHO Electrostatic potential SaveElectrostaticP… SystemLabel.VH Total potential SaveTotalPotential Local density of states LocalDensityOfStates SystemLabel.LDOS Charge density contours WriteDenchar SystemLabel.DIM Atomic coordinates WriteCoorXmol SystemLabel.xyz Animation of MD WriteDXMol SystemLabel.ANI Logical variables Víctor M. García Suárez. Oviedo. 20-May-2015 SystemLabel.VT Gollum School. MOLESCO network How to run the serial version of Siesta To run the serial version: [path]siesta < myinput > myoutput To see the output while it runs [path]siesta < myinput |tee myouput To run the job in the background add & [path]siesta < myinput > myoutput & To see the information dumped in the output file during the run: tail -f myoutput Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Output: the header Information about: - The version of Siesta - The compiler - Compilation flags - Mode (serial or parallel) - Date and time when the run starts Víctor M. García Suárez. Oviedo. 20-May-2015 Useful to reproduce the results of a simulation Gollum School. MOLESCO network Output: dumping the input file Exact copy of the input file Víctor M. García Suárez. Oviedo. 20-May-2015 Useful to reproduce the results of a simulation Gollum School. MOLESCO network Output: processing the input The input file is digested Siesta prints out the value of some variables (some of them might take the default value) A complete list of the parameters used, including default values, can be found in the file fdf.log Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Output: coordinates, cell and k-samling Coordinates, cell vectors and k cutoff and mesh Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Output: first molecular dynamic (MD) or conjugate gradient (CG) step Real space mesh and energies Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Output: forces and stress tensor WriteForces (logical): write the forces to the output file at the end of every MD or relaxation step The forces of the last step can be found in the file SystemLabel.FA Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Output: decomposition of the energy Different types of energy that have been calculated (ionic, neutral atom, kinetic, XC, free energy, etc) Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Output: timer. How many times (and how much time) the code has gone through the most important subroutines Useful to optimize the performance of the code Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Pseudopotential generation The pseudopotential is generated with the atom program Edit the makefile and include the Fortran compiler after the FC variable. The compiler flags can also be defined after FLAGS The generation of the pseudopotential and other data and plotting files is done with the scripts ae.sh (all electrons), pg.sh (pseudopotential) and pt.sh tests The scripts need to know where the atm program and other scritps are located. The simplest way of doing this is writing the its location after the DEFAULT_DIR and default variable. For instance: DEFAULT_DIR=../../../Pseudo.3.3/atom/Tutorial/Utils (*) default="../../Pseudo.3.3/atom/atm” An additional “../” is needed here because the script searches these scripts from the generated directory Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network All-electron calculation ae.sh generates the all-electron eigenvalues, wave functions, total energy and charge densities Input file (for instance Si): Si.ae.inp ae Si ground state all-electron Si ca 0.0 3 2 3 0 2.00 0.00 3 1 2.00 0.00 Core shells Valence shells Generation: ae.sh Si.ae.inp Produces the directory Si.ae with all information Plotting: gnuplot -persist “.gnuplot or .gps file” Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Pseudopotential calculation pg.sh generates the eigenvalues, wave functions, total energy and charge densities Input file (for instance Si): Si.inp Core corrections? pg Silicon tm2 3.0 # PS flavor, logder R n=Si c=car # Symbol, XC flavor,{ |r|s} 0.0 0.0 0.0 0.0 0.0 0.0 3 4 # norbs_core, norbs_valence 3 0 2.00 0.00 # 3s2 3 1 2.00 0.00 # 3p2 3 2 0.00 0.00 # 3d0 4 3 0.00 0.00 # 4f0 1.90 1.90 1.90 1.90 0.00 0.00 # Last line (above): # rc(s) rc(p) rc(d) rc(f) rcore_flag rcore Core radius. If negative or 0, the 5th number gives the charge density Generation: pg.sh Si.inp Produces the directory Si with all information and Si.vps (binary) and Si.psf files Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Pseudopotential test pt.sh performs a transferability test by comparing the all-electron calculation to the generated pseuopotential with various charges in the valence shells (different environments) Input file (for instance Si): Si.test.inp # A-E calculations ae Si Test -- GS 3s2 3p2 Si ca 0.0 3 2 3 0 2.00 3 1 2.00 # Pseudopotential test calculations pt Si Test -- GS 3s2 3p2 Si ca 0.0 3 2 3 0 2.00 3 1 2.00 Generation: pt.sh Si.test.inp Si.vps Produces the directory Si.test with all information. Compares the all-electron excitation energies (different configurations) and eigenvalues Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Generated data A lot of data is available in the generated directory Charge densities r(r) Log. Der. Pseudopot. Fourier Trans. From these graphs it is possible to see for instance if the core and valence overlap, how the wave functions match if they are broad enough and how smooth the pseudopotential is Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network How are the radii chosen? The radii of each channel (s, p, d, etc) have to be chosen in such a way that the wave function and the pseudopotential are smooth and broad inside the radii If the radii increases the wave function becomes broader but the transferability decreases A good choice would start around radii closer to the maximum of r(r). Longer radii go into the region where wave function overlaps with the WF of other atoms The radius of the core corrections has to be chosen so that the pseudo-core charge density reproduces the core charge density in the region where the core and the valence overlap Víctor M. García Suárez. Oviedo. 20-May-2015 Fe Gollum School. MOLESCO network Summary of different tools for post-processing and visualization Denchar Plrho DOS, PDOS DOS and PDOS total Fe, d Macrowave Víctor M. García Suárez. Oviedo. 20-May-2015 XCrySDen Fin Siesta2Gollum interface Víctor M. García Suárez Gollum School. MOLESCO network 20-May-2015 Gollum School. MOLESCO network Outline - What is needed from Siesta - How to obtain the Siesta information - Program files and structure - How to compile the code - How to run the code - Generated files Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network - What is needed from a Siesta calculation Data Number of spin components Fermi energy Information on the atomic orbitals Transversal k-points Hamiltonian and overlap matrices Siesta files Orbitals and geneneral system information SystemLabel.HSX Number of spin components, orbitals, Hamiltonian and overlap matrices SystemLabel.KP k-points SystemLabel.EIG Fermi energy and eigenvalues XX.Out Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network - How that information can be obtained from Siesta FDF flags to include in XX.fdf SaveHS .true. WriteEigenvalues .true. Generates the SystemLabel.HSX file Generates the SystemLabel.EIG file Default files Siesta hould also generate by default the SystemLabel.KP file Outuput file The Siesta ouput, which has a lot of information, has to be redirected to a XX.out file $ siesta < SystemLabel.fdf |tee XX.out Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network - Siesta2Gollum program files and structure Directory tools/interface-to-siesta Files Hsx_m.f90 Module that reads and processes the Hamiltonian and overlap from the .HSX file siesta2gollum.f90 Main program, which reads the rest of the information and generates the Extended_Molecule and Lead_i files Makefile Makes the siesta2gollum executable (Linux and Mac) Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network - How to compile the code Fortran compiler Edit the Makefile to specify the Fortran compiler after the FC (Fortran compiler) variable You can also specify the compiler flags after the FLAGS variable Compilation in Linux or Mac Type make. The code should compile and generate the siesta2gollum file Compilation in Windows Execute the following (with for instance the g95 compiler): $ g95 siesta2gollum -o hsx_m.f90 siesta2gollum.f90 Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network - How to run the code. Generation of the Gollum files Location The siesta2gollum executable should be in the same directory where the Siesta calculation has been run or linked to it It can also be in a directory with just the .out, .HSX, .KP and .EIG files Generation of the Extended_Molecule file Siesta2gollum “XX.out file” “0” For example, in a simulation of a BDT molecule between gold electrodes where the Siesta output has been redirected to the BDT-Au.out file, type the following: $ siesta2gollum BDT-Au.out 0 Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Generation of the Lead_i files Siesta2gollum “XX.out file” “number between 1 and 123456789” This tells siest2gollum to generate a number of Lead_i files, where “i” runs to the numbers specified in the command line For example, in a simulation of a gold lead which is going to be used in electodes 1, 2 and 5 of a multiterminal simulation and which has been redirected to the Au.out file, type the following: $ siesta2gollum Au.out 125 This generates the following files: Lead_1, Lead_2 and Lead_5 Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network - Generated files File Extended_Molecule There should be only one file in the simulation. Contains information about the orbitals, spin, k-points, overlap and Hamiltonian of the extended molecule. It should contain the following data from the DFT calculation of the extended molecule: • nspin. Defines wether the calculation is spin-unpolarized (1) or polarized (2) • FermiE. Value of the Fermi energy at the extended molecule in eV. Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network • iorb. Contains information about the orbitals used in the simulation. It has as many rows as orbitals in the EM region. - iorb(1): Atom to which orbital belongs. - iorb(2): Principal quantum number n. - iorb(3): Quantum number lz using real spherical harmonics. - iorb(4): z-number (basis set with multiple zetas) At the moment Gollum only uses iorb(1). • kpoints_EM. Transverse k-poins used in the DFT simulation of the EM. - kpoints(1): Value of kx. - kpoints(2): Value of ky. - kpoints(3): Weight in the k summation. Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network • HSM. Contains the overlap S(k,i,j) and Hamiltonian H(k,i,j,s) for a given transverse k-point, given orbital pairs (i,j) and spin s. The number of columns is 7 if nspin = 1 or 9 if nspin = 2. There are as many rows as non-zero overlap or Hamiltonian elements. If for a given (k,i,j,s) all elements are zero, then this row is skipped. - HSM(1): Defines the k-point number as defined in kpoints. - HSM(2): Defines the orbital number i as defined in iorb. - HSM(3): Defines the orbital number j as defined in iorb. - HSM(4): Real part of S(k,i,j). - HSM(5): Imaginary part of S(k,i,j). - HSM(6): Real part of H(k,i,j) (nspin = 1) or H(k,i,j,1) (nspin = 2). - HSM(7): Imaginary part of H(k,i,j) (nspin = 1) or H(k,i,j,1) (nspin = 2). - HSM(8): Exists only if nspin = 2. Real part of H(k,i,j,2). - HSM(9): Exists only if nspin = 2. Imaginary part of H(k,i,j,2). Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network Files Lead_i There should be one of these files for each lead. The file will be read and used if the corresponding variable leadp(3) is set to ±1. It should contain the following data from the DFT calculation of the leads: • kpoints_Lead. Transverse k-poins used in the DFT simulation of the lead. It must be given because the ordering of the k-points in the DFT simulation of the Leads and the EM need not to coincide. - kpoints(1): Value of kx. - kpoints(2): Value of ky. - kpoints(3): Weight in the k summation. Víctor M. García Suárez. Oviedo. 20-May-2015 Gollum School. MOLESCO network • HSL. Contains the intra- and inter-PL overlap S0,1(k,i,j) and Hamiltonian H0,1 (k,i,j,s) for a given transverse k-point, given orbital pairs (i,j) and spin s. The number of columns is 11 if nspin = 1 or 15 if nspin = 2. There are as many rows as non-zero overlap or Hamiltonian elements. If for a given (k,i,j,s) all elements are zero, then this row is skipped. - Ordering of the variable. For nspin = 1: k i j Real[S0] Imag[S0] Real[H0] Imag[H0] Real[S1] Imag[S1] Real[H1] Imag[H1] For nspin = 2: k i j Real[S0] Imag[S0] Real[H0,1] Imag[H0,1] Real[H0,2] Imag[H0,2] Real[S1] Imag[S1] Real[H1,1] Imag[H1,1] Real[H1,2] Imag[H1,2] Víctor M. García Suárez. Oviedo. 20-May-2015 Fin