I have a system with box dimensions of 21.0 * 21.0 * 80.0 for x,y and z directions. How may I generate the KPOINTs mesh for this system for VASP simulation? Any reference on this is hugely appreciated.

  • $\begingroup$ Box dimensions are very huge, you need single Kpoint. Take 1 1 1 $\endgroup$ Mar 16 at 3:47
  • $\begingroup$ can I know how to figure that out? Is 1 1 1 a general procedure when box dimensions are too big? $\endgroup$
    – Xdrake
    Mar 16 at 4:34
  • 1
    $\begingroup$ rule of thumb what I use personally (maximum kpoint in a direction = integer (100/(2*pi*length))). You can also use vaspkit to generate automatic from POSCAR $\endgroup$ Mar 16 at 7:19
  • $\begingroup$ When the dimensions are huge, gamma point (1 1 1) calculation is enough because reciprocal space and real space are inversely related to each other. So, to obtain the same accuracy one would need much fewer k-points if one increases the cell dimensions. A gamma point in a big supercell corresponds to many k-points in the Brillouin zone of the smaller cell. It is usual to use gamma-point only for large cell or for isolated structure. $\endgroup$ Mar 16 at 7:21
  • 1
    $\begingroup$ I appreciate the helpful comments. I understand it better now $\endgroup$
    – Xdrake
    Mar 16 at 15:28

2 Answers 2


Here's a Python function that uses Pymatgen to generate a KPOINTS file based on the lattice in the POSCAR file. I think it's similar in spirit (and maybe certain aspects of implementation) to what @Pranav kumar suggested and how VASPKIT does it.

import numpy as np
from pymatgen.core import Structure
from pymatgen.io.vasp.inputs import Kpoints

def write_KPOINTS(kspace=0.04):
    assert kspace >= 0, 'argument kspace must not be negative'
    struc = Structure.from_file('POSCAR')
    b = np.array(struc.lattice.reciprocal_lattice.as_dict()['matrix'])
    if kspace == 0:  # Gamma only
        N = [1, 1, 1]
        comment = 'Gamma point only'
        N = np.maximum(np.array([1, 1, 1]), np.round(np.sqrt(np.sum(b**2, axis=1)) / (kspace * 2 * np.pi))).astype(np.int64)
        comment = 'Mesh generated with kspace = {} × 2π/Å'.format(kspace)
    k_dict = {'nkpoints': 0,
              'generation_style': 'Gamma',
              'kpoints': [[N[0], N[1], N[2]]],
              'usershift': [0, 0, 0],
              'comment': comment}
    kpoints = Kpoints.from_dict(k_dict)

kspace represents the k-point density in units of $2\pi Å^{-1}$ in each cartesian direction. I set kspace=0 to mean Gamma point sampling, which would be used for "isolated structures" as @Abdul Muhaymin suggested. If it were a crystal structure, it's also easier to do a convergence test by reducing a single variable kspace until convergence (as opposed to three distinct mesh integers for the x,y, and z direction).

Of course, your box looks very big, so it is likely that using a "conventionally tight" kspace= 0.01 ~ 0.03 may lead to a single kpoint, which seems related to your exchange with @Pranav kumar.

  • 1
    $\begingroup$ Thank you for this. $\endgroup$
    – Xdrake
    Mar 16 at 15:29

The VASP wiki has many explanations for setting up calculations. For k-spacing you can use the automatic grid generation with the KSPACING tag in the INCAR file, especially if you don't know your system well:


The number of k-points you need can differ between different problems. Therefore, you should try different numbers and look for convergence. The wiki recommends using the automatic generation only for first tries, and then continuing with regular k-meshes.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .