25#ifndef __GET_IRREDUCIBLE_RECIPROCAL_MESH_HPP__
26#define __GET_IRREDUCIBLE_RECIPROCAL_MESH_HPP__
32inline std::tuple<int, std::vector<double>, std::vector<std::array<double, 3>>>
33get_irreducible_reciprocal_mesh(Crystal_symmetry
const& sym__, r3::vector<int> k_mesh__, r3::vector<int> is_shift__)
35 using M = std::array<std::array<int, 3>, 3>;
36 std::map<M, int> sym_map;
38 for (
int isym = 0; isym < sym__.size(); isym++) {
40 for (
int x: {0, 1, 2}) {
41 for (
int y: {0, 1, 2}) {
42 s[x][y] = sym__[isym].spg_op.R(x, y);
47 std::vector<M> sym_list;
48 for (
auto it = sym_map.begin(); it != sym_map.end(); it++) {
49 sym_list.push_back(it->first);
52 int nktot = k_mesh__[0] * k_mesh__[1] * k_mesh__[2];
54 sddk::mdarray<int, 2> ikgrid(3, nktot);
55 std::vector<int> ikmap(nktot, 0);
57 double q[] = {0, 0, 0};
58 int nk = spg_get_stabilized_reciprocal_mesh((
int(*)[3])&ikgrid(0, 0),
63 static_cast<int>(sym_list.size()),
64 (
int(*)[3][3])&sym_list[0],
66 (
double(*)[3])(&q[0]));
68 std::map<int, int> ikcount;
69 for (
int ik = 0; ik < nktot; ik++) {
70 if (ikcount.count(ikmap[ik]) == 0) {
71 ikcount[ikmap[ik]] = 0;
76 std::vector<double> wk(nk);
77 std::vector<std::array<double, 3>> kp(nk);
80 for (
auto it = ikcount.begin(); it != ikcount.end(); it++) {
81 wk[n] =
static_cast<double>(it->second) / nktot;
82 for (
int x: {0, 1, 2}) {
83 kp[n][x] = (ikgrid(x, it->first) + is_shift__[x] / 2.0) / k_mesh__[x];
88 RTE_THROW(
"wrong number of k-points");
91 return std::make_tuple(nk, wk, kp);
Contains definition and partial implementation of sirius::Crystal_symmetry class.
Namespace of the SIRIUS library.