The commands you'll use every day on the server. Keys to press look like
Esc; commands to type look like ls. Anything in [brackets] is a placeholder.
ssh [username]@[serverIP] | Log in. Enter your password when asked; nothing shows on screen as you type it |
scp ~/[local file path] [username]@[serverIP]:~ | Copy a file from your computer to the server |
scp [username]@[serverIP]:~/[server file path] ~/[local file path] | Copy a file from the server to your computer |
scp -r ~/[local folder path] [username]@[serverIP]:~ | Copy a whole folder to the server |
Run scp in a terminal on your own computer, not while logged
into the server.
pwd | Show which folder you're in |
ls / ls -lt | List files / with sizes and dates, newest first |
cd [foldername] | Move into a folder |
cd .. / cd ~ / cd - | Up one level / home folder / back to the previous folder |
mkdir [foldername] | Make a folder |
cp [filename] [destination] | Copy a file |
cp -r [foldername] [destination] | Copy a folder and its contents |
mv [oldname] [newname] | Rename (or move) a file |
rm [filename] / rm -r [foldername] | Delete a file / a folder and its contents |
cp and mv overwrite files without asking, and rm is
permanent (there's no trash). Names are case-sensitive: VASP reads INCAR, not
incar.
cat [filename] | Print the whole file |
head [filename] / tail [filename] | First / last few lines |
tail -f [filename] | Follow a file live as it grows; Ctrl+C stops watching |
less [filename] | Scroll through a file; / to search, q to quit |
grep [text] [filename] | Find lines containing text, e.g. grep TOTEN OUTCAR |
sbatch job | Submit a job (run it from the calculation folder) |
sq | Check your jobs (same as squeue -u [username]) |
scancel [job no.] | Cancel a job, using the number shown by sq |
tail -f out | Watch VASP's output live |
top / htop | CPU use of the server and running processes |
pwdx [PID#] | Find a process's folder from its PID |
vim opens in normal mode, where keys are commands. Press i for
insert mode to type or paste, and Esc to go back. If keys start doing strange
things, press Esc. Commands starting with : are typed in normal mode and appear at
the bottom of the screen; press Enter to run them.
vim [filename] | Open (or create) a file |
| i | Insert mode: type or paste |
| Esc | Back to normal mode |
:wq | Save and exit |
:w | Save without exiting |
:q! | Exit without saving. Use this if :q says "E37: No write since last change" and you want to discard your edits |
| gg / G | Jump to the top / bottom of the file |
:set number / :42 | Show line numbers / jump to line 42 |
/ENCUT then n | Search for text, then go to the next match |
| x | Delete the character under the cursor |
| dd / 5dd | Delete the current line / 5 lines |
| yy then p | Copy the line, then paste it below the cursor |
| u / Ctrl+r | Undo / redo |
x on the # | Uncomment an INCAR line |
| I # Esc | Comment out an INCAR line (I is capital i: insert at the start of the line) |
"Found a swap file" when opening a file means it's open somewhere else, or vim closed badly last time. If nobody else is editing it, choose E (Edit anyway) or D (Delete it).
| Tab | Autocomplete file and folder names (press twice to list options). Saves typing and typos |
↑ / history | Bring back previous commands / list them |
| Ctrl+C | Stop whatever is running in the terminal. It does not cancel a submitted job; use scancel |
clear / Ctrl+L | Clear the screen |
| Cmd+C / Cmd+V | Copy / paste on a Mac. In Windows terminals: Ctrl+Shift+C / V, or right-click |
Every calculation gets its own folder holding five files: POSCAR, POTCAR,
INCAR, KPOINTS and job. VASP reads them from the folder you submit
the job from.
cd DFT. Right after logging in you are
in your home folder, one level too high. Run pwd to check where you are.mkdir DyRuGa, then
cd DyRuGa.vim [filename]: press i, paste,
then Esc + :wq. Don't paste file contents straight into the terminal prompt;
the shell will try to run each line as a command.mv POSCAR.vasp POSCARscp (see
Handy Terminal Commands).Dy Ru Ga). The POTCAR must
follow the same order.potshow, e.g. potshow Dy.
Most elements have several versions, marked by a suffix (e.g. Dy and Dy_3;
_pv and _sv also treat semicore states as valence). The VASP
list of available PAW potentials explains which electrons each one treats
as valence.Dy_3,
Ru and Ga.
Dy_3 vs Dy: the _3 lanthanide potentials treat the atom
as trivalent and freeze the 4f electrons in the core. This is cheaper and converges
more easily, but the f electrons aren't described explicitly, so the results are more
qualitative.potcreate, listing each element's potential once, in the same order
as POSCAR. Only the potential names go in, not the number of atoms:
Dy Ru Ga → potcreate Dy_3 Ru Gavaspkit in the terminal01 for VASP Input-Files Generator103 to generate POTCAR file with default settingsgrep TITEL POTCAR: the potentials should be listed in the same order
as the elements in POSCAR.The INCAR tells VASP which calculation to run. The template below is split into numbered sections. VASP
ignores anything after a #, so you pick a calculation by uncommenting (deleting the
# in front of) the tags in the sections you need, and leaving everything else commented.
NSW defaults to 0).ISMEAR lines). Comment out the copy you
aren't using.| Calculation | Active sections | Notes |
|---|---|---|
| Geometry optimization | [1] + [2] | Template as written |
| Hybrid optimization | [1] + [2] + [11] | Only if [1] + [2] won't converge |
| Density of states | [1] + [3] | Keep LWAVE = .FALSE. commented |
| Magnetic moment | [1] + [3] + [10] | Set MAGMOM for your atoms |
| Band structure | [1] + [3] | KPOINTS from the VASPKIT k-path |
| ELF and Bader charges | [1] + [4] | One run gives both; comment out KPAR |
| COHP/COOP | [1] + [5] | Set NBANDS |
| Phonons | [1] + [6] | |
| Stress tensor | [1] + [7] | Comment out ENCUT in [1] |
| Supercell band offset | [1] + [8] | |
| Born effective charge | [1] + [9] | |
| DFT+U / SOC | add [13] and/or [12] | SOC runs with vasp_ncl |
Copy the template below, or download it here. As written, it runs a geometry optimization ([1] + [2]).
### INCAR template for VASP calculations (adapted from Martin, 2015-12-22)
###
### HOW TO USE THIS TEMPLATE
### - [1] General Parameters is ALWAYS active.
### - Activate ONE task section [2]-[9] by deleting the # in front of its tags,
### and comment out (#) every other task section, including [2].
### With [2] commented out, NSW defaults to 0 (a static run).
### - Add-ons [10]-[13] can be combined with a task section when needed.
### - Never leave the same tag active twice (e.g. two ISMEAR lines).
### Comment out the copy you are not using.
### - As written, this file runs a geometry optimization ([1] + [2]).
## [1] General Parameters / Electronic Relaxation -- ALWAYS ACTIVE
PREC = Accurate # precision
ENCUT = 500 # plane-wave cutoff energy (eV)
EDIFF = 1E-8 # convergence criterion for the electronic loop
NELM = 150 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
KPAR = 2 # k-points run in parallel (comment out for Bader)
NCORE = 4 # cores working on each orbital
#LWAVE = .FALSE. # skips writing WAVECAR; keep commented for DOS, band structure and COHP
## [2] Structure Optimization -- ACTIVE BY DEFAULT (comment out for any other task)
EDIFFG = 1E-6 # convergence criterion for the ionic loop (pos = energy; neg = forces)
NSW = 1000 # maximum number of ionic steps
IBRION = 1 # ionic update: 1 = quasi-Newton, 2 = conjugate gradient (for bad guesses)
ISIF = 3 # freedom: 2 = ions; 4 = ions + shape; 3 = ions + shape + volume
MAXMIX = 80 # max steps stored in Broyden mixer (negative: resets after each ionic step)
ISMEAR = 1 # smearing: -5 = insulators/semiconductors/DOS; 0 = large systems (SIGMA = 0.05); 1 = metals (SIGMA = 0.2)
## [3] DOS and Band Structure
#NEDOS = 1001 # number of DOS grid points
#LORBIT = 10 # write DOSCAR and PROCAR (11 for lm-decomposed orbitals)
#ISMEAR = -5 # tetrahedron method for DOS
# if you add ICHARG = 11, a previous CHGCAR must be in the folder
## [4] Bader Charges and Electron Localization Function
#LAECHG = .TRUE. # write AECCAR0 + AECCAR2 (core + valence charge) for Bader
#LELF = .TRUE. # write ELFCAR
#NPAR = 1
## [5] COHP Analysis (via LOBSTER)
#LWAVE = .TRUE. # LOBSTER needs the WAVECAR
#NSW = 0 # static run
#ISYM = -1 # symmetry off
#NBANDS = 600 # should equal the total number of orbitals (see Troubleshooting)
#LORBIT = 12
#ISTART = 0
## [6] Phonon Dispersion via finite displacements
#EDIFF = 1E-8 # replaces EDIFF in [1] -- don't leave both active
#ISMEAR = 0
#SIGMA = 0.01
#ADDGRID = .TRUE.
## [7] Stress Tensor
#ENCUT = 600 # replaces ENCUT in [1] -- comment that one out
#IBRION = 6
#ISIF = 6
#NSW = 1
#NFREE = 2
## additionally for DFPT (replaces IBRION = 6 above):
#IBRION = 8
#NWRITE = 3
## [8] Supercell (band offset) calculations
#LVHAR = .TRUE.
#AMIN = 0.1
## [9] Born Effective Charge
#LEPSILON = .TRUE. # dielectric matrix
#LOPTICS = .TRUE. # DFPT including empty bands for hybrid functionals
## ---------- ADD-ONS (combine with a task section above) ----------
## [10] Spin Polarization / Magnetism
#ISPIN = 2 # spin-polarized calculation
#MAGMOM = 4*0 4*1 # starting moment per atom, in POSCAR order (here 4 atoms at 0, then 4 at 1)
## [11] Hybrid Calculations -- ONLY add to [2] if a normal optimization won't converge (very slow)
#LHFCALC = .TRUE. # use HF/DFT hybrid functionals
#AEXX = 0.25 # fraction of exact exchange
#AGGAX = 0.75 # fraction of GGA exchange
#ALGO = Damped # electronic minimization algorithm (damped velocity friction)
#TIME = 0.05 # time step for ALGO = Damped (lower it if convergence fails)
#PRECFOCK = FAST # FFT grid for the exact exchange
#HFSCREEN = 0.2 # range-separation parameter
#NKREDX = 2 # grid reduction factors: each KPOINTS number must be divisible by these
#NKREDY = 2
#NKREDZ = 2
## [12] Spin-Orbit Coupling -- run with vasp_ncl, not vasp_std
#LSORBIT = .TRUE.
#LNONCOLLINEAR = .TRUE.
## [13] GGA+U, Coulomb interaction energy (see Hubbard U Correction)
#LDAU = .TRUE.
#LDAUTYPE = 1 # 1 = Liechtenstein et al.; 2 = Dudarev (only U - J is meaningful)
#LDAUPRINT = 0
#LDAUL = -1 2 -1 -1 # orbital to correct, one per species in POSCAR order: -1 = none, 2 = d, 3 = f
#LDAUU = 0 3.71 0 0 # U (eV), one per species
#LDAUJ = 0 0 0 0 # J (eV), one per species
#LASPH = .TRUE.
KPOINTS sets how finely VASP samples reciprocal space (the Brillouin zone). A denser mesh (bigger numbers) gives more accurate results but takes longer. Longer lattice vectors need fewer k-points along that direction.
vaspkit, then 01 (VASP Input-Files
Generator), then 102 (KPOINTS). When asked for the k-point resolution, use the
Fine level, 0.02. See the geometry optimization video for a walkthrough.cat KPOINTS (or vim KPOINTS). It looks like
this:
K-Points
0
Gamma
8 2 8
0 0 0
Monkhorst-Pack is the alternative).KPAR = 2, which splits the k-points into two groups, so an even mesh divides evenly
between them. If VASPKIT gives an odd number, round it up in vim (e.g. 7 3 7 →
8 4 8). Even numbers are also divisible by the NKRED factors used in hybrid
calculations ([11]; see Troubleshooting).cp ../[otherfolder]/job .vim job:
#SBATCH -J: give each run its own job name so it's easy to find in
sq and cancel.#SBATCH -n: the number of cores. Use the number you've been given (e.g. 16),
not the template's 32.#!/bin/sh must be the very first line of the file. Copy-pasting often adds a blank or
stray line above it, and sbatch then refuses the file with an error like
"This does not look like a batch script. The first line must start with #!". Open the file
with vim job, put the cursor on the extra line, press dd, then
:wq.out (from the last line,
srun vasp_std > out). After submitting with sbatch job, follow it with
tail -f out.ls in your folder shows INCAR job KPOINTS POSCAR POTCAR.grep TITEL POTCAR).vaspkit in your terminal.INCAR: keep [1] General Parameters and [2] Structure Optimization active (the template as written). Every other section stays commented out; in particular, make sure [11] Hybrid Calculations is commented out.
# INCAR for geometry optimization: [1] + [2]
# (all other template sections commented out or deleted)
## [1] General Parameters
PREC = Accurate # precision
ENCUT = 500 # plane-wave cutoff energy (eV)
EDIFF = 1E-8 # convergence criterion for the electronic loop
NELM = 150 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
KPAR = 2 # k-points run in parallel (comment out for Bader)
NCORE = 4 # cores working on each orbital
#LWAVE = .FALSE. # skips writing WAVECAR; keep commented for DOS, band structure and COHP
## [2] Structure Optimization
EDIFFG = 1E-6 # convergence criterion for the ionic loop (pos = energy; neg = forces)
NSW = 1000 # maximum number of ionic steps
IBRION = 1 # ionic update: 1 = quasi-Newton, 2 = conjugate gradient (for bad guesses)
ISIF = 3 # freedom: 2 = ions; 4 = ions + shape; 3 = ions + shape + volume
MAXMIX = 80 # max steps stored in Broyden mixer (negative: resets after each ionic step)
ISMEAR = 1 # smearing: -5 = insulators/semiconductors/DOS; 0 = large systems (SIGMA = 0.05); 1 = metals (SIGMA = 0.2)
mpirun is a command used to launch parallel programs written using the Message
Passing Interface (MPI) standard.
sbatch jobsqscancel [job no.] (job number shown by sq)mpirun -np 16 vasp_std>1& (Oliynyk lab - use sbatch job after setting
job file) in the
command line while in the directory of the folder with your
files. "1" indicates the first run, "2" indicates the second,
and "3" indicates the third. I do this to keep track of
everything, but you can just repeat the same command after
copying CONTCAR to POSCAR.Vim + 1tail 1 (only displays last couple of
lines)sbatch job, the output file is out: tail -f outgrep TOTEN OUTCARcp CONTCAR POSCARmpirun -np 4 vasp_std>2& (Oliynyk lab - use sbatch job after
setting job file)cp CONTCAR POSCARmpirun -np 4 vasp_std>3& (Oliynyk lab - use sbatch job after
setting job file)cp CONTCAR POSCARINCAR: [1] General Parameters + [2] Structure Optimization + [11] Hybrid Calculations.
# INCAR for hybrid optimization: [1] + [2] + [11]
# (all other template sections commented out or deleted)
## [1] General Parameters
PREC = Accurate # precision
ENCUT = 500 # plane-wave cutoff energy (eV)
EDIFF = 1E-8 # convergence criterion for the electronic loop
NELM = 150 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
KPAR = 2 # k-points run in parallel (comment out for Bader)
NCORE = 4 # cores working on each orbital
#LWAVE = .FALSE. # skips writing WAVECAR; keep commented for DOS, band structure and COHP
## [2] Structure Optimization
EDIFFG = 1E-6 # convergence criterion for the ionic loop (pos = energy; neg = forces)
NSW = 1000 # maximum number of ionic steps
IBRION = 1 # ionic update: 1 = quasi-Newton, 2 = conjugate gradient (for bad guesses)
ISIF = 3 # freedom: 2 = ions; 4 = ions + shape; 3 = ions + shape + volume
MAXMIX = 80 # max steps stored in Broyden mixer (negative: resets after each ionic step)
ISMEAR = 1 # smearing: -5 = insulators/semiconductors/DOS; 0 = large systems (SIGMA = 0.05); 1 = metals (SIGMA = 0.2)
## [11] Hybrid Calculations
LHFCALC = .TRUE. # use HF/DFT hybrid functionals
AEXX = 0.25 # fraction of exact exchange
AGGAX = 0.75 # fraction of GGA exchange
ALGO = Damped # electronic minimization algorithm (damped velocity friction)
TIME = 0.05 # time step for ALGO = Damped (lower it if convergence fails)
PRECFOCK = FAST # FFT grid for the exact exchange
HFSCREEN = 0.2 # range-separation parameter
NKREDX = 2 # grid reduction factors: each KPOINTS number must be divisible by these
NKREDY = 2
NKREDZ = 2
NKREDX,
NKREDY and NKREDZ (2), i.e. even.
TIME
in [11], e.g. halve it from 0.05 to 0.025.
EDIFF = 1E-6 in [1] (electronic loop) and
EDIFFG = 1E-5 in [2] (ionic loop).
grep TOTEN
OUTCAR to see the final energy of the
optimized structure, which is the last iterated value
at the bottom.
vim
POSCARcp CONTCAR POSCAR at
the end of our third optimization iteration.vim CONTCAR, but we
want to export POSCAR later for further calculations –
so it’s best to do the first command in 1.
INCAR: [1] General Parameters + [3] DOS and Band Structure. Comment out [2] Structure Optimization. Keep LWAVE = .FALSE. commented, as we need the WAVECAR file.
# INCAR for density of states: [1] + [3]
# (all other template sections commented out or deleted)
## [1] General Parameters
PREC = Accurate # precision
ENCUT = 500 # plane-wave cutoff energy (eV)
EDIFF = 1E-8 # convergence criterion for the electronic loop
NELM = 150 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
KPAR = 2 # k-points run in parallel (comment out for Bader)
NCORE = 4 # cores working on each orbital
#LWAVE = .FALSE. # skips writing WAVECAR; keep commented for DOS, band structure and COHP
## [3] DOS and Band Structure
NEDOS = 1001 # number of DOS grid points
LORBIT = 10 # write DOSCAR and PROCAR (11 for lm-decomposed orbitals)
ISMEAR = -5 # tetrahedron method for DOS
# if you add ICHARG = 11, a previous CHGCAR must be in the folder
ISPIN=1 (non-spin-polarized) and ISPIN=2 (spin-polarized)
calculations.LORBIT=11-14: Individual orbitals are lm-resolved/decomposed (e.g., px, py, pz, etc.).
LORBIT=0, 1, 2, 5, 10: Orbitals are grouped (e.g., total p-orbital contributions).mpirun -np 16 vasp_std>Dos1& (Oliynyk lab - use sbatch job after setting
job file)# INCAR for spin-polarized DOS: [1] + [3] + [10]
# (all other template sections commented out or deleted)
## [1] General Parameters
PREC = Accurate # precision
ENCUT = 500 # plane-wave cutoff energy (eV)
EDIFF = 1E-8 # convergence criterion for the electronic loop
NELM = 150 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
KPAR = 2 # k-points run in parallel (comment out for Bader)
NCORE = 4 # cores working on each orbital
#LWAVE = .FALSE. # skips writing WAVECAR; keep commented for DOS, band structure and COHP
## [3] DOS and Band Structure
NEDOS = 1001 # number of DOS grid points
LORBIT = 10 # write DOSCAR and PROCAR (11 for lm-decomposed orbitals)
ISMEAR = -5 # tetrahedron method for DOS
# if you add ICHARG = 11, a previous CHGCAR must be in the folder
## [10] Spin Polarization / Magnetism
ISPIN = 2 # spin-polarized calculation
MAGMOM = 4*0 4*1 # starting moment per atom, in POSCAR order (here 4 atoms at 0, then 4 at 1)
ISPIN = 2 turns on spin polarizationMAGMOM gives a starting moment for each atom, in POSCAR order:
4*0 4*1 is the same as 0 0 0 0 1 1 1 1mpirun -np 8 vasp_std>Dos2& (Oliynyk lab - use sbatch job after
setting job file)INCAR: [1] General Parameters + [4] Bader Charges and ELF. Comment out [2] Structure Optimization and KPAR in [1].
# INCAR for ELF and Bader: [1] + [4]
# (all other template sections commented out or deleted)
## [1] General Parameters
PREC = Accurate # precision
ENCUT = 500 # plane-wave cutoff energy (eV)
EDIFF = 1E-8 # convergence criterion for the electronic loop
NELM = 150 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
#KPAR = 2 # commented out for Bader
NCORE = 4 # cores working on each orbital
#LWAVE = .FALSE. # skips writing WAVECAR; keep commented for DOS, band structure and COHP
## [4] Bader Charges and Electron Localization Function
LAECHG = .TRUE. # write AECCAR0 + AECCAR2 (core + valence charge) for Bader
LELF = .TRUE. # write ELFCAR
NPAR = 1
ELF and Bader use the same run. [4] writes the ELFCAR (from
LELF) and the AECCAR0/AECCAR2 files Bader needs (from
LAECHG) at the same time, so there's no need to run VASP twice. Run it once, then do whichever
post-processing you need: open ELFCAR for the ELF (below), or follow the
Bader Charges steps to get ACF.dat.
mpirun -np 16 vasp_std>Elf& (Oliynyk lab - use sbatch job after setting
job file)INCAR: same as ELF: [1] General Parameters + [4] Bader Charges and ELF, with [2] Structure Optimization and KPAR commented out (see the INCAR in Electron Localization Function). If you already did the ELF run, skip straight to chgsum.pl below in that folder.
mpirun -np 8 vasp_std>Bader& (Oliynyk lab - use sbatch job after setting
job file)ACF.dat.
When converged, run chgsum.pl AECCAR0 AECCAR2
bader CHGCAR -ref CHGCAR_sum, which writes ACF.dat
vim commandgrep ZVAL POTCAR to get the number of valence electrons (ZVAL) of each element
ACF.dat to its atom. Rows are in the same order as the atoms in POSCAR
(vim POSCAR if you forget). For example, if POSCAR lists Dy Ru Ga with counts
4 4 4, rows 1–4 are Dy, rows 5–8 are Ru and rows 9–12 are Ga.CHARGE from that element's ZVAL:
net charge = ZVAL − CHARGE. A positive result means the atom lost electrons
(cation-like); a negative result means it gained them (anion-like).Row 1 of ACF.dat:
# X Y Z CHARGE MIN DIST ATOMIC VOL
--------------------------------------------------------------------------------
1 1.8293 1.8293 1.9646 7.8550 1.3155 17.8112
Atom 1 is the first atom in POSCAR, Dy, and grep ZVAL POTCAR gives ZVAL = 9 for the
Dy_3 potential. Read the CHARGE column (the fifth number), not Z:
| Atom (ACF.dat row) | 1 |
| Element (from POSCAR order) | Dy |
| ZVAL (from POTCAR) | 9 |
| Bader CHARGE (from ACF.dat) | 7.8550 |
| Net charge = ZVAL − CHARGE | 9 − 7.8550 = +1.1450 |
So Dy has given away about 1.15 electrons. Repeat this for every row, using the ZVAL of that row's element.
As a check, NUMBER OF ELECTRONS at the bottom of ACF.dat should equal the sum of
ZVAL over all atoms.
INCAR: [1] General Parameters + [5] COHP Analysis. Comment out [2] Structure Optimization. Set NBANDS for your system (see the note below and calculating NBANDS).
# INCAR for COHP/COOP: [1] + [5]
# (all other template sections commented out or deleted)
## [1] General Parameters
PREC = Accurate # precision
ENCUT = 500 # plane-wave cutoff energy (eV)
EDIFF = 1E-8 # convergence criterion for the electronic loop
NELM = 150 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
KPAR = 2 # k-points run in parallel (comment out for Bader)
NCORE = 4 # cores working on each orbital
#LWAVE = .FALSE. # skips writing WAVECAR; keep commented for DOS, band structure and COHP
## [5] COHP Analysis
LWAVE = .TRUE. # LOBSTER needs the WAVECAR
NSW = 0 # static run
ISYM = -1 # symmetry off
NBANDS = 600 # should equal the total number of orbitals (see Troubleshooting)
LORBIT = 12
ISTART = 0
! First, enter the energetic window in eV (relative to the
Fermi level):
COHPstartEnergy -10
COHPendEnergy 5
!
! Then, specify which types of valence orbitals to use:
includeorbitals s p d
! You can also specify the basis functions per element
manually, e.g.:
! basisfunctions Ga 4s 4p
! basisfunctions Sr 5s 4s 4p ! Sr_sv potential
!
! Now define the pairs for which COHP analysis etc. should be
done.
! The atoms are numbered as per order in the PAW-code control
file.
!cohpbetween atom 1 atom 10
!
! If you are interested in single orbital COHPs, you can get
all the pairs ! like s-s, s-p_x, ..., p_z-p_z. Uncomment this
line to switch it on:
! cohpbetween atom 1 atom 2 orbitalwise
!
! If you want to generate the COHPPairs automatically, use this
to include ! all pairs in a given distance range (in Angstrom,
not in atomic units):
cohpGenerator from 1 to 2.5 type Si type Fe
cohpGenerator from 1 to 3.3 type Gd type Si
cohpGenerator from 1 to 3.3 type Gd type Fe
cohpGenerator from 1 to 2.6 type Si type Si
! and in the latter case only between the specified
elements
- of course adjust accordingly to your atomic interactions and
optimized structure's bond distances.mpirun -np 20 vasp_std>COHP& (Oliynyk lab - use sbatch job after setting
job file)lobsterINCAR: same as DOS: [1] General Parameters + [3] DOS and Band Structure. Comment out [2] Structure Optimization. Keep LWAVE = .FALSE. commented, as we need the WAVECAR file.
# INCAR for band structure: [1] + [3]
# (all other template sections commented out or deleted)
## [1] General Parameters
PREC = Accurate # precision
ENCUT = 500 # plane-wave cutoff energy (eV)
EDIFF = 1E-8 # convergence criterion for the electronic loop
NELM = 150 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
KPAR = 2 # k-points run in parallel (comment out for Bader)
NCORE = 4 # cores working on each orbital
#LWAVE = .FALSE. # skips writing WAVECAR; keep commented for DOS, band structure and COHP
## [3] DOS and Band Structure
NEDOS = 1001 # number of DOS grid points
LORBIT = 10 # write DOSCAR and PROCAR (11 for lm-decomposed orbitals)
ISMEAR = -5 # tetrahedron method for DOS
# if you add ICHARG = 11, a previous CHGCAR must be in the folder
vaspkit into the terminal/powershell03 to select K-Path for Band-Structure303 for bulk structurecp KPOINTS KPOINTS_old to back up your old KPOINTScp KPATH.in KPOINTS to use the new K-pathKPATH.in will become your KPOINTS for the band structure only.
VASPKIT automatically suggests a K-Path based on your structure's symmetry.This section covers how to calculate effective masses for electrons and holes using VASPKIT, which is particularly useful for semiconductor materials and electronic transport properties.
First, perform a standard geometry optimization as described in the Geometry Optimization section to obtain the optimized structure.
Perform a band structure calculation following the Band Structure section instructions. This provides the electronic band structure needed for effective mass calculations.
Identify the high-symmetry points in your material's band structure where you want to calculate effective masses, typically at band extrema (valence band maximum and conduction band minimum).
VASPKIT option 911 can automatically determine band edge positions, namely VBM (Valence Band Maximum) and CBM (Conduction Band Minimum):
+-------------------------- Warm Tips --------------------------+
ONLY Reliable for Band-Structure Calculations!
+---------------------------------------------------------------+
-->> (01) Reading Input Parameters From INCAR File...
-->> (02) Reading Energy-Levels From EIGENVAL File...
+-------------------------- Summary ----------------------------+
Band Character: Direct
Band Gap (eV): 1.7711
Eigenvalue of VBM (eV): -2.1236
Eigenvalue of CBM (eV): -0.3526
HOMO & LUMO Bands: 9 10
Location of VBM: 0.333333 0.333333 0.000000
Location of CBM: 0.333333 0.333333 0.000000
+---------------------------------------------------------------+
Next, calculate the effective mass of electrons and holes along specific directions (e.g., K → Γ and K → M at point K). Create an INPUT.in file with the following content:
1 # Setting it to 1 will generate a KPOINTS file for calculating the effective mass; setting it to 2 will calculate the effective mass.
6 # 6 indicates that we take 6 discrete points near K for polynomial fitting.
0.015 # k-cutoff, cutoff radius, typical value 0.015 1/Å
3 # 3 indicates there are three effective mass tasks.
0.500000 0.500000 0.500000 0.000000 0.000000 0.500000 # A->Z Calculate effective mass from A toward Z.
0.500000 0.500000 0.500000 0.000000 0.500000 0.500000 # A->R Calculate effective mass from A toward R.
0.500000 0.500000 0.500000 0.500000 0.500000 0.000000 # A->M Calculate effective mass from A toward M.
Parameters explained:
With the first line set to 1 in INPUT.in, run VASPKIT option 913 to generate the appropriate KPOINTS file, then run VASP with this new KPOINTS file. (It will overwrite KPOINTS in the VASP working directory, so save a backup of your old KPOINTS file.)
After the VASP calculation is completed, modify the first line of INPUT.in from 1 to 2, then run VASPKIT option 913 again to calculate the effective masses:
Band Index: LUMO = 10 HOMO = 9
Effective-Mass (in m0) Electron (Prec.) Hole (Prec.)
K-PATH No.1: K->G 0.473 (0.3E-07) -0.569 (0.1E-07)
K-PATH No.2: K->M 0.524 (0.1E-06) -0.691 (0.1E-06)
This section covers how to calculate electronic transport properties using the Boltzmann transport equation with VASPKIT, including electrical conductivity, Seebeck coefficient, power factor, and carrier concentration.
First, perform a standard geometry optimization as described in the Geometry Optimization section to obtain the optimized structure.
Perform a band structure calculation following the Band Structure section instructions. This provides the electronic band structure needed for transport property calculations.
Call the VASPKIT-681 command to generate a KPOINTS file specifically for the calculation of transport properties:
vaspkit
681
This will generate the appropriate k-point mesh needed for accurate transport property calculations.
Create an INPUT.in file (note that VASPKIT.in will be renamed to INPUT.in) with the following parameters for calculating transport properties:
1 # 1 for gradient method with constant relaxation time approximation
3D # 2D for slab, 3D for bulk
-2.0 2.0 # Minimum and maximum values of chemical potential with respect to Fermi energy
1000 # Number of intervals between the minimum and maximum chemical potential values
300.0 # Temperature (float type, in units of K)
1.0 # Relaxation time (float type, in units of s), Set 1.0 if you don't know the exact relaxation time
0.0 # Desired gap value in scissor correction (float type, in units of V), Zero means make no correction, available only non-spin-polarization calculation
1 # Finite difference method (integer type)
Parameters explained:
Call the VASPKIT-682 command to calculate the transport properties:
vaspkit
682
-->> (01) Reading INPUT.in File...
-->> (02) Reading Structural Parameters from POSCAR File...
-->> (03) Reading Input Parameters From INCAR File...
+---------------------------------------------------------------+
| >>> The Fermi Energy will be set to zero eV <<< |
+---------------------------------------------------------------+
-->> (04) Reading Fermi-Energy from DOSCAR File...
-->> (05) Reading Energy-Levels From EIGENVAL File...
+-------------------------- Summary ----------------------------+
Chemical Potential Range (eV): -2.00 2.00
Number of Intervals: 1000
Temperature (K): 300.00
Relaxation Time (s): 0.10E+01
+---------------------------------------------------------------+
-->> (06) Calculating Boltzmann Transport Properties...
Percentage complete: 25.0%
Percentage complete: 50.0%
Percentage complete: 75.0%
Percentage complete: 100.0%
-->> (07) Written ELECTRONIC_CONDUCTIVITY.dat File!
-->> (08) Written SEEBECK_COEFFICIENT.dat File!
-->> (09) Written POWER_FACTOR.dat File!
-->> (10) Written ELECTRONIC_THERMAL_CONDUCTIVITY.dat File!
-->> (11) Written CARRIER_CONCENTRATION.dat File!
The calculation will generate several output files:
You can plot the results using Python. Here's a sample code to plot carrier concentration:
import numpy as np
import matplotlib.pyplot as plt
# Read the data from CARRIER_CONCENTRATION.dat
data = np.loadtxt('CARRIER_CONCENTRATION.dat', skiprows=1) # Skip the header row
# Extract energy and carrier concentration
energy = data[:, 0] # Energy in eV
carrier_concentration = data[:, 1] # Carrier concentration in 10^20/cm³
# Create the plot
plt.figure(figsize=(10, 6))
plt.plot(energy, carrier_concentration, 'b-', linewidth=2, label='Carrier Concentration')
plt.xlabel('Energy (eV)', fontsize=12)
plt.ylabel('Carrier Concentration (10²⁰/cm³)', fontsize=12)
plt.title('Carrier Concentration vs Energy', fontsize=14, fontweight='bold')
plt.grid(True, alpha=0.3)
plt.legend()
# Add a horizontal line at y=0 for reference
plt.axhline(y=0, color='k', linestyle='--', alpha=0.5)
# Improve layout
plt.tight_layout()
# Show the plot
plt.show()
# Optional: Save the plot
plt.savefig('carrier_concentration_plot.png', dpi=300, bbox_inches='tight')
print("Plot saved as 'carrier_concentration_plot.png'")
Example Output:
Important: When applying Hubbard U corrections to only some atoms of the same element type (e.g., applying +U to only some U atoms in URhGe), you must modify both POSCAR and POTCAR files to distinguish between atoms that receive the correction and those that don't.
Example for URhGe system:
If your original POSCAR has:
URhGe
4.0
...
U Rh Ge
4 4 4
And you want to apply +U to only the first U atom, modify it to:
URhGe
4.0
...
U U Rh Ge
1 3 4 4
This creates two distinct "U" species: the first one (1 atom) will receive the +U correction, and the second one (3 atoms) will be treated as regular U atoms.
Correspondingly, your POTCAR file must be created with:
potcreate U U Rh Ge
This ensures that VASP recognizes four distinct atomic species, allowing you to apply different parameters to each.
With this setup, your LDA+U parameters would be:
LDAU = .TRUE.
LDAUTYPE = 3
LDAUL = 3 -1 -1 -1 # Apply to f-orbitals of 1st U only
LDAUU = 3.42 0.00 0.00 0.00 # U parameter only for 1st U species
LDAUJ = 0.51 0.00 0.00 0.00 # J parameter only for 1st U species
The first set of parameters applies to the first U species (receiving +U), while the remaining parameters apply to the second U species, Rh, and Ge respectively (all set to not receive corrections).
Prepare the required input files for your system. The example below shows NiO with antiferromagnetic ordering, but the approach applies similarly to other systems like UGe₂.
POSCAR setup (following the file setup from step 1):
For NiO where you want to apply +U to all Ni atoms but distinguish different magnetic sites:
NiO AFM
4.03500000
2.0000000000 1.0000000000 1.0000000000
1.0000000000 2.0000000000 1.0000000000
1.0000000000 1.0000000000 2.0000000000
Ni Ni O
1 15 16 (adding one more Ni species to distinguish sites, so total 2 Ni species)
Direct
...atomic positions...
POTCAR setup:
Create the POTCAR file with distinct entries for each species defined in POSCAR:
potcreate Ni Ni O
INCAR file for ground state calculation:
SYSTEM = NiO AFM
PREC = A
EDIFF = 1E-6
ISMEAR = 0
SIGMA = 0.2
ISPIN = 2
MAGMOM = 1.0 -1.0 1.0 -1.0 \
1.0 -1.0 1.0 -1.0 \
1.0 -1.0 1.0 -1.0 \
1.0 -1.0 1.0 -1.0 \
16*0.0
LORBIT = 11
LMAXMIX = 4
This run provides the reference ground state charge density and wavefunction (CHGCAR, WAVECAR).
Copy the following from the ground state directory:
POSCARPOTCARINCARKPOINTSWAVECAR and CHGCARThen add the following line to INCAR for the NSCF step:
ICHARG = 11
Also append these LDA+U parameters (example for Ni with U and J = 0.10 eV, where only the first Ni species receives the correction):
LDAU = .TRUE.
LDAUTYPE = 3
LDAUL = 2 -1 -1 # Apply to d-orbitals of Ni 1
LDAUU = 0.10 0.00 0.00 # U parameter for Ni 1
LDAUJ = 0.10 0.00 0.00 # J parameter for Ni 1
In this example, the correction is applied to the first atom (Ni, 3d orbital). Adjust accordingly for your system.
From the NSCF run, copy:
POSCARPOTCARINCARKPOINTSWAVECARRemove ICHARG = 11 from INCAR for the SCF run.
The file setup described above is crucial for proper Hubbard U calculations. The POSCAR and POTCAR files must reflect the distinction between atomic species that receive different treatments, even if they are chemically identical atoms.
TITEL = PAW Ni 02Aug2007
TITEL = PAW Ni 02Aug2007
TITEL = PAW O 22Mar2012
AFM NiO
4.03500000
2.0000000000 1.0000000000 1.0000000000
1.0000000000 2.0000000000 1.0000000000
1.0000000000 1.0000000000 2.0000000000
1 15 16
Repeat NSCF and SCF runs for the following U = J values:
0.15, 0.20, 0.05, 0.00, -0.05, -0.10, -0.15, -0.20 eV
After obtaining the number of localized electrons (e.g., f or d orbital) for each run, perform linear response fitting using Python:
import numpy as np
import matplotlib.pyplot as plt
# Applied potential (eV)
J = np.array([-0.1, -0.05, 0, 0.05, 0.1, 0.15, 0.2])
# Number of f-electrons (example data)
NSCF = np.array([2.182, 2.345, 2.517, 2.697, 2.885, 3.08, 3.282])
SCF = np.array([2.448, 2.461, 2.520, 2.533, 2.548, 2.563, 2.575])
# Fit linear response (n vs J)
s_n, intercept_n = np.polyfit(J, NSCF, 1)
s_s, intercept_s = np.polyfit(J, SCF, 1)
U = 1.0/s_s - 1.0/s_n
# Generate fits
J_fit = np.linspace(J.min(), J.max(), 200)
fit_NSCF = s_n * J_fit + intercept_n
fit_SCF = s_s * J_fit + intercept_s
# Print results
print(f"chi0 (NSCF slope) = {s_n:.4f}")
print(f"chi (SCF slope) = {s_s:.4f}")
print(f"U (eV) = {U:.4f}")
# Plot (like VASP wiki)
plt.figure(figsize=(7,5))
plt.scatter(J, NSCF, color='black', label='NSCF', marker='o', facecolors='none', s=70)
plt.scatter(J, SCF, color='red', label='SCF', marker='s', s=60)
plt.plot(J_fit, fit_NSCF, color='black', linestyle='-', label=f'NSCF fit (χ₀={s_n:.3f})')
plt.plot(J_fit, fit_SCF, color='red', linestyle='-', label=f'SCF fit (χ={s_s:.3f})')
plt.xlabel("Applied potential J (eV)")
plt.ylabel("Number of f-electrons")
plt.title("Linear Response for Hubbard U Determination of UGe₂")
plt.grid(True, linestyle=':')
plt.legend()
plt.tight_layout()
plt.show()
Example output:
chi0 (NSCF slope) = 3.6700
chi (SCF slope) = 0.4379
U (eV) = 2.0114
This method extracts the on-site Coulomb interaction U via linear response by comparing self-consistent and non-self-consistent changes in orbital occupations with applied potential perturbations.
This tutorial demonstrates how to perform spin-orbit coupling (SOC) calculations with DFT+U corrections, particularly useful for heavy elements with strong spin-orbit interactions like actinides and lanthanides.
First, perform a standard collinear spin-polarized structural relaxation to obtain the optimized geometry.
INCAR: [1] General Parameters + [2] Structure Optimization + [10] Spin Polarization + [13] GGA+U. Adjust MAGMOM and the LDAU lists to your species.
# INCAR for SOC step 1: [1] + [2] + [10] + [13]
# (all other template sections commented out or deleted)
## [1] General Parameters
PREC = Accurate # precision
ENCUT = 500 # plane-wave cutoff energy (eV)
EDIFF = 1E-8 # convergence criterion for the electronic loop
NELM = 150 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
KPAR = 2 # k-points run in parallel (comment out for Bader)
NCORE = 4 # cores working on each orbital
#LWAVE = .FALSE. # skips writing WAVECAR; keep commented for DOS, band structure and COHP
## [2] Structure Optimization
EDIFFG = 1E-6 # convergence criterion for the ionic loop (pos = energy; neg = forces)
NSW = 1000 # maximum number of ionic steps
IBRION = 1 # ionic update: 1 = quasi-Newton, 2 = conjugate gradient (for bad guesses)
ISIF = 3 # freedom: 2 = ions; 4 = ions + shape; 3 = ions + shape + volume
MAXMIX = 80 # max steps stored in Broyden mixer (negative: resets after each ionic step)
ISMEAR = 1 # smearing: -5 = insulators/semiconductors/DOS; 0 = large systems (SIGMA = 0.05); 1 = metals (SIGMA = 0.2)
## [10] Spin Polarization / Magnetism
ISPIN = 2 # spin-polarized calculation
MAGMOM = 4*0 4*1 # starting moment per atom, in POSCAR order (here 4 atoms at 0, then 4 at 1)
## [13] GGA+U
LDAU = .TRUE.
LDAUTYPE = 1 # 1 = Liechtenstein et al.; 2 = Dudarev (only U - J is meaningful)
LDAUPRINT = 0
LDAUL = -1 2 -1 -1 # orbital to correct, one per species in POSCAR order: -1 = none, 2 = d, 3 = f
LDAUU = 0 3.71 0 0 # U (eV), one per species
LDAUJ = 0 0 0 0 # J (eV), one per species
LASPH = .TRUE.
Run a collinear spin-polarized calculation (e.g., DOS calculation) to obtain CHGCAR and WAVECAR files using vasp_std. Use the following INCAR template (example for UTe₂):
# General Parameters/Electronic Relaxation
PREC = Accurate # Precision
ENCUT = 500 # cutoff energy for the planewave basis set in eV
EDIFF = 1E-8 # convergence condition for the electronic loop
NELM = 400 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
KPAR = 1 # no. of nodes (max. no. of k-points)
NCORE = 4 # no. of cores per node
LWAVE = .TRUE. # Write WAVECAR (needed for SOC step)
ISPIN = 2 # Spin-polarized calculation (required for SOC)
MAGMOM = 4*1 8*0 # Initial magnetic moments (adjust for your system)
# DFT+U parameters (example for Uranium f-electrons)
LDAU = .TRUE.
LDAUTYPE = 1 # Liechtenstein method
LDAUL = 3 -1 # 3 for U (f orbitals); -1 for Te (not applied)
LDAUU = 3.42 0 # U parameter in eV
LDAUJ = 0.51 0 # J parameter in eV
LMAXMIX = 6 # For f-electrons
# DOS calculation settings
NEDOS = 1001 # number of DOS gridpoints
LORBIT = 11 # DOSCAR and PROCAR are written
ISMEAR = 1 # smearing for metals
Perform the spin-orbit coupling calculation using vasp_ncl (non-collinear version of VASP). Copy the following files from Step 2:
INCARPOSCARPOTCARKPOINTSCHGCARModify the INCAR file by adding the following SOC parameters:
# Add to existing INCAR from Step 2 and comment out the DOS-specific tags (not optimizing here), although I'm not 100% certain if they must be enabled off before calculating for the energy:
MAGMOM = 1 0 0 1 0 0 1 0 0 1 0 0 24*0 # x y z components of magnetic moments, adjust as per SAXIS
LSORBIT = .TRUE. # Enable spin-orbit coupling
ISYM = 0 # Disable symmetry (recommended for SOC)
SAXIS = 1 0 0 # Quantization axis (easy axis)
ICHARG = 11 # Read charge density from collinear calculation
Important: Remove WAVECAR before running the SOC calculation, as the spin density is read from CHGCAR but the wavefunctions need to be recalculated for the non-collinear case.
To investigate magnetic anisotropy, run separate SOC calculations with different quantization axes (SAXIS) and see which is most favorable (lowest energy). Run three calculations with:
SAXIS = 1 0 0 (a-axis, often the easy axis)SAXIS = 0 1 0 (b-axis)SAXIS = 0 0 1 (c-axis)Compare the total energies to determine the magnetic easy axis and anisotropy energy.
Execute the calculations using the appropriate VASP executable:
mpirun -np [cores] vasp_std > output_collinear &mpirun -np [cores] vasp_ncl > output_soc &After completing the calculations:
SAXIS orientations (optional)OUTCARMAGMOM tag in SOC calculations specifies x, y, z components of magnetic momentsThis case study demonstrates the calculation of a highly correlated uranium ferromagnetic superconductor system URhGe using spin-orbit coupling combined with DFT+U methods. This is particularly important for actinide compounds where both strong electron correlation and spin-orbit coupling effects are significant.
For this calculation, I used standard pseudopotentials
This part covers the calculation of Hubbard U correction for Rh d-electrons in the URhGe system. The tutorial video above demonstrates the methodology for determining the appropriate U value for Rh atoms.
This section will cover the calculation of Hubbard U correction specifically for uranium f-electrons, which is crucial for accurately describing the strong electron correlation effects in actinide compounds.
Perform standard DFT+U calculations using the determined U values from Parts 1 and 2. This includes:
Final calculations incorporating both DFT+U corrections and spin-orbit coupling effects:
Note: For detailed steps on implementing Hubbard U correction, refer to the Hubbard U Correction section above. For spin-orbit coupling methodology, see the Spin-Orbit Coupled DFT+U section.
This section covers how to calculate and visualize Fermi surfaces using VASPKIT and PyProcar, which is essential for understanding electronic transport properties and band topology in metals.
First, perform a standard collinear structural relaxation (can be spin-polarized) to obtain the optimized geometry: [1] + [2], optionally with [10] Spin Polarization and [13] GGA+U (see SOC).
Run a collinear spin-polarized calculation (e.g., DOS calculation) to obtain CHGCAR and CHG (CHG may not be needed) files using vasp_std.
INCAR: the DOS setup ([1] + [3], [2] commented out), plus the three tags below. Comment out ISMEAR and LORBIT in [3] so they aren't set twice.
# INCAR for Fermi surface step 2: [1] + [3]
# (all other template sections commented out or deleted)
## [1] General Parameters
PREC = Accurate # precision
ENCUT = 500 # plane-wave cutoff energy (eV)
EDIFF = 1E-8 # convergence criterion for the electronic loop
NELM = 150 # maximum number of electronic iterations
NELMIN = 4 # minimum number of electronic iterations
KPAR = 2 # k-points run in parallel (comment out for Bader)
NCORE = 4 # cores working on each orbital
#LWAVE = .FALSE. # skips writing WAVECAR; keep commented for DOS, band structure and COHP
## [3] DOS and Band Structure
NEDOS = 1001 # number of DOS grid points
# if you add ICHARG = 11, a previous CHGCAR must be in the folder
## added to [1] for the Fermi surface
ISMEAR = 0 # Gaussian smearing
ICHARG = 11 # Read charge from CHGCAR
LORBIT = 11 # Write orbital projections (for orbitals)
Run VASPKIT to generate KPOINTS for the Fermi Surface calculation:
vaspkit
261 # Option for Fermi Surface KPOINTS generation
Execute the VASP calculation with the generated KPOINTS file to obtain the electronic structure data needed for Fermi surface visualization.
After the calculation completes, export the following files for Fermi surface analysis:
PROCAR - Contains orbital projections and band informationKPOINTS - K-point mesh informationPOSCAR - Crystal structure (not needed for PROCAR but useful for reference)OUTCAR - Contains Fermi energy and other calculation detailsUse PyProcar to visualize the Fermi surface. See the following PROCAR tutorials for different visualization options:
ERROR FEXCP: supplied exchange-correlation table is too small, maximal index: 5536
internal error in FOCK_FCC: number of k-points incorrect 5 18 2 2 2
grep NELECT OUTCAR after an optimization
will give you the number of electrons, and grep
NIONS OUTCAR will give you the number of ionsgrep VRHFIN POTCAR may also give you the
number of bands (not certain, have to double check)