Main Page

From mn.kjemi.vaspwiki
Jump to: navigation, search

Welcome to VASPwiki hosted by the Electrochemistry group within the Centre for Materials Science and Nanotechnology (SMN) at the University of Oslo, Norway.

The wiki gathers beginner's guides and an overview of methods, software and resources for doing DFT calculations and data processing with specific details related to the high-performance computers within the Norwegian Research Infrastructure Services (NRIS). Disclaimer: use at your own risk.

Contact: Associate Prof. Jonathan Polfus

Getting started

User access

Go to www.metacenter.no > User Login (Passwords) > 1. Request a user account > HPC

Fill in the form with your UiO username and choose the appropriate project. If you already have an account through for instance FYS-MENA41111, the project manager can in principle directly add you to the project without requesting a user account.

The project manager can give you access to the VASP license through the VASP portal and thereafter informing sigma2@uninett.no to give your user the necessary group affiliations (xvasp and vasp5).

Project Manager Group Resources
NN4604K Jonathan M. Polfus Electrochemistry Saga
NN9136K Lasse Vines LENS Saga
NN9180K Clas Persson Structure Physics Saga

Login

ssh and scp

ssh can be used to login to the cluster with a terminal app on UNIX, macOS or Windows Subsystem for Linux

ssh [username]@saga.sigma2.no

Hostnames and usernames can be saved by creating or editing the config file using for instance the vim text editor

vim ~/.ssh/config

Press i to insert text

Host saga
   HostName = saga.sigma2.no
   user [username]

Press escape to exit insert mode, and then :wq to 'write' and 'quit'.

Login is then simplified

ssh saga

Copy files from cluster to current folder (.)

scp saga:[path]/[filename] .

Copy files to the home directory on the cluster

scp [filename] saga:

PuTTY and WinSCP

PuTTY is an ssh client for Windows that can be downloaded from www.putty.org.

WinSCP is an scp client for Windows that can be downloaded from winscp.net.

Working in UNIX

Basic commands

Learn to use the TAB key to autocomplete commands, paths and filenames.

Learn to view the manual for any command: man [command]

Navigating the filesystem
Command Description
ls List files and directories in current directory
mkdir [directoryname] Make a directory
cd [directoryname] Change current path to another directory
pwd Display current path
cd .. Change path to parent directory
cp [path]/[filename] . Copy file to current directory
cp [filename] [directoryname] Copy file to another directory
mv [filename] [path] Move file to another directory
mv [filename] [newfilename] Change the name of a file
cp -r [directory] [path] Copy directory and its contents to new location
rm [filename] Delete file
rm -r [directoryname] Delete directory and its contents
Special paths and symbols
Symbol Description
. Current directory
.. Parent directory
~ Home directory
/ Root directory
* Any text pattern
 ? Any symbol
Reading text files
Command Description
less View text file. View live updates to end of file: Shift-F
head Display top 10 lines of text file. Specify number of lines: -n [count]
tail Display bottom 10 lines of text file. Specify number of lines: -n [count]
grep [pattern] Display each line in text file containing text specific text/symbol pattern.
diff [file1] [file2] Compare files line by line and display the difference between them.
cat Concatenate text files sequentially. Write the output to a file: > [filename]

Filesystem on Saga

Home directory: mainly for personal files, scripts etc. due to limited storage space

/cluster/home/[username]

Project folder: Run jobs and store output files in a subfolder called your username

/cluster/projects/[project number]/[username]

Check disk usage and storage quota for home directory and project folder

dusage

Check disk usage of current folder and subfolders

du -hs

Find and remove files matching [filename] in current folder and subfolders

find . -name "[filename]" -exec rm {} \;

Logfile

Excel sheet for tracking jobs can be downloaded here: Media:Logfile.xlsx It also includes conversion between supercell size, number of atoms and k-point grid for a given k-point density.

Job script

Sigma2 NRIS HPC clusters use Slurm as workload manager and job scheduler. Documentation is available on documentation.sigma2.no/

Computations are run by submitting a job script to the queue

sbatch jobfile

View the queue for a user or project

squeue -u [username] squeue -p [project number]

Job scripts for Saga are available in the project folder

/cluster/projects/nn4604k/jobfile

The job script below contains several SBATCH options

Saga has 40 CPUs per node and it is recommended to use all CPUs on a node and a 1-2 nodes for optimal performance documentation.sigma2.no/hpc_machines/saga

The module system is restored to avoid potential conflicts. There exist several compiled versions of VASP and specific versions are compiled for increased performance with gamma K-point grid

module restore system
module load VASP/5.4.4-intel-2019a-std
#module load VASP/5.4.4-intel-2019a-gam 

Available modules on the cluster can be listed with

module avail

Files are copied to a temporary job folder ($SCRATCH). The WAVECAR file is copied if it is available.

cp [filenames] $SCRATCH
if [ -f WAVECAR ]
then
cp WAVECAR $SCRATCH
fi

Output files are copied from the job folder to the submit folder when job completes. Savefile will also copy files if the job crashes.

savefile [filenames] 

The job is started from the $SCRATCH folder and the elapsed time is recorded to slurm output

cd $SCRATCH
time srun vasp

The progression of the job can be viewed in the slurm output file slurm-[slurm-id] in the submit folder once the job is running.

The working folder can be accessed while the job is running /cluster/work/jobs/[slurm-id]


Example job script

#!/bin/bash

#SBATCH --job-name=[jobname]
#SBATCH --account=[project number]
#SBATCH --time=10:00:00
#SBATCH --mem-per-cpu=4600M
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=40

set -o errexit 
set -o nounset

module restore system
module load VASP/5.4.4-intel-2019a-std
#module load VASP/5.4.4-intel-2019a-gam 
 
cp INCAR POSCAR POTCAR KPOINTS $SCRATCH
if [ -f WAVECAR ]
then
cp WAVECAR $SCRATCH
fi

savefile CONTCAR OUTCAR DOSCAR CHGCAR WAVECAR 

cd $SCRATCH
time srun vasp

Aliases and settings

Define useful shortcuts by adding aliases to ~/.bash_profile

alias l='ls -l'
alias la='ls -l -a'
alias ..='cd ..'
alias nn='cd /cluster/projects/[project number]'
alias q='squeue -u [username]'

You can also add commands such as automatically changing directory to the project folder upon login.

Changes will take effect on next login or manually with source ~/.bash_profile .


vim can be configured in ~/.vimrc . Turn on line numbers to easily jump to a specific line using  :[line number]

set number

Shell scripting

Shell scripting can be used to submit several jobs as exemplified below

#!/bin/bash

for i in $(seq 0.0 0.2 1.4); do
   for j in $(seq 0.0 0.2 1.4); do
      dir="$i-$j"
      echo $dir
      mkdir $dir
      cp INCAR POTCAR KPOINTS jobfile $dir
      cp "prefix_$dir.POSCAR.vasp" $dir/POSCAR
      cd $dir
      sbatch jobfile
      cd ..
   done
done

First VASP calculation

Five files required for a VASP simulation
File Description
POSCAR Structure file that specifies the unit cell vectors, types of atoms and their positions
POTCAR Pseudopotentials for the atoms (same order as in POSCAR)
INCAR Input parameters for the calculation including relaxation algorithms, functionals, convergence criteria, etc.
KPOINTS k-point grid
jobfile job script

Cell volume relaxation of BaZrO3 unit cell

Go to the project folder: cd /cluster/projects/nn4604k

Or if you have defined an alias: nn

Create a subfolder with your username (if you have not done so already)

mkdir [username]

cd [username]

mkdir test

cd test

Copy all the files from the 'vasptest' folder (POSCAR, KPOINTS and INCAR) to your current folder (remember to use TAB to autocomplete the path)

cp ../../vasptest/* .

Copy the necessary POTCAR files (press the UP arrow key to bring up your previous command)

cp ../../potpaw_PBE.54/Ba_sv/POTCAR POTCAR_Ba_sv

cp ../../potpaw_PBE.54/Zr_sv/POTCAR POTCAR_Zr_sv

cp ../../potpaw_PBE.54/O/POTCAR POTCAR_O

Check the order of the atoms in POSCAR file

head POSCAR

Concatenate the POTCAR files in the same order to a file named POTCAR

cat POTCAR_Ba_sv POTCAR_Zr_sv POTCAR_O > POTCAR

Check the order of the POTCAR

grep TITEL POTCAR

Copy job script to current folder

cp ../../jobfile .

Submit the job

sbatch jobfile

Check the queue

squeue -u [username]

Or if you have defined an alias: q

When the job starts you can follow the progress in the slurm log file

less slurm-[slurm-id]

After three ionic relaxation steps, the required accuracy has been reached and the output files defined job script are copied to the current folder.

3 F= -.41724097E+02 E0= -.41724097E+02  d E =-.431449E-02
curvature:  -0.24 expect dE=-0.515E-06 dE for cont linesearch -0.515E-06
trial: gam= 0.00000 g(F)=  0.940E-64 g(S)=  0.213E-05 ort =-0.198E-03 (trialstep = 0.895E+00)
search vector abs. value=  0.213E-05
reached required accuracy - stopping structural energy minimisation
writing wavefunctions

Check the lattice parameter in the POSCAR (input) and output (CONTCAR)

head POSCAR

BaZrO3                           
  1.00000000000000     
    4.2200000000000000    0.0000000000000000    0.0000000000000000
    0.0000000000000000    4.2200000000000000    0.0000000000000000
    0.0000000000000000    0.0000000000000000    4.2200000000000000
...

head CONTCAR

BaZrO3                                  
  1.00000000000000     
    4.2353879522908331   -0.0000000000000000   -0.0000000000000000
    0.0000000000000000    4.2353879522908331   -0.0000000000000000
    0.0000000000000000   -0.0000000000000000    4.2353879522908331
...

The optimized cubic lattice parameter is 4.2354 Å.

Methods

VASP Wiki and Support Forum

The VASP manual contains information on all INCAR tags and tutorials and guides to several types of calculations (www.vasp.at/wiki/).

The VASP Support Forum (www.vasp.at/forum/) allows users to troubleshoot and discuss technical and scientific topics. The VASP developers are also active in answering questions.

Convergence and Efficiency

Convergence tests

How to and relevant examples.

Benchmark

VASP efficiency on Saga (number of nodes/cores)

Computational cost: atoms vs kpoints vs functional etc.

General calculations and relaxation

NELM, NSW

Systems

Supercells

A supercell can be made in VESTA by going into Edit -> Edit data -> Unit Cell...

When the window for the unit cell has opened press Transform, change the numbers in the Transformation matrix to make a supercell of your choice.

Surfaces and slabs

Slabs can be constructed using ASE.

A specific surface can be exposed using VESTA, here is a youtube tutorial for exposing the (110) surface of a TiO2 rutile structure, tutorials for other structures can be found on the same youtube channel.

To make a supercell or a slab from the new unit cell you have just created VESTA you have to export the unit cell in a .vasp format. Open the vasp file in VESTA and then follow the same procedure for the creation of a supercell as has been explained above.

Finite-size correction for slab supercell calculations of materials with spontaneous polarization [1]

Grain boundaries and interfaces

Typically modeled as Coincident Site Lattice (CSL) structures that are optimized by rigid body translation.

Materials project provides a list of matching structures and terminations under the Substrates section for a selected structure.

Special grain boundaries in perovskites [2]

Machine learning sampling to determine rigid body translation [3]

Disordered structures

Site occupancy disorder program: https://github.com/gcmt-group/sod

TDEP code for generating special quasirandom structures

Defect calculations

Charge correction

Self-Consistent Potential Correction for Charged Periodic Systems [4]

CoFFEE: Corrections For Formation Energy and Eigenvalues for charged defect simulations [5]

Limitations of empirical supercell extrapolation for calculations of point defects in bulk, at surfaces, and in two-dimensional materials [6]

Defect configurations

Evolutionary computing and machine learning for discovering of low-energy defect configurations [7]

Phonon calculations

Phonopy

Nudged Elastic Band (NEB)

NEB calculations require relaxed CONTCAR files for the initial and final states, and POSCAR files for one or more states along the migration path, which are termed images. The POSCAR files can be generated by linear interpolation between neighboring states using nebmake.pl script which is part of VTST Tools and is available in the folder /cluster/projects/nn4604k/bin/vtstscripts-922).

The following INCAR tags can be used to initiate a NEB calculations with one image and the climbing image method

IMAGES = 1
SPRING = -5
LCLIMB = .TRUE.

POSCAR files for the initial, interpolated and final position must be placed in subfolders named 00, 01 and 02, and the job script must be modified accordingly. VTST Tools offers some improvements to the standard NEB implementation in VASP, and these can be loaded as a separate module with suffix -vtst

module load VASP/5.4.4-intel-2019a-std-vtst
cp -r 00 01 02 $SCRATCH
savefile 01/CONTCAR 01/OUTCAR 01/DOSCAR 01/CHGCAR 01/WAVECAR

Polaron localization

Normally polarons which are localized at d or p orbitals normally require DFT+U hybrid functionals.

The U value will determine the localization energy.

To determine the proper U value for this calculations, the a piecewise linear method is strongly recommended.

More detail can be found  Physical Review B90(3), 035204.

To visualize the polaron localization, you can generate the partial charge density, by set:

LPARD = T

IBAND = XX, the band where you localized polaron is.

The PARCHG will be generated after calculation, and it can be visualized in the VESTA.

Bader charge analysis

INCAR

PREC = A

LAECHG = T

The core charge is written to AECCAR0 and the valance charge to AECCAR2. These two charge density files can be summed using the chgsum.pl script;

  chgsum.pl AECCAR0 AECCAR2

The bader analysis can then be done on this total charge density file:

  bader CHGCAR -ref CHGCAR_sum

Error messages

References

  1. Yoo, SH., Todorova, M., Wickramaratne, D. et al. Finite-size correction for slab supercell calculations of materials with spontaneous polarization. npj Comput Mater 7, 58 (2021) http://dx.doi.org/10.1038/s41524-021-00529-1
  2. B. M. Darinskiy, N. D. Efanova & D. S. Saiko (2020) Special grain boundaries in perovskite crystals, Ferroelectrics, 567:1, 13-19, https://doi.org/10.1080/00150193.2020.1791582
  3. Application of machine learning-based selective sampling to determine BaZrO3 grain boundary structures, Computational Materials Science, 164 (2019) 57-65. https://doi.org/10.1016/j.commatsci.2019.03.054
  4. Mauricio Chagas da Silva, Michael Lorke, Bálint Aradi, Meisam Farzalipour Tabriz, Thomas Frauenheim, Angel Rubio, Dario Rocca, and Peter Deák Phys. Rev. Lett. 126, 076401. https://doi.org/10.1103/PhysRevLett.126.076401
  5. Naik, Mit H., and Manish Jain. CoFFEE: corrections for formation energy and eigenvalues for charged defect simulations. Computer Physics Communications 226 (2018) 114-126. https://doi-org/10.1016/j.cpc.2018.01.011
  6. Christoph Freysoldt, Jörg Neugebauer, Anne Marie Z. Tan, and Richard G. Hennig, Limitations of empirical supercell extrapolation for calculations of point defects in bulk, at surfaces, and in two-dimensional materials, Phys. Rev. B 105, 01410 http://dx.doi.org/10.1103/PhysRevB.105.014103
  7. Arrigoni, M., Madsen, G.K.H. Evolutionary computing and machine learning for discovering of low-energy defect configurations. npj Comput Mater 7, 71 (2021). https://doi.org/10.1038/s41524-021-00537-1

Software and resources

Structure and crystallography

ICSD database

icsd.fiz-karlsruhe.de/

Automatic login through EZproxy (www.ub.uio.no/english/using/remote-access.html).

Materials project

www.materialsproject.org

Contains structures optimized by DFT that can be downloaded in several formats including .cif or POSCAR. Choose 'Conventional Standard' CIF.

Login with a Google account (available with UiO username www.uio.no/english/services/it/store-collaborate/gsuite/).

International Tables for Crystallography

it.iucr.org

Complete overview of space-group symmetry and more.

Shannon Ionic Radii

abulafia.mt.ic.ac.uk/shannon/

Reference [1]

Binding energies of molecules

Todo: Table of binding energies with reference (e.g., NIST)

Catalysis

Catalysis Hub

www.catalysis-hub.org

Database of reaction energies and barriers from DFT calculations.

No entropy found

Visualization

VESTA

jp-minerals.org/vesta/en/ (Windows, macOS, Linux)

View periodic structures, charge densities and more.

Recommended settings for improved figures

Objects > Properties > Atoms/Bonds/Polyhedra
Specular: 40 40 40
Shininess (%): 1 

View > Overall Appearance...
Ambient: 10
Diffuse: 70

Avogadro

avogadro.cc (Windows, macOS, Linux)

View and edit molecular structures and optimize molecular geometry through molecular mechanics.

Diamond

www.crystalimpact.com/diamond/ (Windows: Licence)

View and edit periodic and molecular structures.

VMD

www.ks.uiuc.edu/Research/vmd/ (Windows, macOS, Linux)

View and animate structures from molecular dynamics simulations.

P4vasp

github.com/orest-d/p4vasp (macOS, Linux)

Visualizing periodic structures, density of states and band structures.

Packages

Spyder

www.spyder-ide.org (Windows, macOS, Linux)

Scientific python developer environment.

Atomic Simulation Environment (ASE)

wiki.fysik.dtu.dk/ase/ (Module available on Saga)

Set of tools and Python modules for setting up, manipulating, running, visualizing and analyzing atomistic simulations.

Example of a script for generating an (1 1 1) surface slab of palladium

#!/opt/local/bin/python
from ase.io import read
from ase.io import write
from ase.build import fcc111
from ase.build import fcc100
from ase.build import fcc111_root
slab = fcc111_root('Pd', 3, size=(1,2,7), a=3.9438731474981594, vacuum=5.0)
write('Pd-111-gb.cif', slab, 'cif')

VASPKIT

VASPKIT provides a powerful and user-friendly interface to perform high throughput analysis of various material properties from the raw calculated data using the widely-used VASP code.

  • Generate KPOINTS, POTCAR and INCAR for a given POSCAR file;
  • Elastic-constants of 2D and bulk materials using stress-strain or energy-strain methods;
  • Equation-of-state fitting;
  • Suggested k-paths for a given crystal structure;
  • Optical adsorption coefficient of 2D and bulk materials;
  • Band structure unfolding;
  • Fermi surface;
  • Density-of-states and band-structure;
  • Charge/spin density, Charge density difference;
  • Vacuum level and work function;
  • Wave-function analysis;
  • Molecular-dynamics analysis;
  • Effective mass of carrier;
  • Symmetry finding and operations;
  • 3D band structures;
  • Magnetocrystalline anisotropy energy;
  • Currently, only VASP raw data are fully supported.

More detail: https://vaspkit.com/index.html

CatMAP

CatMap is a catalyst Micro-kinetic Analysis Package for automated creation of micro-kinetic models used for studying kinetics and screening new catalysts.

https://catmap.readthedocs.io/en/latest/index.html

CatMap can be installed directly via pip:

pip install --upgrade https://github.com/SUNCAT-Center/catmap/zipball/master

To use the package add this directory to the PYTHONPATH, e.g. in bash shell:

export PYTHONPATH=$HOME/THIS_FOLDER_PATH:$PYTHONPATH

Input File Structure

The TableParser accepts inputs in a tab-separated text file. An example of the header and first few lines are provided below:

Image.png

The following column titles are required for a functional input file:

  • surface_name
  • site_name
  • species_name
  • formation_energy
  • frequencies
  • reference

Generating input file for formation energy

You can use the python script under /CATMAP/catmap/tutorials/1-generating_input_file/generate_input.py

Creating a Microkinetic Model

Check the example of CO oxidation in the path of /CATMAP/catmap/tutorials/2-creating_microkinetic_model

One of the most important aspects of the “setup file” is the “rxn_expressions” variable which defines the elementary steps in the model. For this simplified CO oxidation model we will specify these as:

rxn_expressions = [               '*_s + CO_g -> CO*',               '2*_s + O2_g <-> O-O* + *_s -> 2O*',               'CO* +  O* <-> O-CO* + * -> CO2_g + 2*',                   ] 

The first expression includes CO adsorption without any activation barrier. The second includes an activated dissociative chemisorption of the oxygen molecule, and the final is an activated associative desorption of CO2. More complex models for CO oxidation could be imagined, but these elementary steps capture the key features. Note that we have only included “*” and “*_s” sites since this is a single-site model for CO oxidation. This means that all intermediates will be adsorbed at a site designated as “s”. These reaction expressions will be parsed automatically in order to define the adsorbates, transition-states, gasses, and surface sites in the model.

Phonopy and Phono3py

Phonopy is an open source package for phonon calculations at harmonic and quasi-harmonic levels. Phono3py is another open source package for phonon-phonon interaction and lattice thermal conductivity calculations.

Features

  • Phonon band structure, phonon DOS and partial-DOS
  • Phonon thermal properties: Free energy, heat capacity (Cv), and entropy
  • Phonon group velocity
  • Thermal ellipsoids / Mean square displacements
  • Irreducible representations of normal modes
  • Dynamic structure factor for INS and IXS
  • Non-analytical-term correction: LO-TO splitting (Born effective charges and dielectric constant are required.)
  • Mode Grüneisen parameters
  • Quasi-harmonic approximation: Thermal expansion, heat capacity at constant pressure (Cp)
  • Interfaces to calculators: VASP, VASP DFPT, ABINIT, Quantu ESPRESSO, SIESTA, Elk, WIEN2k, CRYSTAL, DFTB+, TURBOMOLE, CP2K, FHI-aims, CASTEP, Fleur, LAMMPS (external)
  • Phonopy API for Python

https://phonopy.github.io/phonopy/

TDEP

ollehellman.github.io

Extract force constants, phonon dispersion relations, thermal conductivity, and generate special quasirandom structures (SQS)

Available on Saga (/cluster/shared/tdep/bin). Use the following modules

module purge
module load Anaconda3/2019.03
module load intel/2018b
module load imkl/2018.3.222-iimpi-2018b
module load HDF5/1.10.2-intel-2018b

Generate SQS supercell from from a unit cell POSCAR file named 'infile.ucposcar'

Example of 'infile.ucposcar' for a A-site doped SrTiO3 unit cell where the disordered site is designated 'ALLOY' (2 elements: 52% Sr and 48% Ca)

 Sr1 Ti1 O3
 1.0
 3.945130 0.000000 0.000000
 0.000000 3.945130 0.000000
 0.000000 0.000000 3.945130
 ALLOY Ti O
 1 1 3
 direct
 0.000000 0.000000 0.000000 2 Sr 0.52 Ca 0.48
 0.500000 0.500000 0.500000
 0.500000 0.000000 0.500000
 0.500000 0.500000 0.000000
 0.000000 0.500000 0.500000

Generate 2x2x2 SQS supercells (five supercells will be generated outfile.sqs_001-005)

generate_structure -d 2 2 2

Spinney

spinney.readthedocs.io/

Python package dedicated to the study of point defects in solids. Can be used to calculate the correction energy due to electrostatic finite-size-effects in charged supercells, defect formation energies and transition levels, and defects concentrations.

References

  1. R.D. Shannon, Revised Effective Ionic Radii and Systematic Studies of Interatomic Distances in Halides and Chalcogenides, Acta Cryst. 1976 (A32) 751-767

Getting started with MediaWiki

Consult the User's Guide for information on using the wiki software.