diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dc28c4c..8e64dc88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,13 +43,13 @@ set(BLAS_LIBRARIES "-lopenblas") # Source code include_directories("${PROJECT_SOURCE_DIR}/c") set(SOURCES_PHONO3PY + ${PROJECT_SOURCE_DIR}/c/bzgrid.c ${PROJECT_SOURCE_DIR}/c/collision_matrix.c ${PROJECT_SOURCE_DIR}/c/fc3.c ${PROJECT_SOURCE_DIR}/c/grgrid.c ${PROJECT_SOURCE_DIR}/c/imag_self_energy_with_g.c ${PROJECT_SOURCE_DIR}/c/interaction.c ${PROJECT_SOURCE_DIR}/c/isotope.c - ${PROJECT_SOURCE_DIR}/c/kpoint.c ${PROJECT_SOURCE_DIR}/c/lapack_wrapper.c ${PROJECT_SOURCE_DIR}/c/phono3py.c ${PROJECT_SOURCE_DIR}/c/phonoc_utils.c diff --git a/c/kpoint.c b/c/bzgrid.c similarity index 87% rename from c/kpoint.c rename to c/bzgrid.c index 7c095180..e3e42478 100644 --- a/c/kpoint.c +++ b/c/bzgrid.c @@ -35,18 +35,18 @@ #include #include #include -#include "kpoint.h" +#include "bzgrid.h" #include "grgrid.h" -#ifdef KPTWARNING +#ifdef BZGWARNING #include #define warning_print(...) fprintf(stderr,__VA_ARGS__) #else #define warning_print(...) #endif -#define KPT_NUM_BZ_SEARCH_SPACE 125 -static long bz_search_space[KPT_NUM_BZ_SEARCH_SPACE][3] = { +#define BZG_NUM_BZ_SEARCH_SPACE 125 +static long bz_search_space[BZG_NUM_BZ_SEARCH_SPACE][3] = { { 0, 0, 0}, { 0, 0, 1}, { 0, 0, 2}, @@ -193,34 +193,34 @@ static long get_ir_reciprocal_mesh_distortion(long grid_address[][3], const MatLONG *rot_reciprocal); static long relocate_BZ_grid_address(long bz_grid_address[][3], long bz_map[], - KPTCONST long grid_address[][3], + GRGCONST long grid_address[][3], const long mesh[3], - KPTCONST double rec_lattice[3][3], + GRGCONST double rec_lattice[3][3], const long is_shift[3]); static long get_bz_grid_addresses(long bz_grid_address[][3], long bz_map[][2], - KPTCONST long grid_address[][3], + GRGCONST long grid_address[][3], const long mesh[3], - KPTCONST double rec_lattice[3][3], + GRGCONST double rec_lattice[3][3], const long is_shift[3]); -static double get_tolerance_for_BZ_reduction(KPTCONST double rec_lattice[3][3], +static double get_tolerance_for_BZ_reduction(GRGCONST double rec_lattice[3][3], const long mesh[3]); static long get_num_ir(long ir_mapping_table[], const long mesh[3]); static long check_mesh_symmetry(const long mesh[3], const long is_shift[3], const MatLONG *rot_reciprocal); -static void transpose_matrix_l3(long a[3][3], KPTCONST long b[3][3]); +static void transpose_matrix_l3(long a[3][3], GRGCONST long b[3][3]); static void multiply_matrix_l3(long m[3][3], - KPTCONST long a[3][3], KPTCONST long b[3][3]); -static long check_identity_matrix_l3(KPTCONST long a[3][3], - KPTCONST long b[3][3]); + GRGCONST long a[3][3], GRGCONST long b[3][3]); +static long check_identity_matrix_l3(GRGCONST long a[3][3], + GRGCONST long b[3][3]); static void multiply_matrix_vector_d3(double v[3], - KPTCONST double a[3][3], + GRGCONST double a[3][3], const double b[3]); static double norm_squared_d3(const double a[3]); -long kpt_get_irreducible_reciprocal_mesh(long grid_address[][3], +long bzg_get_irreducible_reciprocal_mesh(long grid_address[][3], long ir_mapping_table[], const long mesh[3], const long is_shift[3], @@ -237,13 +237,13 @@ long kpt_get_irreducible_reciprocal_mesh(long grid_address[][3], return num_ir; } -MatLONG *kpt_get_point_group_reciprocal(const MatLONG * rotations, +MatLONG *bzg_get_point_group_reciprocal(const MatLONG * rotations, const long is_time_reversal) { return get_point_group_reciprocal(rotations, is_time_reversal); } -long kpt_get_ir_reciprocal_mesh(long grid_address[][3], +long bzg_get_ir_reciprocal_mesh(long grid_address[][3], long ir_mapping_table[], const long mesh[3], const long is_shift[3], @@ -261,16 +261,16 @@ long kpt_get_ir_reciprocal_mesh(long grid_address[][3], is_shift, rot_reciprocal); - kpt_free_MatLONG(rot_reciprocal); + bzg_free_MatLONG(rot_reciprocal); rot_reciprocal = NULL; return num_ir; } -long kpt_relocate_BZ_grid_address(long bz_grid_address[][3], +long bzg_relocate_BZ_grid_address(long bz_grid_address[][3], long bz_map[], - KPTCONST long grid_address[][3], + GRGCONST long grid_address[][3], const long mesh[3], - KPTCONST double rec_lattice[3][3], + GRGCONST double rec_lattice[3][3], const long is_shift[3]) { return relocate_BZ_grid_address(bz_grid_address, @@ -281,11 +281,11 @@ long kpt_relocate_BZ_grid_address(long bz_grid_address[][3], is_shift); } -long kpt_get_bz_grid_addresses(long bz_grid_address[][3], +long bzg_get_bz_grid_addresses(long bz_grid_address[][3], long bz_map[][2], - KPTCONST long grid_address[][3], + GRGCONST long grid_address[][3], const long mesh[3], - KPTCONST double rec_lattice[3][3], + GRGCONST double rec_lattice[3][3], const long is_shift[3]) { return get_bz_grid_addresses(bz_grid_address, @@ -296,7 +296,7 @@ long kpt_get_bz_grid_addresses(long bz_grid_address[][3], is_shift); } -void kpt_copy_matrix_l3(long a[3][3], KPTCONST long b[3][3]) +void bzg_copy_matrix_l3(long a[3][3], GRGCONST long b[3][3]) { a[0][0] = b[0][0]; a[0][1] = b[0][1]; @@ -309,8 +309,8 @@ void kpt_copy_matrix_l3(long a[3][3], KPTCONST long b[3][3]) a[2][2] = b[2][2]; } -void kpt_multiply_matrix_vector_l3(long v[3], - KPTCONST long a[3][3], +void bzg_multiply_matrix_vector_l3(long v[3], + GRGCONST long a[3][3], const long b[3]) { long i; @@ -321,7 +321,7 @@ void kpt_multiply_matrix_vector_l3(long v[3], v[i] = c[i]; } -MatLONG * kpt_alloc_MatLONG(const long size) +MatLONG * bzg_alloc_MatLONG(const long size) { MatLONG *matlong; @@ -346,7 +346,7 @@ MatLONG * kpt_alloc_MatLONG(const long size) return matlong; } -void kpt_free_MatLONG(MatLONG * matlong) +void bzg_free_MatLONG(MatLONG * matlong) { if (matlong->size > 0) { free(matlong->mat); @@ -363,7 +363,7 @@ static MatLONG *get_point_group_reciprocal(const MatLONG * rotations, long i, j, num_rot; MatLONG *rot_reciprocal, *rot_return; long *unique_rot; - KPTCONST long inversion[3][3] = { + GRGCONST long inversion[3][3] = { {-1, 0, 0 }, { 0,-1, 0 }, { 0, 0,-1 } @@ -374,18 +374,18 @@ static MatLONG *get_point_group_reciprocal(const MatLONG * rotations, unique_rot = NULL; if (is_time_reversal) { - if ((rot_reciprocal = kpt_alloc_MatLONG(rotations->size * 2)) == NULL) { + if ((rot_reciprocal = bzg_alloc_MatLONG(rotations->size * 2)) == NULL) { return NULL; } } else { - if ((rot_reciprocal = kpt_alloc_MatLONG(rotations->size)) == NULL) { + if ((rot_reciprocal = bzg_alloc_MatLONG(rotations->size)) == NULL) { return NULL; } } if ((unique_rot = (long*)malloc(sizeof(long) * rot_reciprocal->size)) == NULL) { warning_print("Memory of unique_rot could not be allocated."); - kpt_free_MatLONG(rot_reciprocal); + bzg_free_MatLONG(rot_reciprocal); rot_reciprocal = NULL; return NULL; } @@ -418,15 +418,15 @@ static MatLONG *get_point_group_reciprocal(const MatLONG * rotations, ; } - if ((rot_return = kpt_alloc_MatLONG(num_rot)) != NULL) { + if ((rot_return = bzg_alloc_MatLONG(num_rot)) != NULL) { for (i = 0; i < num_rot; i++) { - kpt_copy_matrix_l3(rot_return->mat[i], rot_reciprocal->mat[unique_rot[i]]); + bzg_copy_matrix_l3(rot_return->mat[i], rot_reciprocal->mat[unique_rot[i]]); } } free(unique_rot); unique_rot = NULL; - kpt_free_MatLONG(rot_reciprocal); + bzg_free_MatLONG(rot_reciprocal); rot_reciprocal = NULL; return rot_return; @@ -481,7 +481,7 @@ static long get_ir_reciprocal_mesh_normal(long grid_address[][3], is_shift); ir_mapping_table[i] = i; for (j = 0; j < rot_reciprocal->size; j++) { - kpt_multiply_matrix_vector_l3(address_double_rot, + bzg_multiply_matrix_vector_l3(address_double_rot, rot_reciprocal->mat[j], address_double); grid_point_rot = grg_get_double_grid_index(address_double_rot, mesh, is_shift); @@ -569,13 +569,13 @@ get_ir_reciprocal_mesh_distortion(long grid_address[][3], static long relocate_BZ_grid_address(long bz_grid_address[][3], long bz_map[], - KPTCONST long grid_address[][3], + GRGCONST long grid_address[][3], const long mesh[3], - KPTCONST double rec_lattice[3][3], + GRGCONST double rec_lattice[3][3], const long is_shift[3]) { double tolerance, min_distance; - double q_vector[3], distance[KPT_NUM_BZ_SEARCH_SPACE]; + double q_vector[3], distance[BZG_NUM_BZ_SEARCH_SPACE]; long bzmesh[3], bz_address_double[3]; long i, boundary_num_gp, total_num_gp, bzgp, gp, num_bzmesh; long j, k, min_index; @@ -596,7 +596,7 @@ static long relocate_BZ_grid_address(long bz_grid_address[][3], /* Multithreading doesn't work for this loop since gp calculated */ /* with boundary_num_gp is unstable to store bz_grid_address. */ for (i = 0; i < total_num_gp; i++) { - for (j = 0; j < KPT_NUM_BZ_SEARCH_SPACE; j++) { + for (j = 0; j < BZG_NUM_BZ_SEARCH_SPACE; j++) { for (k = 0; k < 3; k++) { q_vector[k] = ((grid_address[i][k] + bz_search_space[j][k] * mesh[k]) * 2 + @@ -607,14 +607,14 @@ static long relocate_BZ_grid_address(long bz_grid_address[][3], } min_distance = distance[0]; min_index = 0; - for (j = 1; j < KPT_NUM_BZ_SEARCH_SPACE; j++) { + for (j = 1; j < BZG_NUM_BZ_SEARCH_SPACE; j++) { if (distance[j] < min_distance) { min_distance = distance[j]; min_index = j; } } - for (j = 0; j < KPT_NUM_BZ_SEARCH_SPACE; j++) { + for (j = 0; j < BZG_NUM_BZ_SEARCH_SPACE; j++) { if (distance[j] < min_distance + tolerance) { if (j == min_index) { gp = i; @@ -641,13 +641,13 @@ static long relocate_BZ_grid_address(long bz_grid_address[][3], static long get_bz_grid_addresses(long bz_grid_address[][3], long bz_map[][2], - KPTCONST long grid_address[][3], + GRGCONST long grid_address[][3], const long mesh[3], - KPTCONST double rec_lattice[3][3], + GRGCONST double rec_lattice[3][3], const long is_shift[3]) { double tolerance, min_distance; - double q_vector[3], distance[KPT_NUM_BZ_SEARCH_SPACE]; + double q_vector[3], distance[BZG_NUM_BZ_SEARCH_SPACE]; long i, j, k, min_index, num_gp, multi; tolerance = get_tolerance_for_BZ_reduction(rec_lattice, mesh); @@ -656,7 +656,7 @@ static long get_bz_grid_addresses(long bz_grid_address[][3], for (i = 0; i < mesh[0] * mesh[1] * mesh[2]; i++) { multi = 0; - for (j = 0; j < KPT_NUM_BZ_SEARCH_SPACE; j++) { + for (j = 0; j < BZG_NUM_BZ_SEARCH_SPACE; j++) { for (k = 0; k < 3; k++) { q_vector[k] = ((grid_address[i][k] + bz_search_space[j][k] * mesh[k]) * 2 + @@ -667,14 +667,14 @@ static long get_bz_grid_addresses(long bz_grid_address[][3], } min_distance = distance[0]; min_index = 0; - for (j = 1; j < KPT_NUM_BZ_SEARCH_SPACE; j++) { + for (j = 1; j < BZG_NUM_BZ_SEARCH_SPACE; j++) { if (distance[j] < min_distance) { min_distance = distance[j]; min_index = j; } } - for (j = 0; j < KPT_NUM_BZ_SEARCH_SPACE; j++) { + for (j = 0; j < BZG_NUM_BZ_SEARCH_SPACE; j++) { if (distance[j] < min_distance + tolerance) { for (k = 0; k < 3; k++) { bz_grid_address[num_gp][k] = @@ -691,7 +691,7 @@ static long get_bz_grid_addresses(long bz_grid_address[][3], return num_gp; } -static double get_tolerance_for_BZ_reduction(KPTCONST double rec_lattice[3][3], +static double get_tolerance_for_BZ_reduction(GRGCONST double rec_lattice[3][3], const long mesh[3]) { long i, j; @@ -780,7 +780,7 @@ static long check_mesh_symmetry(const long mesh[3], ((eq[2] && mesh[2] == mesh[0] && is_shift[2] == is_shift[0]) || (!eq[2]))); } -static void transpose_matrix_l3(long a[3][3], KPTCONST long b[3][3]) +static void transpose_matrix_l3(long a[3][3], GRGCONST long b[3][3]) { long c[3][3]; c[0][0] = b[0][0]; @@ -792,12 +792,12 @@ static void transpose_matrix_l3(long a[3][3], KPTCONST long b[3][3]) c[2][0] = b[0][2]; c[2][1] = b[1][2]; c[2][2] = b[2][2]; - kpt_copy_matrix_l3(a, c); + bzg_copy_matrix_l3(a, c); } static void multiply_matrix_l3(long m[3][3], - KPTCONST long a[3][3], - KPTCONST long b[3][3]) + GRGCONST long a[3][3], + GRGCONST long b[3][3]) { long i, j; /* a_ij */ long c[3][3]; @@ -807,11 +807,11 @@ static void multiply_matrix_l3(long m[3][3], a[i][0] * b[0][j] + a[i][1] * b[1][j] + a[i][2] * b[2][j]; } } - kpt_copy_matrix_l3(m, c); + bzg_copy_matrix_l3(m, c); } -static long check_identity_matrix_l3(KPTCONST long a[3][3], - KPTCONST long b[3][3]) +static long check_identity_matrix_l3(GRGCONST long a[3][3], + GRGCONST long b[3][3]) { if ( a[0][0] - b[0][0] || a[0][1] - b[0][1] || @@ -830,7 +830,7 @@ static long check_identity_matrix_l3(KPTCONST long a[3][3], } static void multiply_matrix_vector_d3(double v[3], - KPTCONST double a[3][3], + GRGCONST double a[3][3], const double b[3]) { long i; diff --git a/c/kpoint.h b/c/bzgrid.h similarity index 75% rename from c/kpoint.h rename to c/bzgrid.h index 79ae29aa..0260bc88 100644 --- a/c/kpoint.h +++ b/c/bzgrid.h @@ -32,48 +32,46 @@ /* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __kpoint_H__ -#define __kpoint_H__ +#ifndef __bzgrid_H__ +#define __bzgrid_H__ -#ifndef KPTCONST -#define KPTCONST -#endif +#include "grgrid.h" typedef struct { long size; long (*mat)[3][3]; } MatLONG; -long kpt_get_irreducible_reciprocal_mesh(long grid_address[][3], +long bzg_get_irreducible_reciprocal_mesh(long grid_address[][3], long ir_mapping_table[], const long mesh[3], const long is_shift[3], const MatLONG *rot_reciprocal); -MatLONG *kpt_get_point_group_reciprocal(const MatLONG * rotations, +MatLONG *bzg_get_point_group_reciprocal(const MatLONG * rotations, const long is_time_reversal); -long kpt_get_ir_reciprocal_mesh(long grid_address[][3], +long bzg_get_ir_reciprocal_mesh(long grid_address[][3], long ir_mapping_table[], const long mesh[3], const long is_shift[3], const long is_time_reversal, const MatLONG * rotations); -long kpt_relocate_BZ_grid_address(long bz_grid_address[][3], +long bzg_relocate_BZ_grid_address(long bz_grid_address[][3], long bz_map[], - KPTCONST long grid_address[][3], + GRGCONST long grid_address[][3], const long mesh[3], - KPTCONST double rec_lattice[3][3], + GRGCONST double rec_lattice[3][3], const long is_shift[3]); -long kpt_get_bz_grid_addresses(long bz_grid_address[][3], +long bzg_get_bz_grid_addresses(long bz_grid_address[][3], long bz_map[][2], - KPTCONST long grid_address[][3], + GRGCONST long grid_address[][3], const long mesh[3], - KPTCONST double rec_lattice[3][3], + GRGCONST double rec_lattice[3][3], const long is_shift[3]); -void kpt_copy_matrix_l3(long a[3][3], KPTCONST long b[3][3]); -void kpt_multiply_matrix_vector_l3(long v[3], - KPTCONST long a[3][3], +void bzg_copy_matrix_l3(long a[3][3], GRGCONST long b[3][3]); +void bzg_multiply_matrix_vector_l3(long v[3], + GRGCONST long a[3][3], const long b[3]); -MatLONG * kpt_alloc_MatLONG(const long size); -void kpt_free_MatLONG(MatLONG * matlong); +MatLONG * bzg_alloc_MatLONG(const long size); +void bzg_free_MatLONG(MatLONG * matlong); #endif diff --git a/c/grgrid.c b/c/grgrid.c index c2ca69cb..082074fe 100644 --- a/c/grgrid.c +++ b/c/grgrid.c @@ -60,45 +60,45 @@ static void get_double_grid_address(long address_double[3], const long address[3], const long PS[3]); static long rotate_grid_index(const long grid_index, - MATCONST long rotation[3][3], + GRGCONST long rotation[3][3], const long D_diag[3], const long PS[3]); static void get_ir_grid_map(long ir_grid_indices[], - MATCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long num_rot, const long D_diag[3], const long PS[3]); -static long mat_get_determinant_l3(MATCONST long a[3][3]); -static double mat_get_determinant_d3(MATCONST double a[3][3]); -static void mat_cast_matrix_3l_to_3d(double m[3][3], MATCONST long a[3][3]); -static void mat_cast_matrix_3d_to_3l(long m[3][3], MATCONST double a[3][3]); +static long mat_get_determinant_l3(GRGCONST long a[3][3]); +static double mat_get_determinant_d3(GRGCONST double a[3][3]); +static void mat_cast_matrix_3l_to_3d(double m[3][3], GRGCONST long a[3][3]); +static void mat_cast_matrix_3d_to_3l(long m[3][3], GRGCONST double a[3][3]); static long mat_get_similar_matrix_ld3(double m[3][3], - MATCONST long a[3][3], - MATCONST double b[3][3], + GRGCONST long a[3][3], + GRGCONST double b[3][3], const double precision); -static long mat_check_identity_matrix_l3(MATCONST long a[3][3], - MATCONST long b[3][3]); -static long mat_check_identity_matrix_ld3(MATCONST long a[3][3], - MATCONST double b[3][3], +static long mat_check_identity_matrix_l3(GRGCONST long a[3][3], + GRGCONST long b[3][3]); +static long mat_check_identity_matrix_ld3(GRGCONST long a[3][3], + GRGCONST double b[3][3], const double symprec); static long mat_inverse_matrix_d3(double m[3][3], - MATCONST double a[3][3], + GRGCONST double a[3][3], const double precision); -static void mat_transpose_matrix_l3(long a[3][3], MATCONST long b[3][3]); +static void mat_transpose_matrix_l3(long a[3][3], GRGCONST long b[3][3]); static void mat_multiply_matrix_vector_l3(long v[3], - MATCONST long a[3][3], + GRGCONST long a[3][3], const long b[3]); static void mat_multiply_matrix_l3(long m[3][3], - MATCONST long a[3][3], - MATCONST long b[3][3]); + GRGCONST long a[3][3], + GRGCONST long b[3][3]); static void mat_multiply_matrix_ld3(double m[3][3], - MATCONST long a[3][3], - MATCONST double b[3][3]); + GRGCONST long a[3][3], + GRGCONST double b[3][3]); static void mat_multiply_matrix_d3(double m[3][3], - MATCONST double a[3][3], - MATCONST double b[3][3]); -static void mat_copy_matrix_l3(long a[3][3], MATCONST long b[3][3]); -static void mat_copy_matrix_d3(double a[3][3], MATCONST double b[3][3]); + GRGCONST double a[3][3], + GRGCONST double b[3][3]); +static void mat_copy_matrix_l3(long a[3][3], GRGCONST long b[3][3]); +static void mat_copy_matrix_d3(double a[3][3], GRGCONST double b[3][3]); static void mat_copy_vector_l3(long a[3], const long b[3]); static long mat_modulo_l(const long a, const long b); static long mat_Nint(const double a); @@ -108,7 +108,7 @@ static double mat_Dabs(const double a); long grg_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3], - MATCONST long A[3][3]) + GRGCONST long A[3][3]) { long i, j, succeeded; long D[3][3]; @@ -143,10 +143,10 @@ err: /* vectors. */ /* num_rot : Number of rotations */ long grg_transform_rotations(long (*transformed_rots)[3][3], - MATCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long num_rot, const long D_diag[3], - MATCONST long Q[3][3]) + GRGCONST long Q[3][3]) { long i, j, k; double r[3][3], Q_double[3][3]; @@ -261,7 +261,7 @@ void grg_get_grid_address_from_index(long address[3], /* Rotate grid point by index */ /* ---------------------------*/ long grg_rotate_grid_index(const long grid_index, - MATCONST long rotation[3][3], + GRGCONST long rotation[3][3], const long D_diag[3], const long PS[3]) { @@ -272,7 +272,7 @@ long grg_rotate_grid_index(const long grid_index, /* Find irreducible grid points */ /* -----------------------------*/ void grg_get_ir_grid_map(long ir_grid_indices[], - MATCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long num_rot, const long D_diag[3], const long PS[3]) @@ -289,12 +289,12 @@ void grg_get_ir_grid_map(long ir_grid_indices[], /* included. */ /* Return 0 if failed */ long grg_get_reciprocal_point_group(long rec_rotations[48][3][3], - MATCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long num_rot, const long is_time_reversal) { long i, j, num_rot_ret, inv_exist; - MATCONST long inversion[3][3] = { + GRGCONST long inversion[3][3] = { {-1, 0, 0 }, { 0,-1, 0 }, { 0, 0,-1 } @@ -462,7 +462,7 @@ static void get_double_grid_address(long address_double[3], } static long rotate_grid_index(const long grid_index, - MATCONST long rotation[3][3], + GRGCONST long rotation[3][3], const long D_diag[3], const long PS[3]) { @@ -475,7 +475,7 @@ static long rotate_grid_index(const long grid_index, } static void get_ir_grid_map(long ir_grid_indices[], - MATCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long num_rot, const long D_diag[3], const long PS[3]) @@ -506,21 +506,21 @@ static void get_ir_grid_map(long ir_grid_indices[], } -static long mat_get_determinant_l3(MATCONST long a[3][3]) +static long mat_get_determinant_l3(GRGCONST long a[3][3]) { return a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1]) + a[0][1] * (a[1][2] * a[2][0] - a[1][0] * a[2][2]) + a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]); } -static double mat_get_determinant_d3(MATCONST double a[3][3]) +static double mat_get_determinant_d3(GRGCONST double a[3][3]) { return a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1]) + a[0][1] * (a[1][2] * a[2][0] - a[1][0] * a[2][2]) + a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]); } -static void mat_cast_matrix_3l_to_3d(double m[3][3], MATCONST long a[3][3]) +static void mat_cast_matrix_3l_to_3d(double m[3][3], GRGCONST long a[3][3]) { m[0][0] = a[0][0]; m[0][1] = a[0][1]; @@ -533,7 +533,7 @@ static void mat_cast_matrix_3l_to_3d(double m[3][3], MATCONST long a[3][3]) m[2][2] = a[2][2]; } -static void mat_cast_matrix_3d_to_3l(long m[3][3], MATCONST double a[3][3]) +static void mat_cast_matrix_3d_to_3l(long m[3][3], GRGCONST double a[3][3]) { m[0][0] = mat_Nint(a[0][0]); m[0][1] = mat_Nint(a[0][1]); @@ -547,8 +547,8 @@ static void mat_cast_matrix_3d_to_3l(long m[3][3], MATCONST double a[3][3]) } static long mat_get_similar_matrix_ld3(double m[3][3], - MATCONST long a[3][3], - MATCONST double b[3][3], + GRGCONST long a[3][3], + GRGCONST double b[3][3], const double precision) { double c[3][3]; @@ -561,8 +561,8 @@ static long mat_get_similar_matrix_ld3(double m[3][3], return 1; } -static long mat_check_identity_matrix_l3(MATCONST long a[3][3], - MATCONST long b[3][3]) +static long mat_check_identity_matrix_l3(GRGCONST long a[3][3], + GRGCONST long b[3][3]) { if (a[0][0] - b[0][0] || a[0][1] - b[0][1] || @@ -580,8 +580,8 @@ static long mat_check_identity_matrix_l3(MATCONST long a[3][3], } } -static long mat_check_identity_matrix_ld3(MATCONST long a[3][3], - MATCONST double b[3][3], +static long mat_check_identity_matrix_ld3(GRGCONST long a[3][3], + GRGCONST double b[3][3], const double symprec) { if (mat_Dabs(a[0][0] - b[0][0]) > symprec || @@ -601,7 +601,7 @@ static long mat_check_identity_matrix_ld3(MATCONST long a[3][3], } static long mat_inverse_matrix_d3(double m[3][3], - MATCONST double a[3][3], + GRGCONST double a[3][3], const double precision) { double det; @@ -625,7 +625,7 @@ static long mat_inverse_matrix_d3(double m[3][3], return 1; } -static void mat_transpose_matrix_l3(long a[3][3], MATCONST long b[3][3]) +static void mat_transpose_matrix_l3(long a[3][3], GRGCONST long b[3][3]) { long c[3][3]; c[0][0] = b[0][0]; @@ -641,7 +641,7 @@ static void mat_transpose_matrix_l3(long a[3][3], MATCONST long b[3][3]) } static void mat_multiply_matrix_vector_l3(long v[3], - MATCONST long a[3][3], + GRGCONST long a[3][3], const long b[3]) { long i; @@ -655,8 +655,8 @@ static void mat_multiply_matrix_vector_l3(long v[3], } static void mat_multiply_matrix_l3(long m[3][3], - MATCONST long a[3][3], - MATCONST long b[3][3]) + GRGCONST long a[3][3], + GRGCONST long b[3][3]) { long i, j; /* a_ij */ long c[3][3]; @@ -670,8 +670,8 @@ static void mat_multiply_matrix_l3(long m[3][3], } static void mat_multiply_matrix_ld3(double m[3][3], - MATCONST long a[3][3], - MATCONST double b[3][3]) + GRGCONST long a[3][3], + GRGCONST double b[3][3]) { long i, j; /* a_ij */ double c[3][3]; @@ -685,8 +685,8 @@ static void mat_multiply_matrix_ld3(double m[3][3], } static void mat_multiply_matrix_d3(double m[3][3], - MATCONST double a[3][3], - MATCONST double b[3][3]) + GRGCONST double a[3][3], + GRGCONST double b[3][3]) { long i, j; /* a_ij */ double c[3][3]; @@ -699,7 +699,7 @@ static void mat_multiply_matrix_d3(double m[3][3], mat_copy_matrix_d3(m, c); } -static void mat_copy_matrix_l3(long a[3][3], MATCONST long b[3][3]) +static void mat_copy_matrix_l3(long a[3][3], GRGCONST long b[3][3]) { a[0][0] = b[0][0]; a[0][1] = b[0][1]; @@ -712,7 +712,7 @@ static void mat_copy_matrix_l3(long a[3][3], MATCONST long b[3][3]) a[2][2] = b[2][2]; } -static void mat_copy_matrix_d3(double a[3][3], MATCONST double b[3][3]) +static void mat_copy_matrix_d3(double a[3][3], GRGCONST double b[3][3]) { a[0][0] = b[0][0]; a[0][1] = b[0][1]; diff --git a/c/grgrid.h b/c/grgrid.h index e89f9e83..33911f51 100644 --- a/c/grgrid.h +++ b/c/grgrid.h @@ -37,8 +37,8 @@ #include -#ifndef MATCONST -#define MATCONST +#ifndef GRGCONST +#define GRGCONST #endif #ifdef MATWARNING @@ -50,12 +50,12 @@ long grg_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3], - MATCONST long A[3][3]); + GRGCONST long A[3][3]); long grg_transform_rotations(long (*transformed_rots)[3][3], - MATCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long num_rot, const long D_diag[3], - MATCONST long Q[3][3]); + GRGCONST long Q[3][3]); void grg_get_all_grid_addresses(long grid_address[][3], const long D_diag[3]); void grg_get_double_grid_address(long address_double[3], const long address[3], @@ -74,16 +74,16 @@ void grg_get_grid_address_from_index(long address[3], const long grid_index, const long D_diag[3]); long grg_rotate_grid_index(const long grid_index, - MATCONST long rotations[3][3], + GRGCONST long rotations[3][3], const long D_diag[3], const long PS[3]); void grg_get_ir_grid_map(long ir_grid_indices[], - MATCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long num_rot, const long D_diag[3], const long PS[3]); long grg_get_reciprocal_point_group(long rec_rotations[48][3][3], - MATCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long num_rot, const long is_time_reversal); diff --git a/c/phono3py.c b/c/phono3py.c index 533586ee..943dc3f5 100644 --- a/c/phono3py.c +++ b/c/phono3py.c @@ -41,7 +41,7 @@ #include "interaction.h" #include "imag_self_energy_with_g.h" #include "isotope.h" -#include "kpoint.h" +#include "bzgrid.h" #include "pp_collision.h" #include "real_self_energy.h" #include "grgrid.h" @@ -620,18 +620,18 @@ long ph3py_get_ir_reciprocal_mesh(long grid_address[][3], long i, num_ir; MatLONG *rotations; - rotations = kpt_alloc_MatLONG(num_rot); + rotations = bzg_alloc_MatLONG(num_rot); for (i = 0; i < num_rot; i++) { - kpt_copy_matrix_l3(rotations->mat[i], rotations_in[i]); + bzg_copy_matrix_l3(rotations->mat[i], rotations_in[i]); } - num_ir = kpt_get_ir_reciprocal_mesh(grid_address, + num_ir = bzg_get_ir_reciprocal_mesh(grid_address, ir_mapping_table, mesh, is_shift, is_time_reversal, rotations); - kpt_free_MatLONG(rotations); + bzg_free_MatLONG(rotations); return num_ir; } @@ -642,7 +642,7 @@ long ph3py_relocate_BZ_grid_address(long bz_grid_address[][3], PHPYCONST double rec_lattice[3][3], const long is_shift[3]) { - return kpt_relocate_BZ_grid_address(bz_grid_address, + return bzg_relocate_BZ_grid_address(bz_grid_address, bz_map, grid_address, mesh, @@ -657,7 +657,7 @@ long ph3py_get_bz_grid_addresses(long bz_grid_address[][3], PHPYCONST double rec_lattice[3][3], const long is_shift[3]) { - return kpt_get_bz_grid_addresses(bz_grid_address, + return bzg_get_bz_grid_addresses(bz_grid_address, bz_map, grid_address, mesh, diff --git a/c/triplet.c b/c/triplet.c index b262344c..28206319 100644 --- a/c/triplet.c +++ b/c/triplet.c @@ -34,7 +34,8 @@ /* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ -#include "kpoint.h" +#include "bzgrid.h" +#include "grgrid.h" #include "triplet.h" #include "triplet_iw.h" #include "triplet_kpoint.h" @@ -46,12 +47,12 @@ static long get_triplets_reciprocal_mesh_at_q(long *map_triplets, const long mesh[3], const long is_time_reversal, const long num_rot, - TPLCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long swappable); long tpl_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point, - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map, const long *map_triplets, const long num_map_triplets, @@ -73,7 +74,7 @@ long tpl_get_triplets_reciprocal_mesh_at_q(long *map_triplets, const long mesh[3], const long is_time_reversal, const long num_rot, - TPLCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long swappable) { return get_triplets_reciprocal_mesh_at_q(map_triplets, @@ -91,11 +92,11 @@ void tpl_get_integration_weight(double *iw, char *iw_zero, const double *frequency_points, const long num_band0, - TPLCONST long relative_grid_address[24][4][3], + GRGCONST long relative_grid_address[24][4][3], const long mesh[3], - TPLCONST long (*triplets)[3], + GRGCONST long (*triplets)[3], const long num_triplets, - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map, const double *frequencies1, const long num_band1, @@ -141,7 +142,7 @@ void tpl_get_integration_weight_with_sigma(double *iw, const double sigma_cutoff, const double *frequency_points, const long num_band0, - TPLCONST long (*triplets)[3], + GRGCONST long (*triplets)[3], const long num_triplets, const double *frequencies, const long num_band, @@ -193,7 +194,7 @@ long tpl_is_N(const long triplet[3], const long *grid_address) void tpl_set_relative_grid_address( long tp_relative_grid_address[2][24][4][3], - TPLCONST long relative_grid_address[24][4][3], + GRGCONST long relative_grid_address[24][4][3], const long tp_type) { long i, j, k, l; @@ -227,15 +228,15 @@ static long get_triplets_reciprocal_mesh_at_q(long *map_triplets, const long mesh[3], const long is_time_reversal, const long num_rot, - TPLCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long swappable) { MatLONG *rot_real; long i, num_ir; - rot_real = kpt_alloc_MatLONG(num_rot); + rot_real = bzg_alloc_MatLONG(num_rot); for (i = 0; i < num_rot; i++) { - kpt_copy_matrix_l3(rot_real->mat[i], rotations[i]); + bzg_copy_matrix_l3(rot_real->mat[i], rotations[i]); } num_ir = tpk_get_ir_triplets_at_q(map_triplets, @@ -247,7 +248,7 @@ static long get_triplets_reciprocal_mesh_at_q(long *map_triplets, rot_real, swappable); - kpt_free_MatLONG(rot_real); + bzg_free_MatLONG(rot_real); return num_ir; } diff --git a/c/triplet.h b/c/triplet.h index 90006d3c..894d57ad 100644 --- a/c/triplet.h +++ b/c/triplet.h @@ -37,11 +37,8 @@ #ifndef __triplet_H__ #define __triplet_H__ -#ifndef TPLCONST -#define TPLCONST -#endif - #include +#include "grgrid.h" /* Irreducible triplets of k-points are searched under conservation of */ /* :math:``\mathbf{k}_1 + \mathbf{k}_2 + \mathbf{k}_3 = \mathbf{G}``. */ @@ -56,7 +53,7 @@ long tpl_get_triplets_reciprocal_mesh_at_q(long *map_triplets, const long mesh[3], const long is_time_reversal, const long num_rot, - TPLCONST long (*rotations)[3][3], + GRGCONST long (*rotations)[3][3], const long swappable); /* Irreducible grid-point-triplets in BZ are stored. */ /* triplets are recovered from grid_point and triplet_weights. */ @@ -66,7 +63,7 @@ long tpl_get_triplets_reciprocal_mesh_at_q(long *map_triplets, /* Number of ir-triplets is returned. */ long tpl_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point, - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map, const long *map_triplets, const long num_map_triplets, @@ -75,11 +72,11 @@ void tpl_get_integration_weight(double *iw, char *iw_zero, const double *frequency_points, const long num_band0, - TPLCONST long relative_grid_address[24][4][3], + GRGCONST long relative_grid_address[24][4][3], const long mesh[3], - TPLCONST long (*triplets)[3], + GRGCONST long (*triplets)[3], const long num_triplets, - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map, const double *frequencies1, const long num_band1, @@ -94,7 +91,7 @@ void tpl_get_integration_weight_with_sigma(double *iw, const double sigma_cutoff, const double *frequency_points, const long num_band0, - TPLCONST long (*triplets)[3], + GRGCONST long (*triplets)[3], const long num_triplets, const double *frequencies, const long num_band, @@ -103,7 +100,7 @@ void tpl_get_integration_weight_with_sigma(double *iw, long tpl_is_N(const long triplet[3], const long *grid_address); void tpl_set_relative_grid_address( long tp_relative_grid_address[2][24][4][3], - TPLCONST long relative_grid_address[24][4][3], + GRGCONST long relative_grid_address[24][4][3], const long tp_type); #endif diff --git a/c/triplet_iw.c b/c/triplet_iw.c index a2a1702d..80f23f72 100644 --- a/c/triplet_iw.c +++ b/c/triplet_iw.c @@ -42,7 +42,7 @@ static void set_freq_vertices(double freq_vertices[3][24][4], const double *frequencies1, const double *frequencies2, - TPLCONST long vertices[2][24][4], + GRGCONST long vertices[2][24][4], const long num_band1, const long num_band2, const long b1, @@ -50,15 +50,15 @@ static void set_freq_vertices(double freq_vertices[3][24][4], const long tp_type); static long set_g(double g[3], const double f0, - TPLCONST double freq_vertices[3][24][4], + GRGCONST double freq_vertices[3][24][4], const long max_i); -static long in_tetrahedra(const double f0, TPLCONST double freq_vertices[24][4]); +static long in_tetrahedra(const double f0, GRGCONST double freq_vertices[24][4]); static void get_triplet_tetrahedra_vertices( long vertices[2][24][4], - TPLCONST long tp_relative_grid_address[2][24][4][3], + GRGCONST long tp_relative_grid_address[2][24][4][3], const long mesh[3], const long triplet[3], - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map); void @@ -66,11 +66,11 @@ tpi_get_integration_weight(double *iw, char *iw_zero, const double *frequency_points, const long num_band0, - TPLCONST long tp_relative_grid_address[2][24][4][3], + GRGCONST long tp_relative_grid_address[2][24][4][3], const long mesh[3], const long triplets[3], const long num_triplets, - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map, const double *frequencies1, const long num_band1, @@ -211,10 +211,10 @@ void tpi_get_integration_weight_with_sigma(double *iw, void tpi_get_neighboring_grid_points(long neighboring_grid_points[], const long grid_point, - TPLCONST long relative_grid_address[][3], + GRGCONST long relative_grid_address[][3], const long num_relative_grid_address, const long mesh[3], - TPLCONST long bz_grid_address[][3], + GRGCONST long bz_grid_address[][3], const long bz_map[]) { long bzmesh[3], address_double[3], bz_address_double[3], PS[3]; @@ -245,7 +245,7 @@ tpi_get_neighboring_grid_points(long neighboring_grid_points[], static void set_freq_vertices(double freq_vertices[3][24][4], const double *frequencies1, const double *frequencies2, - TPLCONST long vertices[2][24][4], + GRGCONST long vertices[2][24][4], const long num_band1, const long num_band2, const long b1, @@ -283,7 +283,7 @@ static void set_freq_vertices(double freq_vertices[3][24][4], /* calculation. */ static long set_g(double g[3], const double f0, - TPLCONST double freq_vertices[3][24][4], + GRGCONST double freq_vertices[3][24][4], const long max_i) { long i, iw_zero; @@ -302,7 +302,7 @@ static long set_g(double g[3], return iw_zero; } -static long in_tetrahedra(const double f0, TPLCONST double freq_vertices[24][4]) +static long in_tetrahedra(const double f0, GRGCONST double freq_vertices[24][4]) { long i, j; double fmin, fmax; @@ -330,10 +330,10 @@ static long in_tetrahedra(const double f0, TPLCONST double freq_vertices[24][4]) static void get_triplet_tetrahedra_vertices( long vertices[2][24][4], - TPLCONST long tp_relative_grid_address[2][24][4][3], + GRGCONST long tp_relative_grid_address[2][24][4][3], const long mesh[3], const long triplet[3], - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map) { long i, j; diff --git a/c/triplet_iw.h b/c/triplet_iw.h index 6d09ce34..4ef85e98 100644 --- a/c/triplet_iw.h +++ b/c/triplet_iw.h @@ -35,18 +35,18 @@ #ifndef __triplet_iw_H__ #define __triplet_iw_H__ -#include "triplet.h" +#include "grgrid.h" void tpi_get_integration_weight(double *iw, char *iw_zero, const double *frequency_points, const long num_band0, - TPLCONST long tp_relative_grid_address[2][24][4][3], + GRGCONST long tp_relative_grid_address[2][24][4][3], const long mesh[3], const long triplets[3], const long num_triplets, - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map, const double *frequencies1, const long num_band1, @@ -69,10 +69,10 @@ void tpi_get_integration_weight_with_sigma(double *iw, void tpi_get_neighboring_grid_points(long neighboring_grid_points[], const long grid_point, - TPLCONST long relative_grid_address[][3], + GRGCONST long relative_grid_address[][3], const long num_relative_grid_address, const long mesh[3], - TPLCONST long bz_grid_address[][3], + GRGCONST long bz_grid_address[][3], const long bz_map[]); #endif diff --git a/c/triplet_kpoint.c b/c/triplet_kpoint.c index bcc02603..c62a4a32 100644 --- a/c/triplet_kpoint.c +++ b/c/triplet_kpoint.c @@ -36,13 +36,13 @@ #include #include -#include "kpoint.h" +#include "bzgrid.h" #include "grgrid.h" #include "triplet.h" #include "triplet_kpoint.h" -#define KPT_NUM_BZ_SEARCH_SPACE 125 -static long bz_search_space[KPT_NUM_BZ_SEARCH_SPACE][3] = { +#define BZG_NUM_BZ_SEARCH_SPACE 125 +static long bz_search_space[BZG_NUM_BZ_SEARCH_SPACE][3] = { { 0, 0, 0}, { 0, 0, 1}, { 0, 0, 2}, @@ -179,7 +179,7 @@ static long get_ir_triplets_at_q(long *map_triplets, const long swappable); static long get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point, - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map, const long *map_triplets, const long num_map_triplets, @@ -206,7 +206,7 @@ long tpk_get_ir_triplets_at_q(long *map_triplets, long num_ir; MatLONG *rot_reciprocal; - rot_reciprocal = kpt_get_point_group_reciprocal(rotations, is_time_reversal); + rot_reciprocal = bzg_get_point_group_reciprocal(rotations, is_time_reversal); num_ir = get_ir_triplets_at_q(map_triplets, map_q, grid_address, @@ -214,13 +214,13 @@ long tpk_get_ir_triplets_at_q(long *map_triplets, mesh, rot_reciprocal, swappable); - kpt_free_MatLONG(rot_reciprocal); + bzg_free_MatLONG(rot_reciprocal); return num_ir; } long tpk_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point, - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map, const long *map_triplets, const long num_map_triplets, @@ -264,12 +264,12 @@ static long get_ir_triplets_at_q(long *map_triplets, rot_reciprocal_q = get_point_group_reciprocal_with_q(rot_reciprocal, mesh, grid_point); - num_ir_q = kpt_get_irreducible_reciprocal_mesh(grid_address, + num_ir_q = bzg_get_irreducible_reciprocal_mesh(grid_address, map_q, mesh, is_shift, rot_reciprocal_q); - kpt_free_MatLONG(rot_reciprocal_q); + bzg_free_MatLONG(rot_reciprocal_q); rot_reciprocal_q = NULL; if ((third_q = (long*) malloc(sizeof(long) * num_ir_q)) == NULL) { @@ -343,7 +343,7 @@ ret: static long get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point, - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map, const long *map_triplets, const long num_map_triplets, @@ -416,7 +416,7 @@ static long get_third_q_of_triplets_at_q(long bz_address[3][3], { long i, j, smallest_g, smallest_index, sum_g, delta_g[3]; long prod_bzmesh; - long bzgp[KPT_NUM_BZ_SEARCH_SPACE]; + long bzgp[BZG_NUM_BZ_SEARCH_SPACE]; long bz_address_double[3], PS[3]; prod_bzmesh = bzmesh[0] * bzmesh[1] * bzmesh[2]; @@ -431,7 +431,7 @@ static long get_third_q_of_triplets_at_q(long bz_address[3][3], delta_g[i] /= mesh[i]; } - for (i = 0; i < KPT_NUM_BZ_SEARCH_SPACE; i++) { + for (i = 0; i < BZG_NUM_BZ_SEARCH_SPACE; i++) { for (j = 0; j < 3; j++) { bz_address_double[j] = (bz_address[q_index][j] + bz_search_space[i][j] * mesh[j]) * 2; @@ -439,7 +439,7 @@ static long get_third_q_of_triplets_at_q(long bz_address[3][3], bzgp[i] = bz_map[grg_get_double_grid_index(bz_address_double, bzmesh, PS)]; } - for (i = 0; i < KPT_NUM_BZ_SEARCH_SPACE; i++) { + for (i = 0; i < BZG_NUM_BZ_SEARCH_SPACE; i++) { if (bzgp[i] != prod_bzmesh) { goto escape; } @@ -450,7 +450,7 @@ escape: smallest_g = 4; smallest_index = 0; - for (i = 0; i < KPT_NUM_BZ_SEARCH_SPACE; i++) { + for (i = 0; i < BZG_NUM_BZ_SEARCH_SPACE; i++) { if (bzgp[i] < prod_bzmesh) { /* q'' is in BZ */ sum_g = (labs(delta_g[0] + bz_search_space[i][0]) + labs(delta_g[1] + bz_search_space[i][1]) + @@ -494,7 +494,7 @@ static MatLONG *get_point_group_reciprocal_with_q(const MatLONG * rot_reciprocal ir_rot[i] = -1; } for (i = 0; i < rot_reciprocal->size; i++) { - kpt_multiply_matrix_vector_l3(adrs_rot, rot_reciprocal->mat[i], adrs); + bzg_multiply_matrix_vector_l3(adrs_rot, rot_reciprocal->mat[i], adrs); gp_rot = grg_get_grid_index(adrs_rot, mesh); if (gp_rot == grid_point) { @@ -503,9 +503,9 @@ static MatLONG *get_point_group_reciprocal_with_q(const MatLONG * rot_reciprocal } } - if ((rot_reciprocal_q = kpt_alloc_MatLONG(num_rot)) != NULL) { + if ((rot_reciprocal_q = bzg_alloc_MatLONG(num_rot)) != NULL) { for (i = 0; i < num_rot; i++) { - kpt_copy_matrix_l3(rot_reciprocal_q->mat[i], + bzg_copy_matrix_l3(rot_reciprocal_q->mat[i], rot_reciprocal->mat[ir_rot[i]]); } } diff --git a/c/triplet_kpoint.h b/c/triplet_kpoint.h index fb2cf9ef..23004153 100644 --- a/c/triplet_kpoint.h +++ b/c/triplet_kpoint.h @@ -37,8 +37,8 @@ #ifndef __triplet_kpoint_H__ #define __triplet_kpoint_H__ -#include "kpoint.h" -#include "triplet.h" +#include "bzgrid.h" +#include "grgrid.h" long tpk_get_ir_triplets_at_q(long *map_triplets, long *map_q, @@ -50,7 +50,7 @@ long tpk_get_ir_triplets_at_q(long *map_triplets, const long swappable); long tpk_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point, - TPLCONST long (*bz_grid_address)[3], + GRGCONST long (*bz_grid_address)[3], const long *bz_map, const long *map_triplets, const long num_map_triplets, diff --git a/setup.py b/setup.py index b375cee9..377a78a4 100644 --- a/setup.py +++ b/setup.py @@ -207,13 +207,13 @@ include_dirs += include_dirs_lapacke print("extra_link_args", extra_link_args) sources_phono3py = ['c/_phono3py.c', + 'c/bzgrid.c', 'c/collision_matrix.c', 'c/grgrid.c', 'c/fc3.c', 'c/imag_self_energy_with_g.c', 'c/interaction.c', 'c/isotope.c', - 'c/kpoint.c', 'c/lapack_wrapper.c', 'c/phono3py.c', 'c/phonoc_utils.c',