mirror of https://github.com/phonopy/phono3py.git
Some OpenMP controls are moved to real_to_reciprocal.c and reciprocal_to_normal.c from interaction.c
This commit is contained in:
parent
6320ca1f93
commit
55e0ea6811
|
@ -293,60 +293,36 @@ static void real_to_normal(double *fc3_normal_squared,
|
|||
fc3_reciprocal =
|
||||
(lapack_complex_double*)malloc(sizeof(lapack_complex_double) *
|
||||
num_patom * num_patom * num_patom * 27);
|
||||
|
||||
if (openmp_at_bands) {
|
||||
real_to_reciprocal_openmp(fc3_reciprocal,
|
||||
q,
|
||||
fc3,
|
||||
shortest_vectors,
|
||||
multiplicity,
|
||||
p2s_map,
|
||||
s2p_map);
|
||||
} else {
|
||||
real_to_reciprocal(fc3_reciprocal,
|
||||
q,
|
||||
fc3,
|
||||
shortest_vectors,
|
||||
multiplicity,
|
||||
p2s_map,
|
||||
s2p_map);
|
||||
}
|
||||
real_to_reciprocal(fc3_reciprocal,
|
||||
q,
|
||||
fc3,
|
||||
shortest_vectors,
|
||||
multiplicity,
|
||||
p2s_map,
|
||||
s2p_map,
|
||||
openmp_at_bands);
|
||||
|
||||
if (openmp_at_bands) {
|
||||
#ifdef MEASURE_R2N
|
||||
printf("At triplet %d/%d (# of bands=%d):\n",
|
||||
triplet_index, num_triplets, num_band0);
|
||||
#endif
|
||||
reciprocal_to_normal_squared_openmp(fc3_normal_squared,
|
||||
g_zero,
|
||||
fc3_reciprocal,
|
||||
freqs0,
|
||||
freqs1,
|
||||
freqs2,
|
||||
eigvecs0,
|
||||
eigvecs1,
|
||||
eigvecs2,
|
||||
masses,
|
||||
band_indices,
|
||||
num_band0,
|
||||
num_band,
|
||||
cutoff_frequency);
|
||||
} else {
|
||||
reciprocal_to_normal_squared(fc3_normal_squared,
|
||||
g_zero,
|
||||
fc3_reciprocal,
|
||||
freqs0,
|
||||
freqs1,
|
||||
freqs2,
|
||||
eigvecs0,
|
||||
eigvecs1,
|
||||
eigvecs2,
|
||||
masses,
|
||||
band_indices,
|
||||
num_band0,
|
||||
num_band,
|
||||
cutoff_frequency);
|
||||
}
|
||||
reciprocal_to_normal_squared(fc3_normal_squared,
|
||||
g_zero,
|
||||
fc3_reciprocal,
|
||||
freqs0,
|
||||
freqs1,
|
||||
freqs2,
|
||||
eigvecs0,
|
||||
eigvecs1,
|
||||
eigvecs2,
|
||||
masses,
|
||||
band_indices,
|
||||
num_band0,
|
||||
num_band,
|
||||
cutoff_frequency,
|
||||
openmp_at_bands);
|
||||
|
||||
free(fc3_reciprocal);
|
||||
fc3_reciprocal = NULL;
|
||||
|
|
|
@ -41,6 +41,22 @@
|
|||
#include <phonoc_utils.h>
|
||||
#include <phonon3_h/real_to_reciprocal.h>
|
||||
|
||||
static void
|
||||
real_to_reciprocal_single_thread(lapack_complex_double *fc3_reciprocal,
|
||||
const double q[9],
|
||||
const Darray *fc3,
|
||||
const Darray *shortest_vectors,
|
||||
const Iarray *multiplicity,
|
||||
const int *p2s_map,
|
||||
const int *s2p_map);
|
||||
static void
|
||||
real_to_reciprocal_openmp(lapack_complex_double *fc3_reciprocal,
|
||||
const double q[9],
|
||||
const Darray *fc3,
|
||||
const Darray *shortest_vectors,
|
||||
const Iarray *multiplicity,
|
||||
const int *p2s_map,
|
||||
const int *s2p_map);
|
||||
static void real_to_reciprocal_elements(lapack_complex_double *fc3_rec_elem,
|
||||
const double q[9],
|
||||
const Darray *fc3,
|
||||
|
@ -64,7 +80,37 @@ void real_to_reciprocal(lapack_complex_double *fc3_reciprocal,
|
|||
const Darray *shortest_vectors,
|
||||
const Iarray *multiplicity,
|
||||
const int *p2s_map,
|
||||
const int *s2p_map)
|
||||
const int *s2p_map,
|
||||
const int openmp_at_bands)
|
||||
{
|
||||
if (openmp_at_bands) {
|
||||
real_to_reciprocal_openmp(fc3_reciprocal,
|
||||
q,
|
||||
fc3,
|
||||
shortest_vectors,
|
||||
multiplicity,
|
||||
p2s_map,
|
||||
s2p_map);
|
||||
} else {
|
||||
real_to_reciprocal_single_thread(fc3_reciprocal,
|
||||
q,
|
||||
fc3,
|
||||
shortest_vectors,
|
||||
multiplicity,
|
||||
p2s_map,
|
||||
s2p_map);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
real_to_reciprocal_single_thread(lapack_complex_double *fc3_reciprocal,
|
||||
const double q[9],
|
||||
const Darray *fc3,
|
||||
const Darray *shortest_vectors,
|
||||
const Iarray *multiplicity,
|
||||
const int *p2s_map,
|
||||
const int *s2p_map)
|
||||
{
|
||||
int i, j, k, num_patom, adrs_shift;
|
||||
lapack_complex_double pre_phase_factor;
|
||||
|
@ -97,13 +143,14 @@ void real_to_reciprocal(lapack_complex_double *fc3_reciprocal,
|
|||
}
|
||||
}
|
||||
|
||||
void real_to_reciprocal_openmp(lapack_complex_double *fc3_reciprocal,
|
||||
const double q[9],
|
||||
const Darray *fc3,
|
||||
const Darray *shortest_vectors,
|
||||
const Iarray *multiplicity,
|
||||
const int *p2s_map,
|
||||
const int *s2p_map)
|
||||
static void
|
||||
real_to_reciprocal_openmp(lapack_complex_double *fc3_reciprocal,
|
||||
const double q[9],
|
||||
const Darray *fc3,
|
||||
const Darray *shortest_vectors,
|
||||
const Iarray *multiplicity,
|
||||
const int *p2s_map,
|
||||
const int *s2p_map)
|
||||
{
|
||||
int i, j, k, jk, num_patom, adrs_shift;
|
||||
lapack_complex_double pre_phase_factor;
|
||||
|
|
|
@ -44,6 +44,38 @@
|
|||
#include <time.h>
|
||||
#endif
|
||||
|
||||
static void reciprocal_to_normal_squared_single_thread
|
||||
(double *fc3_normal_squared,
|
||||
const char *g_zero,
|
||||
const lapack_complex_double *fc3_reciprocal,
|
||||
const double *freqs0,
|
||||
const double *freqs1,
|
||||
const double *freqs2,
|
||||
const lapack_complex_double *eigvecs0,
|
||||
const lapack_complex_double *eigvecs1,
|
||||
const lapack_complex_double *eigvecs2,
|
||||
const double *masses,
|
||||
const int *band_indices,
|
||||
const int num_band0,
|
||||
const int num_band,
|
||||
const double cutoff_frequency);
|
||||
|
||||
static void reciprocal_to_normal_squared_openmp
|
||||
(double *fc3_normal_squared,
|
||||
const char *g_zero,
|
||||
const lapack_complex_double *fc3_reciprocal,
|
||||
const double *freqs0,
|
||||
const double *freqs1,
|
||||
const double *freqs2,
|
||||
const lapack_complex_double *eigvecs0,
|
||||
const lapack_complex_double *eigvecs1,
|
||||
const lapack_complex_double *eigvecs2,
|
||||
const double *masses,
|
||||
const int *band_indices,
|
||||
const int num_band0,
|
||||
const int num_band,
|
||||
const double cutoff_frequency);
|
||||
|
||||
static lapack_complex_double fc3_sum_in_reciprocal_to_normal
|
||||
(const int bi0,
|
||||
const int bi1,
|
||||
|
@ -70,7 +102,56 @@ static double get_fc3_sum
|
|||
const int num_atom,
|
||||
const double cutoff_frequency);
|
||||
|
||||
void reciprocal_to_normal_squared
|
||||
void reciprocal_to_normal_squared(double *fc3_normal_squared,
|
||||
const char *g_zero,
|
||||
const lapack_complex_double *fc3_reciprocal,
|
||||
const double *freqs0,
|
||||
const double *freqs1,
|
||||
const double *freqs2,
|
||||
const lapack_complex_double *eigvecs0,
|
||||
const lapack_complex_double *eigvecs1,
|
||||
const lapack_complex_double *eigvecs2,
|
||||
const double *masses,
|
||||
const int *band_indices,
|
||||
const int num_band0,
|
||||
const int num_band,
|
||||
const double cutoff_frequency,
|
||||
const int openmp_at_bands)
|
||||
{
|
||||
if (openmp_at_bands) {
|
||||
reciprocal_to_normal_squared_openmp(fc3_normal_squared,
|
||||
g_zero,
|
||||
fc3_reciprocal,
|
||||
freqs0,
|
||||
freqs1,
|
||||
freqs2,
|
||||
eigvecs0,
|
||||
eigvecs1,
|
||||
eigvecs2,
|
||||
masses,
|
||||
band_indices,
|
||||
num_band0,
|
||||
num_band,
|
||||
cutoff_frequency);
|
||||
} else {
|
||||
reciprocal_to_normal_squared_single_thread(fc3_normal_squared,
|
||||
g_zero,
|
||||
fc3_reciprocal,
|
||||
freqs0,
|
||||
freqs1,
|
||||
freqs2,
|
||||
eigvecs0,
|
||||
eigvecs1,
|
||||
eigvecs2,
|
||||
masses,
|
||||
band_indices,
|
||||
num_band0,
|
||||
num_band,
|
||||
cutoff_frequency);
|
||||
}
|
||||
}
|
||||
|
||||
static void reciprocal_to_normal_squared_single_thread
|
||||
(double *fc3_normal_squared,
|
||||
const char *g_zero,
|
||||
const lapack_complex_double *fc3_reciprocal,
|
||||
|
@ -117,7 +198,7 @@ void reciprocal_to_normal_squared
|
|||
}
|
||||
}
|
||||
|
||||
void reciprocal_to_normal_squared_openmp
|
||||
static void reciprocal_to_normal_squared_openmp
|
||||
(double *fc3_normal_squared,
|
||||
const char *g_zero,
|
||||
const lapack_complex_double *fc3_reciprocal,
|
||||
|
|
Loading…
Reference in New Issue