Skip to content

Commit

Permalink
Merge branch 'develop' into publish-gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
atztogo committed Dec 25, 2023
2 parents 259f3e8 + 8a0d9eb commit 8287ddb
Show file tree
Hide file tree
Showing 42 changed files with 4,262 additions and 2,928 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/phono3py-pytest-conda-mkl-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Pytest with mkl and --v2 option

on:
pull_request:
branches: [ develop ]
push:
branches-ignore:
- publish-gh-pages
- master
- rc

jobs:
build-linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: ["3.11"]

steps:
- uses: actions/checkout@v3
# Use conda-incubator/setup-miniconda for precise control of conda infrastructure
- uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
- name: Install dependent packages
run: |
conda activate test
conda install --yes python=${{ matrix.python-version }}
#conda install --yes matplotlib-base pyyaml "libblas=*=*openblas" openblas h5py scipy pytest codecov pytest-cov spglib alm cmake c-compiler
conda install --yes matplotlib-base pyyaml "libblas=*=*mkl" mkl-include h5py scipy pytest codecov pytest-cov spglib alm cmake c-compiler
- name: Install phonopy develop branch
run: |
conda activate test
git clone --depth 1 https://github.com/phonopy/phonopy.git
cd phonopy
pip install -e . -vvv
cd ..
- name: Install phono3py
run: |
conda activate test
pip install -e . -vvv
- name: Run pytest
run: |
pytest --v2 -v --cov=./ --cov-report=xml test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
verbose: true
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- "--ignore=E203,W503"

- repo: https://github.com/psf/black
rev: 23.10.1
rev: 23.12.0
hooks:
- id: black
args:
Expand All @@ -31,13 +31,13 @@ repos:
- id: pydocstyle

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/Takishima/cmake-pre-commit-hooks
rev: v1.9.4
rev: v1.9.5
hooks:
- id: clang-format
args:
Expand Down
28 changes: 19 additions & 9 deletions c/_phono3py.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ static PyObject *py_get_interaction(PyObject *self, PyObject *args) {
PyArrayObject *py_p2s_map;
PyArrayObject *py_s2p_map;
PyArrayObject *py_band_indices;
PyArrayObject *py_all_shortest;
double cutoff_frequency;
long symmetrize_fc3_q;
long make_r0_average;
Expand All @@ -293,19 +294,20 @@ static PyObject *py_get_interaction(PyObject *self, PyObject *args) {
double(*svecs)[3];
long(*multi)[2];
double *masses;
char *all_shortest;
long *p2s;
long *s2p;
long *band_indices;
long multi_dims[2];
long i;
long is_compact_fc3;

if (!PyArg_ParseTuple(args, "OOOOOOOOOOOOOOOlldl", &py_fc3_normal_squared,
if (!PyArg_ParseTuple(args, "OOOOOOOOOOOOOOOllOdl", &py_fc3_normal_squared,
&py_g_zero, &py_frequencies, &py_eigenvectors,
&py_triplets, &py_bz_grid_addresses, &py_D_diag,
&py_Q, &py_fc3, &py_svecs, &py_multi, &py_masses,
&py_p2s_map, &py_s2p_map, &py_band_indices,
&symmetrize_fc3_q, &make_r0_average,
&symmetrize_fc3_q, &make_r0_average, &py_all_shortest,
&cutoff_frequency, &openmp_per_triplets)) {
return NULL;
}
Expand Down Expand Up @@ -336,12 +338,13 @@ static PyObject *py_get_interaction(PyObject *self, PyObject *args) {
p2s = (long *)PyArray_DATA(py_p2s_map);
s2p = (long *)PyArray_DATA(py_s2p_map);
band_indices = (long *)PyArray_DATA(py_band_indices);
all_shortest = (char *)PyArray_DATA(py_all_shortest);

ph3py_get_interaction(fc3_normal_squared, g_zero, freqs, eigvecs, triplets,
num_triplets, bz_grid_addresses, D_diag, Q, fc3,
is_compact_fc3, svecs, multi_dims, multi, masses, p2s,
s2p, band_indices, symmetrize_fc3_q, make_r0_average,
cutoff_frequency, openmp_per_triplets);
all_shortest, cutoff_frequency, openmp_per_triplets);

free(fc3_normal_squared);
fc3_normal_squared = NULL;
Expand Down Expand Up @@ -370,6 +373,7 @@ static PyObject *py_get_pp_collision(PyObject *self, PyObject *args) {
PyArrayObject *py_s2p_map;
PyArrayObject *py_band_indices;
PyArrayObject *py_temperatures;
PyArrayObject *py_all_shortest;
double cutoff_frequency;
long is_NU;
long symmetrize_fc3_q;
Expand All @@ -396,18 +400,19 @@ static PyObject *py_get_pp_collision(PyObject *self, PyObject *args) {
long *s2p;
Larray *band_indices;
Darray *temperatures;
char *all_shortest;
long multi_dims[2];
long i;
long is_compact_fc3;

if (!PyArg_ParseTuple(
args, "OOOOOOOOlOOOOOOOOOOllldl", &py_gamma,
args, "OOOOOOOOlOOOOOOOOOOlllOdl", &py_gamma,
&py_relative_grid_address, &py_frequencies, &py_eigenvectors,
&py_triplets, &py_triplet_weights, &py_bz_grid_addresses,
&py_bz_map, &bz_grid_type, &py_D_diag, &py_Q, &py_fc3, &py_svecs,
&py_multi, &py_masses, &py_p2s_map, &py_s2p_map, &py_band_indices,
&py_temperatures, &is_NU, &symmetrize_fc3_q, &make_r0_average,
&cutoff_frequency, &openmp_per_triplets)) {
&py_all_shortest, &cutoff_frequency, &openmp_per_triplets)) {
return NULL;
}

Expand Down Expand Up @@ -439,13 +444,14 @@ static PyObject *py_get_pp_collision(PyObject *self, PyObject *args) {
s2p = (long *)PyArray_DATA(py_s2p_map);
band_indices = convert_to_larray(py_band_indices);
temperatures = convert_to_darray(py_temperatures);
all_shortest = (char *)PyArray_DATA(py_all_shortest);

ph3py_get_pp_collision(
gamma, relative_grid_address, frequencies, eigenvectors, triplets,
num_triplets, triplet_weights, bz_grid_addresses, bz_map, bz_grid_type,
D_diag, Q, fc3, is_compact_fc3, svecs, multi_dims, multi, masses, p2s,
s2p, band_indices, temperatures, is_NU, symmetrize_fc3_q,
make_r0_average, cutoff_frequency, openmp_per_triplets);
make_r0_average, all_shortest, cutoff_frequency, openmp_per_triplets);

free(band_indices);
band_indices = NULL;
Expand Down Expand Up @@ -473,6 +479,7 @@ static PyObject *py_get_pp_collision_with_sigma(PyObject *self,
PyArrayObject *py_s2p_map;
PyArrayObject *py_band_indices;
PyArrayObject *py_temperatures;
PyArrayObject *py_all_shortest;
long is_NU;
long symmetrize_fc3_q;
double sigma;
Expand All @@ -498,17 +505,19 @@ static PyObject *py_get_pp_collision_with_sigma(PyObject *self,
long *s2p;
Larray *band_indices;
Darray *temperatures;
char *all_shortest;
long multi_dims[2];
long i;
long is_compact_fc3;

if (!PyArg_ParseTuple(
args, "OddOOOOOOOOOOOOOOOllldl", &py_gamma, &sigma, &sigma_cutoff,
args, "OddOOOOOOOOOOOOOOOlllOdl", &py_gamma, &sigma, &sigma_cutoff,
&py_frequencies, &py_eigenvectors, &py_triplets,
&py_triplet_weights, &py_bz_grid_addresses, &py_D_diag, &py_Q,
&py_fc3, &py_svecs, &py_multi, &py_masses, &py_p2s_map, &py_s2p_map,
&py_band_indices, &py_temperatures, &is_NU, &symmetrize_fc3_q,
&make_r0_average, &cutoff_frequency, &openmp_per_triplets)) {
&make_r0_average, &py_all_shortest, &cutoff_frequency,
&openmp_per_triplets)) {
return NULL;
}

Expand Down Expand Up @@ -537,13 +546,14 @@ static PyObject *py_get_pp_collision_with_sigma(PyObject *self,
s2p = (long *)PyArray_DATA(py_s2p_map);
band_indices = convert_to_larray(py_band_indices);
temperatures = convert_to_darray(py_temperatures);
all_shortest = (char *)PyArray_DATA(py_all_shortest);

ph3py_get_pp_collision_with_sigma(
gamma, sigma, sigma_cutoff, frequencies, eigenvectors, triplets,
num_triplets, triplet_weights, bz_grid_addresses, D_diag, Q, fc3,
is_compact_fc3, svecs, multi_dims, multi, masses, p2s, s2p,
band_indices, temperatures, is_NU, symmetrize_fc3_q, make_r0_average,
cutoff_frequency, openmp_per_triplets);
all_shortest, cutoff_frequency, openmp_per_triplets);

free(band_indices);
band_indices = NULL;
Expand Down
Loading

0 comments on commit 8287ddb

Please sign in to comment.