43 const std::array<int, 3>& grid) {
44 for (
int axis = 0; axis < 3; axis++) {
45 if (grid[axis] <= 0) {
46 throw std::invalid_argument(
47 "import_wannier90_files: the k-point grid must be three positive integers");
54 const int number_of_kpoints = projections.number_of_kpoints;
55 if (eigenvalues.number_of_kpoints != number_of_kpoints) {
56 throw std::runtime_error(
"import_wannier90_files: the .eig and .amn disagree on the "
58 std::to_string(eigenvalues.number_of_kpoints) +
" vs " +
59 std::to_string(number_of_kpoints) +
")");
61 if (eigenvalues.number_of_bands != projections.number_of_bands) {
62 throw std::runtime_error(
63 "import_wannier90_files: the .eig and .amn disagree on the band count (" +
64 std::to_string(eigenvalues.number_of_bands) +
" vs " +
65 std::to_string(projections.number_of_bands) +
66 "); the gauge would be applied to the wrong eigenvalues");
68 if (
static_cast<int>(neighbor_list.kpoints.size()) != number_of_kpoints) {
69 throw std::runtime_error(
"import_wannier90_files: the .nnkp and .amn disagree on the "
71 std::to_string(neighbor_list.kpoints.size()) +
" vs " +
72 std::to_string(number_of_kpoints) +
")");
74 if (grid[0] * grid[1] * grid[2] != number_of_kpoints) {
75 throw std::runtime_error(
"import_wannier90_files: a " + std::to_string(grid[0]) +
"x" +
76 std::to_string(grid[1]) +
"x" + std::to_string(grid[2]) +
77 " grid implies " + std::to_string(grid[0] * grid[1] * grid[2]) +
78 " k-points, but the files hold " +
79 std::to_string(number_of_kpoints));
84 for (
int row = 0; row < 3; row++) {
100 wannier.
projectabilities.resize(
static_cast<std::size_t
>(number_of_kpoints));
101 for (
int kpoint_index = 0; kpoint_index < number_of_kpoints; kpoint_index++) {
107 row[band] += std::norm(block[orbital * wannier.
number_of_bands + band]);