Rename phonoc_utils -> funcs

This commit is contained in:
Atsushi Togo 2024-07-14 15:13:11 +09:00
parent 1e02000c2e
commit 78c1e1d70b
10 changed files with 30 additions and 34 deletions

View File

@ -176,7 +176,7 @@ if(BUILD_PHPHCALC_LIB OR BUILD_NANOBIND_MODULE)
${PROJECT_SOURCE_DIR}/c/isotope.c
${PROJECT_SOURCE_DIR}/c/lapack_wrapper.c
${PROJECT_SOURCE_DIR}/c/phono3py.c
${PROJECT_SOURCE_DIR}/c/phonoc_utils.c
${PROJECT_SOURCE_DIR}/c/funcs.c
${PROJECT_SOURCE_DIR}/c/pp_collision.c
${PROJECT_SOURCE_DIR}/c/real_self_energy.c
${PROJECT_SOURCE_DIR}/c/real_to_reciprocal.c
@ -358,7 +358,7 @@ if(BUILD_GRIDSYS_LIB)
${PROJECT_SOURCE_DIR}/c/gridsys.c
${PROJECT_SOURCE_DIR}/c/lagrid.c
${PROJECT_SOURCE_DIR}/c/niggli.c
${PROJECT_SOURCE_DIR}/c/phonoc_utils.c
${PROJECT_SOURCE_DIR}/c/funcs.c
${PROJECT_SOURCE_DIR}/c/snf3x3.c
${PROJECT_SOURCE_DIR}/c/tetrahedron_method.c
${PROJECT_SOURCE_DIR}/c/triplet.c

View File

@ -38,8 +38,8 @@
#include <stdio.h>
#include <stdlib.h>
#include "funcs.h"
#include "phonoc_array.h"
#include "phonoc_utils.h"
static void get_collision_matrix(
double *collision_matrix, const double *fc3_normal_squared,
@ -255,7 +255,7 @@ static long get_inv_sinh(double *inv_sinh, const long gp,
for (i = 0; i < num_band; i++) {
f = frequencies[gp2 * num_band + i];
if (f > cutoff_frequency) {
inv_sinh[i] = phonoc_inv_sinh_occupation(f, temperature);
inv_sinh[i] = funcs_inv_sinh_occupation(f, temperature);
} else {
inv_sinh[i] = 0;
}

View File

@ -32,7 +32,7 @@
/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
#include "phonoc_utils.h"
#include "funcs.h"
#include <math.h>
@ -41,14 +41,14 @@
#define THZTOEVPARKB 47.992398658977166
#define INVSQRT2PI 0.3989422804014327
double phonoc_bose_einstein(const double x, const double t) {
double funcs_bose_einstein(const double x, const double t) {
return 1.0 / (exp(THZTOEVPARKB * x / t) - 1);
}
double phonoc_gaussian(const double x, const double sigma) {
double funcs_gaussian(const double x, const double sigma) {
return INVSQRT2PI / sigma * exp(-x * x / 2 / sigma / sigma);
}
double phonoc_inv_sinh_occupation(const double x, const double t) {
double funcs_inv_sinh_occupation(const double x, const double t) {
return 1.0 / sinh(x * THZTOEVPARKB / 2 / t);
}

View File

@ -32,11 +32,11 @@
/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
#ifndef __phonoc_utils_H__
#define __phonoc_utils_H__
#ifndef __funcs_H__
#define __funcs_H__
double phonoc_bose_einstein(const double x, const double t);
double phonoc_gaussian(const double x, const double sigma);
double phonoc_inv_sinh_occupation(const double x, const double t);
double funcs_bose_einstein(const double x, const double t);
double funcs_gaussian(const double x, const double sigma);
double funcs_inv_sinh_occupation(const double x, const double t);
#endif

View File

@ -38,9 +38,9 @@
#include <stdio.h>
#include <stdlib.h>
#include "funcs.h"
#include "lagrid.h"
#include "phonoc_array.h"
#include "phonoc_utils.h"
#include "triplet.h"
static long set_g_pos_frequency_point(long (*g_pos)[4], const long num_band0,
@ -455,12 +455,12 @@ static void set_occupations(double *n1, double *n2, const long num_band,
f1 = frequencies[triplet[1] * num_band + j];
f2 = frequencies[triplet[2] * num_band + j];
if (f1 > cutoff_frequency) {
n1[j] = phonoc_bose_einstein(f1, temperature);
n1[j] = funcs_bose_einstein(f1, temperature);
} else {
n1[j] = -1;
}
if (f2 > cutoff_frequency) {
n2[j] = phonoc_bose_einstein(f2, temperature);
n2[j] = funcs_bose_einstein(f2, temperature);
} else {
n2[j] = -1;
}

View File

@ -36,9 +36,9 @@
#include <stdlib.h>
#include "funcs.h"
#include "lapack_wrapper.h"
#include "phonoc_const.h"
#include "phonoc_utils.h"
void iso_get_isotope_scattering_strength(
double *gamma, const long grid_point, const long *ir_grid_points,
@ -75,8 +75,8 @@ void iso_get_isotope_scattering_strength(
}
sum_g = 0;
#ifdef _OPENMP
#pragma omp parallel for private(gp, k, l, m, f, e1_r, e1_i, a, b, dist, sum_g_k) reduction(+ \
: sum_g)
#pragma omp parallel for private(gp, k, l, m, f, e1_r, e1_i, a, b, dist, \
sum_g_k) reduction(+ : sum_g)
#endif
for (j = 0; j < num_grid_points; j++) {
gp = ir_grid_points[j];
@ -86,7 +86,7 @@ void iso_get_isotope_scattering_strength(
if (f < cutoff_frequency) {
continue;
}
dist = phonoc_gaussian(f - f0[i], sigma);
dist = funcs_gaussian(f - f0[i], sigma);
for (l = 0; l < num_band / 3; l++) { /* elements */
a = 0;
b = 0;
@ -162,7 +162,7 @@ void iso_get_thm_isotope_scattering_strength(
#ifdef _OPENMP
#pragma omp parallel for private(j, k, l, m, f, gp, e1_r, e1_i, a, b, dist, \
sum_g_k)
sum_g_k)
#endif
for (i = 0; i < num_grid_points; i++) {
gp = ir_grid_points[i];

View File

@ -37,11 +37,11 @@
#include <stdio.h>
#include <stdlib.h>
#include "funcs.h"
#include "imag_self_energy_with_g.h"
#include "interaction.h"
#include "lapack_wrapper.h"
#include "phonoc_array.h"
#include "phonoc_utils.h"
#include "real_to_reciprocal.h"
#include "recgrid.h"
#include "triplet.h"

View File

@ -37,8 +37,8 @@
#include <math.h>
#include <stdlib.h>
#include "funcs.h"
#include "phonoc_array.h"
#include "phonoc_utils.h"
#include "real_to_reciprocal.h"
static double get_real_self_energy_at_band(
@ -160,10 +160,10 @@ static double sum_real_self_energy_at_band(
shift = 0;
for (i = 0; i < num_band; i++) {
if (freqs1[i] > cutoff_frequency) {
n1 = phonoc_bose_einstein(freqs1[i], temperature);
n1 = funcs_bose_einstein(freqs1[i], temperature);
for (j = 0; j < num_band; j++) {
if (freqs2[j] > cutoff_frequency) {
n2 = phonoc_bose_einstein(freqs2[j], temperature);
n2 = funcs_bose_einstein(freqs2[j], temperature);
f1 = fpoint + freqs1[i] + freqs2[j];
f2 = fpoint - freqs1[i] - freqs2[j];
f3 = fpoint - freqs1[i] + freqs2[j];

View File

@ -39,10 +39,7 @@
#include <stddef.h>
#include <stdlib.h>
#include "bzgrid.h"
#include "grgrid.h"
#include "lagrid.h"
#include "triplet.h"
static long get_ir_triplets_at_q(long *map_triplets, long *map_q,
const long grid_point, const long D_diag[3],

View File

@ -36,10 +36,9 @@
#include <math.h>
#include "funcs.h"
#include "grgrid.h"
#include "phonoc_utils.h"
#include "tetrahedron_method.h"
#include "triplet.h"
static void set_freq_vertices(double freq_vertices[3][24][4],
const double *frequencies1,
@ -159,9 +158,9 @@ void tpi_get_integration_weight_with_sigma(
g2 = 0;
} else {
iw_zero[adrs_shift] = 0;
g0 = phonoc_gaussian(f0 + f1 - f2, sigma);
g1 = phonoc_gaussian(f0 - f1 + f2, sigma);
g2 = phonoc_gaussian(f0 - f1 - f2, sigma);
g0 = funcs_gaussian(f0 + f1 - f2, sigma);
g1 = funcs_gaussian(f0 - f1 + f2, sigma);
g2 = funcs_gaussian(f0 - f1 - f2, sigma);
}
if (tp_type == 2) {
iw[adrs_shift] = g2;
@ -182,7 +181,7 @@ void tpi_get_integration_weight_with_sigma(
iw[adrs_shift] = 0;
} else {
iw_zero[adrs_shift] = 0;
iw[adrs_shift] = phonoc_gaussian(f0 + f1 - f2, sigma);
iw[adrs_shift] = funcs_gaussian(f0 + f1 - f2, sigma);
}
}
}