tres_serols 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. tres_serols-1.0.1/.clang-format +74 -0
  2. tres_serols-1.0.1/.fprettify.rc +9 -0
  3. tres_serols-1.0.1/.github/workflows/docs.yml +65 -0
  4. tres_serols-1.0.1/.github/workflows/gnu.yml +43 -0
  5. tres_serols-1.0.1/.github/workflows/intel.yml +48 -0
  6. tres_serols-1.0.1/.github/workflows/llvm.yml +45 -0
  7. tres_serols-1.0.1/.gitignore +25 -0
  8. tres_serols-1.0.1/.pre-commit-config.yaml +31 -0
  9. tres_serols-1.0.1/CITATION.cff +40 -0
  10. tres_serols-1.0.1/CMakeLists.txt +102 -0
  11. tres_serols-1.0.1/CONTRIBUTING.md +78 -0
  12. tres_serols-1.0.1/LICENSE +203 -0
  13. tres_serols-1.0.1/NOTICE +89 -0
  14. tres_serols-1.0.1/PKG-INFO +141 -0
  15. tres_serols-1.0.1/README.md +116 -0
  16. tres_serols-1.0.1/cmake/Dependencies.cmake +147 -0
  17. tres_serols-1.0.1/cmake/tres_serolsConfig.cmake.in +15 -0
  18. tres_serols-1.0.1/cpp/CMakeLists.txt +90 -0
  19. tres_serols-1.0.1/cpp/include/tres_serols/bands.hpp +238 -0
  20. tres_serols-1.0.1/cpp/include/tres_serols/bands_1d.hpp +88 -0
  21. tres_serols-1.0.1/cpp/include/tres_serols/bands_2d.hpp +104 -0
  22. tres_serols-1.0.1/cpp/include/tres_serols/degeneracy.hpp +159 -0
  23. tres_serols-1.0.1/cpp/include/tres_serols/errors.hpp +34 -0
  24. tres_serols-1.0.1/cpp/include/tres_serols/gauge.hpp +44 -0
  25. tres_serols-1.0.1/cpp/include/tres_serols/grid.hpp +78 -0
  26. tres_serols-1.0.1/cpp/include/tres_serols/phonons.hpp +384 -0
  27. tres_serols-1.0.1/cpp/include/tres_serols/phonons_1d.hpp +215 -0
  28. tres_serols-1.0.1/cpp/include/tres_serols/phonons_2d.hpp +293 -0
  29. tres_serols-1.0.1/cpp/include/tres_serols/strided_view.hpp +77 -0
  30. tres_serols-1.0.1/cpp/include/tres_serols/subperiodic.hpp +71 -0
  31. tres_serols-1.0.1/cpp/include/tres_serols/three_phonon.hpp +218 -0
  32. tres_serols-1.0.1/cpp/include/tres_serols/tres_serols.h +710 -0
  33. tres_serols-1.0.1/cpp/python/bindings.cpp +2773 -0
  34. tres_serols-1.0.1/cpp/src/accurate_poly.hpp +169 -0
  35. tres_serols-1.0.1/cpp/src/acoustic_2d.cpp +1214 -0
  36. tres_serols-1.0.1/cpp/src/acoustic_2d.hpp +143 -0
  37. tres_serols-1.0.1/cpp/src/acoustic_at_gamma.hpp +74 -0
  38. tres_serols-1.0.1/cpp/src/anchored_fit.hpp +43 -0
  39. tres_serols-1.0.1/cpp/src/band_integrals.hpp +108 -0
  40. tres_serols-1.0.1/cpp/src/band_patches.cpp +82 -0
  41. tres_serols-1.0.1/cpp/src/band_patches.hpp +38 -0
  42. tres_serols-1.0.1/cpp/src/bands.cpp +608 -0
  43. tres_serols-1.0.1/cpp/src/bands_1d.cpp +190 -0
  44. tres_serols-1.0.1/cpp/src/bands_2d.cpp +376 -0
  45. tres_serols-1.0.1/cpp/src/bernstein.hpp +150 -0
  46. tres_serols-1.0.1/cpp/src/bernstein_bridge.cpp +269 -0
  47. tres_serols-1.0.1/cpp/src/bernstein_bridge.hpp +70 -0
  48. tres_serols-1.0.1/cpp/src/block3_quadrature.cpp +1063 -0
  49. tres_serols-1.0.1/cpp/src/block3_quadrature.hpp +142 -0
  50. tres_serols-1.0.1/cpp/src/block_patches.cpp +137 -0
  51. tres_serols-1.0.1/cpp/src/block_patches.hpp +59 -0
  52. tres_serols-1.0.1/cpp/src/blocks.cpp +488 -0
  53. tres_serols-1.0.1/cpp/src/blocks.hpp +175 -0
  54. tres_serols-1.0.1/cpp/src/box_rule.hpp +199 -0
  55. tres_serols-1.0.1/cpp/src/c_api.cpp +1804 -0
  56. tres_serols-1.0.1/cpp/src/cardano.cpp +66 -0
  57. tres_serols-1.0.1/cpp/src/cardano.hpp +15 -0
  58. tres_serols-1.0.1/cpp/src/chunks.hpp +70 -0
  59. tres_serols-1.0.1/cpp/src/corner_weights.hpp +334 -0
  60. tres_serols-1.0.1/cpp/src/cubic_line.hpp +643 -0
  61. tres_serols-1.0.1/cpp/src/degeneracy.cpp +431 -0
  62. tres_serols-1.0.1/cpp/src/degenerate_groups.hpp +104 -0
  63. tres_serols-1.0.1/cpp/src/flexural.hpp +78 -0
  64. tres_serols-1.0.1/cpp/src/gamma.cpp +497 -0
  65. tres_serols-1.0.1/cpp/src/gamma.hpp +138 -0
  66. tres_serols-1.0.1/cpp/src/gamma_quadrature.cpp +3209 -0
  67. tres_serols-1.0.1/cpp/src/gamma_quadrature.hpp +100 -0
  68. tres_serols-1.0.1/cpp/src/gauge.cpp +85 -0
  69. tres_serols-1.0.1/cpp/src/grid.cpp +19 -0
  70. tres_serols-1.0.1/cpp/src/hermite.cpp +60 -0
  71. tres_serols-1.0.1/cpp/src/hermite.hpp +45 -0
  72. tres_serols-1.0.1/cpp/src/line_tools.hpp +555 -0
  73. tres_serols-1.0.1/cpp/src/lowdim_projected.hpp +554 -0
  74. tres_serols-1.0.1/cpp/src/pair_quadrature.cpp +1052 -0
  75. tres_serols-1.0.1/cpp/src/pair_quadrature.hpp +139 -0
  76. tres_serols-1.0.1/cpp/src/pairs_2d.cpp +957 -0
  77. tres_serols-1.0.1/cpp/src/pairs_2d.hpp +96 -0
  78. tres_serols-1.0.1/cpp/src/patch_2d.hpp +735 -0
  79. tres_serols-1.0.1/cpp/src/phase_line.hpp +283 -0
  80. tres_serols-1.0.1/cpp/src/phase_moments.hpp +250 -0
  81. tres_serols-1.0.1/cpp/src/phonon_setup.hpp +52 -0
  82. tres_serols-1.0.1/cpp/src/phonons.cpp +705 -0
  83. tres_serols-1.0.1/cpp/src/phonons_1d.cpp +985 -0
  84. tres_serols-1.0.1/cpp/src/phonons_2d.cpp +1973 -0
  85. tres_serols-1.0.1/cpp/src/phonons_2d_plan.hpp +69 -0
  86. tres_serols-1.0.1/cpp/src/poly3.hpp +219 -0
  87. tres_serols-1.0.1/cpp/src/poly_interval.hpp +121 -0
  88. tres_serols-1.0.1/cpp/src/poly_roots.cpp +436 -0
  89. tres_serols-1.0.1/cpp/src/poly_roots.hpp +30 -0
  90. tres_serols-1.0.1/cpp/src/progress.hpp +150 -0
  91. tres_serols-1.0.1/cpp/src/projected.cpp +1095 -0
  92. tres_serols-1.0.1/cpp/src/quadrature.cpp +2433 -0
  93. tres_serols-1.0.1/cpp/src/quadrature.hpp +143 -0
  94. tres_serols-1.0.1/cpp/src/rational_line.hpp +1082 -0
  95. tres_serols-1.0.1/cpp/src/sectors_2d.cpp +241 -0
  96. tres_serols-1.0.1/cpp/src/sectors_2d.hpp +65 -0
  97. tres_serols-1.0.1/cpp/src/segment_1d.hpp +134 -0
  98. tres_serols-1.0.1/cpp/src/subperiodic.cpp +121 -0
  99. tres_serols-1.0.1/cpp/src/threads.hpp +28 -0
  100. tres_serols-1.0.1/cpp/src/three_phonon.cpp +700 -0
  101. tres_serols-1.0.1/cpp/src/three_phonon_2d.cpp +704 -0
  102. tres_serols-1.0.1/cpp/src/three_phonon_common.hpp +112 -0
  103. tres_serols-1.0.1/cpp/src/turning_curves.hpp +232 -0
  104. tres_serols-1.0.1/cpp/tests/CMakeLists.txt +47 -0
  105. tres_serols-1.0.1/cpp/tests/progress_log.hpp +53 -0
  106. tres_serols-1.0.1/cpp/tests/silicon_pair_cube.hpp +135 -0
  107. tres_serols-1.0.1/cpp/tests/simple_cubic.hpp +113 -0
  108. tres_serols-1.0.1/cpp/tests/square_layer.hpp +105 -0
  109. tres_serols-1.0.1/cpp/tests/test_average_degenerate.cpp +300 -0
  110. tres_serols-1.0.1/cpp/tests/test_bands.cpp +1540 -0
  111. tres_serols-1.0.1/cpp/tests/test_bands_1d.cpp +261 -0
  112. tres_serols-1.0.1/cpp/tests/test_bands_2d.cpp +679 -0
  113. tres_serols-1.0.1/cpp/tests/test_bernstein.cpp +108 -0
  114. tres_serols-1.0.1/cpp/tests/test_blocks.cpp +113 -0
  115. tres_serols-1.0.1/cpp/tests/test_degeneracy.cpp +191 -0
  116. tres_serols-1.0.1/cpp/tests/test_gamma.cpp +257 -0
  117. tres_serols-1.0.1/cpp/tests/test_pair_quadrature.cpp +818 -0
  118. tres_serols-1.0.1/cpp/tests/test_pairs_2d.cpp +326 -0
  119. tres_serols-1.0.1/cpp/tests/test_phonons.cpp +663 -0
  120. tres_serols-1.0.1/cpp/tests/test_phonons_1d.cpp +302 -0
  121. tres_serols-1.0.1/cpp/tests/test_phonons_2d.cpp +531 -0
  122. tres_serols-1.0.1/cpp/tests/test_poly_roots.cpp +214 -0
  123. tres_serols-1.0.1/cpp/tests/test_projected_1d.cpp +404 -0
  124. tres_serols-1.0.1/cpp/tests/test_projected_2d.cpp +511 -0
  125. tres_serols-1.0.1/cpp/tests/test_rational_line.cpp +619 -0
  126. tres_serols-1.0.1/cpp/tests/test_sectors_2d.cpp +216 -0
  127. tres_serols-1.0.1/cpp/tests/test_subperiodic.cpp +159 -0
  128. tres_serols-1.0.1/cpp/tests/test_thread_independence.cpp +157 -0
  129. tres_serols-1.0.1/cpp/tests/test_three_phonon.cpp +292 -0
  130. tres_serols-1.0.1/cpp/tests/test_three_phonon_2d.cpp +311 -0
  131. tres_serols-1.0.1/cpp/tests/transverse_oracle.cpp +928 -0
  132. tres_serols-1.0.1/data/README.md +26 -0
  133. tres_serols-1.0.1/data/silicon/FORCE_SETS +21 -0
  134. tres_serols-1.0.1/data/silicon/POSCAR-unitcell +9 -0
  135. tres_serols-1.0.1/examples/README.txt +8 -0
  136. tres_serols-1.0.1/examples/fortran/tight_binding.f90 +58 -0
  137. tres_serols-1.0.1/examples/plot_01_tight_binding.py +71 -0
  138. tres_serols-1.0.1/examples/plot_02_silicon_dos.py +73 -0
  139. tres_serols-1.0.1/examples/plot_03_silicon_greens.py +56 -0
  140. tres_serols-1.0.1/examples/plot_04_projected_dos.py +53 -0
  141. tres_serols-1.0.1/examples/plot_05_transport_distribution.py +64 -0
  142. tres_serols-1.0.1/examples/plot_06_mass_defect.py +70 -0
  143. tres_serols-1.0.1/examples/plot_07_delta_weights.py +63 -0
  144. tres_serols-1.0.1/examples/plot_08_three_phonon.py +68 -0
  145. tres_serols-1.0.1/examples/plot_09_two_dimensions.py +59 -0
  146. tres_serols-1.0.1/examples/plot_10_convergence.py +54 -0
  147. tres_serols-1.0.1/fortran/CMakeLists.txt +75 -0
  148. tres_serols-1.0.1/fortran/STYLE.md +89 -0
  149. tres_serols-1.0.1/fortran/src/tres_serols.f90 +2672 -0
  150. tres_serols-1.0.1/fortran/src/tres_serols_c.f90 +997 -0
  151. tres_serols-1.0.1/fortran/tests/test_bands.f90 +227 -0
  152. tres_serols-1.0.1/fortran/tests/test_bands_1d.f90 +89 -0
  153. tres_serols-1.0.1/fortran/tests/test_bands_2d.f90 +132 -0
  154. tres_serols-1.0.1/fortran/tests/test_c_interface.f90 +85 -0
  155. tres_serols-1.0.1/fortran/tests/test_error_stop.f90 +17 -0
  156. tres_serols-1.0.1/fortran/tests/test_phonons.f90 +511 -0
  157. tres_serols-1.0.1/fortran/tests/test_phonons_1d.f90 +59 -0
  158. tres_serols-1.0.1/fortran/tests/test_phonons_2d.f90 +109 -0
  159. tres_serols-1.0.1/fortran/tests/test_projected_low.f90 +197 -0
  160. tres_serols-1.0.1/fortran/tests/test_subperiodic.f90 +121 -0
  161. tres_serols-1.0.1/fortran/tests/test_three_phonon_2d.f90 +164 -0
  162. tres_serols-1.0.1/licenses/algoim-LICENSE +42 -0
  163. tres_serols-1.0.1/licenses/boost-LICENSE +23 -0
  164. tres_serols-1.0.1/licenses/eigen-MPL2 +373 -0
  165. tres_serols-1.0.1/licenses/fmt-LICENSE +20 -0
  166. tres_serols-1.0.1/licenses/lapack-LICENSE +48 -0
  167. tres_serols-1.0.1/licenses/lapacke-LICENSE +26 -0
  168. tres_serols-1.0.1/licenses/openblas-LICENSE +29 -0
  169. tres_serols-1.0.1/licenses/phonopy-LICENSE +26 -0
  170. tres_serols-1.0.1/licenses/pybind11-LICENSE +29 -0
  171. tres_serols-1.0.1/pyproject.toml +86 -0
  172. tres_serols-1.0.1/src/tres_serols/__init__.py +148 -0
  173. tres_serols-1.0.1/src/tres_serols/_acoustic.py +455 -0
  174. tres_serols-1.0.1/src/tres_serols/_degeneracy.py +345 -0
  175. tres_serols-1.0.1/src/tres_serols/_pairs.py +665 -0
  176. tres_serols-1.0.1/src/tres_serols/_phonopy.py +178 -0
  177. tres_serols-1.0.1/src/tres_serols/_validation.py +73 -0
  178. tres_serols-1.0.1/src/tres_serols/exceptions.py +33 -0
  179. tres_serols-1.0.1/src/tres_serols/grid.py +174 -0
  180. tres_serols-1.0.1/src/tres_serols/phonons.py +1170 -0
  181. tres_serols-1.0.1/src/tres_serols/py.typed +0 -0
  182. tres_serols-1.0.1/src/tres_serols/spectra.py +377 -0
  183. tres_serols-1.0.1/src/tres_serols/subperiodic.py +188 -0
  184. tres_serols-1.0.1/src/tres_serols/three_phonon.py +315 -0
  185. tres_serols-1.0.1/tests/conftest.py +8 -0
  186. tres_serols-1.0.1/tests/fixtures.py +455 -0
  187. tres_serols-1.0.1/tests/reference/algoim_si_cubes.npz +0 -0
  188. tres_serols-1.0.1/tests/reference/cscl.npz +0 -0
  189. tres_serols-1.0.1/tests/reference/flexural.npz +0 -0
  190. tres_serols-1.0.1/tests/reference/generate.py +171 -0
  191. tres_serols-1.0.1/tests/reference/silicon.npz +0 -0
  192. tres_serols-1.0.1/tests/reference/sixband.npz +0 -0
  193. tres_serols-1.0.1/tests/reference/tetragonal.npz +0 -0
  194. tres_serols-1.0.1/tests/test_acoustic.py +692 -0
  195. tres_serols-1.0.1/tests/test_algoim_reference.py +48 -0
  196. tres_serols-1.0.1/tests/test_average_degenerate.py +150 -0
  197. tres_serols-1.0.1/tests/test_basis_invariance.py +66 -0
  198. tres_serols-1.0.1/tests/test_core.py +214 -0
  199. tres_serols-1.0.1/tests/test_degeneracy.py +274 -0
  200. tres_serols-1.0.1/tests/test_integration.py +114 -0
  201. tres_serols-1.0.1/tests/test_noncubic.py +75 -0
  202. tres_serols-1.0.1/tests/test_one_dimensional.py +355 -0
  203. tres_serols-1.0.1/tests/test_pairs.py +385 -0
  204. tres_serols-1.0.1/tests/test_phonopy_grid.py +200 -0
  205. tres_serols-1.0.1/tests/test_projected.py +290 -0
  206. tres_serols-1.0.1/tests/test_reference.py +54 -0
  207. tres_serols-1.0.1/tests/test_subperiodic.py +131 -0
  208. tres_serols-1.0.1/tests/test_three_phonon.py +88 -0
  209. tres_serols-1.0.1/tests/test_two_dimensional.py +718 -0
  210. tres_serols-1.0.1/tests/test_validation_imports.py +30 -0
  211. tres_serols-1.0.1/tests/test_velocity_dos.py +297 -0
  212. tres_serols-1.0.1/tests/test_version.py +8 -0
  213. tres_serols-1.0.1/tests/test_weights.py +981 -0
  214. tres_serols-1.0.1/uv.lock +1673 -0
@@ -0,0 +1,74 @@
1
+ # Style of BoltzTraP2 (https://gitlab.com/sousaw/BoltzTraP2), with the
2
+ # options renamed or removed since clang-format 4.0 spelled in their current
3
+ # form (tested with clang-format 23).
4
+ ---
5
+ Language: Cpp
6
+ AccessModifierOffset: -4
7
+ AlignAfterOpenBracket: Align
8
+ AlignEscapedNewlines: Right
9
+ AlignOperands: Align
10
+ AlignTrailingComments: true
11
+ AllowAllParametersOfDeclarationOnNextLine: false
12
+ AllowShortBlocksOnASingleLine: Never
13
+ AllowShortCaseLabelsOnASingleLine: false
14
+ AllowShortIfStatementsOnASingleLine: Never
15
+ AllowShortLoopsOnASingleLine: false
16
+ AllowShortFunctionsOnASingleLine: None
17
+ BreakAfterReturnType: Automatic
18
+ BreakTemplateDeclarations: MultiLine
19
+ AlwaysBreakBeforeMultilineStrings: false
20
+ BreakBeforeBinaryOperators: None
21
+ BreakBeforeTernaryOperators: true
22
+ BreakConstructorInitializers: BeforeColon
23
+ BinPackParameters: BinPack
24
+ BinPackArguments: true
25
+ ColumnLimit: 72
26
+ PackConstructorInitializers: NextLine
27
+ ConstructorInitializerIndentWidth: 4
28
+ DerivePointerAlignment: false
29
+ IndentCaseLabels: true
30
+ IndentWrappedFunctionNames: false
31
+ MaxEmptyLinesToKeep: 2
32
+ KeepEmptyLines:
33
+ AtStartOfBlock: false
34
+ NamespaceIndentation: None
35
+ PenaltyBreakBeforeFirstCallParameter: 19
36
+ PenaltyBreakComment: 300
37
+ PenaltyBreakString: 1000
38
+ PenaltyBreakFirstLessLess: 120
39
+ PenaltyExcessCharacter: 1000000
40
+ PenaltyReturnTypeOnItsOwnLine: 200
41
+ PointerAlignment: Left
42
+ SpacesBeforeTrailingComments: 1
43
+ Cpp11BracedListStyle: true
44
+ Standard: c++17
45
+ IndentWidth: 4
46
+ TabWidth: 4
47
+ UseTab: Never
48
+ BreakBeforeBraces: Custom
49
+ BraceWrapping:
50
+ AfterClass: true
51
+ AfterControlStatement: Never
52
+ AfterEnum: true
53
+ AfterFunction: true
54
+ AfterNamespace: true
55
+ AfterStruct: true
56
+ AfterUnion: true
57
+ BeforeCatch: true
58
+ BeforeElse: true
59
+ IndentBraces: false
60
+ SpacesInParens: Never
61
+ SpacesInSquareBrackets: false
62
+ SpacesInAngles: Never
63
+ SpaceInEmptyParentheses: false
64
+ SpaceAfterCStyleCast: false
65
+ SpacesInContainerLiterals: true
66
+ SpaceBeforeAssignmentOperators: true
67
+ ContinuationIndentWidth: 4
68
+ ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
69
+ SpaceBeforeParens: ControlStatements
70
+ DisableFormat: false
71
+ SortIncludes: Never
72
+ SpaceAfterTemplateKeyword: false
73
+ ReflowComments: false
74
+ ...
@@ -0,0 +1,9 @@
1
+ # fprettify configuration for the Fortran interface (see fortran/STYLE.md).
2
+ indent = 4
3
+ line-length = 132
4
+ whitespace = 3
5
+ enable-decl = True
6
+ enable-replacements = True
7
+ c-relations = True
8
+ case = [1, 1, 1, 1]
9
+ strict-indent = False
@@ -0,0 +1,65 @@
1
+ name: docs
2
+
3
+ # Builds the documentation (the user guide, the gallery, whose examples run
4
+ # here, and the API reference) as a check and, when run with "deploy",
5
+ # publishes it on GitHub Pages (Settings, Pages, Source: GitHub Actions).
6
+ # By hand only ("Run workflow", or `gh workflow run docs.yml`, with
7
+ # `-f deploy=true` to publish).
8
+ on:
9
+ workflow_dispatch:
10
+ inputs:
11
+ deploy:
12
+ description: "Publish the documentation on GitHub Pages"
13
+ type: boolean
14
+ default: false
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ build:
21
+ runs-on: ubuntu-latest
22
+ env:
23
+ # the dependencies' archives, kept between runs (as in the test
24
+ # workflows, under a key of their own: this build downloads only some
25
+ # of them, and a cache entry, once saved, is never overwritten)
26
+ TRES_SEROLS_DOWNLOAD_DIR: ${{ github.workspace }}/.deps
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ - uses: actions/cache@v4
31
+ with:
32
+ path: .deps
33
+ key: deps-docs-${{ hashFiles('cmake/Dependencies.cmake') }}
34
+
35
+ - name: Doxygen, and LaTeX with dvisvgm for the formulas
36
+ run: |
37
+ sudo apt-get update
38
+ sudo apt-get install -y ninja-build doxygen dvisvgm \
39
+ texlive-latex-base texlive-latex-extra texlive-fonts-extra
40
+
41
+ - uses: astral-sh/setup-uv@v6
42
+
43
+ - name: Build
44
+ run: uv run --group docs sphinx-build -W --keep-going docs docs/_build/html
45
+
46
+ - name: Upload the site
47
+ if: inputs.deploy
48
+ uses: actions/upload-pages-artifact@v3
49
+ with:
50
+ path: docs/_build/html
51
+
52
+ deploy:
53
+ needs: build
54
+ if: inputs.deploy
55
+ runs-on: ubuntu-latest
56
+ permissions:
57
+ pages: write
58
+ id-token: write
59
+ environment:
60
+ name: github-pages
61
+ url: ${{ steps.deployment.outputs.page_url }}
62
+ steps:
63
+ - name: Deploy to GitHub Pages
64
+ id: deployment
65
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,43 @@
1
+ name: gnu
2
+
3
+ # By hand only ("Run workflow", or `gh workflow run gnu.yml`): GCC and
4
+ # gfortran, the Python package and every test.
5
+ on:
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ tests:
10
+ name: tests (gnu)
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ # the dependencies' archives (cmake/Dependencies.cmake), kept between
14
+ # runs: a run downloads them only when that file changes
15
+ TRES_SEROLS_DOWNLOAD_DIR: ${{ github.workspace }}/.deps
16
+ CC: gcc
17
+ CXX: g++
18
+ FC: gfortran
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Compilers and build tools
23
+ run: sudo apt-get update && sudo apt-get install -y ninja-build gfortran
24
+
25
+ - uses: actions/cache@v4
26
+ with:
27
+ path: .deps
28
+ key: deps-tests-${{ hashFiles('cmake/Dependencies.cmake') }}
29
+
30
+ - uses: astral-sh/setup-uv@v6
31
+
32
+ - name: Python package and tests
33
+ run: |
34
+ uv sync --all-groups
35
+ uv run pytest -q -rP
36
+
37
+ # the C++ suite runs here too: the Fortran build has every C++ test
38
+ - name: C++ library, Fortran interface and their tests
39
+ run: |
40
+ cmake -S . -B build/fortran -G Ninja -DCMAKE_BUILD_TYPE=Release \
41
+ -DTRES_SEROLS_BUILD_FORTRAN=ON
42
+ cmake --build build/fortran
43
+ ctest --test-dir build/fortran --output-on-failure
@@ -0,0 +1,48 @@
1
+ name: intel
2
+
3
+ # By hand only ("Run workflow", or `gh workflow run intel.yml`): the C++
4
+ # and Fortran tests with Intel's oneAPI compilers (icx, icpx,
5
+ # ifx), installed from Intel's apt repository on each run (a few minutes;
6
+ # the build gives them -fp-model=precise, CMakeLists.txt).
7
+ on:
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ tests:
12
+ name: tests (intel)
13
+ runs-on: ubuntu-24.04
14
+ env:
15
+ # the dependencies' archives (cmake/Dependencies.cmake), shared with
16
+ # the other workflows
17
+ TRES_SEROLS_DOWNLOAD_DIR: ${{ github.workspace }}/.deps
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Intel oneAPI compilers and build tools
22
+ run: |
23
+ wget -qO- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
24
+ | gpg --dearmor \
25
+ | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
26
+ echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
27
+ | sudo tee /etc/apt/sources.list.d/oneAPI.list
28
+ sudo apt-get update
29
+ sudo apt-get install -y ninja-build \
30
+ intel-oneapi-compiler-dpcpp-cpp intel-oneapi-compiler-fortran
31
+
32
+ - uses: actions/cache@v4
33
+ with:
34
+ path: .deps
35
+ key: deps-tests-${{ hashFiles('cmake/Dependencies.cmake') }}
36
+
37
+ # the compilers' environment (setvars.sh) holds only within a step,
38
+ # so the build and the tests share one
39
+ - name: C++ library, Fortran interface and their tests
40
+ run: |
41
+ source /opt/intel/oneapi/setvars.sh > /dev/null
42
+ export CC=icx CXX=icpx FC=ifx
43
+ icpx --version
44
+ ifx --version
45
+ cmake -S . -B build/intel -G Ninja -DCMAKE_BUILD_TYPE=Release \
46
+ -DTRES_SEROLS_BUILD_FORTRAN=ON
47
+ cmake --build build/intel
48
+ ctest --test-dir build/intel --output-on-failure
@@ -0,0 +1,45 @@
1
+ name: llvm
2
+
3
+ # By hand only ("Run workflow", or `gh workflow run llvm.yml`): clang,
4
+ # flang, LLVM's OpenMP runtime and lld
5
+ # 21 from apt.llvm.org (whose repositories follow the Ubuntu release, hence
6
+ # the fixed image); the C++ and Fortran tests, which build the same C++
7
+ # code as the Python package.
8
+ on:
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ tests:
13
+ name: tests (llvm)
14
+ runs-on: ubuntu-24.04
15
+ env:
16
+ # the dependencies' archives (cmake/Dependencies.cmake), shared with
17
+ # the other workflows
18
+ TRES_SEROLS_DOWNLOAD_DIR: ${{ github.workspace }}/.deps
19
+ CC: clang-21
20
+ CXX: clang++-21
21
+ FC: flang-21
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Compilers and build tools
26
+ run: |
27
+ wget -q https://apt.llvm.org/llvm.sh
28
+ chmod +x llvm.sh
29
+ sudo ./llvm.sh 21
30
+ sudo apt-get install -y ninja-build flang-21 libomp-21-dev lld-21
31
+ $CC --version
32
+ $FC --version
33
+
34
+ - uses: actions/cache@v4
35
+ with:
36
+ path: .deps
37
+ key: deps-tests-${{ hashFiles('cmake/Dependencies.cmake') }}
38
+
39
+ # the C++ suite runs here too: the Fortran build has every C++ test
40
+ - name: C++ library, Fortran interface and their tests
41
+ run: |
42
+ cmake -S . -B build/fortran -G Ninja -DCMAKE_BUILD_TYPE=Release \
43
+ -DTRES_SEROLS_BUILD_FORTRAN=ON -DCMAKE_LINKER_TYPE=LLD
44
+ cmake --build build/fortran
45
+ ctest --test-dir build/fortran --output-on-failure
@@ -0,0 +1,25 @@
1
+ build/
2
+ .venv/
3
+ __pycache__/
4
+ *.pyc
5
+ *.egg-info/
6
+ *.so
7
+ .pytest_cache/
8
+ .DS_Store
9
+ tres_serols_*_demo.png
10
+ tres_serols_demo.png
11
+ tres_serols_*_demo.pdf
12
+ tres_serols_demo.pdf
13
+ tres_serols_*_convergence_*.png
14
+ tres_serols_*_convergence_*.pdf
15
+ tres_serols_si_dos.pdf
16
+ tres_serols_almabte_line_crosscheck.pdf
17
+
18
+ # documentation build (Sphinx, Doxygen XML, the gallery sphinx-gallery
19
+ # generates from examples/)
20
+ docs/_build/
21
+ docs/auto_examples/
22
+ docs/sg_execution_times.rst
23
+
24
+ # a dataset downloaded for validation/, not distributed (data/README.md)
25
+ data/graphite/
@@ -0,0 +1,31 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: end-of-file-fixer
6
+ # the datasets are kept byte for byte as published (data/README.md)
7
+ exclude: ^data/.*/(POSCAR|FORCE_|DEFECT)
8
+ - id: check-added-large-files
9
+ args: [--maxkb=10000]
10
+ - repo: https://github.com/psf/black-pre-commit-mirror
11
+ rev: 26.5.1
12
+ hooks:
13
+ - id: black
14
+ args: [--line-length=79]
15
+ types: [python]
16
+ - repo: https://github.com/pycqa/isort
17
+ rev: 9.0.1
18
+ hooks:
19
+ - id: isort
20
+ args: [--line-length=79, --profile=black]
21
+ types: [python]
22
+ - repo: https://github.com/pre-commit/mirrors-clang-format
23
+ rev: v23.1.1
24
+ hooks:
25
+ - id: clang-format
26
+ types_or: [c++, c]
27
+ - repo: https://github.com/fortran-lang/fprettify
28
+ rev: 71781aaaa0cd513e0e25093a3b69fbdd778e8409 # v0.3.7
29
+ hooks:
30
+ - id: fprettify
31
+ args: [--config-file, .fprettify.rc]
@@ -0,0 +1,40 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use TresSerols in published work, please cite the article
3
+ that describes it."
4
+ type: software
5
+ title: "TresSerols"
6
+ abstract: "Brillouin-zone integration of densities of states and Green's
7
+ functions of band structures (phonons, electrons, ...) from tricubic
8
+ interpolation on a periodic grid."
9
+ authors:
10
+ - family-names: "Carrete Montaña"
11
+ given-names: "Jesús"
12
+ orcid: "https://orcid.org/0000-0003-0971-1098"
13
+ affiliation: "Instituto de Nanociencia y Materiales de Aragón (INMA),
14
+ CSIC-Universidad de Zaragoza, Zaragoza, Spain"
15
+ - family-names: "Raya-Moreno"
16
+ given-names: "Martí"
17
+ orcid: "https://orcid.org/0000-0001-6190-9769"
18
+ affiliation: "Department of Physics and CSMB, Humboldt-Universität zu
19
+ Berlin, Berlin, Germany"
20
+ version: "1.0.1"
21
+ doi: "10.5281/zenodo.24716915"
22
+ license: Apache-2.0
23
+ repository-code: "https://github.com/Theory-and-Simulation-at-INMA/TresSerols"
24
+ keywords:
25
+ - Brillouin-zone integration
26
+ - density of states
27
+ - Green's function
28
+ - phonons
29
+ - tricubic interpolation
30
+ preferred-citation:
31
+ type: article
32
+ title: "TresSerols: High-Fidelity Band Integration for Densities of
33
+ States, Green’s Functions, and Phonon Scattering"
34
+ authors:
35
+ - family-names: "Carrete Montaña"
36
+ given-names: "Jesús"
37
+ orcid: "https://orcid.org/0000-0003-0971-1098"
38
+ - family-names: "Raya-Moreno"
39
+ given-names: "Martí"
40
+ orcid: "https://orcid.org/0000-0001-6190-9769"
@@ -0,0 +1,102 @@
1
+ cmake_minimum_required(VERSION 3.24)
2
+ project(tres_serols VERSION 1.0.1 LANGUAGES C CXX)
3
+ # The pre-release suffix (PEP 440, as the Python package's version, e.g.
4
+ # "b1"; empty for a release), which CMake's numeric VERSION cannot carry;
5
+ # the library and its interfaces report the full version
6
+ set(TRES_SEROLS_VERSION_SUFFIX "")
7
+ set(TRES_SEROLS_VERSION_FULL "${PROJECT_VERSION}${TRES_SEROLS_VERSION_SUFFIX}")
8
+
9
+ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
10
+ set(CMAKE_BUILD_TYPE Release)
11
+ endif()
12
+
13
+ set(CMAKE_CXX_STANDARD 17)
14
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
15
+ set(CMAKE_CXX_EXTENSIONS OFF)
16
+
17
+ option(TRES_SEROLS_BUILD_PYTHON "Build the Python extension module" OFF)
18
+ option(TRES_SEROLS_BUILD_TESTS "Build the C++ unit tests" ${PROJECT_IS_TOP_LEVEL})
19
+ option(TRES_SEROLS_WITH_OPENBLAS "Use OpenBLAS (built from source) behind Eigen" ON)
20
+ option(TRES_SEROLS_OPENBLAS_DYNAMIC_ARCH
21
+ "Build OpenBLAS kernels for all CPUs (for redistributable binaries)" OFF)
22
+ option(BUILD_SHARED_LIBS "Build libtres_serols as a shared library" ON)
23
+ # -march=native: the build machine's instruction set, fixed at compile time
24
+ # (no run-time dispatch), so only for binaries that run where they are built;
25
+ # redistributable binaries (wheels) must leave it OFF
26
+ option(TRES_SEROLS_NATIVE
27
+ "Compile for the build machine's CPU (-march=native)" OFF)
28
+
29
+ option(TRES_SEROLS_BUILD_FORTRAN
30
+ "Build the Fortran interface (needs a Fortran 2018 compiler)" OFF)
31
+
32
+ if(TRES_SEROLS_BUILD_PYTHON)
33
+ # the extension module carries the library inside it
34
+ set(BUILD_SHARED_LIBS OFF)
35
+ set(TRES_SEROLS_BUILD_TESTS OFF)
36
+ set(TRES_SEROLS_BUILD_FORTRAN OFF)
37
+ endif()
38
+
39
+ # Intel's compilers (icx, icpx, ifx) default to fast floating point
40
+ # (reassociation, no NaN or infinity, denormals flushed to zero), under
41
+ # which the root finders and quadratures miss their tolerances (by up to
42
+ # 5e-7 in the tests); their precise model rounds as GCC and clang do. Every
43
+ # target here, and OpenBLAS (cmake/Dependencies.cmake).
44
+ set(TRES_SEROLS_INTEL_PRECISE "-fp-model=precise")
45
+ add_compile_options(
46
+ "$<$<COMPILE_LANG_AND_ID:C,IntelLLVM>:${TRES_SEROLS_INTEL_PRECISE}>"
47
+ "$<$<COMPILE_LANG_AND_ID:CXX,IntelLLVM>:${TRES_SEROLS_INTEL_PRECISE}>"
48
+ "$<$<COMPILE_LANG_AND_ID:Fortran,IntelLLVM>:${TRES_SEROLS_INTEL_PRECISE}>")
49
+
50
+ find_package(OpenMP REQUIRED COMPONENTS CXX)
51
+ include(GNUInstallDirs)
52
+
53
+ include(cmake/Dependencies.cmake)
54
+ add_subdirectory(cpp)
55
+
56
+ if(TRES_SEROLS_BUILD_TESTS)
57
+ enable_testing()
58
+ add_subdirectory(cpp/tests)
59
+ endif()
60
+
61
+ if(TRES_SEROLS_BUILD_FORTRAN)
62
+ enable_language(Fortran)
63
+ add_subdirectory(fortran)
64
+ endif()
65
+
66
+ # --- installation: the shared library, its headers, the Fortran modules and
67
+ # a CMake package (find_package(tres_serols CONFIG): targets
68
+ # tres_serols::tres_serols and, if built, tres_serols::fortran)
69
+ if(BUILD_SHARED_LIBS AND NOT TRES_SEROLS_BUILD_PYTHON)
70
+ include(CMakePackageConfigHelpers)
71
+ set(_tsrls_targets tres_serols)
72
+ if(TRES_SEROLS_BUILD_FORTRAN)
73
+ list(APPEND _tsrls_targets tres_serols_fortran)
74
+ endif()
75
+ install(TARGETS ${_tsrls_targets} EXPORT tres_serolsTargets
76
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
77
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
78
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
79
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
80
+ install(DIRECTORY cpp/include/tres_serols
81
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
82
+ if(TRES_SEROLS_BUILD_FORTRAN)
83
+ # module files are specific to the Fortran compiler
84
+ install(DIRECTORY ${TRES_SEROLS_FORTRAN_MODULE_DIR}/
85
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tres_serols/fortran)
86
+ endif()
87
+ set(_tsrls_cmake_dir ${CMAKE_INSTALL_LIBDIR}/cmake/tres_serols)
88
+ install(EXPORT tres_serolsTargets NAMESPACE tres_serols::
89
+ DESTINATION ${_tsrls_cmake_dir})
90
+ configure_package_config_file(cmake/tres_serolsConfig.cmake.in
91
+ ${CMAKE_CURRENT_BINARY_DIR}/tres_serolsConfig.cmake
92
+ INSTALL_DESTINATION ${_tsrls_cmake_dir})
93
+ write_basic_package_version_file(
94
+ ${CMAKE_CURRENT_BINARY_DIR}/tres_serolsConfigVersion.cmake
95
+ COMPATIBILITY SameMinorVersion)
96
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tres_serolsConfig.cmake
97
+ ${CMAKE_CURRENT_BINARY_DIR}/tres_serolsConfigVersion.cmake
98
+ DESTINATION ${_tsrls_cmake_dir})
99
+ # the licenses of the library and of what it compiles in (NOTICE)
100
+ install(FILES LICENSE NOTICE DESTINATION ${CMAKE_INSTALL_DOCDIR})
101
+ install(DIRECTORY licenses DESTINATION ${CMAKE_INSTALL_DOCDIR})
102
+ endif()
@@ -0,0 +1,78 @@
1
+ # Contributing to TresSerols
2
+
3
+ ## Building and testing
4
+
5
+ ```
6
+ uv sync --all-groups # the library, the Python module, the tools
7
+ OMP_NUM_THREADS=4 uv run pytest -n 4 # Python suite: 4 workers, 4 threads each
8
+ cmake -S . -B build/cpp -G Ninja && ninja -C build/cpp
9
+ ctest --test-dir build/cpp # C++ suite
10
+ cmake -S . -B build/fortran -G Ninja -DTRES_SEROLS_BUILD_FORTRAN=ON
11
+ ninja -C build/fortran && ctest --test-dir build/fortran # Fortran suite
12
+ ```
13
+
14
+ The editable Python install does not rebuild on import: after changing
15
+ C++ sources, run `uv sync --reinstall-package tres-serols`. The
16
+ documentation, with the gallery's examples run, builds with
17
+ `uv run --group docs sphinx-build -W docs docs/_build/html` (Doxygen and
18
+ LaTeX with dvisvgm are needed).
19
+
20
+ All three suites must pass before a change is merged. The CI runs only
21
+ by hand ("Run workflow" on the repository's Actions page, or
22
+ `gh workflow run <name>.yml`), on any commit, with four workflows:
23
+
24
+ | Workflow | Toolchain | Runs |
25
+ |---|---|---|
26
+ | `gnu.yml` | GCC and gfortran | all three suites |
27
+ | `llvm.yml` | clang, flang and LLVM's OpenMP (21) | C++ and Fortran |
28
+ | `intel.yml` | Intel oneAPI (icx, icpx, ifx), installed on each run | C++ and Fortran |
29
+ | `docs.yml` | — | the documentation, as a check; with `deploy`, also publishes it on GitHub Pages |
30
+
31
+ ## Reference data
32
+
33
+ `tests/test_reference.py` compares five cases with `tests/reference/*.npz`
34
+ to 1e-2 relative by default: a few ulps of difference in the inputs move
35
+ g and Re G by up to 2.3e-4 near critical points, so only the machine that
36
+ generated the data reproduces them to rounding level. There, set
37
+ `TRES_SEROLS_REFERENCE_RTOL=1e-9` to check that a change moves nothing.
38
+ It is a change detector; correctness
39
+ is the business of the other tests, which compare with closed forms and
40
+ independent references at tolerances that hold on any machine. The test
41
+ data must not depend on the machine either: where bands are degenerate,
42
+ the eigenvectors an eigensolver returns are arbitrary, so the fixtures
43
+ fix the basis (`tests/test_basis_invariance.py`). When a change of
44
+ results is intended, check it first
45
+ (against a closed form, an independent reference or a finer grid), then
46
+ regenerate the affected cases with `tests/reference/generate.py` and say
47
+ in the commit what moved and by how much.
48
+
49
+ ## Independent references for the quadrature
50
+
51
+ `cpp/tests/transverse_oracle.cpp` integrates single cubes with an
52
+ error-controlled adaptive rule in extended precision; it judges the
53
+ certified-leaf quadrature where closed forms do not exist. It needs
54
+ Boost.Multiprecision (header-only) and is off by default:
55
+
56
+ ```
57
+ cmake -S . -B build/cpp -DTRES_SEROLS_BUILD_ORACLE=ON && ninja -C build/cpp tres_serols_oracle
58
+ ```
59
+
60
+ `validation/` holds the comparisons with other codes (see its README).
61
+
62
+ ## Style
63
+
64
+ - C++17; `clang-format` (`.clang-format`, 72 columns); output through
65
+ fmt; Google Test.
66
+ - Python: black and isort at 79 columns; NumPy-style docstrings.
67
+ - Fortran 2018: [fortran/STYLE.md](fortran/STYLE.md), formatted by
68
+ fprettify (`.fprettify.rc`).
69
+ - Comments say what the code does and why, not how it came to be; the
70
+ history belongs in the commit messages.
71
+
72
+ The formatters run as pre-commit hooks (`uv run pre-commit install`).
73
+
74
+ ## Commits
75
+
76
+ One logical change per commit, with a subject in the imperative (or a
77
+ noun phrase) of at most about 60 characters and a body that says why,
78
+ with the numbers that support it where results change.