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 > 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 to give your user the necessary group affiliations (vasp5).

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


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]

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 =
   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

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

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


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


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 {} \;


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

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


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

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 ]

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

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


#SBATCH --job-name=jobname
#SBATCH --account=nn4604k
#SBATCH --time=10:00:00
#SBATCH --mem-per-cpu=4000M
#SBATCH --nodes=1
#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 

module load VASPModules
module load VASP/6.3.0-intel-2021b-std-wannier90-libxc-hdf5-5289f748cfc70eba91b5b6c81efedad4
#module load VASP/6.3.0-intel-2021b-gam-wannier90-libxc-hdf5-5289f748cfc70eba91b5b6c81efedad4

if [ -f WAVECAR ]


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


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

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


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


Check the order of the 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)


    4.2200000000000000    0.0000000000000000    0.0000000000000000
    0.0000000000000000    4.2200000000000000    0.0000000000000000
    0.0000000000000000    0.0000000000000000    4.2200000000000000


    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 Å.


VASP Wiki and Support Forum

The VASP manual contains information on all INCAR tags and tutorials and guides to several types of calculations (

The VASP Support 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.


VASP efficiency on Saga (number of nodes/cores)

Computational cost: atoms vs kpoints vs functional etc.

General calculations and relaxation




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:

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]

Vibrational frequencies

Finite displacement method (IBRION=5) can be used to find vibrational frequencies within the harmonic approximation.

  1. See Phonons from finite differences
  2. Relax the species that will be displaced to higher force convergance (e.g., EDIFFG=0.0001 or 0.005 eV Å^1)
  3. Use IBRION=5, NFREE=4, POTIM=0.015. The NCORE-tag may need to be removed from INCAR
  4. Check the energy profile (energy of each ionic step vs displacement) to make sure that the harmonic fit is satisfactory (2nd order polynomial)

Phonon calculations


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


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

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:


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




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

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

  bader CHGCAR -ref CHGCAR_sum

Error messages


  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)
  2. B. M. Darinskiy, N. D. Efanova & D. S. Saiko (2020) Special grain boundaries in perovskite crystals, Ferroelectrics, 567:1, 13-19,
  3. Application of machine learning-based selective sampling to determine BaZrO3 grain boundary structures, Computational Materials Science, 164 (2019) 57-65.
  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.
  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
  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).

Software and resources

Overview of codes from the Materials Design Group at Imperial College London

Installation on Saga

module load Python/3.9.6-GCCcore-11.2.0
pip install sumo
pip install --upgrade

This will install the python packages under .local/lib/python3.9/site-packages/

Structure and crystallography

ICSD database

Automatic login through EZproxy (

Materials project

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

International Tables for Crystallography

Complete overview of space-group symmetry and more.

Shannon Ionic Radii

Reference [1]

Binding energies of molecules

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


Catalysis Hub

Database of reaction energies and barriers from DFT calculations.

No entropy found


VESTA (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 (Windows, macOS, Linux)

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

Diamond (Windows: Licence)

View and edit periodic and molecular structures.

VMD (Windows, macOS, Linux)

View and animate structures from molecular dynamics simulations.

P4vasp (macOS, Linux)

Visualizing periodic structures, density of states and band structures.


OVITO is a visualization and analysis software for output data generated in molecular dynamics, atomistic Monte-Carlo and other particle-based simulations.


Escher is a collection of octave and python routines for the visualization and plotting of molecules and crystals. The original idea in escher was to modernize tessel, a program for the representation of crystal structures (and more). Via an interface to POV-Ray, tessel is able to generate very high quality representations of periodic and finite molecular structures.

Code link of a cover art example:


Spyder (Windows, macOS, Linux)

Scientific python developer environment.

Atomic Simulation Environment (ASE)

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

ASE modules are available on Saga

module avail ase

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

from import read
from import write
from import fcc111
from import fcc100
from import fcc111_root
slab = fcc111_root('Pd', 3, size=(1,2,7), a=3.9438731474981594, vacuum=5.0)
write('Pd-111.cif', slab, 'cif')


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.


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

CatMap can be installed directly via pip:

pip install --upgrade

You may need to add the install directory to the PYTHONPATH, e.g. in bash shell or .bash_profile


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:


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/

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.


  • 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


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
 3.945130 0.000000 0.000000
 0.000000 3.945130 0.000000
 0.000000 0.000000 3.945130
 1 1 3
 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


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.


Sumo is a Python toolkit for plotting and analysis of ab initio solid-state calculation data, built on existing Python packages from the solid-state chemistry/physics community. SUMO can plot projected DOS directly from DOSCAR and vasprun.xml

Installation on Saga works with the following python module (consider loading it in ~/.bash_profile)

module load Python/3.9.6-GCCcore-11.2.0

pip install sumo

The installation folder will be ~/.local/lib/python3.9/site-packages/


Pymatgen (Python Materials Genomics) is a robust, open-source Python library for materials analysis.

Generate a POTCAR with symbols Li_sv O and the PBE functional in a termial

pmg potcar --symbols Li_sv O --functional PBE

Python code quick examples:

1) to generate NEB images by using IDPP method (image dependent pair potential: J. Chem. Phys. 140, 214106 (2014))

from pymatgen.core import Structure
from pymatgen.analysis.diffusion.neb.pathfinder import IDPPSolver
init_struct = Structure.from_file("POSCAR_start.vasp")
final_struct =Structure.from_file("POSCAR_end.vasp")
obj = IDPPSolver.from_endpoints(endpoints=[init_struct, final_struct], nimages=5,
                               sort_tol=1.0)new_path =, 
                               tol=1e-5, gtol=1e-3, species=["Na"])
for i in range(len(new_path)):

2) to analyze NEB results

from pymatgen.analysis.transition_state import NEBAnalysis
neb = NEBAnalysis.from_dir("./")
nebplot = neb.get_plot()


Atomsk creates, manipulates, and converts data files for atomic-scale simulations in the field of computational materials sciences in CLI. Atomsk can generate common lattice types such as fcc, bcc, hcp, and perform elementary transformations: duplicate, rotate, deform, insert dislocations, merge several systems, create twins, bicrystals and polycrystals, and so on. These elementary tools can be combined to construct and shape a wide variety of atomic systems.

To compile on Saga by using Intel fort/MLK,

git clone

cd atomsk/src

module load intel-compilers/2022.1.0

module load imkl/2022.1.0

make -f Makefile.ifort atomsk


  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.