mirror of https://github.com/phonopy/phono3py.git
Introduce bzgrid to most C-extensions
This commit is contained in:
parent
7eb304f86f
commit
9411f45c45
|
@ -314,7 +314,7 @@ static PyObject * py_get_interaction(PyObject *self, PyObject *args)
|
|||
PyArrayObject *py_frequencies;
|
||||
PyArrayObject *py_eigenvectors;
|
||||
PyArrayObject *py_triplets;
|
||||
PyArrayObject *py_grid_address;
|
||||
PyArrayObject *py_bz_grid_addresses;
|
||||
PyArrayObject *py_mesh;
|
||||
PyArrayObject *py_shortest_vectors;
|
||||
PyArrayObject *py_multiplicities;
|
||||
|
@ -332,7 +332,7 @@ static PyObject * py_get_interaction(PyObject *self, PyObject *args)
|
|||
long (*triplets)[3];
|
||||
long num_triplets;
|
||||
char* g_zero;
|
||||
long *grid_address;
|
||||
long (*bz_grid_addresses)[3];
|
||||
long *mesh;
|
||||
double *fc3;
|
||||
double *svecs;
|
||||
|
@ -351,7 +351,7 @@ static PyObject * py_get_interaction(PyObject *self, PyObject *args)
|
|||
&py_frequencies,
|
||||
&py_eigenvectors,
|
||||
&py_triplets,
|
||||
&py_grid_address,
|
||||
&py_bz_grid_addresses,
|
||||
&py_mesh,
|
||||
&py_fc3,
|
||||
&py_shortest_vectors,
|
||||
|
@ -374,7 +374,7 @@ static PyObject * py_get_interaction(PyObject *self, PyObject *args)
|
|||
triplets = (long(*)[3])PyArray_DATA(py_triplets);
|
||||
num_triplets = (long)PyArray_DIMS(py_triplets)[0];
|
||||
g_zero = (char*)PyArray_DATA(py_g_zero);
|
||||
grid_address = (long*)PyArray_DATA(py_grid_address);
|
||||
bz_grid_addresses = (long(*)[3])PyArray_DATA(py_bz_grid_addresses);
|
||||
mesh = (long*)PyArray_DATA(py_mesh);
|
||||
fc3 = (double*)PyArray_DATA(py_fc3);
|
||||
if (PyArray_DIMS(py_fc3)[0] == PyArray_DIMS(py_fc3)[1]) {
|
||||
|
@ -398,7 +398,7 @@ static PyObject * py_get_interaction(PyObject *self, PyObject *args)
|
|||
eigvecs,
|
||||
triplets,
|
||||
num_triplets,
|
||||
grid_address,
|
||||
bz_grid_addresses,
|
||||
mesh,
|
||||
fc3,
|
||||
is_compact_fc3,
|
||||
|
@ -428,7 +428,7 @@ static PyObject * py_get_pp_collision(PyObject *self, PyObject *args)
|
|||
PyArrayObject *py_eigenvectors;
|
||||
PyArrayObject *py_triplets;
|
||||
PyArrayObject *py_triplet_weights;
|
||||
PyArrayObject *py_grid_address;
|
||||
PyArrayObject *py_bz_grid_addresses;
|
||||
PyArrayObject *py_bz_map;
|
||||
PyArrayObject *py_mesh;
|
||||
PyArrayObject *py_fc3;
|
||||
|
@ -442,6 +442,7 @@ static PyObject * py_get_pp_collision(PyObject *self, PyObject *args)
|
|||
double cutoff_frequency;
|
||||
long is_NU;
|
||||
long symmetrize_fc3_q;
|
||||
long bz_grid_type;
|
||||
|
||||
double *gamma;
|
||||
long (*relative_grid_address)[4][3];
|
||||
|
@ -450,7 +451,7 @@ static PyObject * py_get_pp_collision(PyObject *self, PyObject *args)
|
|||
long (*triplets)[3];
|
||||
long num_triplets;
|
||||
long *triplet_weights;
|
||||
long *grid_address;
|
||||
long (*bz_grid_addresses)[3];
|
||||
long *bz_map;
|
||||
long *mesh;
|
||||
double *fc3;
|
||||
|
@ -465,15 +466,16 @@ static PyObject * py_get_pp_collision(PyObject *self, PyObject *args)
|
|||
long i;
|
||||
long is_compact_fc3;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OOOOOOOOOOOOOOOOOlld",
|
||||
if (!PyArg_ParseTuple(args, "OOOOOOOOlOOOOOOOOOlld",
|
||||
&py_gamma,
|
||||
&py_relative_grid_address,
|
||||
&py_frequencies,
|
||||
&py_eigenvectors,
|
||||
&py_triplets,
|
||||
&py_triplet_weights,
|
||||
&py_grid_address,
|
||||
&py_bz_grid_addresses,
|
||||
&py_bz_map,
|
||||
&bz_grid_type,
|
||||
&py_mesh,
|
||||
&py_fc3,
|
||||
&py_shortest_vectors,
|
||||
|
@ -496,7 +498,7 @@ static PyObject * py_get_pp_collision(PyObject *self, PyObject *args)
|
|||
triplets = (long(*)[3])PyArray_DATA(py_triplets);
|
||||
num_triplets = (long)PyArray_DIMS(py_triplets)[0];
|
||||
triplet_weights = (long*)PyArray_DATA(py_triplet_weights);
|
||||
grid_address = (long*)PyArray_DATA(py_grid_address);
|
||||
bz_grid_addresses = (long(*)[3])PyArray_DATA(py_bz_grid_addresses);
|
||||
bz_map = (long*)PyArray_DATA(py_bz_map);
|
||||
mesh = (long*)PyArray_DATA(py_mesh);
|
||||
fc3 = (double*)PyArray_DATA(py_fc3);
|
||||
|
@ -523,8 +525,9 @@ static PyObject * py_get_pp_collision(PyObject *self, PyObject *args)
|
|||
triplets,
|
||||
num_triplets,
|
||||
triplet_weights,
|
||||
grid_address,
|
||||
bz_grid_addresses,
|
||||
bz_map,
|
||||
bz_grid_type,
|
||||
mesh,
|
||||
fc3,
|
||||
is_compact_fc3,
|
||||
|
@ -555,7 +558,7 @@ static PyObject * py_get_pp_collision_with_sigma(PyObject *self, PyObject *args)
|
|||
PyArrayObject *py_eigenvectors;
|
||||
PyArrayObject *py_triplets;
|
||||
PyArrayObject *py_triplet_weights;
|
||||
PyArrayObject *py_grid_address;
|
||||
PyArrayObject *py_bz_grid_addresses;
|
||||
PyArrayObject *py_mesh;
|
||||
PyArrayObject *py_fc3;
|
||||
PyArrayObject *py_shortest_vectors;
|
||||
|
@ -577,7 +580,7 @@ static PyObject * py_get_pp_collision_with_sigma(PyObject *self, PyObject *args)
|
|||
long (*triplets)[3];
|
||||
long num_triplets;
|
||||
long *triplet_weights;
|
||||
long *grid_address;
|
||||
long (*bz_grid_addresses)[3];
|
||||
long *mesh;
|
||||
double *fc3;
|
||||
double *svecs;
|
||||
|
@ -599,7 +602,7 @@ static PyObject * py_get_pp_collision_with_sigma(PyObject *self, PyObject *args)
|
|||
&py_eigenvectors,
|
||||
&py_triplets,
|
||||
&py_triplet_weights,
|
||||
&py_grid_address,
|
||||
&py_bz_grid_addresses,
|
||||
&py_mesh,
|
||||
&py_fc3,
|
||||
&py_shortest_vectors,
|
||||
|
@ -621,7 +624,7 @@ static PyObject * py_get_pp_collision_with_sigma(PyObject *self, PyObject *args)
|
|||
triplets = (long(*)[3])PyArray_DATA(py_triplets);
|
||||
num_triplets = (long)PyArray_DIMS(py_triplets)[0];
|
||||
triplet_weights = (long*)PyArray_DATA(py_triplet_weights);
|
||||
grid_address = (long*)PyArray_DATA(py_grid_address);
|
||||
bz_grid_addresses = (long(*)[3])PyArray_DATA(py_bz_grid_addresses);
|
||||
mesh = (long*)PyArray_DATA(py_mesh);
|
||||
fc3 = (double*)PyArray_DATA(py_fc3);
|
||||
if (PyArray_DIMS(py_fc3)[0] == PyArray_DIMS(py_fc3)[1]) {
|
||||
|
@ -648,7 +651,7 @@ static PyObject * py_get_pp_collision_with_sigma(PyObject *self, PyObject *args)
|
|||
triplets,
|
||||
num_triplets,
|
||||
triplet_weights,
|
||||
grid_address,
|
||||
bz_grid_addresses,
|
||||
mesh,
|
||||
fc3,
|
||||
is_compact_fc3,
|
||||
|
@ -744,7 +747,7 @@ py_get_detailed_imag_self_energy_with_g(PyObject *self, PyObject *args)
|
|||
PyArrayObject *py_frequencies;
|
||||
PyArrayObject *py_triplets;
|
||||
PyArrayObject *py_triplet_weights;
|
||||
PyArrayObject *py_grid_address;
|
||||
PyArrayObject *py_bz_grid_addresses;
|
||||
PyArrayObject *py_g;
|
||||
PyArrayObject *py_g_zero;
|
||||
double cutoff_frequency, temperature;
|
||||
|
@ -758,7 +761,7 @@ py_get_detailed_imag_self_energy_with_g(PyObject *self, PyObject *args)
|
|||
double *frequencies;
|
||||
long (*triplets)[3];
|
||||
long *triplet_weights;
|
||||
long *grid_address;
|
||||
long (*bz_grid_addresses)[3];
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OOOOOOOOdOOd",
|
||||
&py_gamma_detail,
|
||||
|
@ -767,7 +770,7 @@ py_get_detailed_imag_self_energy_with_g(PyObject *self, PyObject *args)
|
|||
&py_fc3_normal_squared,
|
||||
&py_triplets,
|
||||
&py_triplet_weights,
|
||||
&py_grid_address,
|
||||
&py_bz_grid_addresses,
|
||||
&py_frequencies,
|
||||
&temperature,
|
||||
&py_g,
|
||||
|
@ -785,7 +788,7 @@ py_get_detailed_imag_self_energy_with_g(PyObject *self, PyObject *args)
|
|||
frequencies = (double*)PyArray_DATA(py_frequencies);
|
||||
triplets = (long(*)[3])PyArray_DATA(py_triplets);
|
||||
triplet_weights = (long*)PyArray_DATA(py_triplet_weights);
|
||||
grid_address = (long*)PyArray_DATA(py_grid_address);
|
||||
bz_grid_addresses = (long(*)[3])PyArray_DATA(py_bz_grid_addresses);
|
||||
|
||||
ph3py_get_detailed_imag_self_energy_at_bands_with_g(gamma_detail,
|
||||
gamma_N,
|
||||
|
@ -794,7 +797,7 @@ py_get_detailed_imag_self_energy_with_g(PyObject *self, PyObject *args)
|
|||
frequencies,
|
||||
triplets,
|
||||
triplet_weights,
|
||||
grid_address,
|
||||
bz_grid_addresses,
|
||||
g,
|
||||
g_zero,
|
||||
temperature,
|
||||
|
@ -1465,6 +1468,7 @@ static PyObject * py_get_neighboring_grid_points(PyObject *self, PyObject *args)
|
|||
PyArrayObject *py_mesh;
|
||||
PyArrayObject *py_bz_grid_address;
|
||||
PyArrayObject *py_bz_map;
|
||||
long bz_grid_type;
|
||||
|
||||
long *relative_grid_points;
|
||||
long *grid_points;
|
||||
|
@ -1474,13 +1478,14 @@ static PyObject * py_get_neighboring_grid_points(PyObject *self, PyObject *args)
|
|||
long (*bz_grid_address)[3];
|
||||
long *bz_map;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OOOOOO",
|
||||
if (!PyArg_ParseTuple(args, "OOOOOOl",
|
||||
&py_relative_grid_points,
|
||||
&py_grid_points,
|
||||
&py_relative_grid_address,
|
||||
&py_mesh,
|
||||
&py_bz_grid_address,
|
||||
&py_bz_map)) {
|
||||
&py_bz_map,
|
||||
&bz_grid_type)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1499,6 +1504,7 @@ static PyObject * py_get_neighboring_grid_points(PyObject *self, PyObject *args)
|
|||
mesh,
|
||||
bz_grid_address,
|
||||
bz_map,
|
||||
bz_grid_type,
|
||||
num_grid_points,
|
||||
num_relative_grid_address);
|
||||
|
||||
|
@ -1515,6 +1521,7 @@ static PyObject * py_set_integration_weights(PyObject *self, PyObject *args)
|
|||
PyArrayObject *py_frequencies;
|
||||
PyArrayObject *py_bz_grid_address;
|
||||
PyArrayObject *py_bz_map;
|
||||
long bz_grid_type;
|
||||
|
||||
double *iw;
|
||||
double *frequency_points;
|
||||
|
@ -1526,7 +1533,7 @@ static PyObject * py_set_integration_weights(PyObject *self, PyObject *args)
|
|||
long *bz_map;
|
||||
double *frequencies;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OOOOOOOO",
|
||||
if (!PyArg_ParseTuple(args, "OOOOOOOOl",
|
||||
&py_iw,
|
||||
&py_frequency_points,
|
||||
&py_relative_grid_address,
|
||||
|
@ -1534,7 +1541,8 @@ static PyObject * py_set_integration_weights(PyObject *self, PyObject *args)
|
|||
&py_grid_points,
|
||||
&py_frequencies,
|
||||
&py_bz_grid_address,
|
||||
&py_bz_map)) {
|
||||
&py_bz_map,
|
||||
&bz_grid_type)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1560,6 +1568,7 @@ static PyObject * py_set_integration_weights(PyObject *self, PyObject *args)
|
|||
grid_points,
|
||||
bz_grid_address,
|
||||
bz_map,
|
||||
bz_grid_type,
|
||||
frequencies);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
@ -1675,8 +1684,9 @@ py_set_triplets_integration_weights(PyObject *self, PyObject *args)
|
|||
PyArrayObject *py_triplets;
|
||||
PyArrayObject *py_frequencies1;
|
||||
PyArrayObject *py_frequencies2;
|
||||
PyArrayObject *py_bz_grid_address;
|
||||
PyArrayObject *py_bz_grid_addresses;
|
||||
PyArrayObject *py_bz_map;
|
||||
long bz_grid_type;
|
||||
long tp_type;
|
||||
|
||||
double *iw;
|
||||
|
@ -1685,12 +1695,12 @@ py_set_triplets_integration_weights(PyObject *self, PyObject *args)
|
|||
long (*relative_grid_address)[4][3];
|
||||
long *mesh;
|
||||
long (*triplets)[3];
|
||||
long (*bz_grid_address)[3];
|
||||
long (*bz_grid_addresses)[3];
|
||||
long *bz_map;
|
||||
double *frequencies1, *frequencies2;
|
||||
long num_band0, num_band1, num_band2, num_triplets;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OOOOOOOOOOl",
|
||||
if (!PyArg_ParseTuple(args, "OOOOOOOOOOll",
|
||||
&py_iw,
|
||||
&py_iw_zero,
|
||||
&py_frequency_points,
|
||||
|
@ -1699,8 +1709,9 @@ py_set_triplets_integration_weights(PyObject *self, PyObject *args)
|
|||
&py_triplets,
|
||||
&py_frequencies1,
|
||||
&py_frequencies2,
|
||||
&py_bz_grid_address,
|
||||
&py_bz_grid_addresses,
|
||||
&py_bz_map,
|
||||
&bz_grid_type,
|
||||
&tp_type)) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1713,7 +1724,7 @@ py_set_triplets_integration_weights(PyObject *self, PyObject *args)
|
|||
mesh = (long*)PyArray_DATA(py_mesh);
|
||||
triplets = (long(*)[3])PyArray_DATA(py_triplets);
|
||||
num_triplets = (long)PyArray_DIMS(py_triplets)[0];
|
||||
bz_grid_address = (long(*)[3])PyArray_DATA(py_bz_grid_address);
|
||||
bz_grid_addresses = (long(*)[3])PyArray_DATA(py_bz_grid_addresses);
|
||||
bz_map = (long*)PyArray_DATA(py_bz_map);
|
||||
frequencies1 = (double*)PyArray_DATA(py_frequencies1);
|
||||
frequencies2 = (double*)PyArray_DATA(py_frequencies2);
|
||||
|
@ -1728,8 +1739,9 @@ py_set_triplets_integration_weights(PyObject *self, PyObject *args)
|
|||
mesh,
|
||||
triplets,
|
||||
num_triplets,
|
||||
bz_grid_address,
|
||||
bz_grid_addresses,
|
||||
bz_map,
|
||||
bz_grid_type,
|
||||
frequencies1,
|
||||
num_band1,
|
||||
frequencies2,
|
||||
|
|
|
@ -187,7 +187,7 @@ void ise_get_detailed_imag_self_energy_at_bands_with_g
|
|||
const double *frequencies,
|
||||
const long (*triplets)[3],
|
||||
const long *triplet_weights,
|
||||
const long *grid_address,
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const double *g,
|
||||
const char *g_zero,
|
||||
const double temperature,
|
||||
|
@ -229,7 +229,7 @@ void ise_get_detailed_imag_self_energy_at_bands_with_g
|
|||
|
||||
is_N = (long*)malloc(sizeof(long) * num_triplets);
|
||||
for (i = 0; i < num_triplets; i++) {
|
||||
is_N[i] = tpl_is_N(triplets[i], grid_address);
|
||||
is_N[i] = tpl_is_N(triplets[i], bz_grid_addresses);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_band0; i++) {
|
||||
|
|
|
@ -57,7 +57,7 @@ void ise_get_detailed_imag_self_energy_at_bands_with_g
|
|||
const double *frequencies,
|
||||
const long (*triplets)[3],
|
||||
const long *triplet_weights,
|
||||
const long *grid_address,
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const double *g,
|
||||
const char *g_zero,
|
||||
const double temperature,
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "bzgrid.h"
|
||||
#include "phonoc_array.h"
|
||||
#include "phonoc_const.h"
|
||||
#include "interaction.h"
|
||||
|
@ -102,8 +103,7 @@ void itr_get_interaction(Darray *fc3_normal_squared,
|
|||
const lapack_complex_double *eigenvectors,
|
||||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *grid_address,
|
||||
const long *mesh,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
const double *shortest_vectors,
|
||||
|
@ -150,8 +150,7 @@ void itr_get_interaction(Darray *fc3_normal_squared,
|
|||
frequencies->data,
|
||||
eigenvectors,
|
||||
triplets[i],
|
||||
grid_address,
|
||||
mesh,
|
||||
bzgrid,
|
||||
fc3,
|
||||
is_compact_fc3,
|
||||
shortest_vectors,
|
||||
|
@ -180,8 +179,7 @@ void itr_get_interaction_at_triplet(double *fc3_normal_squared,
|
|||
const double *frequencies,
|
||||
const lapack_complex_double *eigenvectors,
|
||||
const long triplet[3],
|
||||
const long *grid_address,
|
||||
const long *mesh,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
const double *shortest_vectors,
|
||||
|
@ -204,7 +202,7 @@ void itr_get_interaction_at_triplet(double *fc3_normal_squared,
|
|||
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (k = 0; k < 3; k++) {
|
||||
q[j * 3 + k] = ((double)grid_address[triplet[j] * 3 + k]) / mesh[k];
|
||||
q[j * 3 + k] = ((double)bzgrid->addresses[triplet[j]][k]) / bzgrid->D_diag[k];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,7 @@ void itr_get_interaction(Darray *fc3_normal_squared,
|
|||
const lapack_complex_double *eigenvectors,
|
||||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *grid_address,
|
||||
const long *mesh,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
const double *shortest_vectors,
|
||||
|
@ -65,8 +64,7 @@ void itr_get_interaction_at_triplet(double *fc3_normal_squared,
|
|||
const double *frequencies,
|
||||
const lapack_complex_double *eigenvectors,
|
||||
const long triplet[3],
|
||||
const long *grid_address,
|
||||
const long *mesh,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
const double *shortest_vectors,
|
||||
|
|
178
c/phono3py.c
178
c/phono3py.c
|
@ -53,13 +53,13 @@
|
|||
#include <stdio.h>
|
||||
|
||||
|
||||
void ph3py_get_interaction(Darray *fc3_normal_squared,
|
||||
long ph3py_get_interaction(Darray *fc3_normal_squared,
|
||||
const char *g_zero,
|
||||
const Darray *frequencies,
|
||||
const lapack_complex_double *eigenvectors,
|
||||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *grid_address,
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const long *mesh,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
|
@ -73,14 +73,27 @@ void ph3py_get_interaction(Darray *fc3_normal_squared,
|
|||
const long symmetrize_fc3_q,
|
||||
const double cutoff_frequency)
|
||||
{
|
||||
ConstBZGrid *bzgrid;
|
||||
long i;
|
||||
|
||||
if ((bzgrid = (ConstBZGrid*) malloc(sizeof(ConstBZGrid))) == NULL) {
|
||||
warning_print("Memory could not be allocated.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bzgrid->addresses = bz_grid_addresses;
|
||||
for (i = 0; i < 3; i++) {
|
||||
bzgrid->D_diag[i] = mesh[i];
|
||||
bzgrid->PS[i] = 0;
|
||||
}
|
||||
|
||||
itr_get_interaction(fc3_normal_squared,
|
||||
g_zero,
|
||||
frequencies,
|
||||
eigenvectors,
|
||||
triplets,
|
||||
num_triplets,
|
||||
grid_address,
|
||||
mesh,
|
||||
bzgrid,
|
||||
fc3,
|
||||
is_compact_fc3,
|
||||
shortest_vectors,
|
||||
|
@ -92,18 +105,23 @@ void ph3py_get_interaction(Darray *fc3_normal_squared,
|
|||
band_indices,
|
||||
symmetrize_fc3_q,
|
||||
cutoff_frequency);
|
||||
free(bzgrid);
|
||||
bzgrid = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void ph3py_get_pp_collision(double *imag_self_energy,
|
||||
long ph3py_get_pp_collision(double *imag_self_energy,
|
||||
PHPYCONST long relative_grid_address[24][4][3], /* thm */
|
||||
const double *frequencies,
|
||||
const lapack_complex_double *eigenvectors,
|
||||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *triplet_weights,
|
||||
const long *grid_address, /* thm */
|
||||
const long (*bz_grid_addresses)[3], /* thm */
|
||||
const long *bz_map, /* thm */
|
||||
const long bz_grid_type,
|
||||
const long *mesh, /* thm */
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
|
@ -119,6 +137,22 @@ void ph3py_get_pp_collision(double *imag_self_energy,
|
|||
const long symmetrize_fc3_q,
|
||||
const double cutoff_frequency)
|
||||
{
|
||||
ConstBZGrid *bzgrid;
|
||||
long i;
|
||||
|
||||
if ((bzgrid = (ConstBZGrid*) malloc(sizeof(ConstBZGrid))) == NULL) {
|
||||
warning_print("Memory could not be allocated.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bzgrid->addresses = bz_grid_addresses;
|
||||
bzgrid->gp_map = bz_map;
|
||||
bzgrid->type = bz_grid_type;
|
||||
for (i = 0; i < 3; i++) {
|
||||
bzgrid->D_diag[i] = mesh[i];
|
||||
bzgrid->PS[i] = 0;
|
||||
}
|
||||
|
||||
ppc_get_pp_collision(imag_self_energy,
|
||||
relative_grid_address,
|
||||
frequencies,
|
||||
|
@ -126,9 +160,7 @@ void ph3py_get_pp_collision(double *imag_self_energy,
|
|||
triplets,
|
||||
num_triplets,
|
||||
triplet_weights,
|
||||
grid_address,
|
||||
bz_map,
|
||||
mesh,
|
||||
bzgrid,
|
||||
fc3,
|
||||
is_compact_fc3,
|
||||
shortest_vectors,
|
||||
|
@ -142,10 +174,15 @@ void ph3py_get_pp_collision(double *imag_self_energy,
|
|||
is_NU,
|
||||
symmetrize_fc3_q,
|
||||
cutoff_frequency);
|
||||
|
||||
free(bzgrid);
|
||||
bzgrid = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void ph3py_get_pp_collision_with_sigma(
|
||||
long ph3py_get_pp_collision_with_sigma(
|
||||
double *imag_self_energy,
|
||||
const double sigma,
|
||||
const double sigma_cutoff,
|
||||
|
@ -154,7 +191,7 @@ void ph3py_get_pp_collision_with_sigma(
|
|||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *triplet_weights,
|
||||
const long *grid_address,
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const long *mesh,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
|
@ -170,6 +207,20 @@ void ph3py_get_pp_collision_with_sigma(
|
|||
const long symmetrize_fc3_q,
|
||||
const double cutoff_frequency)
|
||||
{
|
||||
ConstBZGrid *bzgrid;
|
||||
long i;
|
||||
|
||||
if ((bzgrid = (ConstBZGrid*) malloc(sizeof(ConstBZGrid))) == NULL) {
|
||||
warning_print("Memory could not be allocated.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bzgrid->addresses = bz_grid_addresses;
|
||||
for (i = 0; i < 3; i++) {
|
||||
bzgrid->D_diag[i] = mesh[i];
|
||||
bzgrid->PS[i] = 0;
|
||||
}
|
||||
|
||||
ppc_get_pp_collision_with_sigma(imag_self_energy,
|
||||
sigma,
|
||||
sigma_cutoff,
|
||||
|
@ -178,8 +229,7 @@ void ph3py_get_pp_collision_with_sigma(
|
|||
triplets,
|
||||
num_triplets,
|
||||
triplet_weights,
|
||||
grid_address,
|
||||
mesh,
|
||||
bzgrid,
|
||||
fc3,
|
||||
is_compact_fc3,
|
||||
shortest_vectors,
|
||||
|
@ -193,6 +243,11 @@ void ph3py_get_pp_collision_with_sigma(
|
|||
is_NU,
|
||||
symmetrize_fc3_q,
|
||||
cutoff_frequency);
|
||||
|
||||
free(bzgrid);
|
||||
bzgrid = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -231,7 +286,7 @@ void ph3py_get_detailed_imag_self_energy_at_bands_with_g(
|
|||
const double *frequencies,
|
||||
const long (*triplets)[3],
|
||||
const long *triplet_weights,
|
||||
const long *grid_address,
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const double *g,
|
||||
const char *g_zero,
|
||||
const double temperature,
|
||||
|
@ -244,7 +299,7 @@ void ph3py_get_detailed_imag_self_energy_at_bands_with_g(
|
|||
frequencies,
|
||||
triplets,
|
||||
triplet_weights,
|
||||
grid_address,
|
||||
bz_grid_addresses,
|
||||
g,
|
||||
g_zero,
|
||||
temperature,
|
||||
|
@ -523,7 +578,7 @@ long ph3py_get_triplets_reciprocal_mesh_at_q(long *map_triplets,
|
|||
|
||||
long ph3py_get_BZ_triplets_at_q(long (*triplets)[3],
|
||||
const long grid_point,
|
||||
const long (*bz_grid_address)[3],
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const long *bz_map,
|
||||
const long *map_triplets,
|
||||
const long num_map_triplets,
|
||||
|
@ -538,7 +593,7 @@ long ph3py_get_BZ_triplets_at_q(long (*triplets)[3],
|
|||
return 0;
|
||||
}
|
||||
|
||||
bzgrid->addresses = bz_grid_address;
|
||||
bzgrid->addresses = bz_grid_addresses;
|
||||
bzgrid->gp_map = bz_map;
|
||||
bzgrid->type = type;
|
||||
for (i = 0; i < 3; i++) {
|
||||
|
@ -558,7 +613,7 @@ long ph3py_get_BZ_triplets_at_q(long (*triplets)[3],
|
|||
}
|
||||
|
||||
|
||||
void ph3py_get_integration_weight(double *iw,
|
||||
long ph3py_get_integration_weight(double *iw,
|
||||
char *iw_zero,
|
||||
const double *frequency_points,
|
||||
const long num_band0,
|
||||
|
@ -566,8 +621,9 @@ void ph3py_get_integration_weight(double *iw,
|
|||
const long mesh[3],
|
||||
PHPYCONST long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
PHPYCONST long (*bz_grid_address)[3],
|
||||
PHPYCONST long (*bz_grid_addresses)[3],
|
||||
const long *bz_map,
|
||||
const long bz_grid_type,
|
||||
const double *frequencies1,
|
||||
const long num_band1,
|
||||
const double *frequencies2,
|
||||
|
@ -576,16 +632,30 @@ void ph3py_get_integration_weight(double *iw,
|
|||
const long openmp_per_triplets,
|
||||
const long openmp_per_bands)
|
||||
{
|
||||
ConstBZGrid *bzgrid;
|
||||
long i;
|
||||
|
||||
if ((bzgrid = (ConstBZGrid*) malloc(sizeof(ConstBZGrid))) == NULL) {
|
||||
warning_print("Memory could not be allocated.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bzgrid->addresses = bz_grid_addresses;
|
||||
bzgrid->gp_map = bz_map;
|
||||
bzgrid->type = bz_grid_type;
|
||||
for (i = 0; i < 3; i++) {
|
||||
bzgrid->D_diag[i] = mesh[i];
|
||||
bzgrid->PS[i] = 0;
|
||||
}
|
||||
|
||||
tpl_get_integration_weight(iw,
|
||||
iw_zero,
|
||||
frequency_points,
|
||||
num_band0,
|
||||
relative_grid_address,
|
||||
mesh,
|
||||
triplets,
|
||||
num_triplets,
|
||||
bz_grid_address,
|
||||
bz_map,
|
||||
bzgrid,
|
||||
frequencies1,
|
||||
num_band1,
|
||||
frequencies2,
|
||||
|
@ -593,6 +663,10 @@ void ph3py_get_integration_weight(double *iw,
|
|||
tp_type,
|
||||
openmp_per_triplets,
|
||||
openmp_per_bands);
|
||||
free(bzgrid);
|
||||
bzgrid = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ph3py_get_integration_weight_with_sigma(double *iw,
|
||||
|
@ -655,7 +729,7 @@ long ph3py_get_ir_reciprocal_mesh(long grid_address[][3],
|
|||
return num_ir;
|
||||
}
|
||||
|
||||
long ph3py_get_bz_grid_address(long (*bz_grid_address)[3],
|
||||
long ph3py_get_bz_grid_address(long (*bz_grid_addresses)[3],
|
||||
long *bz_map,
|
||||
PHPYCONST long grid_address[][3],
|
||||
const long D_diag[3],
|
||||
|
@ -672,7 +746,7 @@ long ph3py_get_bz_grid_address(long (*bz_grid_address)[3],
|
|||
return 0;
|
||||
}
|
||||
|
||||
bzgrid->addresses = bz_grid_address;
|
||||
bzgrid->addresses = bz_grid_addresses;
|
||||
bzgrid->gp_map = bz_map;
|
||||
bzgrid->type = type;
|
||||
for (i = 0; i < 3; i++) {
|
||||
|
@ -793,16 +867,31 @@ void ph3py_expand_collision_matrix(double *collision_matrix,
|
|||
}
|
||||
|
||||
|
||||
void ph3py_get_neighboring_gird_points(long *relative_grid_points,
|
||||
long ph3py_get_neighboring_gird_points(long *relative_grid_points,
|
||||
const long *grid_points,
|
||||
PHPYCONST long (*relative_grid_address)[3],
|
||||
const long mesh[3],
|
||||
PHPYCONST long (*bz_grid_address)[3],
|
||||
PHPYCONST long (*bz_grid_addresses)[3],
|
||||
const long *bz_map,
|
||||
const long bz_grid_type,
|
||||
const long num_grid_points,
|
||||
const long num_relative_grid_address)
|
||||
{
|
||||
long i;
|
||||
ConstBZGrid *bzgrid;
|
||||
|
||||
if ((bzgrid = (ConstBZGrid*) malloc(sizeof(ConstBZGrid))) == NULL) {
|
||||
warning_print("Memory could not be allocated.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bzgrid->addresses = bz_grid_addresses;
|
||||
bzgrid->gp_map = bz_map;
|
||||
bzgrid->type = bz_grid_type;
|
||||
for (i = 0; i < 3; i++) {
|
||||
bzgrid->D_diag[i] = mesh[i];
|
||||
bzgrid->PS[i] = 0;
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for (i = 0; i < num_grid_points; i++) {
|
||||
|
@ -811,14 +900,17 @@ void ph3py_get_neighboring_gird_points(long *relative_grid_points,
|
|||
grid_points[i],
|
||||
relative_grid_address,
|
||||
num_relative_grid_address,
|
||||
mesh,
|
||||
bz_grid_address,
|
||||
bz_map);
|
||||
bzgrid);
|
||||
}
|
||||
|
||||
free(bzgrid);
|
||||
bzgrid = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void ph3py_set_integration_weights(double *iw,
|
||||
long ph3py_set_integration_weights(double *iw,
|
||||
const double *frequency_points,
|
||||
const long num_band0,
|
||||
const long num_band,
|
||||
|
@ -826,13 +918,28 @@ void ph3py_set_integration_weights(double *iw,
|
|||
PHPYCONST long (*relative_grid_address)[4][3],
|
||||
const long mesh[3],
|
||||
const long *grid_points,
|
||||
PHPYCONST long (*bz_grid_address)[3],
|
||||
PHPYCONST long (*bz_grid_addresses)[3],
|
||||
const long *bz_map,
|
||||
const long bz_grid_type,
|
||||
const double *frequencies)
|
||||
{
|
||||
long i, j, k, bi;
|
||||
long vertices[24][4];
|
||||
double freq_vertices[24][4];
|
||||
ConstBZGrid *bzgrid;
|
||||
|
||||
if ((bzgrid = (ConstBZGrid*) malloc(sizeof(ConstBZGrid))) == NULL) {
|
||||
warning_print("Memory could not be allocated.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bzgrid->addresses = bz_grid_addresses;
|
||||
bzgrid->gp_map = bz_map;
|
||||
bzgrid->type = bz_grid_type;
|
||||
for (i = 0; i < 3; i++) {
|
||||
bzgrid->D_diag[i] = mesh[i];
|
||||
bzgrid->PS[i] = 0;
|
||||
}
|
||||
|
||||
#pragma omp parallel for private(j, k, bi, vertices, freq_vertices)
|
||||
for (i = 0; i < num_gp; i++) {
|
||||
|
@ -841,9 +948,7 @@ void ph3py_set_integration_weights(double *iw,
|
|||
grid_points[i],
|
||||
relative_grid_address[j],
|
||||
4,
|
||||
mesh,
|
||||
bz_grid_address,
|
||||
bz_map);
|
||||
bzgrid);
|
||||
}
|
||||
for (bi = 0; bi < num_band; bi++) {
|
||||
for (j = 0; j < 24; j++) {
|
||||
|
@ -857,4 +962,9 @@ void ph3py_set_integration_weights(double *iw,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(bzgrid);
|
||||
bzgrid = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
34
c/phono3py.h
34
c/phono3py.h
|
@ -42,13 +42,13 @@
|
|||
#include "lapack_wrapper.h"
|
||||
#include "phonoc_array.h"
|
||||
|
||||
void ph3py_get_interaction(Darray *fc3_normal_squared,
|
||||
long ph3py_get_interaction(Darray *fc3_normal_squared,
|
||||
const char *g_zero,
|
||||
const Darray *frequencies,
|
||||
const lapack_complex_double *eigenvectors,
|
||||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *grid_address,
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const long *mesh,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
|
@ -61,15 +61,16 @@ void ph3py_get_interaction(Darray *fc3_normal_squared,
|
|||
const long *band_indices,
|
||||
const long symmetrize_fc3_q,
|
||||
const double cutoff_frequency);
|
||||
void ph3py_get_pp_collision(double *imag_self_energy,
|
||||
long ph3py_get_pp_collision(double *imag_self_energy,
|
||||
PHPYCONST long relative_grid_address[24][4][3], /* thm */
|
||||
const double *frequencies,
|
||||
const lapack_complex_double *eigenvectors,
|
||||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *triplet_weights,
|
||||
const long *grid_address, /* thm */
|
||||
const long (*bz_grid_addresses)[3], /* thm */
|
||||
const long *bz_map, /* thm */
|
||||
const long bz_grid_type,
|
||||
const long *mesh, /* thm */
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
|
@ -84,7 +85,7 @@ void ph3py_get_pp_collision(double *imag_self_energy,
|
|||
const long is_NU,
|
||||
const long symmetrize_fc3_q,
|
||||
const double cutoff_frequency);
|
||||
void ph3py_get_pp_collision_with_sigma(
|
||||
long ph3py_get_pp_collision_with_sigma(
|
||||
double *imag_self_energy,
|
||||
const double sigma,
|
||||
const double sigma_cutoff,
|
||||
|
@ -93,7 +94,7 @@ void ph3py_get_pp_collision_with_sigma(
|
|||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *triplet_weights,
|
||||
const long *grid_address,
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const long *mesh,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
|
@ -128,7 +129,7 @@ void ph3py_get_detailed_imag_self_energy_at_bands_with_g(
|
|||
const double *frequencies,
|
||||
const long (*triplets)[3],
|
||||
const long *triplet_weights,
|
||||
const long *grid_address,
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const double *g,
|
||||
const char *g_zero,
|
||||
const double temperature,
|
||||
|
@ -248,13 +249,13 @@ long ph3py_get_triplets_reciprocal_mesh_at_q(long *map_triplets,
|
|||
const long swappable);
|
||||
long ph3py_get_BZ_triplets_at_q(long (*triplets)[3],
|
||||
const long grid_point,
|
||||
const long (*bz_grid_address)[3],
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const long *bz_map,
|
||||
const long *map_triplets,
|
||||
const long num_map_triplets,
|
||||
const long mesh[3],
|
||||
const long type);
|
||||
void ph3py_get_integration_weight(double *iw,
|
||||
long ph3py_get_integration_weight(double *iw,
|
||||
char *iw_zero,
|
||||
const double *frequency_points,
|
||||
const long num_band0,
|
||||
|
@ -262,8 +263,9 @@ void ph3py_get_integration_weight(double *iw,
|
|||
const long mesh[3],
|
||||
PHPYCONST long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
PHPYCONST long (*bz_grid_address)[3],
|
||||
PHPYCONST long (*bz_grid_addresses)[3],
|
||||
const long *bz_map,
|
||||
const long bz_grid_type,
|
||||
const double *frequencies1,
|
||||
const long num_band1,
|
||||
const double *frequencies2,
|
||||
|
@ -291,7 +293,7 @@ long ph3py_get_ir_reciprocal_mesh(long grid_address[][3],
|
|||
const long is_time_reversal,
|
||||
PHPYCONST long rotations_in[][3][3],
|
||||
const long num_rot);
|
||||
long ph3py_get_bz_grid_address(long (*bz_grid_address)[3],
|
||||
long ph3py_get_bz_grid_address(long (*bz_grid_addresses)[3],
|
||||
long *bz_map,
|
||||
PHPYCONST long grid_address[][3],
|
||||
const long D_diag[3],
|
||||
|
@ -313,15 +315,16 @@ void ph3py_expand_collision_matrix(double *collision_matrix,
|
|||
const long num_sigma,
|
||||
const long num_temp,
|
||||
const long num_band);
|
||||
void ph3py_get_neighboring_gird_points(long *relative_grid_points,
|
||||
long ph3py_get_neighboring_gird_points(long *relative_grid_points,
|
||||
const long *grid_points,
|
||||
PHPYCONST long (*relative_grid_address)[3],
|
||||
const long mesh[3],
|
||||
PHPYCONST long (*bz_grid_address)[3],
|
||||
PHPYCONST long (*bz_grid_addresses)[3],
|
||||
const long *bz_map,
|
||||
const long bz_grid_type,
|
||||
const long num_grid_points,
|
||||
const long num_relative_grid_address);
|
||||
void ph3py_set_integration_weights(double *iw,
|
||||
long ph3py_set_integration_weights(double *iw,
|
||||
const double *frequency_points,
|
||||
const long num_band0,
|
||||
const long num_band,
|
||||
|
@ -329,8 +332,9 @@ void ph3py_set_integration_weights(double *iw,
|
|||
PHPYCONST long (*relative_grid_address)[4][3],
|
||||
const long mesh[3],
|
||||
const long *grid_points,
|
||||
PHPYCONST long (*bz_grid_address)[3],
|
||||
PHPYCONST long (*bz_grid_addresses)[3],
|
||||
const long *bz_map,
|
||||
const long bz_grid_type,
|
||||
const double *frequencies);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -55,8 +55,7 @@ static void get_collision(double *ise,
|
|||
const lapack_complex_double *eigenvectors,
|
||||
const long triplet[3],
|
||||
const long triplet_weight,
|
||||
const long *grid_address,
|
||||
const long *mesh,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
const double *shortest_vectors,
|
||||
|
@ -71,7 +70,7 @@ static void get_collision(double *ise,
|
|||
const long openmp_per_triplets);
|
||||
static void finalize_ise(double *imag_self_energy,
|
||||
const double *ise,
|
||||
const long *grid_address,
|
||||
const long (*bz_grid_address)[3],
|
||||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long num_temps,
|
||||
|
@ -85,9 +84,7 @@ void ppc_get_pp_collision(double *imag_self_energy,
|
|||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *triplet_weights,
|
||||
const long *grid_address, /* thm */
|
||||
const long *bz_map, /* thm */
|
||||
const long *mesh, /* thm */
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
const double *shortest_vectors,
|
||||
|
@ -144,11 +141,9 @@ void ppc_get_pp_collision(double *imag_self_energy,
|
|||
freqs_at_gp, /* used as f0 */
|
||||
num_band0,
|
||||
tp_relative_grid_address,
|
||||
mesh,
|
||||
triplets[i],
|
||||
1,
|
||||
(long(*)[3])grid_address,
|
||||
bz_map,
|
||||
bzgrid,
|
||||
frequencies, /* used as f1 */
|
||||
num_band,
|
||||
frequencies, /* used as f2 */
|
||||
|
@ -167,8 +162,7 @@ void ppc_get_pp_collision(double *imag_self_energy,
|
|||
eigenvectors,
|
||||
triplets[i],
|
||||
triplet_weights[i],
|
||||
grid_address,
|
||||
mesh,
|
||||
bzgrid,
|
||||
fc3,
|
||||
is_compact_fc3,
|
||||
shortest_vectors,
|
||||
|
@ -190,7 +184,7 @@ void ppc_get_pp_collision(double *imag_self_energy,
|
|||
|
||||
finalize_ise(imag_self_energy,
|
||||
ise,
|
||||
grid_address,
|
||||
bzgrid->addresses,
|
||||
triplets,
|
||||
num_triplets,
|
||||
num_temps,
|
||||
|
@ -212,8 +206,7 @@ void ppc_get_pp_collision_with_sigma(
|
|||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *triplet_weights,
|
||||
const long *grid_address,
|
||||
const long *mesh,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
const double *shortest_vectors,
|
||||
|
@ -289,8 +282,7 @@ void ppc_get_pp_collision_with_sigma(
|
|||
eigenvectors,
|
||||
triplets[i],
|
||||
triplet_weights[i],
|
||||
grid_address,
|
||||
mesh,
|
||||
bzgrid,
|
||||
fc3,
|
||||
is_compact_fc3,
|
||||
shortest_vectors,
|
||||
|
@ -312,7 +304,7 @@ void ppc_get_pp_collision_with_sigma(
|
|||
|
||||
finalize_ise(imag_self_energy,
|
||||
ise,
|
||||
grid_address,
|
||||
bzgrid->addresses,
|
||||
triplets,
|
||||
num_triplets,
|
||||
num_temps,
|
||||
|
@ -336,8 +328,7 @@ static void get_collision(double *ise,
|
|||
const lapack_complex_double *eigenvectors,
|
||||
const long triplet[3],
|
||||
const long triplet_weight,
|
||||
const long *grid_address,
|
||||
const long *mesh,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
const double *shortest_vectors,
|
||||
|
@ -381,8 +372,7 @@ static void get_collision(double *ise,
|
|||
frequencies,
|
||||
eigenvectors,
|
||||
triplet,
|
||||
grid_address,
|
||||
mesh,
|
||||
bzgrid,
|
||||
fc3,
|
||||
is_compact_fc3,
|
||||
shortest_vectors,
|
||||
|
@ -424,7 +414,7 @@ static void get_collision(double *ise,
|
|||
|
||||
static void finalize_ise(double *imag_self_energy,
|
||||
const double *ise,
|
||||
const long *grid_address,
|
||||
const long (*bz_grid_addresses)[3],
|
||||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long num_temps,
|
||||
|
@ -439,7 +429,7 @@ static void finalize_ise(double *imag_self_energy,
|
|||
imag_self_energy[i] = 0;
|
||||
}
|
||||
for (i = 0; i < num_triplets; i++) {
|
||||
is_N = tpl_is_N(triplets[i], grid_address);
|
||||
is_N = tpl_is_N(triplets[i], bz_grid_addresses);
|
||||
for (j = 0; j < num_temps; j++) {
|
||||
for (k = 0; k < num_band0; k++) {
|
||||
if (is_N) {
|
||||
|
|
|
@ -37,18 +37,17 @@
|
|||
|
||||
#include "phonoc_array.h"
|
||||
#include "phonoc_const.h"
|
||||
#include "bzgrid.h"
|
||||
#include "lapack_wrapper.h"
|
||||
|
||||
void ppc_get_pp_collision(double *imag_self_energy,
|
||||
PHPYCONST long relative_grid_address[24][4][3],
|
||||
PHPYCONST long relative_grid_address[24][4][3], /* thm */
|
||||
const double *frequencies,
|
||||
const lapack_complex_double *eigenvectors,
|
||||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *triplet_weights,
|
||||
const long *grid_address,
|
||||
const long *bz_map,
|
||||
const long *mesh,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
const double *shortest_vectors,
|
||||
|
@ -62,7 +61,6 @@ void ppc_get_pp_collision(double *imag_self_energy,
|
|||
const long is_NU,
|
||||
const long symmetrize_fc3_q,
|
||||
const double cutoff_frequency);
|
||||
|
||||
void ppc_get_pp_collision_with_sigma(
|
||||
double *imag_self_energy,
|
||||
const double sigma,
|
||||
|
@ -72,8 +70,7 @@ void ppc_get_pp_collision_with_sigma(
|
|||
const long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
const long *triplet_weights,
|
||||
const long *grid_address,
|
||||
const long *mesh,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *fc3,
|
||||
const long is_compact_fc3,
|
||||
const double *shortest_vectors,
|
||||
|
|
12
c/triplet.c
12
c/triplet.c
|
@ -87,11 +87,9 @@ void tpl_get_integration_weight(double *iw,
|
|||
const double *frequency_points,
|
||||
const long num_band0,
|
||||
LAGCONST long relative_grid_address[24][4][3],
|
||||
const long mesh[3],
|
||||
LAGCONST long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
LAGCONST long (*bz_grid_address)[3],
|
||||
const long *bz_map,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *frequencies1,
|
||||
const long num_band1,
|
||||
const double *frequencies2,
|
||||
|
@ -115,11 +113,9 @@ void tpl_get_integration_weight(double *iw,
|
|||
frequency_points, /* f0 */
|
||||
num_band0,
|
||||
tp_relative_grid_address,
|
||||
mesh,
|
||||
triplets[i],
|
||||
num_triplets,
|
||||
bz_grid_address,
|
||||
bz_map,
|
||||
bzgrid,
|
||||
frequencies1, /* f1 */
|
||||
num_band1,
|
||||
frequencies2, /* f2 */
|
||||
|
@ -168,7 +164,7 @@ void tpl_get_integration_weight_with_sigma(double *iw,
|
|||
}
|
||||
|
||||
|
||||
long tpl_is_N(const long triplet[3], const long *grid_address)
|
||||
long tpl_is_N(const long triplet[3], const long (*bz_grid_addresses)[3])
|
||||
{
|
||||
long i, j, sum_q, is_N;
|
||||
|
||||
|
@ -176,7 +172,7 @@ long tpl_is_N(const long triplet[3], const long *grid_address)
|
|||
for (i = 0; i < 3; i++) {
|
||||
sum_q = 0;
|
||||
for (j = 0; j < 3; j++) { /* 1st, 2nd, 3rd triplet */
|
||||
sum_q += grid_address[triplet[j] * 3 + i];
|
||||
sum_q += bz_grid_addresses[triplet[j]][i];
|
||||
}
|
||||
if (sum_q) {
|
||||
is_N = 0;
|
||||
|
|
|
@ -71,11 +71,9 @@ void tpl_get_integration_weight(double *iw,
|
|||
const double *frequency_points,
|
||||
const long num_band0,
|
||||
LAGCONST long relative_grid_address[24][4][3],
|
||||
const long mesh[3],
|
||||
LAGCONST long (*triplets)[3],
|
||||
const long num_triplets,
|
||||
LAGCONST long (*bz_grid_address)[3],
|
||||
const long *bz_map,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *frequencies1,
|
||||
const long num_band1,
|
||||
const double *frequencies2,
|
||||
|
@ -95,7 +93,7 @@ void tpl_get_integration_weight_with_sigma(double *iw,
|
|||
const long num_band,
|
||||
const long tp_type);
|
||||
|
||||
long tpl_is_N(const long triplet[3], const long *grid_address);
|
||||
long tpl_is_N(const long triplet[3], const long (*bz_grid_addresses)[3]);
|
||||
void tpl_set_relative_grid_address(
|
||||
long tp_relative_grid_address[2][24][4][3],
|
||||
LAGCONST long relative_grid_address[24][4][3],
|
||||
|
|
|
@ -57,10 +57,8 @@ static long in_tetrahedra(const double f0, LAGCONST double freq_vertices[24][4])
|
|||
static void get_triplet_tetrahedra_vertices(
|
||||
long vertices[2][24][4],
|
||||
LAGCONST long tp_relative_grid_address[2][24][4][3],
|
||||
const long mesh[3],
|
||||
const long triplet[3],
|
||||
LAGCONST long (*bz_grid_address)[3],
|
||||
const long *bz_map);
|
||||
const ConstBZGrid *bzgrid);
|
||||
|
||||
void
|
||||
tpi_get_integration_weight(double *iw,
|
||||
|
@ -68,11 +66,9 @@ tpi_get_integration_weight(double *iw,
|
|||
const double *frequency_points,
|
||||
const long num_band0,
|
||||
LAGCONST long tp_relative_grid_address[2][24][4][3],
|
||||
const long mesh[3],
|
||||
const long triplets[3],
|
||||
const long num_triplets,
|
||||
LAGCONST long (*bz_grid_address)[3],
|
||||
const long *bz_map,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *frequencies1,
|
||||
const long num_band1,
|
||||
const double *frequencies2,
|
||||
|
@ -87,10 +83,8 @@ tpi_get_integration_weight(double *iw,
|
|||
|
||||
get_triplet_tetrahedra_vertices(vertices,
|
||||
tp_relative_grid_address,
|
||||
mesh,
|
||||
triplets,
|
||||
bz_grid_address,
|
||||
bz_map);
|
||||
bzgrid);
|
||||
|
||||
num_band_prod = num_triplets * num_band0 * num_band1 * num_band2;
|
||||
|
||||
|
@ -214,29 +208,28 @@ tpi_get_neighboring_grid_points(long neighboring_grid_points[],
|
|||
const long grid_point,
|
||||
LAGCONST long relative_grid_address[][3],
|
||||
const long num_relative_grid_address,
|
||||
const long mesh[3],
|
||||
LAGCONST long bz_grid_address[][3],
|
||||
const long bz_map[])
|
||||
const ConstBZGrid *bzgrid)
|
||||
{
|
||||
long bzmesh[3], address_double[3], bz_address_double[3], PS[3];
|
||||
long i, j, bz_gp, prod_bz_mesh;
|
||||
|
||||
prod_bz_mesh = 1;
|
||||
for (i = 0; i < 3; i++) {
|
||||
bzmesh[i] = mesh[i] * 2;
|
||||
bzmesh[i] = bzgrid->D_diag[i] * 2;
|
||||
prod_bz_mesh *= bzmesh[i];
|
||||
PS[i] = 0;
|
||||
}
|
||||
for (i = 0; i < num_relative_grid_address; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
address_double[j] = (bz_grid_address[grid_point][j] +
|
||||
address_double[j] = (bzgrid->addresses[grid_point][j] +
|
||||
relative_grid_address[i][j]) * 2;
|
||||
bz_address_double[j] = address_double[j];
|
||||
}
|
||||
bz_gp = bz_map[grg_get_double_grid_index(bz_address_double, bzmesh, PS)];
|
||||
bz_gp = bzgrid->gp_map[
|
||||
grg_get_double_grid_index(bz_address_double, bzmesh, PS)];
|
||||
if (bz_gp == prod_bz_mesh) {
|
||||
neighboring_grid_points[i] =
|
||||
grg_get_double_grid_index(address_double, mesh, PS);
|
||||
grg_get_double_grid_index(address_double, bzgrid->D_diag, PS);
|
||||
} else {
|
||||
neighboring_grid_points[i] = bz_gp;
|
||||
}
|
||||
|
@ -332,10 +325,8 @@ static long in_tetrahedra(const double f0, LAGCONST double freq_vertices[24][4])
|
|||
static void get_triplet_tetrahedra_vertices(
|
||||
long vertices[2][24][4],
|
||||
LAGCONST long tp_relative_grid_address[2][24][4][3],
|
||||
const long mesh[3],
|
||||
const long triplet[3],
|
||||
LAGCONST long (*bz_grid_address)[3],
|
||||
const long *bz_map)
|
||||
const ConstBZGrid *bzgrid)
|
||||
{
|
||||
long i, j;
|
||||
|
||||
|
@ -345,9 +336,7 @@ static void get_triplet_tetrahedra_vertices(
|
|||
triplet[i + 1],
|
||||
tp_relative_grid_address[i][j],
|
||||
4,
|
||||
mesh,
|
||||
bz_grid_address,
|
||||
bz_map);
|
||||
bzgrid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,11 +43,9 @@ tpi_get_integration_weight(double *iw,
|
|||
const double *frequency_points,
|
||||
const long num_band0,
|
||||
LAGCONST long tp_relative_grid_address[2][24][4][3],
|
||||
const long mesh[3],
|
||||
const long triplets[3],
|
||||
const long num_triplets,
|
||||
LAGCONST long (*bz_grid_address)[3],
|
||||
const long *bz_map,
|
||||
const ConstBZGrid *bzgrid,
|
||||
const double *frequencies1,
|
||||
const long num_band1,
|
||||
const double *frequencies2,
|
||||
|
@ -71,8 +69,6 @@ tpi_get_neighboring_grid_points(long neighboring_grid_points[],
|
|||
const long grid_point,
|
||||
LAGCONST long relative_grid_address[][3],
|
||||
const long num_relative_grid_address,
|
||||
const long mesh[3],
|
||||
LAGCONST long bz_grid_address[][3],
|
||||
const long bz_map[]);
|
||||
const ConstBZGrid *bzgrid);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -247,7 +247,8 @@ class Isotope(object):
|
|||
unique_vertices,
|
||||
self._mesh,
|
||||
self._bz_grid.addresses,
|
||||
self._bz_grid.gp_map)
|
||||
self._bz_grid.gp_map,
|
||||
self._bz_grid.is_dense_gp_map * 1 + 1)
|
||||
unique_grid_points = np.array(np.unique(neighboring_grid_points),
|
||||
dtype='int_')
|
||||
self._run_phonon_solver_c(unique_grid_points)
|
||||
|
@ -262,7 +263,8 @@ class Isotope(object):
|
|||
self._grid_points,
|
||||
self._frequencies,
|
||||
self._bz_grid.addresses,
|
||||
self._bz_grid.gp_map)
|
||||
self._bz_grid.gp_map,
|
||||
self._bz_grid.is_dense_gp_map * 1 + 1)
|
||||
|
||||
def _set_integration_weights_py(self, thm):
|
||||
for i, gp in enumerate(self._grid_points):
|
||||
|
|
|
@ -816,6 +816,7 @@ class Conductivity_RTA(Conductivity):
|
|||
weights_at_q,
|
||||
self._bz_grid.addresses,
|
||||
self._bz_grid.gp_map,
|
||||
self._bz_grid.is_dense_gp_map * 1 + 1,
|
||||
self._mesh,
|
||||
fc3,
|
||||
svecs,
|
||||
|
|
|
@ -702,7 +702,8 @@ def _set_triplets_integration_weights_c(g,
|
|||
np.array(j * unique_vertices, dtype='int_', order='C'),
|
||||
mesh,
|
||||
pp.bz_grid.addresses,
|
||||
pp.bz_grid.gp_map)
|
||||
pp.bz_grid.gp_map,
|
||||
pp.bz_grid.is_dense_gp_map * 1 + 1)
|
||||
pp.run_phonon_solver(
|
||||
np.array(np.unique(neighboring_grid_points), dtype='int_'))
|
||||
|
||||
|
@ -718,6 +719,7 @@ def _set_triplets_integration_weights_c(g,
|
|||
frequencies, # f2
|
||||
pp.bz_grid.addresses,
|
||||
pp.bz_grid.gp_map,
|
||||
pp.bz_grid.is_dense_gp_map * 1 + 1,
|
||||
g.shape[0])
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue