1 /* Copyright (C) 2021 Atsushi Togo */ 2 /* All rights reserved. */ 3 4 /* This file is part of phonopy. */ 5 6 /* Redistribution and use in source and binary forms, with or without */ 7 /* modification, are permitted provided that the following conditions */ 8 /* are met: */ 9 10 /* * Redistributions of source code must retain the above copyright */ 11 /* notice, this list of conditions and the following disclaimer. */ 12 13 /* * Redistributions in binary form must reproduce the above copyright */ 14 /* notice, this list of conditions and the following disclaimer in */ 15 /* the documentation and/or other materials provided with the */ 16 /* distribution. */ 17 18 /* * Neither the name of the phonopy project nor the names of its */ 19 /* contributors may be used to endorse or promote products derived */ 20 /* from this software without specific prior written permission. */ 21 22 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ 23 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ 24 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ 25 /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */ 26 /* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */ 27 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */ 28 /* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ 29 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */ 30 /* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */ 31 /* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */ 32 /* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ 33 /* POSSIBILITY OF SUCH DAMAGE. */ 34 35 #ifndef __phono3py_H__ 36 #define __phono3py_H__ 37 38 #ifndef PHPYCONST 39 #define PHPYCONST 40 #endif 41 42 #include "lapack_wrapper.h" 43 #include "phonoc_array.h" 44 45 void ph3py_get_interaction(Darray *fc3_normal_squared, 46 const char *g_zero, 47 const Darray *frequencies, 48 const lapack_complex_double *eigenvectors, 49 const size_t (*triplets)[3], 50 const size_t num_triplets, 51 const int *grid_address, 52 const int *mesh, 53 const double *fc3, 54 const int is_compact_fc3, 55 const double *shortest_vectors, 56 const int svecs_dims[3], 57 const int *multiplicity, 58 const double *masses, 59 const int *p2s_map, 60 const int *s2p_map, 61 const int *band_indices, 62 const int symmetrize_fc3_q, 63 const double cutoff_frequency); 64 void ph3py_get_pp_collision(double *imag_self_energy, 65 PHPYCONST int relative_grid_address[24][4][3], /* thm */ 66 const double *frequencies, 67 const lapack_complex_double *eigenvectors, 68 const size_t (*triplets)[3], 69 const size_t num_triplets, 70 const int *triplet_weights, 71 const int *grid_address, /* thm */ 72 const size_t *bz_map, /* thm */ 73 const int *mesh, /* thm */ 74 const double *fc3, 75 const int is_compact_fc3, 76 const double *shortest_vectors, 77 const int svecs_dims[3], 78 const int *multiplicity, 79 const double *masses, 80 const int *p2s_map, 81 const int *s2p_map, 82 const Iarray *band_indices, 83 const Darray *temperatures, 84 const int is_NU, 85 const int symmetrize_fc3_q, 86 const double cutoff_frequency); 87 void ph3py_get_pp_collision_with_sigma( 88 double *imag_self_energy, 89 const double sigma, 90 const double sigma_cutoff, 91 const double *frequencies, 92 const lapack_complex_double *eigenvectors, 93 const size_t (*triplets)[3], 94 const size_t num_triplets, 95 const int *triplet_weights, 96 const int *grid_address, 97 const int *mesh, 98 const double *fc3, 99 const int is_compact_fc3, 100 const double *shortest_vectors, 101 const int svecs_dims[3], 102 const int *multiplicity, 103 const double *masses, 104 const int *p2s_map, 105 const int *s2p_map, 106 const Iarray *band_indices, 107 const Darray *temperatures, 108 const int is_NU, 109 const int symmetrize_fc3_q, 110 const double cutoff_frequency); 111 void ph3py_get_imag_self_energy_at_bands_with_g( 112 double *imag_self_energy, 113 const Darray *fc3_normal_squared, 114 const double *frequencies, 115 const size_t (*triplets)[3], 116 const int *triplet_weights, 117 const double *g, 118 const char *g_zero, 119 const double temperature, 120 const double cutoff_frequency, 121 const int num_frequency_points, 122 const int frequency_point_index); 123 void ph3py_get_detailed_imag_self_energy_at_bands_with_g( 124 double *detailed_imag_self_energy, 125 double *imag_self_energy_N, 126 double *imag_self_energy_U, 127 const Darray *fc3_normal_squared, 128 const double *frequencies, 129 const size_t (*triplets)[3], 130 const int *triplet_weights, 131 const int *grid_address, 132 const double *g, 133 const char *g_zero, 134 const double temperature, 135 const double cutoff_frequency); 136 void ph3py_get_real_self_energy_at_bands(double *real_self_energy, 137 const Darray *fc3_normal_squared, 138 const int *band_indices, 139 const double *frequencies, 140 const size_t (*triplets)[3], 141 const int *triplet_weights, 142 const double epsilon, 143 const double temperature, 144 const double unit_conversion_factor, 145 const double cutoff_frequency); 146 void ph3py_get_real_self_energy_at_frequency_point( 147 double *real_self_energy, 148 const double frequency_point, 149 const Darray *fc3_normal_squared, 150 const int *band_indices, 151 const double *frequencies, 152 const size_t (*triplets)[3], 153 const int *triplet_weights, 154 const double epsilon, 155 const double temperature, 156 const double unit_conversion_factor, 157 const double cutoff_frequency); 158 void ph3py_get_collision_matrix(double *collision_matrix, 159 const Darray *fc3_normal_squared, 160 const double *frequencies, 161 const size_t (*triplets)[3], 162 const size_t *triplets_map, 163 const size_t *map_q, 164 const size_t *rotated_grid_points, 165 const double *rotations_cartesian, 166 const double *g, 167 const size_t num_ir_gp, 168 const size_t num_gp, 169 const size_t num_rot, 170 const double temperature, 171 const double unit_conversion_factor, 172 const double cutoff_frequency); 173 void ph3py_get_reducible_collision_matrix(double *collision_matrix, 174 const Darray *fc3_normal_squared, 175 const double *frequencies, 176 const size_t (*triplets)[3], 177 const size_t *triplets_map, 178 const size_t *map_q, 179 const double *g, 180 const size_t num_gp, 181 const double temperature, 182 const double unit_conversion_factor, 183 const double cutoff_frequency); 184 void ph3py_get_isotope_scattering_strength( 185 double *gamma, 186 const size_t grid_point, 187 const double *mass_variances, 188 const double *frequencies, 189 const lapack_complex_double *eigenvectors, 190 const size_t num_grid_points, 191 const int *band_indices, 192 const size_t num_band, 193 const size_t num_band0, 194 const double sigma, 195 const double cutoff_frequency); 196 void ph3py_get_thm_isotope_scattering_strength( 197 double *gamma, 198 const size_t grid_point, 199 const size_t *ir_grid_points, 200 const int *weights, 201 const double *mass_variances, 202 const double *frequencies, 203 const lapack_complex_double *eigenvectors, 204 const size_t num_ir_grid_points, 205 const int *band_indices, 206 const size_t num_band, 207 const size_t num_band0, 208 const double *integration_weights, 209 const double cutoff_frequency); 210 void ph3py_distribute_fc3(double *fc3, 211 const int target, 212 const int source, 213 const int *atom_mapping, 214 const size_t num_atom, 215 const double *rot_cart); 216 void ph3py_rotate_delta_fc2(double (*fc3)[3][3][3], 217 PHPYCONST double (*delta_fc2s)[3][3], 218 const double *inv_U, 219 PHPYCONST double (*site_sym_cart)[3][3], 220 const int *rot_map_syms, 221 const size_t num_atom, 222 const size_t num_site_sym, 223 const size_t num_disp); 224 void ph3py_set_permutation_symmetry_fc3(double *fc3, const size_t num_atom); 225 void ph3py_set_permutation_symmetry_compact_fc3(double * fc3, 226 const int p2s[], 227 const int s2pp[], 228 const int nsym_list[], 229 const int perms[], 230 const size_t n_satom, 231 const size_t n_patom); 232 void ph3py_transpose_compact_fc3(double * fc3, 233 const int p2s[], 234 const int s2pp[], 235 const int nsym_list[], 236 const int perms[], 237 const size_t n_satom, 238 const size_t n_patom, 239 const int t_type); 240 size_t ph3py_get_triplets_reciprocal_mesh_at_q(size_t *map_triplets, 241 size_t *map_q, 242 int (*grid_address)[3], 243 const size_t grid_point, 244 const int mesh[3], 245 const int is_time_reversal, 246 const int num_rot, 247 PHPYCONST int (*rotations)[3][3], 248 const int swappable); 249 size_t ph3py_get_BZ_triplets_at_q(size_t (*triplets)[3], 250 const size_t grid_point, 251 PHPYCONST int (*bz_grid_address)[3], 252 const size_t *bz_map, 253 const size_t *map_triplets, 254 const size_t num_map_triplets, 255 const int mesh[3]); 256 void ph3py_get_integration_weight(double *iw, 257 char *iw_zero, 258 const double *frequency_points, 259 const size_t num_band0, 260 PHPYCONST int relative_grid_address[24][4][3], 261 const int mesh[3], 262 PHPYCONST size_t (*triplets)[3], 263 const size_t num_triplets, 264 PHPYCONST int (*bz_grid_address)[3], 265 const size_t *bz_map, 266 const double *frequencies1, 267 const size_t num_band1, 268 const double *frequencies2, 269 const size_t num_band2, 270 const size_t tp_type, 271 const int openmp_per_triplets, 272 const int openmp_per_bands); 273 void ph3py_get_integration_weight_with_sigma(double *iw, 274 char *iw_zero, 275 const double sigma, 276 const double sigma_cutoff, 277 const double *frequency_points, 278 const size_t num_band0, 279 PHPYCONST size_t (*triplets)[3], 280 const size_t num_triplets, 281 const double *frequencies, 282 const size_t num_band, 283 const size_t tp_type); 284 285 286 void ph3py_symmetrize_collision_matrix(double *collision_matrix, 287 const long num_column, 288 const long num_temp, 289 const long num_sigma); 290 void ph3py_expand_collision_matrix(double *collision_matrix, 291 const size_t *rot_grid_points, 292 const size_t *ir_grid_points, 293 const long num_ir_gp, 294 const long num_grid_points, 295 const long num_rot, 296 const long num_sigma, 297 const long num_temp, 298 const long num_band); 299 void ph3py_get_neighboring_gird_points(size_t *relative_grid_points, 300 const size_t *grid_points, 301 PHPYCONST int (*relative_grid_address)[3], 302 const int mesh[3], 303 PHPYCONST int (*bz_grid_address)[3], 304 const size_t *bz_map, 305 const long num_grid_points, 306 const long num_relative_grid_address); 307 void ph3py_set_integration_weights(double *iw, 308 const double *frequency_points, 309 const long num_band0, 310 const long num_band, 311 const long num_gp, 312 PHPYCONST int (*relative_grid_address)[4][3], 313 const int mesh[3], 314 const size_t *grid_points, 315 PHPYCONST int (*bz_grid_address)[3], 316 const size_t *bz_map, 317 const double *frequencies); 318 319 #endif 320