.. _18_k_points: .. include:: ../../examples/18_k_points/README.rst ---- .. code-block:: python from eminus import Cell, SCF from eminus.units import ang2bohr Create a diamond cell :code:`kmesh=(2, 1, 1)` will create a Monkhorst-Pack k-point grid with two k-points .. code-block:: python cell = Cell("C", "diamond", 30, ang2bohr(3.57), kmesh=(2, 1, 1)) One can also use a custom crystal basis, the diamond system would be equivalent of the following .. code-block:: python # cell = Cell("C", "fcc", 30, ang2bohr(3.57), basis=[[0, 0, 0], [0.25, 0.25, 0.25]]) Do a DFT calculation for the cell .. code-block:: python scf = SCF(cell) scf.run() The :code:`SCF` and :code:`Atoms` objects have a k-point object .. code-block:: python print(f"\nKPoints object\n{scf.kpts}\n") The object can be modified, e.g., to create a non-Gamma-point centered mesh or to shift the k-points (do not forget to rebuild the object) .. code-block:: python print(f"Original points:\n{cell.kpts.k}") cell.kpts.gamma_centered = False cell.build() print(f"non-Gamma-centered points:\n{cell.kpts.k}") cell.kpts.kshift = [1, 0, 0] cell.kpts.build() print(f"Shifted points:\n{cell.kpts.k}\n") One can also use custom k-points The easiest way to set them is the following .. code-block:: python cell.set_k([[0, 0, 0]]) SCF(cell, verbose=3).run() Download :download:`18_k_points.py <../../examples/18_k_points/18_k_points.py>`