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 Jul 27, 2024
2 parents c292c20 + 10d6641 commit 8ca39c5
Show file tree
Hide file tree
Showing 52 changed files with 1,308 additions and 657 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/phono3py-pytest-conda-mkl-phphmtblas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
conda activate test
conda install --yes python=${{ matrix.python-version }}
conda install --yes matplotlib-base pyyaml "libblas=*=*mkl" mkl-include h5py scipy pytest codecov pytest-cov spglib alm cmake c-compiler cxx-compiler
conda install --yes matplotlib-base pyyaml "libblas=*=*mkl" mkl-include h5py scipy pytest spglib alm cmake c-compiler cxx-compiler
- name: Install symfc develop branch
run: |
conda activate test
Expand All @@ -45,8 +45,5 @@ jobs:
PHPHCALC_USE_MTBLAS=ON pip install -e . -vvv
- name: Run pytest
run: |
pytest -v --cov=./ --cov-report=xml test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
verbose: true
conda activate test
pytest -v test
9 changes: 3 additions & 6 deletions .github/workflows/phono3py-pytest-conda-mkl-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
conda activate test
conda install --yes python=${{ matrix.python-version }}
conda install --yes matplotlib-base pyyaml "libblas=*=*mkl" mkl-include h5py scipy pytest codecov pytest-cov spglib alm cmake c-compiler cxx-compiler
conda install --yes matplotlib-base pyyaml "libblas=*=*mkl" mkl-include h5py scipy pytest spglib alm cmake c-compiler cxx-compiler
- name: Install symfc develop branch
run: |
conda activate test
Expand All @@ -45,8 +45,5 @@ jobs:
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
conda activate test
pytest --v2 -v test
1 change: 1 addition & 0 deletions .github/workflows/phono3py-pytest-conda-mkl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
pip install -e . -vvv
- name: Run pytest
run: |
conda activate test
pytest -v --cov=./ --cov-report=xml test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/phono3py-pytest-conda-numpy2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
conda activate test
conda install --yes python=${{ matrix.python-version }}
conda install --yes matplotlib-base pyyaml "libblas=*=*openblas" openblas h5py "numpy=2" scipy pytest codecov pytest-cov cmake c-compiler cxx-compiler
conda install --yes matplotlib-base pyyaml "libblas=*=*openblas" openblas h5py "numpy=2" scipy pytest cmake c-compiler cxx-compiler
- name: Install spglib develop branch
run: |
conda activate test
Expand Down Expand Up @@ -52,8 +52,5 @@ jobs:
pip install -e . -vvv
- name: Run pytest
run: |
conda activate test
pytest -v test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
verbose: true
9 changes: 3 additions & 6 deletions .github/workflows/phono3py-pytest-conda-phphmtblas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
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 cxx-compiler
conda install --yes matplotlib-base pyyaml "libblas=*=*openblas" openblas h5py scipy pytest spglib alm cmake c-compiler cxx-compiler
- name: Install symfc develop branch
run: |
conda activate test
Expand All @@ -45,8 +45,5 @@ jobs:
PHPHCALC_USE_MTBLAS=ON pip install -e . -vvv
- name: Run pytest
run: |
pytest -v --cov=./ --cov-report=xml test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
verbose: true
conda activate test
pytest -v test
11 changes: 4 additions & 7 deletions .github/workflows/phono3py-pytest-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
shell: bash -l {0}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -24,7 +24,7 @@ jobs:
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 cxx-compiler
conda install --yes matplotlib-base pyyaml "libblas=*=*openblas" openblas h5py scipy pytest spglib alm cmake c-compiler cxx-compiler
- name: Install phonopy develop branch
run: |
conda activate test
Expand All @@ -38,8 +38,5 @@ jobs:
pip install -e . -vvv
- name: Run pytest
run: |
pytest -v --cov=./ --cov-report=xml test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
verbose: true
conda activate test
pytest -v test
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12, ]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.1
rev: v0.5.4
hooks:
- id: ruff
args: [ "--fix", "--show-fixes" ]
Expand Down
69 changes: 55 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.20)

option(BUILD_PHPHCALC_LIB "Option to build phph calculation module" OFF)
option(BUILD_PHONONCALC_LIB "Option to build phonon calculation module" OFF)
option(BUILD_RECGRID_LIB "Option to build reciprocal space grid module" OFF)
option(BUILD_GRIDSYS_LIB "Option to build gridsys module" OFF)
option(PHONO3PY_WITH_Fortran "enable fortran interface" OFF)
option(PHONO3PY_USE_OMP "Option to search OpenMP library" ON)
Expand Down Expand Up @@ -125,27 +126,61 @@ if(BUILD_PHPHCALC_LIB
endif()

# ###################################################################################
# Build phphcalc module #
# Reciprocal space grid library #
# ###################################################################################
if(BUILD_RECGRID_LIB
OR BUILD_PHPHCALC_LIB
OR BUILD_NANOBIND_MODULE)
# Source code
set(SOURCES_PHPHCALC
${PROJECT_SOURCE_DIR}/c/bzgrid.c ${PROJECT_SOURCE_DIR}/c/grgrid.c
${PROJECT_SOURCE_DIR}/c/lagrid.c ${PROJECT_SOURCE_DIR}/c/snf3x3.c
${PROJECT_SOURCE_DIR}/c/recgrid.c)

if(BUILD_SHARED_LIBS)
# Shared library
add_library(recgrid_lib SHARED ${SOURCES_PHPHCALC})
else()
# Static link library
add_library(recgrid_lib STATIC ${SOURCES_PHPHCALC})
endif()

if(NOT BUILD_NANOBIND_MODULE)
if(BUILD_SHARED_LIBS)
set_property(TARGET recgrid_lib PROPERTY VERSION ${SERIAL})
set_property(TARGET recgrid_lib PROPERTY SOVERSION ${SOSERIAL})
install(TARGETS recgrid_lib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
else()
set_property(TARGET recgrid_lib PROPERTY VERSION ${SERIAL})
set_property(TARGET recgrid_lib PROPERTY SOVERSION ${SOSERIAL})
set_property(TARGET recgrid_lib PROPERTY OUTPUT_NAME recgrid_lib)
install(TARGETS recgrid_lib ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

# Header file
install(FILES ${PROJECT_SOURCE_DIR}/c/recgrid.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
endif()

# ###################################################################################
# Ph-ph calculation library #
# ###################################################################################
if(BUILD_PHPHCALC_LIB OR BUILD_NANOBIND_MODULE)
# Source code
set(SOURCES_PHPHCALC
${PROJECT_SOURCE_DIR}/c/bzgrid.c
${PROJECT_SOURCE_DIR}/c/collision_matrix.c
${PROJECT_SOURCE_DIR}/c/fc3.c
${PROJECT_SOURCE_DIR}/c/grgrid.c
${PROJECT_SOURCE_DIR}/c/imag_self_energy_with_g.c
${PROJECT_SOURCE_DIR}/c/interaction.c
${PROJECT_SOURCE_DIR}/c/isotope.c
${PROJECT_SOURCE_DIR}/c/lagrid.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
${PROJECT_SOURCE_DIR}/c/reciprocal_to_normal.c
${PROJECT_SOURCE_DIR}/c/snf3x3.c
${PROJECT_SOURCE_DIR}/c/tetrahedron_method.c
${PROJECT_SOURCE_DIR}/c/triplet.c
${PROJECT_SOURCE_DIR}/c/triplet_grid.c
Expand All @@ -156,10 +191,12 @@ if(BUILD_PHPHCALC_LIB OR BUILD_NANOBIND_MODULE)
add_library(phphcalc_lib SHARED ${SOURCES_PHPHCALC})

if(OpenMP_FOUND)
target_link_libraries(phphcalc_lib PRIVATE BLAS::BLAS LAPACK::LAPACK
OpenMP::OpenMP_C)
target_link_libraries(
phphcalc_lib PRIVATE recgrid_lib BLAS::BLAS LAPACK::LAPACK
OpenMP::OpenMP_C)
else()
target_link_libraries(phphcalc_lib PRIVATE BLAS::BLAS LAPACK::LAPACK)
target_link_libraries(phphcalc_lib PRIVATE recgrid_lib BLAS::BLAS
LAPACK::LAPACK)
endif()

target_include_directories(phphcalc_lib PRIVATE ${MY_INCLUDES})
Expand Down Expand Up @@ -188,10 +225,10 @@ if(BUILD_PHPHCALC_LIB OR BUILD_NANOBIND_MODULE)
add_library(phphcalc_lib STATIC ${SOURCES_PHPHCALC})

if(OpenMP_FOUND)
target_link_libraries(phphcalc_lib BLAS::BLAS LAPACK::LAPACK
target_link_libraries(phphcalc_lib recgrid_lib BLAS::BLAS LAPACK::LAPACK
OpenMP::OpenMP_C)
else()
target_link_libraries(phphcalc_lib BLAS::BLAS LAPACK::LAPACK)
target_link_libraries(phphcalc_lib recgrid_lib BLAS::BLAS LAPACK::LAPACK)
endif()

target_include_directories(phphcalc_lib PRIVATE ${MY_INCLUDES})
Expand Down Expand Up @@ -236,7 +273,7 @@ if(BUILD_PHPHCALC_LIB OR BUILD_NANOBIND_MODULE)
endif()

# ###################################################################################
# phononcalc #
# Phonon calculation library #
# ###################################################################################
if(BUILD_PHONONCALC_LIB OR BUILD_NANOBIND_MODULE)
# Source code
Expand Down Expand Up @@ -311,7 +348,7 @@ if(BUILD_PHONONCALC_LIB OR BUILD_NANOBIND_MODULE)
endif()

# ###################################################################################
# grid #
# gridsys #
# ###################################################################################
if(BUILD_GRIDSYS_LIB)
# Source code
Expand All @@ -321,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
Expand Down Expand Up @@ -388,11 +425,15 @@ if(BUILD_NANOBIND_MODULE)
${PROJECT_SOURCE_DIR}/c/_phono3py.cpp)
nanobind_add_module(_phononcalc STABLE_ABI ${PROJECT_SOURCE_DIR}/c/phononcalc.h
${PROJECT_SOURCE_DIR}/c/_phononcalc.cpp)
nanobind_add_module(_recgrid STABLE_ABI ${PROJECT_SOURCE_DIR}/c/recgrid.h
${PROJECT_SOURCE_DIR}/c/_recgrid.cpp)

target_link_libraries(_phono3py PRIVATE phphcalc_lib)
target_link_libraries(_phononcalc PRIVATE phononcalc_lib)
target_link_libraries(_recgrid PRIVATE recgrid_lib)

target_compile_definitions(_phono3py PRIVATE THM_EPSILON=1e-10)
install(TARGETS _phono3py LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})
install(TARGETS _phononcalc LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})
install(TARGETS _recgrid LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})
endif()
8 changes: 0 additions & 8 deletions c/_phono3py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,14 +1179,6 @@ NB_MODULE(_phono3py, m) {
m.def("triplets_integration_weights", &py_get_triplets_integration_weights);
m.def("triplets_integration_weights_with_sigma",
&py_get_triplets_integration_weights_with_sigma);
m.def("grid_index_from_address", &py_get_grid_index_from_address);
m.def("ir_grid_map", &py_get_ir_grid_map);
m.def("gr_grid_addresses", &py_get_gr_grid_addresses);
m.def("reciprocal_rotations", &py_get_reciprocal_rotations);
m.def("transform_rotations", &py_transform_rotations);
m.def("snf3x3", &py_get_snf3x3);
m.def("bz_grid_addresses", &py_get_bz_grid_addresses);
m.def("rotate_bz_grid_index", &py_rotate_bz_grid_addresses);
m.def("diagonalize_collision_matrix", &py_diagonalize_collision_matrix);
m.def("pinv_from_eigensolution", &py_pinv_from_eigensolution);
m.def("default_colmat_solver", &py_get_default_colmat_solver);
Expand Down
Loading

0 comments on commit 8ca39c5

Please sign in to comment.