Compare commits

...

311 Commits

Author SHA1 Message Date
Atsushi Togo ff95c4dd2e
Merge pull request #420 from phonopy/refactor
Merge CUI for pypolymlp to phonopy
2025-07-29 16:22:34 +09:00
Atsushi Togo 3ec495f05a Merge CUI for pypolymlp to phonopy 2025-07-29 16:11:59 +09:00
Atsushi Togo de2e6d3025
Merge pull request #419 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-07-29 09:21:58 +09:00
pre-commit-ci[bot] 2195be17f9
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.4 → v0.12.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.4...v0.12.5)
2025-07-28 20:57:00 +00:00
Atsushi Togo 499ba37b43 Update document on pypolymlp 2025-07-26 14:59:11 +09:00
Atsushi Togo 5e254fa516 Update document on pypolymlp 2025-07-26 14:52:32 +09:00
Atsushi Togo 8e7bc01229 Merge branch 'develop' 2025-07-22 16:15:29 +09:00
Atsushi Togo a12bb6becd
Merge pull request #418 from phonopy/release
Release v3.18.0
2025-07-22 16:06:34 +09:00
Atsushi Togo 21d4d86698 Avoid redundant calculation of fc2 2025-07-22 15:57:20 +09:00
Atsushi Togo b7a71c2883 Minor fix for reading polymlp.yaml 2025-07-22 15:34:55 +09:00
Atsushi Togo 006e63d799 Minor fix for reading polymlp.yaml 2025-07-22 15:18:40 +09:00
Atsushi Togo 5a14780e6b Set version 3.18.0 2025-07-22 15:13:54 +09:00
Atsushi Togo e736838528 Merge branch 'develop' of github.com:phonopy/phono3py into develop 2025-07-22 15:12:07 +09:00
Atsushi Togo 4181111479 Prevent phono3py-kaccum from reading POSCAR 2025-07-22 15:11:57 +09:00
Atsushi Togo baf34031eb
Merge pull request #416 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-07-22 14:23:52 +09:00
pre-commit-ci[bot] 69d6fcec75
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.3 → v0.12.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.3...v0.12.4)
2025-07-21 21:04:31 +00:00
Atsushi Togo 9ddbbbfa56 Very minor update 2025-07-21 17:21:47 +09:00
Atsushi Togo 12dc119f56 Update phonopy version dependency 2025-07-21 12:05:13 +09:00
Atsushi Togo e26f3ecbbd
Merge pull request #415 from phonopy/relax
Implement relaxation using pypolymlp in CUI
2025-07-20 19:28:08 +09:00
Atsushi Togo 3564186adc Implement relaxation using pypolymlp in CUI 2025-07-20 18:42:07 +09:00
Atsushi Togo cbcf9e84e5
Merge pull request #414 from phonopy/refactor
Refactoring
2025-07-19 19:15:26 +09:00
Atsushi Togo 9eb09dd01e Minor refactoring 2025-07-19 18:25:13 +09:00
Atsushi Togo 7dc202dde7 Further refactoring 2025-07-19 18:19:29 +09:00
Atsushi Togo dd9f626bb8 Set __all__ for imports in __init__.py 2025-07-19 17:22:08 +09:00
Atsushi Togo 630d09f174 Add from __future__ import annotations 2025-07-19 17:17:05 +09:00
Atsushi Togo 8d9e72c130 Minor typehint update 2025-07-19 17:13:30 +09:00
Atsushi Togo 096269a8b6 Refactoring 2025-07-19 17:11:28 +09:00
Atsushi Togo 35dd083b3a
Merge pull request #413 from phonopy/refactoring
Refactoring and adding typehints
2025-07-18 15:02:04 +09:00
Atsushi Togo 6eceedc3bb Add from __future__ import annotations 2025-07-18 14:53:37 +09:00
Atsushi Togo d67c4d81db Add from __future__ import annotations 2025-07-18 14:48:36 +09:00
Atsushi Togo 818ea508c8 Refactoring and adding typehints 2025-07-18 14:44:39 +09:00
Atsushi Togo 8568191817
Merge pull request #412 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-07-15 08:16:39 +09:00
pre-commit-ci[bot] 6a1239408a
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.2 → v0.12.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.2...v0.12.3)
2025-07-14 20:49:53 +00:00
Atsushi Togo fdc6aece55
Merge pull request #411 from phonopy/symmetrize-api
Update Phono3py.symmetrize_fc3
2025-07-08 19:22:07 +09:00
Atsushi Togo 7effdf6c26 Update test 2025-07-08 18:32:23 +09:00
Atsushi Togo cfcd64fb9f Add test for Phono3py.symmetrize_fc3 and symmetrize_fc2 2025-07-08 18:12:43 +09:00
Atsushi Togo 8488ed0424 Update Phono3py.symmetrize_fc3 2025-07-08 16:08:41 +09:00
Atsushi Togo c4c6d14ca2
Merge pull request #410 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-07-08 11:32:25 +09:00
pre-commit-ci[bot] 9825b8c171
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.1 → v0.12.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.1...v0.12.2)
2025-07-07 21:31:08 +00:00
Atsushi Togo 7e6e2ce628 Merge branch 'develop' 2025-07-05 10:46:58 +09:00
Atsushi Togo 47482e4116
Merge pull request #409 from phonopy/release
Set version 3.17.1
2025-07-05 10:45:15 +09:00
Atsushi Togo 9951f5bfaf Set version 3.17.1 2025-07-05 10:34:26 +09:00
Atsushi Togo 48105c5f52
Merge pull request #408 from phonopy/fix-407
Fix issue 407
2025-07-04 16:01:15 +09:00
Atsushi Togo 617a6e9162 Fix issue 407 2025-07-04 15:52:21 +09:00
Atsushi Togo 8eeb09d934
Merge pull request #406 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-07-01 10:57:37 +09:00
pre-commit-ci[bot] b4fa5458d5
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.13 → v0.12.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.13...v0.12.1)
2025-06-30 20:38:25 +00:00
Atsushi Togo d41603560d
Merge pull request #405 from phonopy/symmetrize-fc-methods
Add symmetrize_fc2 and symmetrize_fc3 in Phono3py class
2025-06-29 16:06:34 +09:00
Atsushi Togo 260e4a5e75 Add symmetrize_fc2 and symmetrize_fc3 in Phono3py class 2025-06-29 15:56:55 +09:00
Atsushi Togo 93a5e0ed3c Minor update of typehint 2025-06-27 16:12:18 +09:00
Atsushi Togo ad9cdcc64b Merge branch 'develop' 2025-06-26 19:25:00 +09:00
Atsushi Togo ea6b96d594
Merge pull request #404 from phonopy/release
Set version 3.17.0
2025-06-26 19:05:42 +09:00
Atsushi Togo dff1e08232 Set version 3.17.0 2025-06-26 18:56:55 +09:00
Atsushi Togo a001c65e6c Update dependency of phonopy version 2025-06-26 10:58:57 +09:00
Atsushi Togo 0269254fb9
Merge pull request #403 from phonopy/run-test
Commit to run tests on github
2025-06-25 15:38:59 +09:00
Atsushi Togo b42f1c374c Commit to run tests on github 2025-06-25 14:43:21 +09:00
Atsushi Togo 9441266bbb Call symfc project for FD when phonopy-load and fc-calculator is blank 2025-06-25 14:41:26 +09:00
Atsushi Togo ac2653147e
Merge pull request #402 from phonopy/symfc-projector
Use symfc-projector for FD when phono3py-load
2025-06-24 15:38:18 +09:00
Atsushi Togo 22fa0e1862 Use symfc-projector for FD when phono3py-load 2025-06-24 15:25:26 +09:00
Atsushi Togo 3ee42f3b81
Merge pull request #400 from phonopy/merge-nac-cui-routines
Merge cui traditional and phono3py-load rotines
2025-06-23 16:55:13 +09:00
Atsushi Togo 072e195940 Adjustment to let both CUI and phno3py.load work nicely 2025-06-23 16:25:31 +09:00
Atsushi Togo 7f44ce3594 Merge produe fc routines in CUI 2025-06-23 15:04:08 +09:00
Atsushi Togo bb1012784d Merge CUI routines to handle NAC 2025-06-23 11:08:27 +09:00
Atsushi Togo d4dcd0465e
Merge pull request #399 from phonopy/cell-info
Update following the change of collect_cell_info in phonopy
2025-06-23 10:50:18 +09:00
Atsushi Togo 1a243e2316 Add from __future__ import annotations 2025-06-22 17:36:34 +09:00
Atsushi Togo 166f012147 Update following the change of collect_cell_info in phonopy 2025-06-22 17:33:22 +09:00
Atsushi Togo 1426752ad8
Merge pull request #398 from phonopy/refactor-settings-py
Refactor settings.py following that of phonopy
2025-06-17 20:37:11 +09:00
Atsushi Togo 9b88998e3a Add from __future__ import annotations 2025-06-17 20:07:42 +09:00
Atsushi Togo 1441cbc155 Refactor settings.py following that of phonopy 2025-06-17 20:03:31 +09:00
Atsushi Togo 36ae0c1ffb Merge branch 'develop' of github.com:phonopy/phono3py into develop 2025-06-17 15:59:35 +09:00
Atsushi Togo 518b6feebf Update phonopy version dependency 2025-06-17 15:59:25 +09:00
Atsushi Togo 685d5f5e55
Merge pull request #397 from phonopy/tune-rec2normal
Performance optimization of reciprocal_to_normal in C
2025-06-14 18:24:21 +09:00
Atsushi Togo 55c334e6c2 Minor code clean-up 2025-06-14 18:15:03 +09:00
Atsushi Togo 26cac3aef5 Performance optimization of reciprocal_to_normal in C 2025-06-14 18:07:46 +09:00
Atsushi Togo 200e1b92a9
Merge pull request #396 from phonopy/number-estimation-factor
Add number_estimation_factor parameter for rd displacement generation
2025-06-13 14:01:49 +09:00
Atsushi Togo 788fab3cdf Avoid writing files in running tests 2025-06-13 13:43:04 +09:00
Atsushi Togo e02e7c9921 Update test_random_disps_agno2 2025-06-13 13:38:22 +09:00
Atsushi Togo d601796e05 Add number_estimation_factor parameter for rd displacement generation 2025-06-13 12:57:02 +09:00
Atsushi Togo bbd055d9b7 Merge branch 'develop' 2025-06-12 16:22:01 +09:00
Atsushi Togo dd60053a74
Merge pull request #395 from phonopy/release
Set version 3.16.0
2025-06-12 11:57:54 +09:00
Atsushi Togo c3a755ecb0 Set version 3.16.0 2025-06-12 11:31:02 +09:00
Atsushi Togo 1ec0116c10
Merge pull request #393 from phonopy/tune-recip2normal
Introduce memorization in reciprocal_to_normal for optimization
2025-06-11 12:57:59 +09:00
Atsushi Togo e4f37dba71 Zero clear of temporary array 2025-06-11 12:47:58 +09:00
Atsushi Togo cedd2477d8 Remove unused variables 2025-06-11 09:59:15 +09:00
Atsushi Togo 29cda14982 Replace memset 2025-06-11 09:56:42 +09:00
Atsushi Togo 5f75510927 Introduce memorization in eciprocal_to_normal for performance optimization 2025-06-11 09:44:34 +09:00
Atsushi Togo a3b8ad3dbd
Merge pull request #392 from phonopy/fix-distance-in-BZ
Fix distance calculation in BZ
2025-06-10 18:41:28 +09:00
Atsushi Togo 71bb34aa4a Fix distance calculation in BZ 2025-06-10 18:32:13 +09:00
Atsushi Togo ea1d083056
Merge pull request #391 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-06-10 10:28:21 +09:00
pre-commit-ci[bot] 13c83d6d6a
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.12 → v0.11.13](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.12...v0.11.13)
2025-06-09 20:42:14 +00:00
Atsushi Togo 2d30f9baf0 Fix comment in reciprocal_to_normal.c 2025-06-09 16:05:46 +09:00
Atsushi Togo 8bf63c030c
Merge pull request #390 from phonopy/fc3-cutoff-in-fdf5
Add fc3_cutoff entry in fc3.hdf5
2025-06-06 18:23:30 +09:00
Atsushi Togo 3eab5fbcbe Add fc3_cutoff entry in fc3.hdf5 2025-06-06 18:14:19 +09:00
Atsushi Togo 2e67d46379
Merge pull request #389 from phonopy/fc3-non-zero-indices
Run ph-ph interaction calculation with fc3-nonzero-indices
2025-06-06 13:21:17 +09:00
Atsushi Togo cbd410ac4c Run ph-ph interaction calculation with fc3-nonzero-indices 2025-06-06 13:05:44 +09:00
Atsushi Togo 748a9692aa
Merge pull request #388 from phonopy/refactor-read-write-fc3-fc2
Refactor reading and writing fc2 and fc3
2025-06-05 18:15:17 +09:00
Atsushi Togo 48f52c762c Refactor reading and writing fc2 and fc3 2025-06-05 18:07:18 +09:00
Atsushi Togo 83a96ebce6 Minor refactoring 2025-06-05 17:13:45 +09:00
Atsushi Togo ca30fcc101 Minor refactoring 2025-06-05 16:56:37 +09:00
Atsushi Togo c4a70293d2
Merge pull request #387 from phonopy/fc3-nonzero-indices
Write fc3_nonzero_indices in fc3.hdf5
2025-06-05 16:34:52 +09:00
Atsushi Togo 731ea60afe Update test_phono3py_load_with_typeII_dataset 2025-06-05 16:27:14 +09:00
Atsushi Togo 2732a1a0f0 Write fc3_nonzero_indices in fc3.hdf5 2025-06-05 16:23:26 +09:00
Atsushi Togo d202f2c27b
Merge pull request #386 from phonopy/fc3-nonzero-indices
Add Phono3py.fc3_nonzero_indices
2025-06-04 17:50:16 +09:00
Atsushi Togo 8d0db5c396 Add Phono3py.fc3_nonzero_indices 2025-06-04 17:40:45 +09:00
Atsushi Togo 03a26d1b6d Add self._fc3_nonzero_elems in API 2025-06-03 18:09:34 +09:00
Atsushi Togo 6a1a1a984a
Merge pull request #385 from phonopy/refactor-conductivity
Refactor conductivity
2025-06-03 15:40:42 +09:00
Atsushi Togo 238c537f31 [refactoring of conductivity] Wigner LBTE 2025-06-03 15:28:28 +09:00
Atsushi Togo 300e08d1d3 [refactoring of conductivity] Wigner RTA 2025-06-03 14:42:57 +09:00
Atsushi Togo 28dc226ee9
Merge pull request #384 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-06-03 10:51:48 +09:00
pre-commit-ci[bot] 91c9c5c619
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.11 → v0.11.12](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.11...v0.11.12)
2025-06-02 21:00:32 +00:00
Atsushi Togo 8be1b4cf95 [refactoring of conductivity] LBTE full-colmat 2025-06-02 17:00:09 +09:00
Atsushi Togo 18dac50c78 [refactoring of conductivity] LBTE 2025-06-02 08:48:54 +09:00
Atsushi Togo bcc4227415 [refactoring of conductivity] RTA 2025-06-02 08:26:59 +09:00
Atsushi Togo 39f4d09e24
Merge pull request #383 from phonopy/typehints
Improve type hints
2025-06-01 18:13:46 +09:00
Atsushi Togo 7122307413 Minor fix for type annotation 2025-06-01 09:20:15 +09:00
Atsushi Togo d0101dbb4b Improve type hints 2025-05-30 17:30:24 +09:00
Atsushi Togo 91ae3b89fc
Merge pull request #382 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-05-27 07:21:28 +09:00
pre-commit-ci[bot] 8a606ebf13
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.10 → v0.11.11](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.10...v0.11.11)
2025-05-26 20:43:46 +00:00
Atsushi Togo d86b3ed24d Update document to read pp-*.hdf5 and handling triplets 2025-05-20 19:30:21 +09:00
Atsushi Togo 9fc5186267 Update document to read pp-*.hdf5 and handling triplets 2025-05-20 19:20:24 +09:00
Atsushi Togo 16957da192
Merge pull request #381 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-05-20 07:24:37 +09:00
pre-commit-ci[bot] d8b2a2cd83
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.9 → v0.11.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.9...v0.11.10)
2025-05-19 20:45:28 +00:00
Atsushi Togo 8d0785c191 Minor fix 2025-05-17 18:56:51 +09:00
Atsushi Togo bacf5c2c5f Minor fix 2025-05-17 18:06:11 +09:00
Atsushi Togo 8ed85bff78
Merge pull request #379 from phonopy/symfc-memsize
Refine behaviour of symfc-memsize
2025-05-17 11:22:16 +09:00
Atsushi Togo e10b20260a Refine behaviour of symfc-memsize 2025-05-16 22:35:48 +09:00
Atsushi Togo 4a735f317e
Merge pull request #378 from phonopy/option-memsize
Add CUI option for rd=auto along with symfc memsize
2025-05-16 13:19:09 +09:00
Atsushi Togo cc0879dde0 Add tests 2025-05-16 08:54:22 +09:00
Atsushi Togo 426a193729 Support memsize displacement generation for MLP 2025-05-16 06:44:20 +09:00
Atsushi Togo f465e6ebab Refactoring of handling fc_calculator and cutoff input strings 2025-05-15 12:18:25 +09:00
Atsushi Togo e350a93a79 Add CUI option for rd=auto along with symfc memsize 2025-05-15 08:41:12 +09:00
Atsushi Togo 2a6239979c
Merge pull request #377 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-05-13 09:17:29 +09:00
pre-commit-ci[bot] d9e1a6c834
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.8 → v0.11.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.8...v0.11.9)
2025-05-12 20:38:08 +00:00
Atsushi Togo 8ccb13b081
Merge pull request #376 from phonopy/symfc
Update symfc wrapper to implement cutoff estimation by memory limit
2025-05-11 18:12:54 +09:00
Atsushi Togo e078306390 Update symfc wrapper to implement cutoff estimation by memory limit 2025-05-11 18:03:37 +09:00
Atsushi Togo 6521e406c5 Merge branch 'develop' of github.com:phonopy/phono3py into develop 2025-05-06 11:16:29 +09:00
Atsushi Togo 3ad068b34a Show pypolymlp version 2025-05-06 11:16:19 +09:00
Atsushi Togo 00d5ef756b
Merge pull request #375 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-05-06 11:00:06 +09:00
pre-commit-ci[bot] d5c88263d5
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.7 → v0.11.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.7...v0.11.8)
2025-05-05 20:56:40 +00:00
Atsushi Togo f0c26cec8a Merge branch 'develop' 2025-04-30 21:36:49 +09:00
Atsushi Togo 2e4c0b5d69
Merge pull request #374 from phonopy/release
Set version 3.15.1
2025-04-30 21:34:17 +09:00
Atsushi Togo a548f2269e Set version 3.15.1 2025-04-30 21:17:20 +09:00
Atsushi Togo da0bcbbceb
Merge pull request #373 from phonopy/KB_in_C
Remove unit conversion factor in C routines
2025-04-30 07:24:15 +09:00
Atsushi Togo 855ce1c3c2 Remove unit conversion factor in C routines 2025-04-29 22:31:05 +09:00
Atsushi Togo 6264dc5e35
Merge pull request #372 from phonopy/physical-unit
Migration of the physical units system
2025-04-29 19:56:36 +09:00
Atsushi Togo 7c0b4a2d0e Migration of the physical units system 2025-04-29 09:36:31 +09:00
Atsushi Togo c171367edd
Merge pull request #371 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-04-29 08:35:56 +09:00
pre-commit-ci[bot] ebde72e495
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.6 → v0.11.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.6...v0.11.7)
2025-04-28 20:38:58 +00:00
Atsushi Togo 834d644971
Merge pull request #370 from phonopy/kubo
Refactor kubo
2025-04-25 11:58:41 +09:00
Atsushi Togo aa2c973be3 Refactor kubo 2025-04-25 11:29:25 +09:00
Atsushi Togo bd04df7447
Merge pull request #369 from phonopy/refactor-conductivity
Refactoring of conductivity code
2025-04-25 09:42:24 +09:00
Atsushi Togo fe9d56135b Refactoring of conductivity code 2025-04-24 18:20:36 +09:00
Atsushi Togo fcefaf6fc9
Merge pull request #367 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-04-22 07:47:15 +09:00
pre-commit-ci[bot] 549b45aa7a
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.5 → v0.11.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.5...v0.11.6)
2025-04-21 20:28:14 +00:00
Atsushi Togo 16d2caae93
Merge pull request #366 from phonopy/fix-set_forces_and_nac_params
Fix _set_forces_and_nac_params
2025-04-21 16:20:26 +09:00
Atsushi Togo 2edbeadd3e Fix _set_forces_and_nac_params 2025-04-21 16:07:39 +09:00
Atsushi Togo fbdf8f9df7
Merge pull request #365 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-04-15 08:01:43 +09:00
pre-commit-ci[bot] 7c23c34d7c
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.4 → v0.11.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.4...v0.11.5)
2025-04-14 20:37:46 +00:00
Atsushi Togo f596ec86a1
Merge pull request #364 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-04-08 13:58:04 +09:00
pre-commit-ci[bot] 8d6f228d91
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.2 → v0.11.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.2...v0.11.4)
2025-04-07 21:21:14 +00:00
Atsushi Togo 285140c4ec
Merge pull request #363 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-03-25 10:10:59 +09:00
pre-commit-ci[bot] 29018ceb97
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.0 → v0.11.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.0...v0.11.2)
2025-03-24 20:47:42 +00:00
Atsushi Togo 3b77084931
Merge pull request #362 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-03-18 09:08:35 +09:00
pre-commit-ci[bot] 138103ba68
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.10...v0.11.0)
2025-03-17 20:55:25 +00:00
Atsushi Togo 204bd4db33
Merge pull request #361 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-03-11 16:01:05 +09:00
pre-commit-ci[bot] c7570cc4b8
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.9 → v0.9.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.9...v0.9.10)
2025-03-10 20:49:08 +00:00
Atsushi Togo 7806f7eb67 Merge branch 'develop' 2025-03-04 13:47:02 +09:00
Atsushi Togo 806bad7663
Merge pull request #360 from phonopy/release
Set version 3.15.0
2025-03-04 13:20:12 +09:00
Atsushi Togo 5817ef240c Set version 3.15.0 2025-03-04 13:10:42 +09:00
Atsushi Togo 613322f7e7
Merge pull request #359 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-03-04 08:05:16 +09:00
pre-commit-ci[bot] 359e76e0db
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.7 → v0.9.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.7...v0.9.9)
2025-03-03 21:26:22 +00:00
Atsushi Togo b22639ee1d Update pyrpoject.toml 2025-03-03 12:13:38 +09:00
Atsushi Togo 02a089ce91
Merge pull request #358 from phonopy/pypoylymlp-yaml
Pypoylymlp yaml
2025-03-03 12:07:53 +09:00
Atsushi Togo d7cb66417f Update pypolymlp doc 2025-03-03 11:19:45 +09:00
Atsushi Togo 33827f7210 Update for pypolymlp v0.9 2025-03-03 10:37:37 +09:00
Atsushi Togo 7a2b54faa7 Merge branch 'develop' 2025-03-01 18:29:38 +09:00
Atsushi Togo 6be93e7953
Merge pull request #357 from phonopy/release
Set version 3.14.1
2025-03-01 18:06:10 +09:00
Atsushi Togo 88469e0a83 Restrict pypolymlp<0.9 in github action tests 2025-03-01 17:50:22 +09:00
Atsushi Togo 8dac418ffc Set version 3.14.1 2025-03-01 16:49:15 +09:00
Atsushi Togo d15a5ec8ec
Merge pull request #356 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-02-25 11:55:42 +09:00
pre-commit-ci[bot] 0d6549b2e8
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.6 → v0.9.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.6...v0.9.7)
2025-02-24 20:39:05 +00:00
Atsushi Togo 088651931c
Merge pull request #354 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-02-11 10:50:30 +09:00
pre-commit-ci[bot] cb4cd068de
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.4 → v0.9.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.4...v0.9.6)
2025-02-11 00:05:08 +00:00
Atsushi Togo 91d43a535d
Merge pull request #353 from phonopy/refactor-fcsolver
Refactor fcsolver
2025-02-08 22:51:46 +09:00
Atsushi Togo e0fc1dfa31 Refactoring of fc solver 2025-02-08 22:40:33 +09:00
Atsushi Togo f12260fd4a Refactoring of fc solver 2025-02-08 20:08:58 +09:00
Atsushi Togo 5bcb753357 Merge branch 'develop' 2025-02-07 19:16:44 +09:00
Atsushi Togo 01bffc756d
Merge pull request #352 from phonopy/release
Set version 3.14.0
2025-02-07 18:47:51 +09:00
Atsushi Togo 482aec7bd8 Set version 3.14.0 2025-02-07 18:39:22 +09:00
Atsushi Togo 948faad549
Merge pull request #351 from phonopy/estimate-symfc-mem
Memory usage estimation for fc3 calculation using symfc
2025-02-06 16:05:38 +09:00
Atsushi Togo 8687e8eeb9 Limit --symfc-memshow option for phono3py-load 2025-02-06 15:47:00 +09:00
Atsushi Togo b70bb6ced4 --symfc-memshow option 2025-02-06 15:42:59 +09:00
Atsushi Togo c7c680df86
Merge pull request #348 from janosh/typos
Fix typos and add `codespell` `pre-commit` hook to catch future typos
2025-02-06 09:17:53 +09:00
Atsushi Togo a4ae4d05cd Fix .pre-commit-config.yaml 2025-02-06 09:12:14 +09:00
Janosh Riebesell e0e10db48c
Merge branch 'develop' into typos 2025-02-05 06:59:22 -05:00
Janosh Riebesell fc43730807 restore quotes in yaml config args 2025-02-05 06:25:56 -05:00
Janosh Riebesell e41b86877e missed some more 2025-02-05 05:50:52 -05:00
Janosh Riebesell 9145e47ea1 missed some 2025-02-05 05:47:27 -05:00
Janosh Riebesell 692dcce073 address @atztogo PR comments 2025-02-05 05:41:32 -05:00
Atsushi Togo 1fb5cb4eb9 Merge branch 'develop' 2025-02-05 14:50:49 +09:00
Atsushi Togo c49cfd7a64
Merge pull request #349 from phonopy/release
Set version 3.13.0
2025-02-05 14:44:51 +09:00
Atsushi Togo f2b7abde58 Set version 3.13.0 2025-02-05 14:33:53 +09:00
Atsushi Togo 40206bb1b8 Fix overwriting fc3 calc opts by cutoff-pair 2025-02-05 14:31:52 +09:00
Atsushi Togo 4144d97eb4 Update phonopy version dependency 2025-02-05 12:03:06 +09:00
Janosh Riebesell ece67a3201 fix typos and add codespell pre-commit hooks to catch future typos 2025-02-04 13:41:45 -05:00
Janosh Riebesell 00fb3b41f0 auto-format .pre-commit-config.yaml 2025-02-04 13:24:55 -05:00
Atsushi Togo fa6783d3ad
Merge pull request #347 from phonopy/update-rd-test
Update auto random displacements following the change in phonopy
2025-02-04 15:40:51 +09:00
Atsushi Togo 38ecb67988 Update auto random displacements following the change in phonopy 2025-02-04 15:30:03 +09:00
Atsushi Togo d8c0a6f999
Merge pull request #346 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-02-04 10:14:38 +09:00
pre-commit-ci[bot] 4b07cb1563
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.3 → v0.9.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.3...v0.9.4)
2025-02-04 00:59:19 +00:00
Atsushi Togo d658273c70 Merge branch 'make-wheel-test' into develop 2025-02-01 16:29:43 +09:00
Atsushi Togo c3447376ee Update github action to include windows wheel build 2025-02-01 16:19:25 +09:00
Atsushi Togo 64432ef141 Merge branch 'develop' 2025-02-01 16:15:06 +09:00
Atsushi Togo cacc4428d5
Merge pull request #345 from phonopy/release
Set version 3.12.2
2025-02-01 16:13:01 +09:00
Atsushi Togo aca7e14d4e Set version 3.12.2 2025-02-01 16:06:36 +09:00
Atsushi Togo acde28c571
Merge pull request #344 from phonopy/windows
Fix a bug in computing collision matrix in C
2025-02-01 16:04:01 +09:00
Atsushi Togo c6f5cab9cb Separate collision matrix function for each gp 2025-02-01 15:51:50 +09:00
Atsushi Togo e3421cf466 With private variable in openmp for collision matrix 2025-02-01 15:37:45 +09:00
Atsushi Togo eb11ab2972 No openmp for collision matrix 2025-02-01 15:33:25 +09:00
Atsushi Togo 788fe10a4a
Merge pull request #343 from phonopy/colmat-solver7
Colmat solver using np.linalg.pinv
2025-01-29 11:07:53 +09:00
Atsushi Togo f919792895 Support reducible colmat solver 7 2025-01-29 10:49:39 +09:00
Atsushi Togo 1602254de1 Update log for colmat solver 7 2025-01-29 10:40:37 +09:00
Atsushi Togo fab77d11e2 Colmat solver using np.linalg.pinv(a, hermitian=False) 2025-01-29 10:38:00 +09:00
Atsushi Togo db36845a75 Colmat solver using np.linalg.pinv 2025-01-29 10:31:35 +09:00
Atsushi Togo 30ecb1b697 Merge branch 'develop' 2025-01-28 09:18:35 +09:00
Atsushi Togo 89a851a572
Merge pull request #342 from phonopy/release
Set version 3.12.1
2025-01-28 09:16:23 +09:00
Atsushi Togo 6f07e11a49
Merge pull request #341 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-01-28 09:11:37 +09:00
Atsushi Togo c4818e9ea2 Set version 3.12.1 2025-01-28 09:08:36 +09:00
Atsushi Togo 86da9ca73a Merge branch 'develop' 2025-01-28 09:04:17 +09:00
pre-commit-ci[bot] eef47946a1
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.2 → v0.9.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.2...v0.9.3)
2025-01-28 00:01:00 +00:00
Atsushi Togo 6a834a33d0
Merge pull request #340 from phonopy/release
Set version 3.12.0
2025-01-28 08:56:47 +09:00
Atsushi Togo 5633c4ebed Set version 3.12.0 2025-01-28 08:48:35 +09:00
Atsushi Togo 94caacaced
Merge pull request #339 from phonopy/make-wheel-test
Make wheels for test-PyPI
2025-01-27 16:50:28 +09:00
Atsushi Togo 6784edcae2 Make wheels for test-PyPI 2025-01-27 16:43:26 +09:00
Atsushi Togo b0e26747f6
Merge pull request #338 from phonopy/long-to-int64
c-long was changed to int64_t.
2025-01-27 10:04:57 +09:00
Atsushi Togo 3281cc26e3 Merge branch 'windows' into long-to-int64 2025-01-27 09:55:23 +09:00
Atsushi Togo 4eeb1e4d4f Update github action for build-windows 2025-01-27 09:48:01 +09:00
Atsushi Togo 942b1f5e01 c-long was changed to int64_t. 2025-01-26 21:29:32 +09:00
Atsushi Togo d024ecb4c0 Merge branch 'windows' into develop 2025-01-26 19:27:50 +09:00
Atsushi Togo b81d56c2f3 Merge branch 'macos' into develop 2025-01-26 19:26:42 +09:00
Atsushi Togo 54a18f1af2 Add github action test on windows 2025-01-26 19:18:51 +09:00
Atsushi Togo 5315df39c0 Add github action test on macos 2025-01-26 19:14:23 +09:00
Atsushi Togo 8f4f48cadc
Merge pull request #336 from phonopy/pypolymlp
Change default disp-distance for pypolymlp
2025-01-22 07:16:35 +09:00
Atsushi Togo 24621c81fa
Merge pull request #337 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-01-21 10:41:56 +09:00
pre-commit-ci[bot] 6bf78730b2
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.1 → v0.9.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.1...v0.9.2)
2025-01-20 23:54:08 +00:00
Atsushi Togo 2a9fd71e53 Change default disp-distance for pypolymlp 2025-01-19 18:25:58 +09:00
Atsushi Togo b8677363b2 Minor change of displaying pypolymlp params 2025-01-19 14:52:31 +09:00
Atsushi Togo 988354a346 Update to support cutoff of symfc for fc3 2025-01-18 22:54:22 +09:00
Atsushi Togo d4f1b0d87c Merge branch 'develop' 2025-01-18 20:09:36 +09:00
Atsushi Togo f129c5a6d1
Merge pull request #334 from phonopy/release
Set version 3.11.2
2025-01-18 19:34:30 +09:00
Atsushi Togo ee213e9395 Set version 3.11.2 2025-01-18 19:20:36 +09:00
Atsushi Togo b6d961ea50 Merge branch 'make-wheel-test' into develop 2025-01-18 12:48:23 +09:00
Atsushi Togo 845e5e5418 Update github workflow to build wheels 2025-01-18 12:42:07 +09:00
Atsushi Togo ba101f1b52 Update github workflow to build wheels 2025-01-18 12:37:35 +09:00
Atsushi Togo 4489781af1 Update github workflow to build wheels 2025-01-18 12:28:21 +09:00
Atsushi Togo 2d9b233c74 Add github workflow to build wheels 2025-01-18 12:10:40 +09:00
Atsushi Togo befc1fdba0 Refactoring of kaccum_script.py 2025-01-16 12:45:56 +09:00
Atsushi Togo 90c600c61b Fix kaccum_script 2025-01-15 21:46:22 +09:00
Atsushi Togo c64aefd726 Update pypolymlp interface documentation 2025-01-15 19:36:24 +09:00
Atsushi Togo 394e7e0601
Merge pull request #332 from phonopy/refactoring
Refactor CUI for using pypolymlp
2025-01-15 19:05:35 +09:00
Atsushi Togo bbd238090a Update a test due to the change of default behaviour 2025-01-15 18:10:29 +09:00
Atsushi Togo a66f59ac47 Symfc is used to handle random displacements unless specified in CUI. 2025-01-15 17:00:53 +09:00
Atsushi Togo bd9cfd81c7 Minor fix of run_mode 2025-01-15 16:42:42 +09:00
Atsushi Togo 9587735e29 Made possible to specify -d option for phono3py-load 2025-01-15 16:21:40 +09:00
Atsushi Togo 2f91fea9cf Refactor CUI for using pypolymlp 2025-01-15 16:15:37 +09:00
Atsushi Togo 4ac2d788f3
Merge pull request #331 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-01-14 11:12:11 +09:00
pre-commit-ci[bot] 33522bda1a [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-01-14 00:34:49 +00:00
pre-commit-ci[bot] 705ade84f8
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.6...v0.9.1)
2025-01-14 00:34:39 +00:00
Atsushi Togo d5f48c0ed2 Merge branch 'develop' of github.com:phonopy/phono3py into develop 2025-01-13 16:19:56 +09:00
Atsushi Togo 5146070780 Update pypolymlp example 2025-01-13 16:19:45 +09:00
Atsushi Togo 2afef356db Minor fix of show_general_settings 2025-01-13 10:13:33 +09:00
Atsushi Togo 42c12a78e8 Merge branch 'develop' 2025-01-12 10:48:29 +09:00
Atsushi Togo 17576533b0
Merge pull request #330 from phonopy/release
Release v3.11.1
2025-01-12 10:27:02 +09:00
Atsushi Togo 672702083a Update documentation 2025-01-12 10:18:50 +09:00
Atsushi Togo 36f976a6ab Set version 3.11.1 2025-01-12 10:16:42 +09:00
Atsushi Togo b2309d69a3
Merge pull request #329 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-01-07 10:43:17 +09:00
pre-commit-ci[bot] ed441f048e
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.4 → v0.8.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.4...v0.8.6)
2025-01-07 01:25:24 +00:00
Atsushi Togo 9ea51edba8 Merge branch 'develop' 2025-01-02 14:47:51 +09:00
Atsushi Togo a14ffc34f3
Merge pull request #328 from phonopy/release
Set version 3.11.0
2025-01-02 14:46:00 +09:00
Atsushi Togo 8e06402135 Set version 3.11.0 2025-01-02 14:36:56 +09:00
Atsushi Togo 5f281b6534 Update phonopy version dependency 2025-01-01 15:14:35 +09:00
Atsushi Togo 4ee00d50c8 importskip test_random_disps_agno2 2025-01-01 10:59:28 +09:00
Atsushi Togo 2ede289425 importskip test_random_disps_agno2 2025-01-01 10:58:33 +09:00
Atsushi Togo 193eddbd02
Merge pull request #327 from phonopy/rd-option
New --rd auto option
2025-01-01 10:54:59 +09:00
Atsushi Togo 1d3d085db7 New --rd auto option 2025-01-01 10:43:28 +09:00
Atsushi Togo ae4ad6fa18
Merge pull request #326 from phonopy/remove-get_displacements_fc3
Update get_displacements_and_forces_fc3
2024-12-28 14:24:26 +09:00
Atsushi Togo 47a2fa8ee4 Update get_displacements_and_forces_fc3 2024-12-28 13:55:28 +09:00
Atsushi Togo 3dda1e3290
Merge pull request #325 from phonopy/wien2k-forces
Add wien2k supercell forces for the example
2024-12-28 13:35:06 +09:00
Atsushi Togo c685e37f39 Include total energy in supercell scf files 2024-12-28 08:17:04 +09:00
Atsushi Togo d3c906934c Add wien2k supercell forces for the example 2024-12-28 08:00:05 +09:00
Atsushi Togo 1f17f4ec18
Merge pull request #324 from phonopy/SergeevGregory-wien2k-support
Merge PR-323
2024-12-28 07:34:56 +09:00
Atsushi Togo a2de5322c1 Merge PR-323 2024-12-28 07:26:05 +09:00
Atsushi Togo ce6b8aa182
Merge pull request #322 from phonopy/minor-fix
Minor fix
2024-12-26 18:35:04 +09:00
Atsushi Togo ecb7e899b3 Minor fix 2024-12-26 18:22:51 +09:00
Atsushi Togo 22220ead6e Merge branch 'develop' 2024-12-26 10:34:46 +09:00
Atsushi Togo feba2ed3fb
Merge pull request #321 from phonopy/releaes
Set version 3.10.2
2024-12-26 10:27:01 +09:00
Atsushi Togo 3a7458b207 Set version 3.10.2 2024-12-26 10:17:52 +09:00
Atsushi Togo d987e9e2ed
Merge pull request #320 from phonopy/default-no-lapacke
Update github workflows for no-lapacke as default
2024-12-26 10:16:57 +09:00
Atsushi Togo 1184cc00c4 Fix titles of github workflows 2024-12-26 10:11:06 +09:00
Atsushi Togo fb7f2bbe8f Update github workflows for no-lapacke as default 2024-12-26 10:02:00 +09:00
Atsushi Togo 5604d368cc
Merge pull request #317 from phonopy/for-win
Minor refactoring of direct solution code
2024-12-24 17:25:36 +09:00
Atsushi Togo 47aaab55d3 Show also trace in diagonalization of colmat 2024-12-24 15:59:36 +09:00
Atsushi Togo b12248f384 Show diagonalization information 2024-12-24 15:37:41 +09:00
Atsushi Togo 61712ee520 Made D_diag's dtype=long 2024-12-24 13:30:05 +09:00
Atsushi Togo a4a424fe29
Merge pull request #316 from phonopy/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-12-24 11:49:07 +09:00
pre-commit-ci[bot] cd1e1e9407
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.3 → v0.8.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.3...v0.8.4)
2024-12-24 00:07:42 +00:00
Atsushi Togo bd951bf592
Merge pull request #315 from phonopy/cf-win-build
Refactor C build
2024-12-23 20:57:44 +09:00
Atsushi Togo 0b677509b9 Remove unnecessary functions from _phono3py.cpp and phono3py.h 2024-12-23 16:04:55 +09:00
Atsushi Togo 71dcf84108 Define complex for VC 2024-12-23 15:45:51 +09:00
Atsushi Togo 7b8f7a8d84 Define complex for VC 2024-12-23 15:20:16 +09:00
Atsushi Togo eb1ebe0cf2 Update CMakeLists.txt 2024-12-23 14:43:32 +09:00
Atsushi Togo be5d2dd30c Set BUILD_WITHOUT_LAPACKE=ON as default 2024-12-23 14:17:06 +09:00
169 changed files with 22108 additions and 11164 deletions

View File

@ -1,4 +1,4 @@
name: Pytest with mkl sing BLAS for phph-calc
name: Pytest with mkl using BLAS for phph-calc
on:
pull_request:
@ -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 spglib alm cmake c-compiler cxx-compiler pypolymlp
conda install --yes matplotlib-base pyyaml "libblas=*=*mkl" mkl-include h5py scipy pytest spglib alm cmake c-compiler cxx-compiler "pypolymlp<0.9"
- name: Install symfc develop branch
run: |
conda activate test
@ -42,7 +42,7 @@ jobs:
- name: Install phono3py
run: |
conda activate test
PHPHCALC_USE_MTBLAS=ON pip install -e . -vvv
BUILD_WITHOUT_LAPACKE=OFF PHPHCALC_USE_MTBLAS=ON pip install -e . -vvv
- name: Run pytest
run: |
conda activate test

View File

@ -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 spglib alm cmake c-compiler cxx-compiler pypolymlp
conda install --yes matplotlib-base pyyaml "libblas=*=*mkl" mkl-include h5py scipy pytest spglib alm cmake c-compiler cxx-compiler "pypolymlp<0.9"
- name: Install symfc develop branch
run: |
conda activate test
@ -42,7 +42,7 @@ jobs:
- name: Install phono3py
run: |
conda activate test
pip install -e . -vvv
BUILD_WITHOUT_LAPACKE=OFF pip install -e . -vvv
- name: Run pytest
run: |
conda activate test

View File

@ -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 pypolymlp
conda install --yes matplotlib-base pyyaml "libblas=*=*mkl" mkl-include h5py scipy pytest codecov pytest-cov spglib alm cmake c-compiler cxx-compiler "pypolymlp<0.9"
- name: Install symfc develop branch
run: |
conda activate test
@ -46,7 +46,7 @@ jobs:
- name: Run pytest
run: |
conda activate test
pytest -v --cov=./ --cov-report=xml test
BUILD_WITHOUT_LAPACKE=OFF pytest -v --cov=./ --cov-report=xml test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:

View File

@ -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 spglib alm cmake c-compiler cxx-compiler pypolymlp
conda install --yes matplotlib-base pyyaml "libblas=*=*openblas" openblas h5py scipy pytest spglib alm cmake c-compiler cxx-compiler "pypolymlp<0.9"
- name: Install symfc develop branch
run: |
conda activate test
@ -42,7 +42,7 @@ jobs:
- name: Install phono3py
run: |
conda activate test
PHPHCALC_USE_MTBLAS=ON pip install -e . -vvv
BUILD_WITHOUT_LAPACKE=OFF PHPHCALC_USE_MTBLAS=ON pip install -e . -vvv
- name: Run pytest
run: |
conda activate test

View File

@ -1,4 +1,4 @@
name: Pytest without linking BLAS and LAPACK in C
name: Pytest with linking BLAS and LAPACK in C
on:
pull_request:
@ -24,7 +24,7 @@ jobs:
run: |
conda activate test
conda install --yes python=${{ matrix.python-version }}
conda install --yes matplotlib-base pyyaml h5py scipy pytest spglib cmake c-compiler cxx-compiler
conda install --yes matplotlib-base pyyaml "libblas=*=*openblas" openblas h5py scipy pytest spglib cmake c-compiler cxx-compiler
- name: Install symfc develop branch
run: |
conda activate test
@ -42,7 +42,7 @@ jobs:
- name: Install phono3py
run: |
conda activate test
BUILD_WITHOUT_LAPACKE=ON pip install -e . -vvv
BUILD_WITHOUT_LAPACKE=OFF pip install -e . -vvv
- name: Run pytest
run: |
conda activate test

View File

@ -1,4 +1,4 @@
name: Pytest with openblas
name: Pytest without using LAPACKE
on:
pull_request:
@ -25,13 +25,13 @@ jobs:
run: |
conda activate test
conda install --yes python=${{ matrix.python-version }}
conda install --yes matplotlib-base pyyaml "libblas=*=*openblas" openblas h5py "numpy>=2.1" scipy pytest spglib alm cmake c-compiler cxx-compiler pypolymlp
conda install --yes matplotlib-base pyyaml h5py "numpy>=2.1" scipy pytest spglib alm cmake c-compiler cxx-compiler "pypolymlp<0.9"
- name: Install dependent packages for python == 3.9
if: ${{ matrix.python-version == 3.9 }}
run: |
conda activate test
conda install --yes python=${{ matrix.python-version }}
conda install --yes matplotlib-base pyyaml "libblas=*=*openblas" openblas h5py scipy pytest spglib alm cmake c-compiler cxx-compiler
conda install --yes matplotlib-base pyyaml h5py scipy pytest spglib alm cmake c-compiler cxx-compiler
- name: Install symfc develop branch
run: |
conda activate test

View File

@ -0,0 +1,23 @@
name: Pytest on macOS
on:
push:
branches:
- macos
jobs:
build-macos:
runs-on: macos-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Install phono3py
run: |
pip install -e . -v
- name: Run pytest
run: |
pip install pytest
pytest -v test

View File

@ -0,0 +1,26 @@
name: Pytest on windows
on:
push:
branches:
- windows
jobs:
build-windows:
runs-on: windows-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Install phonopy
run: |
pip install git+https://github.com/phonopy/phonopy@develop
- name: Install phono3py
run: |
pip install -e . -v
- name: Run pytest
run: |
pip install pytest
pytest -v test

96
.github/workflows/wheels.yml vendored Normal file
View File

@ -0,0 +1,96 @@
name: wheel-build-and-deploy
on:
push:
branches:
- make-wheel
- make-wheel-test
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
# Used to host cibuildwheel
- uses: actions/setup-python@v5
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.22.0
- name: Build wheels on ubuntu
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
git tag v`grep __version__ phono3py/version.py|awk -F'"' '{print($2)}'`
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "cp39-* pp* *_i686 *musllinux*"
CIBW_BUILD_VERBOSITY: 1
- name: Build wheels on macos
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
git tag v`grep __version__ phono3py/version.py|awk -F'"' '{print($2)}'`
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "cp39-* pp*"
# CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_BUILD_VERBOSITY: 1
- name: Build wheels on windows
if: ${{ startsWith(matrix.os, 'windows') }}
run: |
$version = Select-String -Path "phono3py\version.py" -Pattern '__version__' | ForEach-Object {
($_ -split '"')[1]
}
git tag "v$version"
Write-Output "The value of version is: $version"
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "cp39-* pp*"
CIBW_BUILD_VERBOSITY: 1
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
upload_pypi_test:
name: Upload to PyPI (test)
needs: [build_wheels,]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/make-wheel-test' }}
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
upload_pypi:
name: Upload to PyPI
needs: [build_wheels,]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/make-wheel' }}
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true

View File

@ -1,45 +1,55 @@
# See https://pre-commit.com for more informatio
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
exclude: ^example/AlN-LDA/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
exclude: ^example/AlN-LDA/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
hooks:
- id: ruff
args: [ "--fix", "--show-fixes" ]
- id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.5
hooks:
- id: ruff
args: [ "--fix", "--show-fixes" ]
- id: ruff-format
- repo: https://github.com/Takishima/cmake-pre-commit-hooks
rev: v1.9.6
hooks:
- id: clang-format
args:
- '-B_build-pre-commit'
- '-DWITH_Fortran=ON'
- '-DWITH_TESTS=ON'
- '-i'
stages: [manual]
- id: clang-tidy
args:
- '-B_build-pre-commit'
- '-DWITH_Fortran=ON'
- '-DWITH_TESTS=ON'
# - '--'
# - '-I/Users/togo/.miniforge/envs/dev/include'
# - '-I/Users/togo/.miniforge/envs/dev/include/python3.10'
# - '-I/Users/togo/.miniforge/envs/dev/lib/python3.10/site-packages/numpy/core/include'
stages: [manual]
- repo: https://github.com/Takishima/cmake-pre-commit-hooks
rev: v1.9.6
hooks:
- id: clang-format
args:
- "-B_build-pre-commit"
- "-DWITH_Fortran=ON"
- "-DWITH_TESTS=ON"
- "-i"
stages: [manual]
- id: clang-tidy
args:
- "-B_build-pre-commit"
- "-DWITH_Fortran=ON"
- "-DWITH_TESTS=ON"
# "- --"
# "- -I/Users/togo/.miniforge/envs/dev/include"
# "- -I/Users/togo/.miniforge/envs/dev/include/python3.10"
# "- -I/Users/togo/.miniforge/envs/dev/lib/python3.10/site-packages/numpy/core/include"
stages: [manual]
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- id: cmake-lint
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- id: cmake-lint
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
stages: [pre-commit, commit-msg]
args:
- --ignore-words-list
- "te,groth,skelton,inout,mater"
- --check-filenames

View File

@ -31,6 +31,7 @@ else()
endif()
if(BUILD_NANOBIND_MODULE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
project(${SKBUILD_PROJECT_NAME})
set(DEV_MODULE Development.Module)
find_package(
@ -66,7 +67,9 @@ endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "CMAKE_SYSTEM_PREFIX_PATH: ${CMAKE_SYSTEM_PREFIX_PATH}")
if(USE_CONDA_PATH AND DEFINED ENV{CONDA_PREFIX})
if((NOT BUILD_WITHOUT_LAPACKE)
AND USE_CONDA_PATH
AND DEFINED ENV{CONDA_PREFIX})
message(STATUS "$ENV{CONDA_PREFIX}")
set(CMAKE_MODULE_PATH $ENV{CONDA_PREFIX})
set(MY_INCLUDES $ENV{CONDA_PREFIX}/include ${PROJECT_SOURCE_DIR}/c)
@ -134,17 +137,17 @@ if(BUILD_RECGRID_LIB
OR BUILD_PHPHCALC_LIB
OR BUILD_NANOBIND_MODULE)
# Source code
set(SOURCES_PHPHCALC
set(SOURCES_RECGRID
${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})
add_library(recgrid_lib SHARED ${SOURCES_RECGRID})
else()
# Static link library
add_library(recgrid_lib STATIC ${SOURCES_PHPHCALC})
add_library(recgrid_lib STATIC ${SOURCES_RECGRID})
endif()
if(NOT BUILD_NANOBIND_MODULE)

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
#include <math.h>
#include <nanobind/nanobind.h>
#include <nanobind/ndarray.h>
#include <stdint.h>
#include "phononcalc.h"
@ -16,46 +17,46 @@ void py_get_phonons_at_gridpoints(
double unit_conversion_factor, nb::ndarray<> py_born_effective_charge,
nb::ndarray<> py_dielectric_constant, nb::ndarray<> py_reciprocal_lattice,
nb::ndarray<> py_q_direction, double nac_factor, nb::ndarray<> py_dd_q0,
nb::ndarray<> py_G_list, double lambda, long is_nac, long is_nac_q_zero,
long use_GL_NAC, const char *uplo) {
nb::ndarray<> py_G_list, double lambda, int64_t is_nac,
int64_t is_nac_q_zero, int64_t use_GL_NAC, const char *uplo) {
double(*born)[3][3];
double(*dielectric)[3];
double *q_dir;
double *freqs;
_lapack_complex_double *eigvecs;
char *phonon_done;
long *grid_points;
long(*grid_address)[3];
int64_t *grid_points;
int64_t(*grid_address)[3];
double(*QDinv)[3];
double *fc2;
double(*svecs_fc2)[3];
long(*multi_fc2)[2];
int64_t(*multi_fc2)[2];
double(*positions_fc2)[3];
double *masses_fc2;
long *p2s_fc2;
long *s2p_fc2;
int64_t *p2s_fc2;
int64_t *s2p_fc2;
double(*rec_lat)[3];
double(*dd_q0)[2];
double(*G_list)[3];
long num_patom, num_satom, num_phonons, num_grid_points, num_G_points;
int64_t num_patom, num_satom, num_phonons, num_grid_points, num_G_points;
freqs = (double *)py_frequencies.data();
eigvecs = (_lapack_complex_double *)py_eigenvectors.data();
phonon_done = (char *)py_phonon_done.data();
grid_points = (long *)py_grid_points.data();
grid_address = (long(*)[3])py_grid_address.data();
grid_points = (int64_t *)py_grid_points.data();
grid_address = (int64_t(*)[3])py_grid_address.data();
QDinv = (double(*)[3])py_QDinv.data();
fc2 = (double *)py_fc2.data();
svecs_fc2 = (double(*)[3])py_shortest_vectors_fc2.data();
multi_fc2 = (long(*)[2])py_multiplicity_fc2.data();
multi_fc2 = (int64_t(*)[2])py_multiplicity_fc2.data();
masses_fc2 = (double *)py_masses_fc2.data();
p2s_fc2 = (long *)py_p2s_map_fc2.data();
s2p_fc2 = (long *)py_s2p_map_fc2.data();
p2s_fc2 = (int64_t *)py_p2s_map_fc2.data();
s2p_fc2 = (int64_t *)py_s2p_map_fc2.data();
rec_lat = (double(*)[3])py_reciprocal_lattice.data();
num_patom = (long)py_multiplicity_fc2.shape(1);
num_satom = (long)py_multiplicity_fc2.shape(0);
num_phonons = (long)py_frequencies.shape(0);
num_grid_points = (long)py_grid_points.shape(0);
num_patom = (int64_t)py_multiplicity_fc2.shape(1);
num_satom = (int64_t)py_multiplicity_fc2.shape(0);
num_phonons = (int64_t)py_frequencies.shape(0);
num_grid_points = (int64_t)py_grid_points.shape(0);
if (is_nac) {
born = (double(*)[3][3])py_born_effective_charge.data();
@ -78,7 +79,7 @@ void py_get_phonons_at_gridpoints(
if (use_GL_NAC) {
dd_q0 = (double(*)[2])py_dd_q0.data();
G_list = (double(*)[3])py_G_list.data();
num_G_points = (long)py_G_list.shape(0);
num_G_points = (int64_t)py_G_list.shape(0);
positions_fc2 = (double(*)[3])py_positions_fc2.data();
} else {
dd_q0 = NULL;

View File

@ -1,40 +1,41 @@
#include <nanobind/nanobind.h>
#include <nanobind/ndarray.h>
#include <stdint.h>
#include "recgrid.h"
namespace nb = nanobind;
long py_get_grid_index_from_address(nb::ndarray<> py_address,
nb::ndarray<> py_D_diag) {
long *address;
long *D_diag;
long gp;
int64_t py_get_grid_index_from_address(nb::ndarray<> py_address,
nb::ndarray<> py_D_diag) {
int64_t *address;
int64_t *D_diag;
int64_t gp;
address = (long *)py_address.data();
D_diag = (long *)py_D_diag.data();
address = (int64_t *)py_address.data();
D_diag = (int64_t *)py_D_diag.data();
gp = recgrid_get_grid_index_from_address(address, D_diag);
return gp;
}
long py_get_ir_grid_map(nb::ndarray<> py_grid_mapping_table,
nb::ndarray<> py_D_diag, nb::ndarray<> py_is_shift,
nb::ndarray<> py_rotations) {
long *D_diag;
long *is_shift;
long(*rot)[3][3];
long num_rot;
int64_t py_get_ir_grid_map(nb::ndarray<> py_grid_mapping_table,
nb::ndarray<> py_D_diag, nb::ndarray<> py_is_shift,
nb::ndarray<> py_rotations) {
int64_t *D_diag;
int64_t *is_shift;
int64_t(*rot)[3][3];
int64_t num_rot;
long *grid_mapping_table;
long num_ir;
int64_t *grid_mapping_table;
int64_t num_ir;
D_diag = (long *)py_D_diag.data();
is_shift = (long *)py_is_shift.data();
rot = (long(*)[3][3])py_rotations.data();
num_rot = (long)py_rotations.shape(0);
grid_mapping_table = (long *)py_grid_mapping_table.data();
D_diag = (int64_t *)py_D_diag.data();
is_shift = (int64_t *)py_is_shift.data();
rot = (int64_t(*)[3][3])py_rotations.data();
num_rot = (int64_t)py_rotations.shape(0);
grid_mapping_table = (int64_t *)py_grid_mapping_table.data();
num_ir = recgrid_get_ir_grid_map(grid_mapping_table, rot, num_rot, D_diag,
is_shift);
@ -43,25 +44,25 @@ long py_get_ir_grid_map(nb::ndarray<> py_grid_mapping_table,
void py_get_gr_grid_addresses(nb::ndarray<> py_gr_grid_addresses,
nb::ndarray<> py_D_diag) {
long(*gr_grid_addresses)[3];
long *D_diag;
int64_t(*gr_grid_addresses)[3];
int64_t *D_diag;
gr_grid_addresses = (long(*)[3])py_gr_grid_addresses.data();
D_diag = (long *)py_D_diag.data();
gr_grid_addresses = (int64_t(*)[3])py_gr_grid_addresses.data();
D_diag = (int64_t *)py_D_diag.data();
recgrid_get_all_grid_addresses(gr_grid_addresses, D_diag);
}
long py_get_reciprocal_rotations(nb::ndarray<> py_rec_rotations,
nb::ndarray<> py_rotations,
long is_time_reversal) {
long(*rec_rotations)[3][3];
long(*rotations)[3][3];
long num_rot, num_rec_rot;
int64_t py_get_reciprocal_rotations(nb::ndarray<> py_rec_rotations,
nb::ndarray<> py_rotations,
int64_t is_time_reversal) {
int64_t(*rec_rotations)[3][3];
int64_t(*rotations)[3][3];
int64_t num_rot, num_rec_rot;
rec_rotations = (long(*)[3][3])py_rec_rotations.data();
rotations = (long(*)[3][3])py_rotations.data();
num_rot = (long)py_rotations.shape(0);
rec_rotations = (int64_t(*)[3][3])py_rec_rotations.data();
rotations = (int64_t(*)[3][3])py_rotations.data();
num_rot = (int64_t)py_rotations.shape(0);
num_rec_rot = recgrid_get_reciprocal_point_group(
rec_rotations, rotations, num_rot, is_time_reversal, 1);
@ -72,17 +73,17 @@ long py_get_reciprocal_rotations(nb::ndarray<> py_rec_rotations,
bool py_transform_rotations(nb::ndarray<> py_transformed_rotations,
nb::ndarray<> py_rotations, nb::ndarray<> py_D_diag,
nb::ndarray<> py_Q) {
long(*transformed_rotations)[3][3];
long(*rotations)[3][3];
long *D_diag;
long(*Q)[3];
long num_rot, succeeded;
int64_t(*transformed_rotations)[3][3];
int64_t(*rotations)[3][3];
int64_t *D_diag;
int64_t(*Q)[3];
int64_t num_rot, succeeded;
transformed_rotations = (long(*)[3][3])py_transformed_rotations.data();
rotations = (long(*)[3][3])py_rotations.data();
D_diag = (long *)py_D_diag.data();
Q = (long(*)[3])py_Q.data();
num_rot = (long)py_transformed_rotations.shape(0);
transformed_rotations = (int64_t(*)[3][3])py_transformed_rotations.data();
rotations = (int64_t(*)[3][3])py_rotations.data();
D_diag = (int64_t *)py_D_diag.data();
Q = (int64_t(*)[3])py_Q.data();
num_rot = (int64_t)py_transformed_rotations.shape(0);
succeeded = recgrid_transform_rotations(transformed_rotations, rotations,
num_rot, D_diag, Q);
@ -95,16 +96,16 @@ bool py_transform_rotations(nb::ndarray<> py_transformed_rotations,
bool py_get_snf3x3(nb::ndarray<> py_D_diag, nb::ndarray<> py_P,
nb::ndarray<> py_Q, nb::ndarray<> py_A) {
long *D_diag;
long(*P)[3];
long(*Q)[3];
long(*A)[3];
long succeeded;
int64_t *D_diag;
int64_t(*P)[3];
int64_t(*Q)[3];
int64_t(*A)[3];
int64_t succeeded;
D_diag = (long *)py_D_diag.data();
P = (long(*)[3])py_P.data();
Q = (long(*)[3])py_Q.data();
A = (long(*)[3])py_A.data();
D_diag = (int64_t *)py_D_diag.data();
P = (int64_t(*)[3])py_P.data();
Q = (int64_t(*)[3])py_Q.data();
A = (int64_t(*)[3])py_A.data();
succeeded = recgrid_get_snf3x3(D_diag, P, Q, A);
if (succeeded) {
@ -114,26 +115,25 @@ bool py_get_snf3x3(nb::ndarray<> py_D_diag, nb::ndarray<> py_P,
}
}
long py_get_bz_grid_addresses(nb::ndarray<> py_bz_grid_addresses,
nb::ndarray<> py_bz_map, nb::ndarray<> py_bzg2grg,
nb::ndarray<> py_D_diag, nb::ndarray<> py_Q,
nb::ndarray<> py_PS,
nb::ndarray<> py_reciprocal_lattice, long type) {
long(*bz_grid_addresses)[3];
long *bz_map;
long *bzg2grg;
long *D_diag;
long(*Q)[3];
long *PS;
int64_t py_get_bz_grid_addresses(
nb::ndarray<> py_bz_grid_addresses, nb::ndarray<> py_bz_map,
nb::ndarray<> py_bzg2grg, nb::ndarray<> py_D_diag, nb::ndarray<> py_Q,
nb::ndarray<> py_PS, nb::ndarray<> py_reciprocal_lattice, int64_t type) {
int64_t(*bz_grid_addresses)[3];
int64_t *bz_map;
int64_t *bzg2grg;
int64_t *D_diag;
int64_t(*Q)[3];
int64_t *PS;
double(*reciprocal_lattice)[3];
long num_total_gp;
int64_t num_total_gp;
bz_grid_addresses = (long(*)[3])py_bz_grid_addresses.data();
bz_map = (long *)py_bz_map.data();
bzg2grg = (long *)py_bzg2grg.data();
D_diag = (long *)py_D_diag.data();
Q = (long(*)[3])py_Q.data();
PS = (long *)py_PS.data();
bz_grid_addresses = (int64_t(*)[3])py_bz_grid_addresses.data();
bz_map = (int64_t *)py_bz_map.data();
bzg2grg = (int64_t *)py_bzg2grg.data();
D_diag = (int64_t *)py_D_diag.data();
Q = (int64_t(*)[3])py_Q.data();
PS = (int64_t *)py_PS.data();
reciprocal_lattice = (double(*)[3])py_reciprocal_lattice.data();
num_total_gp =
@ -143,23 +143,24 @@ long py_get_bz_grid_addresses(nb::ndarray<> py_bz_grid_addresses,
return num_total_gp;
}
long py_rotate_bz_grid_addresses(long bz_grid_index, nb::ndarray<> py_rotation,
nb::ndarray<> py_bz_grid_addresses,
nb::ndarray<> py_bz_map,
nb::ndarray<> py_D_diag, nb::ndarray<> py_PS,
long type) {
long(*bz_grid_addresses)[3];
long(*rotation)[3];
long *bz_map;
long *D_diag;
long *PS;
long ret_bz_gp;
int64_t py_rotate_bz_grid_addresses(int64_t bz_grid_index,
nb::ndarray<> py_rotation,
nb::ndarray<> py_bz_grid_addresses,
nb::ndarray<> py_bz_map,
nb::ndarray<> py_D_diag,
nb::ndarray<> py_PS, int64_t type) {
int64_t(*bz_grid_addresses)[3];
int64_t(*rotation)[3];
int64_t *bz_map;
int64_t *D_diag;
int64_t *PS;
int64_t ret_bz_gp;
bz_grid_addresses = (long(*)[3])py_bz_grid_addresses.data();
rotation = (long(*)[3])py_rotation.data();
bz_map = (long *)py_bz_map.data();
D_diag = (long *)py_D_diag.data();
PS = (long *)py_PS.data();
bz_grid_addresses = (int64_t(*)[3])py_bz_grid_addresses.data();
rotation = (int64_t(*)[3])py_rotation.data();
bz_map = (int64_t *)py_bz_map.data();
D_diag = (int64_t *)py_D_diag.data();
PS = (int64_t *)py_PS.data();
ret_bz_gp = recgrid_rotate_bz_grid_index(
bz_grid_index, rotation, bz_grid_addresses, bz_map, D_diag, PS, type);

View File

@ -35,6 +35,7 @@
#include "bzgrid.h"
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -43,7 +44,7 @@
#include "recgrid.h"
#define BZG_NUM_BZ_SEARCH_SPACE 125
static long bz_search_space[BZG_NUM_BZ_SEARCH_SPACE][3] = {
static int64_t bz_search_space[BZG_NUM_BZ_SEARCH_SPACE][3] = {
{0, 0, 0}, {0, 0, 1}, {0, 0, 2}, {0, 0, -2}, {0, 0, -1},
{0, 1, 0}, {0, 1, 1}, {0, 1, 2}, {0, 1, -2}, {0, 1, -1},
{0, 2, 0}, {0, 2, 1}, {0, 2, 2}, {0, 2, -2}, {0, 2, -1},
@ -71,27 +72,30 @@ static long bz_search_space[BZG_NUM_BZ_SEARCH_SPACE][3] = {
{-1, -1, 0}, {-1, -1, 1}, {-1, -1, 2}, {-1, -1, -2}, {-1, -1, -1}};
static void get_bz_grid_addresses_type1(RecgridBZGrid *bzgrid,
const long Qinv[3][3]);
const int64_t Qinv[3][3]);
static void get_bz_grid_addresses_type2(RecgridBZGrid *bzgrid,
const long Qinv[3][3]);
static void set_bz_address(long address[3], const long bz_index,
const long grid_address[3], const long D_diag[3],
const long nint[3], const long Qinv[3][3]);
static double get_bz_distances(long nint[3], double distances[],
const int64_t Qinv[3][3]);
static void set_bz_address(int64_t address[3], const int64_t bz_index,
const int64_t grid_address[3],
const int64_t D_diag[3], const int64_t nint[3],
const int64_t Qinv[3][3]);
static double get_bz_distances(int64_t nint[3], double distances[],
const RecgridBZGrid *bzgrid,
const long grid_address[3],
const int64_t grid_address[3],
const double tolerance);
static void multiply_matrix_vector_d3(double v[3], const double a[3][3],
const double b[3]);
static void multiply_matrix_vector_ld3(double v[3], const long a[3][3],
static void multiply_matrix_vector_ld3(double v[3], const int64_t a[3][3],
const double b[3]);
static long get_inverse_unimodular_matrix_l3(long m[3][3], const long a[3][3]);
static int64_t get_inverse_unimodular_matrix_l3(int64_t m[3][3],
const int64_t a[3][3]);
static double norm_squared_d3(const double a[3]);
long bzg_rotate_grid_index(const long bz_grid_index, const long rotation[3][3],
const RecgridConstBZGrid *bzgrid) {
long i, gp, num_bzgp, num_grgp;
long dadrs[3], dadrs_rot[3], adrs_rot[3];
int64_t bzg_rotate_grid_index(const int64_t bz_grid_index,
const int64_t rotation[3][3],
const RecgridConstBZGrid *bzgrid) {
int64_t i, gp, num_bzgp, num_grgp;
int64_t dadrs[3], dadrs_rot[3], adrs_rot[3];
grg_get_double_grid_address(dadrs, bzgrid->addresses[bz_grid_index],
bzgrid->PS);
@ -129,9 +133,9 @@ long bzg_rotate_grid_index(const long bz_grid_index, const long rotation[3][3],
return bzgrid->gp_map[gp];
}
long bzg_get_bz_grid_addresses(RecgridBZGrid *bzgrid) {
long det;
long Qinv[3][3];
int64_t bzg_get_bz_grid_addresses(RecgridBZGrid *bzgrid) {
int64_t det;
int64_t Qinv[3][3];
det = get_inverse_unimodular_matrix_l3(Qinv, bzgrid->Q);
if (det == 0) {
@ -148,12 +152,12 @@ long bzg_get_bz_grid_addresses(RecgridBZGrid *bzgrid) {
}
static void get_bz_grid_addresses_type1(RecgridBZGrid *bzgrid,
const long Qinv[3][3]) {
const int64_t Qinv[3][3]) {
double tolerance, min_distance;
double distances[BZG_NUM_BZ_SEARCH_SPACE];
long bzmesh[3], bz_address_double[3], nint[3], gr_adrs[3];
long i, j, k, boundary_num_gp, total_num_gp, bzgp, gp, num_bzmesh;
long count, id_shift;
int64_t bzmesh[3], bz_address_double[3], nint[3], gr_adrs[3];
int64_t i, j, k, boundary_num_gp, total_num_gp, bzgp, gp, num_bzmesh;
int64_t count, id_shift;
tolerance = recgrid_get_tolerance_for_BZ_reduction(bzgrid);
for (j = 0; j < 3; j++) {
@ -208,11 +212,11 @@ static void get_bz_grid_addresses_type1(RecgridBZGrid *bzgrid,
}
static void get_bz_grid_addresses_type2(RecgridBZGrid *bzgrid,
const long Qinv[3][3]) {
const int64_t Qinv[3][3]) {
double tolerance, min_distance;
double distances[BZG_NUM_BZ_SEARCH_SPACE];
long nint[3], gr_adrs[3];
long i, j, num_gp;
int64_t nint[3], gr_adrs[3];
int64_t i, j, num_gp;
tolerance = recgrid_get_tolerance_for_BZ_reduction(bzgrid);
num_gp = 0;
@ -238,11 +242,12 @@ static void get_bz_grid_addresses_type2(RecgridBZGrid *bzgrid,
bzgrid->size = num_gp;
}
static void set_bz_address(long address[3], const long bz_index,
const long grid_address[3], const long D_diag[3],
const long nint[3], const long Qinv[3][3]) {
long i;
long deltaG[3];
static void set_bz_address(int64_t address[3], const int64_t bz_index,
const int64_t grid_address[3],
const int64_t D_diag[3], const int64_t nint[3],
const int64_t Qinv[3][3]) {
int64_t i;
int64_t deltaG[3];
for (i = 0; i < 3; i++) {
deltaG[i] = bz_search_space[bz_index][i] - nint[i];
@ -253,12 +258,12 @@ static void set_bz_address(long address[3], const long bz_index,
}
}
static double get_bz_distances(long nint[3], double distances[],
static double get_bz_distances(int64_t nint[3], double distances[],
const RecgridBZGrid *bzgrid,
const long grid_address[3],
const int64_t grid_address[3],
const double tolerance) {
long i, j;
long dadrs[3];
int64_t i, j;
int64_t dadrs[3];
double min_distance;
double q_vec[3], q_red[3];
@ -297,7 +302,7 @@ static double get_bz_distances(long nint[3], double distances[],
static void multiply_matrix_vector_d3(double v[3], const double a[3][3],
const double b[3]) {
long i;
int64_t i;
double c[3];
for (i = 0; i < 3; i++) {
c[i] = a[i][0] * b[0] + a[i][1] * b[1] + a[i][2] * b[2];
@ -307,9 +312,9 @@ static void multiply_matrix_vector_d3(double v[3], const double a[3][3],
}
}
static void multiply_matrix_vector_ld3(double v[3], const long a[3][3],
static void multiply_matrix_vector_ld3(double v[3], const int64_t a[3][3],
const double b[3]) {
long i;
int64_t i;
double c[3];
for (i = 0; i < 3; i++) {
c[i] = a[i][0] * b[0] + a[i][1] * b[1] + a[i][2] * b[2];
@ -319,9 +324,10 @@ static void multiply_matrix_vector_ld3(double v[3], const long a[3][3],
}
}
static long get_inverse_unimodular_matrix_l3(long m[3][3], const long a[3][3]) {
long det;
long c[3][3];
static int64_t get_inverse_unimodular_matrix_l3(int64_t m[3][3],
const int64_t a[3][3]) {
int64_t det;
int64_t c[3][3];
det = lagmat_get_determinant_l3(a);
if (labs(det) != 1) {

View File

@ -35,10 +35,13 @@
#ifndef __bzgrid_H__
#define __bzgrid_H__
#include <stdint.h>
#include "recgrid.h"
long bzg_rotate_grid_index(const long grid_index, const long rotation[3][3],
const RecgridConstBZGrid *bzgrid);
long bzg_get_bz_grid_addresses(RecgridBZGrid *bzgrid);
int64_t bzg_rotate_grid_index(const int64_t grid_index,
const int64_t rotation[3][3],
const RecgridConstBZGrid *bzgrid);
int64_t bzg_get_bz_grid_addresses(RecgridBZGrid *bzgrid);
#endif

View File

@ -35,6 +35,7 @@
#include "collision_matrix.h"
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -43,53 +44,74 @@
static void get_collision_matrix(
double *collision_matrix, const double *fc3_normal_squared,
const long num_band0, const long num_band, const double *frequencies,
const long (*triplets)[3], const long *triplets_map, const long num_gp,
const long *map_q, const long *rot_grid_points, const long num_ir_gp,
const long num_rot, const double *rotations_cartesian, const double *g,
const double temperature, const double unit_conversion_factor,
const int64_t num_band0, const int64_t num_band, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplets_map,
const int64_t num_gp, const int64_t *map_q, const int64_t *rot_grid_points,
const int64_t num_ir_gp, const int64_t num_rot,
const double *rotations_cartesian, const double *g,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency);
static void get_collision_matrix_at_gp(
double *collision_matrix, const double *fc3_normal_squared,
const int64_t num_band0, const int64_t num_band, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplets_map,
const int64_t *map_q, const int64_t *rot_grid_points,
const int64_t num_ir_gp, const int64_t num_rot,
const double *rotations_cartesian, const double *g,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency, const int64_t *gp2tp_map, const int64_t i);
static void get_reducible_collision_matrix(
double *collision_matrix, const double *fc3_normal_squared,
const long num_band0, const long num_band, const double *frequencies,
const long (*triplets)[3], const long *triplets_map, const long num_gp,
const long *map_q, const double *g, const double temperature,
const double unit_conversion_factor, const double cutoff_frequency);
static long get_inv_sinh(double *inv_sinh, const long gp,
const double temperature, const double *frequencies,
const long triplet[3], const long *triplets_map,
const long *map_q, const long num_band,
const double cutoff_frequency);
static long *create_gp2tp_map(const long *triplets_map, const long num_gp);
const int64_t num_band0, const int64_t num_band, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplets_map,
const int64_t num_gp, const int64_t *map_q, const double *g,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency);
static void get_reducible_collision_matrix_at_gp(
double *collision_matrix, const double *fc3_normal_squared,
const int64_t num_band0, const int64_t num_band, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplets_map,
const int64_t num_gp, const int64_t *map_q, const double *g,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency, const int64_t *gp2tp_map, const int64_t i);
static int64_t get_inv_sinh(double *inv_sinh, const int64_t gp,
const double temperature_THz,
const double *frequencies, const int64_t triplet[3],
const int64_t *triplets_map, const int64_t *map_q,
const int64_t num_band,
const double cutoff_frequency);
static int64_t *create_gp2tp_map(const int64_t *triplets_map,
const int64_t num_gp);
void col_get_collision_matrix(
double *collision_matrix, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplets_map, const long *map_q, const long *rot_grid_points,
const double *rotations_cartesian, const double *g, const long num_ir_gp,
const long num_gp, const long num_rot, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplets_map, const int64_t *map_q,
const int64_t *rot_grid_points, const double *rotations_cartesian,
const double *g, const int64_t num_ir_gp, const int64_t num_gp,
const int64_t num_rot, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency) {
long num_triplets, num_band0, num_band;
int64_t num_triplets, num_band0, num_band;
num_triplets = fc3_normal_squared->dims[0];
num_band0 = fc3_normal_squared->dims[1];
num_band = fc3_normal_squared->dims[2];
get_collision_matrix(collision_matrix, fc3_normal_squared->data, num_band0,
num_band, frequencies, triplets, triplets_map, num_gp,
map_q, rot_grid_points, num_ir_gp, num_rot,
rotations_cartesian,
g + 2 * num_triplets * num_band0 * num_band * num_band,
temperature, unit_conversion_factor, cutoff_frequency);
get_collision_matrix(
collision_matrix, fc3_normal_squared->data, num_band0, num_band,
frequencies, triplets, triplets_map, num_gp, map_q, rot_grid_points,
num_ir_gp, num_rot, rotations_cartesian,
g + 2 * num_triplets * num_band0 * num_band * num_band, temperature_THz,
unit_conversion_factor, cutoff_frequency);
}
void col_get_reducible_collision_matrix(
double *collision_matrix, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplets_map, const long *map_q, const double *g,
const long num_gp, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplets_map, const int64_t *map_q, const double *g,
const int64_t num_gp, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency) {
long num_triplets, num_band, num_band0;
int64_t num_triplets, num_band, num_band0;
num_triplets = fc3_normal_squared->dims[0];
num_band0 = fc3_normal_squared->dims[1];
@ -98,147 +120,182 @@ void col_get_reducible_collision_matrix(
get_reducible_collision_matrix(
collision_matrix, fc3_normal_squared->data, num_band0, num_band,
frequencies, triplets, triplets_map, num_gp, map_q,
g + 2 * num_triplets * num_band0 * num_band * num_band, temperature,
g + 2 * num_triplets * num_band0 * num_band * num_band, temperature_THz,
unit_conversion_factor, cutoff_frequency);
}
static void get_collision_matrix(
double *collision_matrix, const double *fc3_normal_squared,
const long num_band0, const long num_band, const double *frequencies,
const long (*triplets)[3], const long *triplets_map, const long num_gp,
const long *map_q, const long *rot_grid_points, const long num_ir_gp,
const long num_rot, const double *rotations_cartesian, const double *g,
const double temperature, const double unit_conversion_factor,
const int64_t num_band0, const int64_t num_band, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplets_map,
const int64_t num_gp, const int64_t *map_q, const int64_t *rot_grid_points,
const int64_t num_ir_gp, const int64_t num_rot,
const double *rotations_cartesian, const double *g,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency) {
long i, j, k, l, m, n, ti, r_gp, swapped;
long *gp2tp_map;
double collision;
double *inv_sinh;
int64_t i;
int64_t *gp2tp_map;
gp2tp_map = create_gp2tp_map(triplets_map, num_gp);
#ifdef _OPENMP
#pragma omp parallel for private(j, k, l, m, n, ti, r_gp, collision, inv_sinh)
#pragma omp parallel for
#endif
for (i = 0; i < num_ir_gp; i++) {
inv_sinh = (double *)malloc(sizeof(double) * num_band);
for (j = 0; j < num_rot; j++) {
r_gp = rot_grid_points[i * num_rot + j];
ti = gp2tp_map[triplets_map[r_gp]];
swapped = get_inv_sinh(inv_sinh, r_gp, temperature, frequencies,
triplets[ti], triplets_map, map_q, num_band,
cutoff_frequency);
for (k = 0; k < num_band0; k++) {
for (l = 0; l < num_band; l++) {
collision = 0;
for (m = 0; m < num_band; m++) {
if (swapped) {
collision +=
fc3_normal_squared[ti * num_band0 * num_band *
num_band +
k * num_band * num_band +
m * num_band + l] *
g[ti * num_band0 * num_band * num_band +
k * num_band * num_band + m * num_band + l] *
inv_sinh[m] * unit_conversion_factor;
} else {
collision +=
fc3_normal_squared[ti * num_band0 * num_band *
num_band +
k * num_band * num_band +
l * num_band + m] *
g[ti * num_band0 * num_band * num_band +
k * num_band * num_band + l * num_band + m] *
inv_sinh[m] * unit_conversion_factor;
}
}
for (m = 0; m < 3; m++) {
for (n = 0; n < 3; n++) {
collision_matrix[k * 3 * num_ir_gp * num_band * 3 +
m * num_ir_gp * num_band * 3 +
i * num_band * 3 + l * 3 + n] +=
collision *
rotations_cartesian[j * 9 + m * 3 + n];
}
}
}
}
}
free(inv_sinh);
inv_sinh = NULL;
get_collision_matrix_at_gp(
collision_matrix, fc3_normal_squared, num_band0, num_band,
frequencies, triplets, triplets_map, map_q, rot_grid_points,
num_ir_gp, num_rot, rotations_cartesian, g, temperature_THz,
unit_conversion_factor, cutoff_frequency, gp2tp_map, i);
}
free(gp2tp_map);
gp2tp_map = NULL;
}
static void get_reducible_collision_matrix(
static void get_collision_matrix_at_gp(
double *collision_matrix, const double *fc3_normal_squared,
const long num_band0, const long num_band, const double *frequencies,
const long (*triplets)[3], const long *triplets_map, const long num_gp,
const long *map_q, const double *g, const double temperature,
const double unit_conversion_factor, const double cutoff_frequency) {
long i, j, k, l, ti, swapped;
long *gp2tp_map;
const int64_t num_band0, const int64_t num_band, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplets_map,
const int64_t *map_q, const int64_t *rot_grid_points,
const int64_t num_ir_gp, const int64_t num_rot,
const double *rotations_cartesian, const double *g,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency, const int64_t *gp2tp_map, const int64_t i) {
int64_t j, k, l, m, n, ti, r_gp, swapped;
double collision;
double *inv_sinh;
gp2tp_map = create_gp2tp_map(triplets_map, num_gp);
inv_sinh = (double *)malloc(sizeof(double) * num_band);
for (j = 0; j < num_rot; j++) {
r_gp = rot_grid_points[i * num_rot + j];
ti = gp2tp_map[triplets_map[r_gp]];
swapped = get_inv_sinh(inv_sinh, r_gp, temperature_THz, frequencies,
triplets[ti], triplets_map, map_q, num_band,
cutoff_frequency);
#ifdef _OPENMP
#pragma omp parallel for private(j, k, l, ti, collision, inv_sinh)
#endif
for (i = 0; i < num_gp; i++) {
inv_sinh = (double *)malloc(sizeof(double) * num_band);
ti = gp2tp_map[triplets_map[i]];
swapped =
get_inv_sinh(inv_sinh, i, temperature, frequencies, triplets[ti],
triplets_map, map_q, num_band, cutoff_frequency);
for (j = 0; j < num_band0; j++) {
for (k = 0; k < num_band; k++) {
for (k = 0; k < num_band0; k++) {
for (l = 0; l < num_band; l++) {
collision = 0;
for (l = 0; l < num_band; l++) {
for (m = 0; m < num_band; m++) {
if (swapped) {
collision +=
fc3_normal_squared[ti * num_band0 * num_band *
num_band +
j * num_band * num_band +
l * num_band + k] *
k * num_band * num_band +
m * num_band + l] *
g[ti * num_band0 * num_band * num_band +
j * num_band * num_band + l * num_band + k] *
inv_sinh[l] * unit_conversion_factor;
k * num_band * num_band + m * num_band + l] *
inv_sinh[m] * unit_conversion_factor;
} else {
collision +=
fc3_normal_squared[ti * num_band0 * num_band *
num_band +
j * num_band * num_band +
k * num_band + l] *
k * num_band * num_band +
l * num_band + m] *
g[ti * num_band0 * num_band * num_band +
j * num_band * num_band + k * num_band + l] *
inv_sinh[l] * unit_conversion_factor;
k * num_band * num_band + l * num_band + m] *
inv_sinh[m] * unit_conversion_factor;
}
}
for (m = 0; m < 3; m++) {
for (n = 0; n < 3; n++) {
collision_matrix[k * 3 * num_ir_gp * num_band * 3 +
m * num_ir_gp * num_band * 3 +
i * num_band * 3 + l * 3 + n] +=
collision * rotations_cartesian[j * 9 + m * 3 + n];
}
}
collision_matrix[j * num_gp * num_band + i * num_band + k] +=
collision;
}
}
}
free(inv_sinh);
inv_sinh = NULL;
}
free(inv_sinh);
inv_sinh = NULL;
static void get_reducible_collision_matrix(
double *collision_matrix, const double *fc3_normal_squared,
const int64_t num_band0, const int64_t num_band, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplets_map,
const int64_t num_gp, const int64_t *map_q, const double *g,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency) {
int64_t i;
int64_t *gp2tp_map;
gp2tp_map = create_gp2tp_map(triplets_map, num_gp);
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (i = 0; i < num_gp; i++) {
get_reducible_collision_matrix_at_gp(
collision_matrix, fc3_normal_squared, num_band0, num_band,
frequencies, triplets, triplets_map, num_gp, map_q, g,
temperature_THz, unit_conversion_factor, cutoff_frequency,
gp2tp_map, i);
}
free(gp2tp_map);
gp2tp_map = NULL;
}
static long get_inv_sinh(double *inv_sinh, const long gp,
const double temperature, const double *frequencies,
const long triplet[3], const long *triplets_map,
const long *map_q, const long num_band,
const double cutoff_frequency) {
long i, gp2, swapped;
static void get_reducible_collision_matrix_at_gp(
double *collision_matrix, const double *fc3_normal_squared,
const int64_t num_band0, const int64_t num_band, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplets_map,
const int64_t num_gp, const int64_t *map_q, const double *g,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency, const int64_t *gp2tp_map, const int64_t i) {
int64_t j, k, l, ti, swapped;
double collision;
double *inv_sinh;
inv_sinh = (double *)malloc(sizeof(double) * num_band);
ti = gp2tp_map[triplets_map[i]];
swapped =
get_inv_sinh(inv_sinh, i, temperature_THz, frequencies, triplets[ti],
triplets_map, map_q, num_band, cutoff_frequency);
for (j = 0; j < num_band0; j++) {
for (k = 0; k < num_band; k++) {
collision = 0;
for (l = 0; l < num_band; l++) {
if (swapped) {
collision += fc3_normal_squared[ti * num_band0 * num_band *
num_band +
j * num_band * num_band +
l * num_band + k] *
g[ti * num_band0 * num_band * num_band +
j * num_band * num_band + l * num_band + k] *
inv_sinh[l] * unit_conversion_factor;
} else {
collision += fc3_normal_squared[ti * num_band0 * num_band *
num_band +
j * num_band * num_band +
k * num_band + l] *
g[ti * num_band0 * num_band * num_band +
j * num_band * num_band + k * num_band + l] *
inv_sinh[l] * unit_conversion_factor;
}
}
collision_matrix[j * num_gp * num_band + i * num_band + k] +=
collision;
}
}
free(inv_sinh);
inv_sinh = NULL;
}
static int64_t get_inv_sinh(double *inv_sinh, const int64_t gp,
const double temperature_THz,
const double *frequencies, const int64_t triplet[3],
const int64_t *triplets_map, const int64_t *map_q,
const int64_t num_band,
const double cutoff_frequency) {
int64_t i, gp2, swapped;
double f;
/* This assumes the algorithm of get_ir_triplets_at_q_perm_q1q2, */
@ -255,7 +312,7 @@ static long get_inv_sinh(double *inv_sinh, const long gp,
for (i = 0; i < num_band; i++) {
f = frequencies[gp2 * num_band + i];
if (f > cutoff_frequency) {
inv_sinh[i] = funcs_inv_sinh_occupation(f, temperature);
inv_sinh[i] = funcs_inv_sinh_occupation(f, temperature_THz);
} else {
inv_sinh[i] = 0;
}
@ -267,11 +324,12 @@ static long get_inv_sinh(double *inv_sinh, const long gp,
/* Symmetrically independent triplets are indexed. */
/* Inverse definition of ir_grid_points in get_BZ_triplets_at_q */
/* in triplet_grid.c. */
static long *create_gp2tp_map(const long *triplets_map, const long num_gp) {
long i, num_ir;
long *gp2tp_map;
static int64_t *create_gp2tp_map(const int64_t *triplets_map,
const int64_t num_gp) {
int64_t i, num_ir;
int64_t *gp2tp_map;
gp2tp_map = (long *)malloc(sizeof(long) * num_gp);
gp2tp_map = (int64_t *)malloc(sizeof(int64_t) * num_gp);
num_ir = 0;
for (i = 0; i < num_gp; i++) {
if (triplets_map[i] == i) {

View File

@ -35,20 +35,23 @@
#ifndef __collision_matrix_H__
#define __collision_matrix_H__
#include <stdint.h>
#include "phonoc_array.h"
void col_get_collision_matrix(
double *collision_matrix, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplets_map, const long *map_q, const long *rot_grid_points,
const double *rotations_cartesian, const double *g, const long num_ir_gp,
const long num_gp, const long num_rot, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplets_map, const int64_t *map_q,
const int64_t *rot_grid_points, const double *rotations_cartesian,
const double *g, const int64_t num_ir_gp, const int64_t num_gp,
const int64_t num_rot, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency);
void col_get_reducible_collision_matrix(
double *collision_matrix, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplets_map, const long *map_q, const double *g,
const long num_gp, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplets_map, const int64_t *map_q, const double *g,
const int64_t num_gp, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency);
#endif

View File

@ -35,56 +35,61 @@
#include "dynmat.h"
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#define PI 3.14159265358979323846
static void add_dynmat_dd_at_q(
double (*dynamical_matrices)[2], const double q[3], const double *fc,
const double (*positions)[3], const long num_patom, const double *masses,
const double (*positions)[3], const int64_t num_patom, const double *masses,
const double (*born)[3][3], const double dielectric[3][3],
const double reciprocal_lattice[3][3], const double *q_dir_cart,
const double nac_factor, const double (*dd_q0)[2],
const double (*G_list)[3], const long num_G_points, const double lambda,
const double (*G_list)[3], const int64_t num_G_points, const double lambda,
const double tolerance);
static void get_dynmat_ij(double (*dynamical_matrix)[2], const long num_patom,
const long num_satom, const double *fc,
const double q[3], const double (*svecs)[3],
const long (*multi)[2], const double *mass,
const long *s2p_map, const long *p2s_map,
const double (*charge_sum)[3][3], const long i,
const long j);
static void get_dm(double dm[3][3][2], const long num_patom,
const long num_satom, const double *fc, const double q[3],
const double (*svecs)[3], const long (*multi)[2],
const long *p2s_map, const double (*charge_sum)[3][3],
const long i, const long j, const long k);
static void get_dynmat_ij(double (*dynamical_matrix)[2],
const int64_t num_patom, const int64_t num_satom,
const double *fc, const double q[3],
const double (*svecs)[3], const int64_t (*multi)[2],
const double *mass, const int64_t *s2p_map,
const int64_t *p2s_map,
const double (*charge_sum)[3][3], const int64_t i,
const int64_t j);
static void get_dm(double dm[3][3][2], const int64_t num_patom,
const int64_t num_satom, const double *fc, const double q[3],
const double (*svecs)[3], const int64_t (*multi)[2],
const int64_t *p2s_map, const double (*charge_sum)[3][3],
const int64_t i, const int64_t j, const int64_t k);
static double get_dielectric_part(const double q_cart[3],
const double dielectric[3][3]);
static void get_dd(double (*dd_part)[2], /* [natom, 3, natom, 3, (real,imag)] */
const double (*G_list)[3], /* [num_G, 3] */
const long num_G, const long num_patom,
const int64_t num_G, const int64_t num_patom,
const double q_cart[3], const double *q_direction_cart,
const double dielectric[3][3],
const double (*pos)[3], /* [num_patom, 3] */
const double lambda, const double tolerance,
const long use_openmp);
const int64_t use_openmp);
static void get_dd_at_g(
double (*dd_part)[2], /* [natom, 3, natom, 3, (real,imag)] */
const long i, const long j, const double G[3], const long num_patom,
const double (*pos)[3], /* [num_patom, 3] */
const int64_t i, const int64_t j, const double G[3],
const int64_t num_patom, const double (*pos)[3], /* [num_patom, 3] */
const double KK[3][3]);
static void make_Hermitian(double (*mat)[2], const long num_band);
static void make_Hermitian(double (*mat)[2], const int64_t num_band);
static void multiply_borns(double (*dd)[2], const double (*dd_in)[2],
const long num_patom, const double (*born)[3][3],
const long use_openmp);
static void multiply_borns_at_ij(double (*dd)[2], const long i, const long j,
const double (*dd_in)[2], const long num_patom,
const int64_t num_patom, const double (*born)[3][3],
const int64_t use_openmp);
static void multiply_borns_at_ij(double (*dd)[2], const int64_t i,
const int64_t j, const double (*dd_in)[2],
const int64_t num_patom,
const double (*born)[3][3]);
static void transform_dynmat_to_fc_ij(
double *fc, const double (*dm)[2], const long i, const long j,
double *fc, const double (*dm)[2], const int64_t i, const int64_t j,
const double (*comm_points)[3], const double (*svecs)[3],
const long (*multi)[2], const double *masses, const long *s2pp_map,
const long *fc_index_map, const long num_patom, const long num_satom);
const int64_t (*multi)[2], const double *masses, const int64_t *s2pp_map,
const int64_t *fc_index_map, const int64_t num_patom,
const int64_t num_satom);
static void get_q_cart(double q_cart[3], const double q[3],
const double reciprocal_lattice[3][3]);
@ -94,17 +99,18 @@ static void get_q_cart(double q_cart[3], const double q[3],
/// !use_Wang_NAC and dd_0 is not NULL: NAC by Gonze and Lee.
/// @param reciprocal_lattice in column vectors
/// @param q_direction in Crystallographic coordinates.
long dym_dynamical_matrices_with_dd_openmp_over_qpoints(
int64_t dym_dynamical_matrices_with_dd_openmp_over_qpoints(
double (*dynamical_matrices)[2], const double (*qpoints)[3],
const long n_qpoints, const double *fc, const double (*svecs)[3],
const long (*multi)[2], const double (*positions)[3], const long num_patom,
const long num_satom, const double *masses, const long *p2s_map,
const long *s2p_map, const double (*born)[3][3],
const int64_t n_qpoints, const double *fc, const double (*svecs)[3],
const int64_t (*multi)[2], const double (*positions)[3],
const int64_t num_patom, const int64_t num_satom, const double *masses,
const int64_t *p2s_map, const int64_t *s2p_map, const double (*born)[3][3],
const double dielectric[3][3], const double (*reciprocal_lattice)[3],
const double *q_direction, const double nac_factor,
const double (*dd_q0)[2], const double (*G_list)[3],
const long num_G_points, const double lambda, const long use_Wang_NAC) {
long i, n, adrs_shift;
const int64_t num_G_points, const double lambda,
const int64_t use_Wang_NAC) {
int64_t i, n, adrs_shift;
double(*charge_sum)[3][3];
double q_cart[3];
double *q_dir_cart;
@ -182,13 +188,13 @@ long dym_dynamical_matrices_with_dd_openmp_over_qpoints(
static void add_dynmat_dd_at_q(
double (*dynamical_matrices)[2], const double q[3], const double *fc,
const double (*positions)[3], const long num_patom, const double *masses,
const double (*positions)[3], const int64_t num_patom, const double *masses,
const double (*born)[3][3], const double dielectric[3][3],
const double reciprocal_lattice[3][3], const double *q_dir_cart,
const double nac_factor, const double (*dd_q0)[2],
const double (*G_list)[3], const long num_G_points, const double lambda,
const double (*G_list)[3], const int64_t num_G_points, const double lambda,
const double tolerance) {
long i, j, k, l, adrs;
int64_t i, j, k, l, adrs;
double(*dd)[2];
double q_cart[3];
double mm;
@ -217,15 +223,13 @@ static void add_dynmat_dd_at_q(
}
/// @brief charge_sum is NULL if G-L NAC or no-NAC.
long dym_get_dynamical_matrix_at_q(double (*dynamical_matrix)[2],
const long num_patom, const long num_satom,
const double *fc, const double q[3],
const double (*svecs)[3],
const long (*multi)[2], const double *mass,
const long *s2p_map, const long *p2s_map,
const double (*charge_sum)[3][3],
const long use_openmp) {
long i, j, ij;
int64_t dym_get_dynamical_matrix_at_q(
double (*dynamical_matrix)[2], const int64_t num_patom,
const int64_t num_satom, const double *fc, const double q[3],
const double (*svecs)[3], const int64_t (*multi)[2], const double *mass,
const int64_t *s2p_map, const int64_t *p2s_map,
const double (*charge_sum)[3][3], const int64_t use_openmp) {
int64_t i, j, ij;
if (use_openmp) {
#ifdef _OPENMP
@ -256,13 +260,13 @@ void dym_get_recip_dipole_dipole(
double (*dd)[2], /* [natom, 3, natom, 3, (real,imag)] */
const double (*dd_q0)[2], /* [natom, 3, 3, (real,imag)] */
const double (*G_list)[3], /* [num_G, 3] */
const long num_G, const long num_patom, const double q_cart[3],
const int64_t num_G, const int64_t num_patom, const double q_cart[3],
const double *q_direction_cart, /* must be pointer */
const double (*born)[3][3], const double dielectric[3][3],
const double (*pos)[3], /* [num_patom, 3] */
const double factor, /* 4pi/V*unit-conv */
const double lambda, const double tolerance, const long use_openmp) {
long i, k, l, adrs, adrs_sum;
const double lambda, const double tolerance, const int64_t use_openmp) {
int64_t i, k, l, adrs, adrs_sum;
double(*dd_tmp)[2];
dd_tmp =
@ -306,10 +310,10 @@ void dym_get_recip_dipole_dipole(
void dym_get_recip_dipole_dipole_q0(
double (*dd_q0)[2], /* [natom, 3, 3, (real,imag)] */
const double (*G_list)[3], /* [num_G, 3] */
const long num_G, const long num_patom, const double (*born)[3][3],
const int64_t num_G, const int64_t num_patom, const double (*born)[3][3],
const double dielectric[3][3], const double (*pos)[3], /* [num_patom, 3] */
const double lambda, const double tolerance, const long use_openmp) {
long i, j, k, l, adrs_tmp, adrs, adrsT;
const double lambda, const double tolerance, const int64_t use_openmp) {
int64_t i, j, k, l, adrs_tmp, adrs, adrsT;
double zero_vec[3];
double(*dd_tmp1)[2], (*dd_tmp2)[2];
@ -390,10 +394,10 @@ void dym_get_recip_dipole_dipole_q0(
}
void dym_get_charge_sum(
double (*charge_sum)[3][3], const long num_patom,
double (*charge_sum)[3][3], const int64_t num_patom,
const double factor, /* 4pi/V*unit-conv and denominator */
const double q_cart[3], const double (*born)[3][3]) {
long i, j, k, a, b;
int64_t i, j, k, a, b;
double(*q_born)[3];
q_born = (double(*)[3])malloc(sizeof(double[3]) * num_patom);
@ -431,14 +435,13 @@ void dym_get_charge_sum(
/* comm_points[num_satom / num_patom, 3] */
/* shortest_vectors[:, 3] */
/* multiplicities[num_satom, num_patom, 2] */
void dym_transform_dynmat_to_fc(double *fc, const double (*dm)[2],
const double (*comm_points)[3],
const double (*svecs)[3],
const long (*multi)[2], const double *masses,
const long *s2pp_map, const long *fc_index_map,
const long num_patom, const long num_satom,
const long use_openmp) {
long i, j, ij;
void dym_transform_dynmat_to_fc(
double *fc, const double (*dm)[2], const double (*comm_points)[3],
const double (*svecs)[3], const int64_t (*multi)[2], const double *masses,
const int64_t *s2pp_map, const int64_t *fc_index_map,
const int64_t num_patom, const int64_t num_satom,
const int64_t use_openmp) {
int64_t i, j, ij;
for (i = 0; i < num_patom * num_satom * 9; i++) {
fc[i] = 0;
@ -465,14 +468,15 @@ void dym_transform_dynmat_to_fc(double *fc, const double (*dm)[2],
}
/// @brief charge_sum is NULL if G-L NAC or no-NAC.
static void get_dynmat_ij(double (*dynamical_matrix)[2], const long num_patom,
const long num_satom, const double *fc,
const double q[3], const double (*svecs)[3],
const long (*multi)[2], const double *mass,
const long *s2p_map, const long *p2s_map,
const double (*charge_sum)[3][3], const long i,
const long j) {
long k, l, adrs;
static void get_dynmat_ij(double (*dynamical_matrix)[2],
const int64_t num_patom, const int64_t num_satom,
const double *fc, const double q[3],
const double (*svecs)[3], const int64_t (*multi)[2],
const double *mass, const int64_t *s2p_map,
const int64_t *p2s_map,
const double (*charge_sum)[3][3], const int64_t i,
const int64_t j) {
int64_t k, l, adrs;
double mass_sqrt;
double dm[3][3][2]; // [3][3][(real, imag)]
@ -502,12 +506,12 @@ static void get_dynmat_ij(double (*dynamical_matrix)[2], const long num_patom,
}
}
static void get_dm(double dm[3][3][2], const long num_patom,
const long num_satom, const double *fc, const double q[3],
const double (*svecs)[3], const long (*multi)[2],
const long *p2s_map, const double (*charge_sum)[3][3],
const long i, const long j, const long k) {
long l, m, i_pair, m_pair, adrs;
static void get_dm(double dm[3][3][2], const int64_t num_patom,
const int64_t num_satom, const double *fc, const double q[3],
const double (*svecs)[3], const int64_t (*multi)[2],
const int64_t *p2s_map, const double (*charge_sum)[3][3],
const int64_t i, const int64_t j, const int64_t k) {
int64_t l, m, i_pair, m_pair, adrs;
double phase, cos_phase, sin_phase, fc_elem;
cos_phase = 0;
@ -542,7 +546,7 @@ static void get_dm(double dm[3][3][2], const long num_patom,
static double get_dielectric_part(const double q_cart[3],
const double dielectric[3][3]) {
long i, j;
int64_t i, j;
double sum;
sum = 0;
@ -556,13 +560,13 @@ static double get_dielectric_part(const double q_cart[3],
static void get_dd(double (*dd_part)[2], /* [natom, 3, natom, 3, (real,imag)] */
const double (*G_list)[3], /* [num_G, 3] */
const long num_G, const long num_patom,
const int64_t num_G, const int64_t num_patom,
const double q_cart[3], const double *q_direction_cart,
const double dielectric[3][3],
const double (*pos)[3], /* [num_patom, 3] */
const double lambda, const double tolerance,
const long use_openmp) {
long i, j, g;
const int64_t use_openmp) {
int64_t i, j, g;
double q_K[3];
double norm, dielectric_part, L2;
double(*KK)[3][3];
@ -629,10 +633,10 @@ static void get_dd(double (*dd_part)[2], /* [natom, 3, natom, 3, (real,imag)] */
static void get_dd_at_g(
double (*dd_part)[2], /* [natom, 3, natom, 3, (real,imag)] */
const long i, const long j, const double G[3], const long num_patom,
const double (*pos)[3], /* [num_patom, 3] */
const int64_t i, const int64_t j, const double G[3],
const int64_t num_patom, const double (*pos)[3], /* [num_patom, 3] */
const double KK[3][3]) {
long k, l, adrs;
int64_t k, l, adrs;
double cos_phase, sin_phase, phase;
phase = 0;
@ -654,8 +658,8 @@ static void get_dd_at_g(
}
}
static void make_Hermitian(double (*mat)[2], const long num_band) {
long i, j, adrs, adrsT;
static void make_Hermitian(double (*mat)[2], const int64_t num_band) {
int64_t i, j, adrs, adrsT;
for (i = 0; i < num_band; i++) {
for (j = i; j < num_band; j++) {
@ -675,9 +679,9 @@ static void make_Hermitian(double (*mat)[2], const long num_band) {
}
static void multiply_borns(double (*dd)[2], const double (*dd_in)[2],
const long num_patom, const double (*born)[3][3],
const long use_openmp) {
long i, j, ij;
const int64_t num_patom, const double (*born)[3][3],
const int64_t use_openmp) {
int64_t i, j, ij;
if (use_openmp) {
#ifdef _OPENMP
@ -696,10 +700,11 @@ static void multiply_borns(double (*dd)[2], const double (*dd_in)[2],
}
}
static void multiply_borns_at_ij(double (*dd)[2], const long i, const long j,
const double (*dd_in)[2], const long num_patom,
static void multiply_borns_at_ij(double (*dd)[2], const int64_t i,
const int64_t j, const double (*dd_in)[2],
const int64_t num_patom,
const double (*born)[3][3]) {
long k, l, m, n, adrs, adrs_in;
int64_t k, l, m, n, adrs, adrs_in;
double zz;
for (k = 0; k < 3; k++) { /* alpha */
@ -718,11 +723,12 @@ static void multiply_borns_at_ij(double (*dd)[2], const long i, const long j,
}
static void transform_dynmat_to_fc_ij(
double *fc, const double (*dm)[2], const long i, const long j,
double *fc, const double (*dm)[2], const int64_t i, const int64_t j,
const double (*comm_points)[3], const double (*svecs)[3],
const long (*multi)[2], const double *masses, const long *s2pp_map,
const long *fc_index_map, const long num_patom, const long num_satom) {
long k, l, m, N, adrs, m_pair, i_pair, svecs_adrs;
const int64_t (*multi)[2], const double *masses, const int64_t *s2pp_map,
const int64_t *fc_index_map, const int64_t num_patom,
const int64_t num_satom) {
int64_t k, l, m, N, adrs, m_pair, i_pair, svecs_adrs;
double coef, phase, cos_phase, sin_phase;
N = num_satom / num_patom;
@ -760,7 +766,7 @@ static void transform_dynmat_to_fc_ij(
/// @param reciprocal_lattice in column vectors
static void get_q_cart(double q_cart[3], const double q[3],
const double reciprocal_lattice[3][3]) {
long i, j;
int64_t i, j;
for (i = 0; i < 3; i++) {
q_cart[i] = 0;

View File

@ -34,42 +34,42 @@
#ifndef __dynmat_H__
#define __dynmat_H__
#include <stdint.h>
long dym_dynamical_matrices_with_dd_openmp_over_qpoints(
int64_t dym_dynamical_matrices_with_dd_openmp_over_qpoints(
double (*dynamical_matrices)[2], const double (*qpoints)[3],
const long n_qpoints, const double *fc, const double (*svecs)[3],
const long (*multi)[2], const double (*positions)[3], const long num_patom,
const long num_satom, const double *masses, const long *p2s_map,
const long *s2p_map, const double (*born)[3][3],
const int64_t n_qpoints, const double *fc, const double (*svecs)[3],
const int64_t (*multi)[2], const double (*positions)[3],
const int64_t num_patom, const int64_t num_satom, const double *masses,
const int64_t *p2s_map, const int64_t *s2p_map, const double (*born)[3][3],
const double dielectric[3][3], const double (*reciprocal_lattice)[3],
const double *q_direction, const double nac_factor,
const double (*dd_q0)[2], const double (*G_list)[3],
const long num_G_points, const double lambda, const long use_Wang_NAC);
long dym_get_dynamical_matrix_at_q(double (*dynamical_matrix)[2],
const long num_patom, const long num_satom,
const double *fc, const double q[3],
const double (*svecs)[3],
const long (*multi)[2], const double *mass,
const long *s2p_map, const long *p2s_map,
const double (*charge_sum)[3][3],
const long use_openmp);
const int64_t num_G_points, const double lambda,
const int64_t use_Wang_NAC);
int64_t dym_get_dynamical_matrix_at_q(
double (*dynamical_matrix)[2], const int64_t num_patom,
const int64_t num_satom, const double *fc, const double q[3],
const double (*svecs)[3], const int64_t (*multi)[2], const double *mass,
const int64_t *s2p_map, const int64_t *p2s_map,
const double (*charge_sum)[3][3], const int64_t use_openmp);
void dym_get_recip_dipole_dipole(
double (*dd)[2], /* [natom, 3, natom, 3, (real,imag)] */
const double (*dd_q0)[2], /* [natom, 3, 3, (real,imag)] */
const double (*G_list)[3], /* [num_G, 3] */
const long num_G, const long num_patom, const double q_cart[3],
const int64_t num_G, const int64_t num_patom, const double q_cart[3],
const double *q_direction_cart, /* must be pointer */
const double (*born)[3][3], const double dielectric[3][3],
const double (*pos)[3], /* [num_patom, 3] */
const double factor, /* 4pi/V*unit-conv */
const double lambda, const double tolerance, const long use_openmp);
const double lambda, const double tolerance, const int64_t use_openmp);
void dym_get_recip_dipole_dipole_q0(
double (*dd_q0)[2], /* [natom, 3, 3, (real,imag)] */
const double (*G_list)[3], /* [num_G, 3] */
const long num_G, const long num_patom, const double (*born)[3][3],
const int64_t num_G, const int64_t num_patom, const double (*born)[3][3],
const double dielectric[3][3], const double (*pos)[3], /* [natom, 3] */
const double lambda, const double tolerance, const long use_openmp);
void dym_get_charge_sum(double (*charge_sum)[3][3], const long num_patom,
const double lambda, const double tolerance, const int64_t use_openmp);
void dym_get_charge_sum(double (*charge_sum)[3][3], const int64_t num_patom,
const double factor, const double q_cart[3],
const double (*born)[3][3]);
/* fc[num_patom, num_satom, 3, 3] */
@ -77,12 +77,10 @@ void dym_get_charge_sum(double (*charge_sum)[3][3], const long num_patom,
/* comm_points[num_satom / num_patom, 3] */
/* shortest_vectors[:, 3] */
/* multiplicities[num_satom, num_patom, 2] */
void dym_transform_dynmat_to_fc(double *fc, const double (*dm)[2],
const double (*comm_points)[3],
const double (*svecs)[3],
const long (*multi)[2], const double *masses,
const long *s2pp_map, const long *fc_index_map,
const long num_patom, const long num_satom,
const long use_openmp);
void dym_transform_dynmat_to_fc(
double *fc, const double (*dm)[2], const double (*comm_points)[3],
const double (*svecs)[3], const int64_t (*multi)[2], const double *masses,
const int64_t *s2pp_map, const int64_t *fc_index_map,
const int64_t num_patom, const int64_t num_satom, const int64_t use_openmp);
#endif

165
c/fc3.c
View File

@ -34,47 +34,49 @@
#include "fc3.h"
#include <stdint.h>
#include <stdlib.h>
static void rotate_delta_fc2s(double (*rot_delta_fc2s)[3][3], const long i_atom,
const long j_atom,
const double (*delta_fc2s)[3][3],
const double (*site_sym_cart)[3][3],
const long *rot_map_sym, const long num_atom,
const long num_site_sym, const long num_disp);
static void rotate_delta_fc2s(
double (*rot_delta_fc2s)[3][3], const int64_t i_atom, const int64_t j_atom,
const double (*delta_fc2s)[3][3], const double (*site_sym_cart)[3][3],
const int64_t *rot_map_sym, const int64_t num_atom,
const int64_t num_site_sym, const int64_t num_disp);
static void tensor2_rotation(double rot_tensor[3][3], const double tensor[3][3],
const double r[3][3]);
static void tensor3_rotation(double *rot_tensor, const double *tensor,
const double *rot_cartesian);
static double tensor3_rotation_elem(const double *tensor, const double *r,
const long pos);
const int64_t pos);
static void copy_permutation_symmetry_fc3_elem(double *fc3,
const double fc3_elem[27],
const long a, const long b,
const long c,
const long num_atom);
const int64_t a, const int64_t b,
const int64_t c,
const int64_t num_atom);
static void set_permutation_symmetry_fc3_elem(double *fc3_elem,
const double *fc3, const long a,
const long b, const long c,
const long num_atom);
const double *fc3,
const int64_t a, const int64_t b,
const int64_t c,
const int64_t num_atom);
static void set_permutation_symmetry_compact_fc3(
double *fc3, const long p2s[], const long s2pp[], const long nsym_list[],
const long perms[], const long n_satom, const long n_patom);
static void transpose_compact_fc3_type01(double *fc3, const long p2s[],
const long s2pp[],
const long nsym_list[],
const long perms[], const long n_satom,
const long n_patom, const long t_type);
static void transpose_compact_fc3_type2(double *fc3, const long p2s[],
const long s2pp[],
const long nsym_list[],
const long perms[], const long n_satom,
const long n_patom);
double *fc3, const int64_t p2s[], const int64_t s2pp[],
const int64_t nsym_list[], const int64_t perms[], const int64_t n_satom,
const int64_t n_patom);
static void transpose_compact_fc3_type01(
double *fc3, const int64_t p2s[], const int64_t s2pp[],
const int64_t nsym_list[], const int64_t perms[], const int64_t n_satom,
const int64_t n_patom, const int64_t t_type);
static void transpose_compact_fc3_type2(double *fc3, const int64_t p2s[],
const int64_t s2pp[],
const int64_t nsym_list[],
const int64_t perms[],
const int64_t n_satom,
const int64_t n_patom);
void fc3_distribute_fc3(double *fc3, const long target, const long source,
const long *atom_mapping, const long num_atom,
void fc3_distribute_fc3(double *fc3, const int64_t target, const int64_t source,
const int64_t *atom_mapping, const int64_t num_atom,
const double *rot_cart) {
long i, j, adrs_out, adrs_in;
int64_t i, j, adrs_out, adrs_in;
for (i = 0; i < num_atom; i++) {
for (j = 0; j < num_atom; j++) {
@ -90,9 +92,9 @@ void fc3_distribute_fc3(double *fc3, const long target, const long source,
void fc3_rotate_delta_fc2(double (*fc3)[3][3][3],
const double (*delta_fc2s)[3][3], const double *inv_U,
const double (*site_sym_cart)[3][3],
const long *rot_map_syms, const long num_atom,
const long num_site_sym, const long num_disp) {
long i_atoms, i, j, k, l, m, n;
const int64_t *rot_map_syms, const int64_t num_atom,
const int64_t num_site_sym, const int64_t num_disp) {
int64_t i_atoms, i, j, k, l, m, n;
double(*rot_delta_fc2s)[3][3];
rot_delta_fc2s =
@ -120,9 +122,9 @@ void fc3_rotate_delta_fc2(double (*fc3)[3][3][3],
rot_delta_fc2s = NULL;
}
void fc3_set_permutation_symmetry_fc3(double *fc3, const long num_atom) {
void fc3_set_permutation_symmetry_fc3(double *fc3, const int64_t num_atom) {
double fc3_elem[27];
long i, j, k;
int64_t i, j, k;
#ifdef _OPENMP
#pragma omp parallel for private(j, k, fc3_elem)
@ -139,17 +141,20 @@ void fc3_set_permutation_symmetry_fc3(double *fc3, const long num_atom) {
}
}
void fc3_set_permutation_symmetry_compact_fc3(
double *fc3, const long p2s[], const long s2pp[], const long nsym_list[],
const long perms[], const long n_satom, const long n_patom) {
void fc3_set_permutation_symmetry_compact_fc3(double *fc3, const int64_t p2s[],
const int64_t s2pp[],
const int64_t nsym_list[],
const int64_t perms[],
const int64_t n_satom,
const int64_t n_patom) {
set_permutation_symmetry_compact_fc3(fc3, p2s, s2pp, nsym_list, perms,
n_satom, n_patom);
}
void fc3_transpose_compact_fc3(double *fc3, const long p2s[], const long s2pp[],
const long nsym_list[], const long perms[],
const long n_satom, const long n_patom,
const long t_type) {
void fc3_transpose_compact_fc3(double *fc3, const int64_t p2s[],
const int64_t s2pp[], const int64_t nsym_list[],
const int64_t perms[], const int64_t n_satom,
const int64_t n_patom, const int64_t t_type) {
/* Three types of index permutations */
/* t_type=0: dim[0] <-> dim[1] */
/* t_type=1: dim[0] <-> dim[2] */
@ -165,13 +170,12 @@ void fc3_transpose_compact_fc3(double *fc3, const long p2s[], const long s2pp[],
}
}
static void rotate_delta_fc2s(double (*rot_delta_fc2s)[3][3], const long i_atom,
const long j_atom,
const double (*delta_fc2s)[3][3],
const double (*site_sym_cart)[3][3],
const long *rot_map_sym, const long num_atom,
const long num_site_sym, const long num_disp) {
long i, j;
static void rotate_delta_fc2s(
double (*rot_delta_fc2s)[3][3], const int64_t i_atom, const int64_t j_atom,
const double (*delta_fc2s)[3][3], const double (*site_sym_cart)[3][3],
const int64_t *rot_map_sym, const int64_t num_atom,
const int64_t num_site_sym, const int64_t num_disp) {
int64_t i, j;
for (i = 0; i < num_disp; i++) {
for (j = 0; j < num_site_sym; j++) {
@ -187,7 +191,7 @@ static void rotate_delta_fc2s(double (*rot_delta_fc2s)[3][3], const long i_atom,
static void tensor2_rotation(double rot_tensor[3][3], const double tensor[3][3],
const double r[3][3]) {
long i, j, k, l;
int64_t i, j, k, l;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
@ -208,7 +212,7 @@ static void tensor2_rotation(double rot_tensor[3][3], const double tensor[3][3],
static void tensor3_rotation(double *rot_tensor, const double *tensor,
const double *rot_cartesian) {
long l;
int64_t l;
for (l = 0; l < 27; l++) {
rot_tensor[l] = tensor3_rotation_elem(tensor, rot_cartesian, l);
@ -216,8 +220,8 @@ static void tensor3_rotation(double *rot_tensor, const double *tensor,
}
static double tensor3_rotation_elem(const double *tensor, const double *r,
const long pos) {
long i, j, k, l, m, n;
const int64_t pos) {
int64_t i, j, k, l, m, n;
double sum;
l = pos / 9;
@ -238,10 +242,10 @@ static double tensor3_rotation_elem(const double *tensor, const double *r,
static void copy_permutation_symmetry_fc3_elem(double *fc3,
const double fc3_elem[27],
const long a, const long b,
const long c,
const long num_atom) {
long i, j, k;
const int64_t a, const int64_t b,
const int64_t c,
const int64_t num_atom) {
int64_t i, j, k;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
@ -264,10 +268,11 @@ static void copy_permutation_symmetry_fc3_elem(double *fc3,
}
static void set_permutation_symmetry_fc3_elem(double *fc3_elem,
const double *fc3, const long a,
const long b, const long c,
const long num_atom) {
long i, j, k;
const double *fc3,
const int64_t a, const int64_t b,
const int64_t c,
const int64_t num_atom) {
int64_t i, j, k;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
@ -292,16 +297,17 @@ static void set_permutation_symmetry_fc3_elem(double *fc3_elem,
}
static void set_permutation_symmetry_compact_fc3(
double *fc3, const long p2s[], const long s2pp[], const long nsym_list[],
const long perms[], const long n_satom, const long n_patom) {
double *fc3, const int64_t p2s[], const int64_t s2pp[],
const int64_t nsym_list[], const int64_t perms[], const int64_t n_satom,
const int64_t n_patom) {
/* fc3 shape=(n_patom, n_satom, n_satom, 3, 3, 3) */
/* 1D indexing: */
/* i * n_satom * n_satom * 27 + j * n_satom * 27 + */
/* k * 27 + l * 9 + m * 3 + n */
long i, j, k, l, m, n, i_p, j_p, k_p;
long done_any;
long i_trans_j, k_trans_j, i_trans_k, j_trans_k;
long adrs[6];
int64_t i, j, k, l, m, n, i_p, j_p, k_p;
int64_t done_any;
int64_t i_trans_j, k_trans_j, i_trans_k, j_trans_k;
int64_t adrs[6];
double fc3_elem[3][3][3];
char *done;
@ -395,18 +401,16 @@ static void set_permutation_symmetry_compact_fc3(
done = NULL;
}
static void transpose_compact_fc3_type01(double *fc3, const long p2s[],
const long s2pp[],
const long nsym_list[],
const long perms[], const long n_satom,
const long n_patom,
const long t_type) {
static void transpose_compact_fc3_type01(
double *fc3, const int64_t p2s[], const int64_t s2pp[],
const int64_t nsym_list[], const int64_t perms[], const int64_t n_satom,
const int64_t n_patom, const int64_t t_type) {
/* Three types of index permutations */
/* t_type=0: dim[0] <-> dim[1] */
/* t_type=1: dim[0] <-> dim[2] */
/* t_type=2: dim[1] <-> dim[2] */
long i, j, k, l, m, n, i_p, j_p, i_trans, k_trans;
long adrs, adrs_t;
int64_t i, j, k, l, m, n, i_p, j_p, i_trans, k_trans;
int64_t adrs, adrs_t;
double fc3_elem[3][3][3];
char *done;
@ -509,13 +513,14 @@ static void transpose_compact_fc3_type01(double *fc3, const long p2s[],
done = NULL;
}
static void transpose_compact_fc3_type2(double *fc3, const long p2s[],
const long s2pp[],
const long nsym_list[],
const long perms[], const long n_satom,
const long n_patom) {
long j, k, l, m, n, i_p;
long adrs, adrs_t;
static void transpose_compact_fc3_type2(double *fc3, const int64_t p2s[],
const int64_t s2pp[],
const int64_t nsym_list[],
const int64_t perms[],
const int64_t n_satom,
const int64_t n_patom) {
int64_t j, k, l, m, n, i_p;
int64_t adrs, adrs_t;
double fc3_elem[3][3][3];
for (i_p = 0; i_p < n_patom; i_p++) {

28
c/fc3.h
View File

@ -34,22 +34,26 @@
#ifndef __fc3_H__
#define __fc3_H__
#include <stdint.h>
void fc3_distribute_fc3(double *fc3, const long target, const long source,
const long *atom_mapping, const long num_atom,
void fc3_distribute_fc3(double *fc3, const int64_t target, const int64_t source,
const int64_t *atom_mapping, const int64_t num_atom,
const double *rot_cart);
void fc3_rotate_delta_fc2(double (*fc3)[3][3][3],
const double (*delta_fc2s)[3][3], const double *inv_U,
const double (*site_sym_cart)[3][3],
const long *rot_map_syms, const long num_atom,
const long num_site_sym, const long num_disp);
void fc3_set_permutation_symmetry_fc3(double *fc3, const long num_atom);
void fc3_set_permutation_symmetry_compact_fc3(
double *fc3, const long p2s[], const long s2pp[], const long nsym_list[],
const long perms[], const long n_satom, const long n_patom);
void fc3_transpose_compact_fc3(double *fc3, const long p2s[], const long s2pp[],
const long nsym_list[], const long perms[],
const long n_satom, const long n_patom,
const long t_type);
const int64_t *rot_map_syms, const int64_t num_atom,
const int64_t num_site_sym, const int64_t num_disp);
void fc3_set_permutation_symmetry_fc3(double *fc3, const int64_t num_atom);
void fc3_set_permutation_symmetry_compact_fc3(double *fc3, const int64_t p2s[],
const int64_t s2pp[],
const int64_t nsym_list[],
const int64_t perms[],
const int64_t n_satom,
const int64_t n_patom);
void fc3_transpose_compact_fc3(double *fc3, const int64_t p2s[],
const int64_t s2pp[], const int64_t nsym_list[],
const int64_t perms[], const int64_t n_satom,
const int64_t n_patom, const int64_t t_type);
#endif

View File

@ -38,17 +38,16 @@
#include "phonoc_const.h"
#define THZTOEVPARKB 47.992398658977166
#define INVSQRT2PI 0.3989422804014327
double funcs_bose_einstein(const double x, const double t) {
return 1.0 / (exp(THZTOEVPARKB * x / t) - 1);
double funcs_bose_einstein(const double x, const double temperature_THz) {
return 1.0 / (exp(x / temperature_THz) - 1);
}
double funcs_gaussian(const double x, const double sigma) {
return INVSQRT2PI / sigma * exp(-x * x / 2 / sigma / sigma);
}
double funcs_inv_sinh_occupation(const double x, const double t) {
return 1.0 / sinh(x * THZTOEVPARKB / 2 / t);
double funcs_inv_sinh_occupation(const double x, const double temperature_THz) {
return 1.0 / sinh(x / 2 / temperature_THz);
}

View File

@ -36,6 +36,7 @@
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include "lagrid.h"
@ -43,29 +44,35 @@
#define IDENTITY_TOL 1e-5
static void reduce_grid_address(long address[3], const long D_diag[3]);
static long get_double_grid_index(const long address_double[3],
const long D_diag[3], const long PS[3]);
static long get_grid_index_from_address(const long address[3],
const long D_diag[3]);
static void get_all_grid_addresses(long grid_address[][3],
const long D_diag[3]);
static void get_grid_address_from_index(long address[3], const long grid_index,
const long D_diag[3]);
static void get_grid_address(long address[3], const long address_double[3],
const long PS[3]);
static void get_double_grid_address(long address_double[3],
const long address[3], const long PS[3]);
static long rotate_grid_index(const long grid_index, const long rotation[3][3],
const long D_diag[3], const long PS[3]);
static void get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long PS[3]);
static void reduce_grid_address(int64_t address[3], const int64_t D_diag[3]);
static int64_t get_double_grid_index(const int64_t address_double[3],
const int64_t D_diag[3],
const int64_t PS[3]);
static int64_t get_grid_index_from_address(const int64_t address[3],
const int64_t D_diag[3]);
static void get_all_grid_addresses(int64_t grid_address[][3],
const int64_t D_diag[3]);
static void get_grid_address_from_index(int64_t address[3],
const int64_t grid_index,
const int64_t D_diag[3]);
static void get_grid_address(int64_t address[3],
const int64_t address_double[3],
const int64_t PS[3]);
static void get_double_grid_address(int64_t address_double[3],
const int64_t address[3],
const int64_t PS[3]);
static int64_t rotate_grid_index(const int64_t grid_index,
const int64_t rotation[3][3],
const int64_t D_diag[3], const int64_t PS[3]);
static void get_ir_grid_map(int64_t *ir_grid_map,
const int64_t (*rotations)[3][3],
const int64_t num_rot, const int64_t D_diag[3],
const int64_t PS[3]);
long grg_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3],
const long A[3][3]) {
long i, j, succeeded;
long D[3][3];
int64_t grg_get_snf3x3(int64_t D_diag[3], int64_t P[3][3], int64_t Q[3][3],
const int64_t A[3][3]) {
int64_t i, j, succeeded;
int64_t D[3][3];
succeeded = 0;
@ -96,10 +103,11 @@ err:
/* Defined as q' = Rq where q is in the reciprocal primitive basis */
/* vectors. */
/* num_rot : Number of rotations */
long grg_transform_rotations(long (*transformed_rots)[3][3],
const long (*rotations)[3][3], const long num_rot,
const long D_diag[3], const long Q[3][3]) {
long i, j, k;
int64_t grg_transform_rotations(int64_t (*transformed_rots)[3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot, const int64_t D_diag[3],
const int64_t Q[3][3]) {
int64_t i, j, k;
double r[3][3], Q_double[3][3];
/* Compute D(Q^-1)RQ(D^-1) by three steps */
@ -132,7 +140,8 @@ long grg_transform_rotations(long (*transformed_rots)[3][3],
/* -------------------------------*/
/* address : Single grid address. */
/* D_diag : Diagnal elements of D. */
void grg_get_all_grid_addresses(long (*grid_address)[3], const long D_diag[3]) {
void grg_get_all_grid_addresses(int64_t (*grid_address)[3],
const int64_t D_diag[3]) {
get_all_grid_addresses(grid_address, D_diag);
}
@ -144,21 +153,22 @@ void grg_get_all_grid_addresses(long (*grid_address)[3], const long D_diag[3]) {
/* address_double : Double grid address. */
/* address : Single grid address. */
/* PS : Shifts transformed by P. s_i is 0 or 1. */
void grg_get_double_grid_address(long address_double[3], const long address[3],
const long PS[3]) {
void grg_get_double_grid_address(int64_t address_double[3],
const int64_t address[3],
const int64_t PS[3]) {
get_double_grid_address(address_double, address, PS);
}
/* -------------------------------------------------------*/
/* Get address in single grid from address in double grid */
/* -------------------------------------------------------*/
/* This function shifts double-grid adress by PS and divides it by 2. */
/* This function shifts double-grid address by PS and divides it by 2. */
/* No modulo operation is applied to returned single-grid address. */
/* address : Single grid address. */
/* address_double : Double grid address. */
/* PS : Shifts transformed by P. s_i is 0 or 1. */
void grg_get_grid_address(long address[3], const long address_double[3],
const long PS[3]) {
void grg_get_grid_address(int64_t address[3], const int64_t address_double[3],
const int64_t PS[3]) {
get_grid_address(address, address_double, PS);
}
@ -168,8 +178,9 @@ void grg_get_grid_address(long address[3], const long address_double[3],
/* address_double : Double grid address. */
/* D_diag : Diagnal elements of D. */
/* PS : Shifts transformed by P. s_i is 0 or 1. */
long grg_get_double_grid_index(const long address_double[3],
const long D_diag[3], const long PS[3]) {
int64_t grg_get_double_grid_index(const int64_t address_double[3],
const int64_t D_diag[3],
const int64_t PS[3]) {
return get_double_grid_index(address_double, D_diag, PS);
}
@ -178,8 +189,8 @@ long grg_get_double_grid_index(const long address_double[3],
/* -------------------------------------------------*/
/* address : Single grid address. */
/* D_diag : Diagnal elements of D. */
long grg_get_grid_index(const long address[3], const long D_diag[3]) {
long red_adrs[3];
int64_t grg_get_grid_index(const int64_t address[3], const int64_t D_diag[3]) {
int64_t red_adrs[3];
lagmat_copy_vector_l3(red_adrs, address);
reduce_grid_address(red_adrs, D_diag);
@ -191,25 +202,27 @@ long grg_get_grid_index(const long address[3], const long D_diag[3]) {
/* ---------------------------------------*/
/* address : Single grid address. */
/* D_diag : Diagnal elements of D. */
void grg_get_grid_address_from_index(long address[3], const long grid_index,
const long D_diag[3]) {
void grg_get_grid_address_from_index(int64_t address[3],
const int64_t grid_index,
const int64_t D_diag[3]) {
get_grid_address_from_index(address, grid_index, D_diag);
}
/* ---------------------------*/
/* Rotate grid point by index */
/* ---------------------------*/
long grg_rotate_grid_index(const long grid_index, const long rotation[3][3],
const long D_diag[3], const long PS[3]) {
int64_t grg_rotate_grid_index(const int64_t grid_index,
const int64_t rotation[3][3],
const int64_t D_diag[3], const int64_t PS[3]) {
return rotate_grid_index(grid_index, rotation, D_diag, PS);
}
/* -----------------------------*/
/* Find irreducible grid points */
/* -----------------------------*/
void grg_get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long PS[3]) {
void grg_get_ir_grid_map(int64_t *ir_grid_map, const int64_t (*rotations)[3][3],
const int64_t num_rot, const int64_t D_diag[3],
const int64_t PS[3]) {
get_ir_grid_map(ir_grid_map, rotations, num_rot, D_diag, PS);
}
@ -221,15 +234,15 @@ void grg_get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
/* is_time_reversal controls if inversion is added in the group of */
/* reciprocal space rotations. */
/* Return 0 if failed */
long grg_get_reciprocal_point_group(long rec_rotations[48][3][3],
const long (*rotations)[3][3],
const long num_rot,
const long is_time_reversal,
const long is_transpose)
int64_t grg_get_reciprocal_point_group(int64_t rec_rotations[48][3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot,
const int64_t is_time_reversal,
const int64_t is_transpose)
{
long i, j, num_rot_ret, inv_exist;
const long inversion[3][3] = {{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}};
int64_t i, j, num_rot_ret, inv_exist;
const int64_t inversion[3][3] = {{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}};
/* Collect unique rotations */
num_rot_ret = 0;
@ -281,17 +294,18 @@ err:
return 0;
}
static void reduce_grid_address(long address[3], const long D_diag[3]) {
long i;
static void reduce_grid_address(int64_t address[3], const int64_t D_diag[3]) {
int64_t i;
for (i = 0; i < 3; i++) {
address[i] = lagmat_modulo_l(address[i], D_diag[i]);
}
}
static long get_double_grid_index(const long address_double[3],
const long D_diag[3], const long PS[3]) {
long address[3];
static int64_t get_double_grid_index(const int64_t address_double[3],
const int64_t D_diag[3],
const int64_t PS[3]) {
int64_t address[3];
get_grid_address(address, address_double, PS);
reduce_grid_address(address, D_diag);
@ -302,8 +316,8 @@ static long get_double_grid_index(const long address_double[3],
/* Therefore reduction to interval [0, D_diag[i]) has to be */
/* done outside of this function. */
/* See kgrid.h about GRID_ORDER_XYZ information. */
static long get_grid_index_from_address(const long address[3],
const long D_diag[3]) {
static int64_t get_grid_index_from_address(const int64_t address[3],
const int64_t D_diag[3]) {
#ifndef GRID_ORDER_XYZ
return (address[2] * D_diag[0] * D_diag[1] + address[1] * D_diag[0] +
address[0]);
@ -313,10 +327,10 @@ static long get_grid_index_from_address(const long address[3],
#endif
}
static void get_all_grid_addresses(long grid_address[][3],
const long D_diag[3]) {
long i, j, k, grid_index;
long address[3];
static void get_all_grid_addresses(int64_t grid_address[][3],
const int64_t D_diag[3]) {
int64_t i, j, k, grid_index;
int64_t address[3];
for (i = 0; i < D_diag[0]; i++) {
address[0] = i;
@ -332,9 +346,10 @@ static void get_all_grid_addresses(long grid_address[][3],
}
/* See grg_get_grid_address_from_index */
static void get_grid_address_from_index(long address[3], const long grid_index,
const long D_diag[3]) {
long nn;
static void get_grid_address_from_index(int64_t address[3],
const int64_t grid_index,
const int64_t D_diag[3]) {
int64_t nn;
#ifndef GRID_ORDER_XYZ
nn = D_diag[0] * D_diag[1];
@ -351,9 +366,10 @@ static void get_grid_address_from_index(long address[3], const long grid_index,
/* Usually address has to be reduced to [0, D_diag[i]) */
/* by calling reduce_grid_address after this operation. */
static void get_grid_address(long address[3], const long address_double[3],
const long PS[3]) {
long i;
static void get_grid_address(int64_t address[3],
const int64_t address_double[3],
const int64_t PS[3]) {
int64_t i;
for (i = 0; i < 3; i++) {
address[i] = (address_double[i] - PS[i]) / 2;
@ -362,18 +378,20 @@ static void get_grid_address(long address[3], const long address_double[3],
/* Usually address_double has to be reduced to [0, 2*D_diag[i]) */
/* by calling reduce_double_grid_address after this operation. */
static void get_double_grid_address(long address_double[3],
const long address[3], const long PS[3]) {
long i;
static void get_double_grid_address(int64_t address_double[3],
const int64_t address[3],
const int64_t PS[3]) {
int64_t i;
for (i = 0; i < 3; i++) {
address_double[i] = address[i] * 2 + PS[i];
}
}
static long rotate_grid_index(const long grid_index, const long rotation[3][3],
const long D_diag[3], const long PS[3]) {
long adrs[3], dadrs[3], dadrs_rot[3];
static int64_t rotate_grid_index(const int64_t grid_index,
const int64_t rotation[3][3],
const int64_t D_diag[3], const int64_t PS[3]) {
int64_t adrs[3], dadrs[3], dadrs_rot[3];
get_grid_address_from_index(adrs, grid_index, D_diag);
get_double_grid_address(dadrs, adrs, PS);
@ -384,11 +402,12 @@ static long rotate_grid_index(const long grid_index, const long rotation[3][3],
/* Find ir-grid points. */
/* This algorithm relies on the ir-grid index is always smallest */
/* number among symmetrically equivalent grid points. */
static void get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long PS[3]) {
long gp, num_gp, r_gp;
long i;
static void get_ir_grid_map(int64_t *ir_grid_map,
const int64_t (*rotations)[3][3],
const int64_t num_rot, const int64_t D_diag[3],
const int64_t PS[3]) {
int64_t gp, num_gp, r_gp;
int64_t i;
num_gp = D_diag[0] * D_diag[1] * D_diag[2];

View File

@ -36,31 +36,36 @@
#define __grgrid_H__
#include <stddef.h>
#include <stdint.h>
long grg_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3],
const long A[3][3]);
long grg_transform_rotations(long (*transformed_rots)[3][3],
const long (*rotations)[3][3], const long num_rot,
const long D_diag[3], const long Q[3][3]);
void grg_get_all_grid_addresses(long (*grid_address)[3], const long D_diag[3]);
void grg_get_double_grid_address(long address_double[3], const long address[3],
const long PS[3]);
void grg_get_grid_address(long address[3], const long address_double[3],
const long PS[3]);
long grg_get_grid_index(const long address[3], const long D_diag[3]);
long grg_get_double_grid_index(const long address_double[3],
const long D_diag[3], const long PS[3]);
void grg_get_grid_address_from_index(long address[3], const long grid_index,
const long D_diag[3]);
long grg_rotate_grid_index(const long grid_index, const long rotations[3][3],
const long D_diag[3], const long PS[3]);
void grg_get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long PS[3]);
long grg_get_reciprocal_point_group(long rec_rotations[48][3][3],
const long (*rotations)[3][3],
const long num_rot,
const long is_time_reversal,
const long is_transpose);
int64_t grg_get_snf3x3(int64_t D_diag[3], int64_t P[3][3], int64_t Q[3][3],
const int64_t A[3][3]);
int64_t grg_transform_rotations(int64_t (*transformed_rots)[3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot, const int64_t D_diag[3],
const int64_t Q[3][3]);
void grg_get_all_grid_addresses(int64_t (*grid_address)[3],
const int64_t D_diag[3]);
void grg_get_double_grid_address(int64_t address_double[3],
const int64_t address[3], const int64_t PS[3]);
void grg_get_grid_address(int64_t address[3], const int64_t address_double[3],
const int64_t PS[3]);
int64_t grg_get_grid_index(const int64_t address[3], const int64_t D_diag[3]);
int64_t grg_get_double_grid_index(const int64_t address_double[3],
const int64_t D_diag[3], const int64_t PS[3]);
void grg_get_grid_address_from_index(int64_t address[3],
const int64_t grid_index,
const int64_t D_diag[3]);
int64_t grg_rotate_grid_index(const int64_t grid_index,
const int64_t rotations[3][3],
const int64_t D_diag[3], const int64_t PS[3]);
void grg_get_ir_grid_map(int64_t *ir_grid_map, const int64_t (*rotations)[3][3],
const int64_t num_rot, const int64_t D_diag[3],
const int64_t PS[3]);
int64_t grg_get_reciprocal_point_group(int64_t rec_rotations[48][3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot,
const int64_t is_time_reversal,
const int64_t is_transpose);
#endif

View File

@ -34,6 +34,7 @@
#include "gridsys.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -48,73 +49,79 @@
#define GRIDSYS_NIGGLI_TOLERANCE 1e-5
void gridsys_get_all_grid_addresses(long (*gr_grid_addresses)[3],
const long D_diag[3]) {
void gridsys_get_all_grid_addresses(int64_t (*gr_grid_addresses)[3],
const int64_t D_diag[3]) {
grg_get_all_grid_addresses(gr_grid_addresses, D_diag);
}
void gridsys_get_double_grid_address(long address_double[3],
const long address[3], const long PS[3]) {
void gridsys_get_double_grid_address(int64_t address_double[3],
const int64_t address[3],
const int64_t PS[3]) {
grg_get_double_grid_address(address_double, address, PS);
}
void gridsys_get_grid_address_from_index(long address[3], const long grid_index,
const long D_diag[3]) {
void gridsys_get_grid_address_from_index(int64_t address[3],
const int64_t grid_index,
const int64_t D_diag[3]) {
grg_get_grid_address_from_index(address, grid_index, D_diag);
}
long gridsys_get_double_grid_index(const long address_double[3],
const long D_diag[3], const long PS[3]) {
int64_t gridsys_get_double_grid_index(const int64_t address_double[3],
const int64_t D_diag[3],
const int64_t PS[3]) {
return grg_get_double_grid_index(address_double, D_diag, PS);
}
long gridsys_get_grid_index_from_address(const long address[3],
const long D_diag[3]) {
int64_t gridsys_get_grid_index_from_address(const int64_t address[3],
const int64_t D_diag[3]) {
return grg_get_grid_index(address, D_diag);
}
long gridsys_rotate_grid_index(const long grid_index, const long rotation[3][3],
const long D_diag[3], const long PS[3]) {
int64_t gridsys_rotate_grid_index(const int64_t grid_index,
const int64_t rotation[3][3],
const int64_t D_diag[3],
const int64_t PS[3]) {
return grg_rotate_grid_index(grid_index, rotation, D_diag, PS);
}
long gridsys_get_reciprocal_point_group(long rec_rotations[48][3][3],
const long (*rotations)[3][3],
const long num_rot,
const long is_time_reversal) {
int64_t gridsys_get_reciprocal_point_group(int64_t rec_rotations[48][3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot,
const int64_t is_time_reversal) {
return grg_get_reciprocal_point_group(rec_rotations, rotations, num_rot,
is_time_reversal, 1);
}
long gridsys_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3],
const long A[3][3]) {
int64_t gridsys_get_snf3x3(int64_t D_diag[3], int64_t P[3][3], int64_t Q[3][3],
const int64_t A[3][3]) {
return grg_get_snf3x3(D_diag, P, Q, A);
}
long gridsys_transform_rotations(long (*transformed_rots)[3][3],
const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long Q[3][3]) {
long succeeded;
int64_t gridsys_transform_rotations(int64_t (*transformed_rots)[3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot,
const int64_t D_diag[3],
const int64_t Q[3][3]) {
int64_t succeeded;
succeeded = grg_transform_rotations(transformed_rots, rotations, num_rot,
D_diag, Q);
return succeeded;
}
void gridsys_get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long PS[3]) {
void gridsys_get_ir_grid_map(int64_t *ir_grid_map,
const int64_t (*rotations)[3][3],
const int64_t num_rot, const int64_t D_diag[3],
const int64_t PS[3]) {
grg_get_ir_grid_map(ir_grid_map, rotations, num_rot, D_diag, PS);
}
long gridsys_get_bz_grid_addresses(long (*bz_grid_addresses)[3], long *bz_map,
long *bzg2grg, const long D_diag[3],
const long Q[3][3], const long PS[3],
const double rec_lattice[3][3],
const long bz_grid_type) {
int64_t gridsys_get_bz_grid_addresses(
int64_t (*bz_grid_addresses)[3], int64_t *bz_map, int64_t *bzg2grg,
const int64_t D_diag[3], const int64_t Q[3][3], const int64_t PS[3],
const double rec_lattice[3][3], const int64_t bz_grid_type) {
RecgridBZGrid *bzgrid;
long i, j, size;
long inv_Mpr_int[3][3];
int64_t i, j, size;
int64_t inv_Mpr_int[3][3];
double inv_Lr[3][3], inv_Mpr[3][3];
double niggli_lattice[9];
@ -131,7 +138,7 @@ long gridsys_get_bz_grid_addresses(long (*bz_grid_addresses)[3], long *bz_map,
if (!niggli_reduce(niggli_lattice, GRIDSYS_NIGGLI_TOLERANCE)) {
return 0;
}
if (!lagmat_inverse_matrix_d3(inv_Lr, (double(*)[3])niggli_lattice,
if (!lagmat_inverse_matrix_d3(inv_Lr, (double (*)[3])niggli_lattice,
GRIDSYS_NIGGLI_TOLERANCE)) {
return 0;
}
@ -149,7 +156,7 @@ long gridsys_get_bz_grid_addresses(long (*bz_grid_addresses)[3], long *bz_map,
bzgrid->bzg2grg = bzg2grg;
bzgrid->type = bz_grid_type;
lagmat_multiply_matrix_l3(bzgrid->Q, inv_Mpr_int, Q);
lagmat_copy_matrix_d3(bzgrid->reclat, (double(*)[3])niggli_lattice);
lagmat_copy_matrix_d3(bzgrid->reclat, (double (*)[3])niggli_lattice);
for (i = 0; i < 3; i++) {
bzgrid->D_diag[i] = D_diag[i];
bzgrid->PS[i] = PS[i];
@ -167,13 +174,12 @@ long gridsys_get_bz_grid_addresses(long (*bz_grid_addresses)[3], long *bz_map,
return size;
}
long gridsys_rotate_bz_grid_index(const long bz_grid_index,
const long rotation[3][3],
const long (*bz_grid_addresses)[3],
const long *bz_map, const long D_diag[3],
const long PS[3], const long bz_grid_type) {
int64_t gridsys_rotate_bz_grid_index(
const int64_t bz_grid_index, const int64_t rotation[3][3],
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t D_diag[3], const int64_t PS[3], const int64_t bz_grid_type) {
RecgridConstBZGrid *bzgrid;
long i, rot_bz_gp;
int64_t i, rot_bz_gp;
if ((bzgrid = (RecgridConstBZGrid *)malloc(sizeof(RecgridConstBZGrid))) ==
NULL) {
@ -197,25 +203,26 @@ long gridsys_rotate_bz_grid_index(const long bz_grid_index,
return rot_bz_gp;
}
long gridsys_get_triplets_at_q(long *map_triplets, long *map_q,
const long grid_point, const long D_diag[3],
const long is_time_reversal, const long num_rot,
const long (*rec_rotations)[3][3],
const long swappable) {
int64_t gridsys_get_triplets_at_q(int64_t *map_triplets, int64_t *map_q,
const int64_t grid_point,
const int64_t D_diag[3],
const int64_t is_time_reversal,
const int64_t num_rot,
const int64_t (*rec_rotations)[3][3],
const int64_t swappable) {
return tpl_get_triplets_reciprocal_mesh_at_q(
map_triplets, map_q, grid_point, D_diag, is_time_reversal, num_rot,
rec_rotations, swappable);
}
long gridsys_get_bz_triplets_at_q(long (*ir_triplets)[3],
const long bz_grid_index,
const long (*bz_grid_addresses)[3],
const long *bz_map, const long *map_triplets,
const long num_map_triplets,
const long D_diag[3], const long Q[3][3],
const long bz_grid_type) {
int64_t gridsys_get_bz_triplets_at_q(
int64_t (*ir_triplets)[3], const int64_t bz_grid_index,
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t *map_triplets, const int64_t num_map_triplets,
const int64_t D_diag[3], const int64_t Q[3][3],
const double reciprocal_lattice[3][3], const int64_t bz_grid_type) {
RecgridConstBZGrid *bzgrid;
long i, j, num_ir;
int64_t i, j, num_ir;
if ((bzgrid = (RecgridConstBZGrid *)malloc(sizeof(RecgridConstBZGrid))) ==
NULL) {
@ -230,6 +237,7 @@ long gridsys_get_bz_triplets_at_q(long (*ir_triplets)[3],
bzgrid->D_diag[i] = D_diag[i];
bzgrid->PS[i] = 0;
for (j = 0; j < 3; j++) {
bzgrid->reclat[i][j] = reciprocal_lattice[i][j];
bzgrid->Q[i][j] = Q[i][j];
}
}
@ -250,28 +258,29 @@ double gridsys_get_thm_integration_weight(const double omega,
}
void gridsys_get_thm_all_relative_grid_address(
long relative_grid_address[4][24][4][3]) {
int64_t relative_grid_address[4][24][4][3]) {
thm_get_all_relative_grid_address(relative_grid_address);
}
long gridsys_get_thm_relative_grid_address(
long relative_grid_addresses[24][4][3], const double rec_lattice[3][3]) {
int64_t gridsys_get_thm_relative_grid_address(
int64_t relative_grid_addresses[24][4][3], const double rec_lattice[3][3]) {
return thm_get_relative_grid_address(relative_grid_addresses, rec_lattice);
}
/* relative_grid_addresses are given as P multipled with those from */
/* relative_grid_addresses are given as P multiplied with those from */
/* dataset, i.e., */
/* np.dot(relative_grid_addresses, P.T) */
long gridsys_get_integration_weight(
int64_t gridsys_get_integration_weight(
double *iw, char *iw_zero, const double *frequency_points,
const long num_band0, const long relative_grid_address[24][4][3],
const long D_diag[3], const long (*triplets)[3], const long num_triplets,
const long (*bz_grid_addresses)[3], const long *bz_map,
const long bz_grid_type, const double *frequencies1, const long num_band1,
const double *frequencies2, const long num_band2, const long tp_type,
const long openmp_per_triplets) {
const int64_t num_band0, const int64_t relative_grid_address[24][4][3],
const int64_t D_diag[3], const int64_t (*triplets)[3],
const int64_t num_triplets, const int64_t (*bz_grid_addresses)[3],
const int64_t *bz_map, const int64_t bz_grid_type,
const double *frequencies1, const int64_t num_band1,
const double *frequencies2, const int64_t num_band2, const int64_t tp_type,
const int64_t openmp_per_triplets) {
RecgridConstBZGrid *bzgrid;
long i;
int64_t i;
if ((bzgrid = (RecgridConstBZGrid *)malloc(sizeof(RecgridConstBZGrid))) ==
NULL) {
@ -298,9 +307,9 @@ long gridsys_get_integration_weight(
void gridsys_get_integration_weight_with_sigma(
double *iw, char *iw_zero, const double sigma, const double sigma_cutoff,
const double *frequency_points, const long num_band0,
const long (*triplets)[3], const long num_triplets,
const double *frequencies, const long num_band, const long tp_type) {
const double *frequency_points, const int64_t num_band0,
const int64_t (*triplets)[3], const int64_t num_triplets,
const double *frequencies, const int64_t num_band, const int64_t tp_type) {
tpl_get_integration_weight_with_sigma(
iw, iw_zero, sigma, sigma_cutoff, frequency_points, num_band0, triplets,
num_triplets, frequencies, num_band, tp_type);

View File

@ -38,6 +38,7 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/* Generalized regular (GR) grid
@ -46,7 +47,7 @@ by D = P M_g Q, which can be achieved by Smith normal form like transformation.
P and Q used are integer unimodular matrices with determinant=1.
S in PS is doubled shift with respect to microzone basis vectors, i.e.,
half-grid shift along an axis corresponds to 1.
half-grid shift aint64_t an axis corresponds to 1.
*/
@ -54,11 +55,11 @@ half-grid shift along an axis corresponds to 1.
* @brief Return all GR-grid addresses with respect to n_1, n_2, n_3
*
* @param gr_grid_addresses All GR-grid addresses
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @return void
*/
void gridsys_get_all_grid_addresses(long (*gr_grid_addresses)[3],
const long D_diag[3]);
void gridsys_get_all_grid_addresses(int64_t (*gr_grid_addresses)[3],
const int64_t D_diag[3]);
/**
* @brief Return double grid address in GR-grid
@ -69,53 +70,57 @@ void gridsys_get_all_grid_addresses(long (*gr_grid_addresses)[3],
* @param PS Shift in GR-grid
* @return void
*/
void gridsys_get_double_grid_address(long address_double[3],
const long address[3], const long PS[3]);
void gridsys_get_double_grid_address(int64_t address_double[3],
const int64_t address[3],
const int64_t PS[3]);
/**
* @brief Return single grid address in GR-grid with given grid point index.
*
* @param address Single grid address in GR-grid
* @param grid_index Grid point index in GR-grid
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @return void
*/
void gridsys_get_grid_address_from_index(long address[3], const long grid_index,
const long D_diag[3]);
void gridsys_get_grid_address_from_index(int64_t address[3],
const int64_t grid_index,
const int64_t D_diag[3]);
/**
* @brief Return grid point index of double grid address in GR-grid
*
* @param address_double Double grid address, i.e., possibly with shift in
* GR-grid
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @param PS Shift in GR-grid
* @return long
* @return int64_t
*/
long gridsys_get_double_grid_index(const long address_double[3],
const long D_diag[3], const long PS[3]);
int64_t gridsys_get_double_grid_index(const int64_t address_double[3],
const int64_t D_diag[3],
const int64_t PS[3]);
/**
* @brief Return grid point index of single grid address in GR-grid
*
* @param address Single grid address in GR-grid
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @return long
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @return int64_t
*/
long gridsys_get_grid_index_from_address(const long address[3],
const long D_diag[3]);
int64_t gridsys_get_grid_index_from_address(const int64_t address[3],
const int64_t D_diag[3]);
/**
* @brief Return grid point index of rotated address of given grid point index.
*
* @param grid_index Grid point index in GR-grid
* @param rotation Transformed rotation in reciprocal space tilde-R^T
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @param PS Shift in GR-grid
* @return long
* @return int64_t
*/
long gridsys_rotate_grid_index(const long grid_index, const long rotation[3][3],
const long D_diag[3], const long PS[3]);
int64_t gridsys_rotate_grid_index(const int64_t grid_index,
const int64_t rotation[3][3],
const int64_t D_diag[3], const int64_t PS[3]);
/**
* @brief Return {R^T} of crystallographic point group {R} with and without time
@ -125,24 +130,24 @@ long gridsys_rotate_grid_index(const long grid_index, const long rotation[3][3],
* @param rotations Rotations in direct space {R}
* @param num_rot Number of given rotations |{R}|
* @param is_time_reversal With (1) or without (0) time reversal symmetry
* @return long
* @return int64_t
*/
long gridsys_get_reciprocal_point_group(long rec_rotations[48][3][3],
const long (*rotations)[3][3],
const long num_rot,
const long is_time_reversal);
int64_t gridsys_get_reciprocal_point_group(int64_t rec_rotations[48][3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot,
const int64_t is_time_reversal);
/**
* @brief Return D, P, Q of Smith normal form of A.
*
* @param D_diag Diagonal elements of diagnoal matrix D
* @param D_diag Diagonal elements of diagonal matrix D
* @param P Unimodular matrix P
* @param Q Unimodular matrix Q
* @param A Integer matrix
* @return long
* @return int64_t
*/
long gridsys_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3],
const long A[3][3]);
int64_t gridsys_get_snf3x3(int64_t D_diag[3], int64_t P[3][3], int64_t Q[3][3],
const int64_t A[3][3]);
/**
* @brief Transform {R^T} to {R^T} with respect to transformed microzone basis
@ -152,14 +157,15 @@ long gridsys_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3],
* {tilde-R^T}
* @param rotations Original rotations matrices in reciprocal space {R^T}
* @param num_rot Number of rotation matrices
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param Q Unimodular matrix Q of Smith normal form
* @return long
* @return int64_t
*/
long gridsys_transform_rotations(long (*transformed_rots)[3][3],
const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long Q[3][3]);
int64_t gridsys_transform_rotations(int64_t (*transformed_rots)[3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot,
const int64_t D_diag[3],
const int64_t Q[3][3]);
/**
* @brief Return mapping table from GR-grid points to GR-ir-grid points
@ -168,12 +174,13 @@ long gridsys_transform_rotations(long (*transformed_rots)[3][3],
* array size of prod(D_diag)
* @param rotations Transformed rotation matrices in reciprocal space
* @param num_rot Number of rotation matrices
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param PS Shift in GR-grid
*/
void gridsys_get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long PS[3]);
void gridsys_get_ir_grid_map(int64_t *ir_grid_map,
const int64_t (*rotations)[3][3],
const int64_t num_rot, const int64_t D_diag[3],
const int64_t PS[3]);
/**
* @brief Find shortest grid points from Gamma considering periodicity of
@ -186,40 +193,38 @@ void gridsys_get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
* @param bzg2grg Mapping table of bz_grid_addresses to gr_grid_addresses. In
* type-II, len(bzg2grg) == len(bz_grid_addresses) <= (D_diag[0] + 1) *
* (D_diag[1] + 1) * (D_diag[2] + 1).
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param Q Unimodular matrix Q of Smith normal form
* @param PS Shift in GR-grid
* @param rec_lattice Reduced reciprocal basis vectors in column vectors
* @param bz_grid_type Data structure type I (old and sparse) or II (new and
* dense, recommended) of bz_map
* @return long Number of bz_grid_addresses stored.
* @return int64_t Number of bz_grid_addresses stored.
*/
long gridsys_get_bz_grid_addresses(long (*bz_grid_addresses)[3], long *bz_map,
long *bzg2grg, const long D_diag[3],
const long Q[3][3], const long PS[3],
const double rec_lattice[3][3],
const long bz_grid_type);
int64_t gridsys_get_bz_grid_addresses(
int64_t (*bz_grid_addresses)[3], int64_t *bz_map, int64_t *bzg2grg,
const int64_t D_diag[3], const int64_t Q[3][3], const int64_t PS[3],
const double rec_lattice[3][3], const int64_t bz_grid_type);
/**
* @brief Return index of rotated bz grid point
*
* @param bz_grid_index BZ grid point index
* @param rotation Transformed rotation in reciprocal space tilde-R^T
* @param bz_grid_addresses BZ grid point adddresses
* @param bz_grid_addresses BZ grid point addresses
* @param bz_map List of accumulated numbers of BZ grid points from the
* first GR grid point to the last grid point. In type-II, [0, 1, 3, 4, ...]
* means multiplicities of [1, 2, 1, ...], with len(bz_map)=product(D_diag) + 1.
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @param PS Shift in GR-grid
* @param bz_grid_type Data structure type I (old and sparse) or II (new and
* dense, recommended) of bz_map
* @return long
* @return int64_t
*/
long gridsys_rotate_bz_grid_index(const long bz_grid_index,
const long rotation[3][3],
const long (*bz_grid_addresses)[3],
const long *bz_map, const long D_diag[3],
const long PS[3], const long bz_grid_type);
int64_t gridsys_rotate_bz_grid_index(
const int64_t bz_grid_index, const int64_t rotation[3][3],
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t D_diag[3], const int64_t PS[3], const int64_t bz_grid_type);
/**
* @brief Find independent q' of (q, q', q'') with given q.
@ -229,19 +234,21 @@ long gridsys_rotate_bz_grid_index(const long bz_grid_index,
* @param map_q Mapping table from all grid points to grid point indices of
* irreducible q-points under the stabilizer subgroup of q
* @param grid_index Grid point index of q in GR-grid
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param is_time_reversal With (1) or without (0) time reversal symmetry
* @param num_rot Number of rotation matrices
* @param rec_rotations Transformed rotation matrices in reciprocal space
* @param swappable With (1) or without (0) permutation symmetry between q'
* and q''
* @return long Number of unique element of map_triplets
* @return int64_t Number of unique element of map_triplets
*/
long gridsys_get_triplets_at_q(long *map_triplets, long *map_q,
const long grid_index, const long D_diag[3],
const long is_time_reversal, const long num_rot,
const long (*rec_rotations)[3][3],
const long swappable);
int64_t gridsys_get_triplets_at_q(int64_t *map_triplets, int64_t *map_q,
const int64_t grid_index,
const int64_t D_diag[3],
const int64_t is_time_reversal,
const int64_t num_rot,
const int64_t (*rec_rotations)[3][3],
const int64_t swappable);
/**
* @brief Search grid point triplets considering BZ surface.
@ -255,19 +262,18 @@ long gridsys_get_triplets_at_q(long *map_triplets, long *map_q,
* @param map_triplets Mapping table from all grid points to grid points of
* independent q'
* @param num_map_triplets First dimension of map_triplets
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param Q Unimodular matrix Q of Smith normal form
* @param bz_grid_type Data structure type I (old and sparse) or II (new and
* dense, recommended) of bz_map
* @return long
* @return int64_t
*/
long gridsys_get_bz_triplets_at_q(long (*ir_triplets)[3],
const long bz_grid_index,
const long (*bz_grid_addresses)[3],
const long *bz_map, const long *map_triplets,
const long num_map_triplets,
const long D_diag[3], const long Q[3][3],
const long bz_grid_type);
int64_t gridsys_get_bz_triplets_at_q(
int64_t (*ir_triplets)[3], const int64_t bz_grid_index,
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t *map_triplets, const int64_t num_map_triplets,
const int64_t D_diag[3], const int64_t Q[3][3],
const double reciprocal_lattice[3][3], const int64_t bz_grid_type);
/**
* @brief Return integration weight of linear tetrahedron method
@ -289,7 +295,7 @@ double gridsys_get_thm_integration_weight(const double omega,
* tetrahedron method
*/
void gridsys_get_thm_all_relative_grid_address(
long relative_grid_address[4][24][4][3]);
int64_t relative_grid_address[4][24][4][3]);
/**
* @brief Return predefined relative grid addresses of main diagonal determined
@ -298,24 +304,25 @@ void gridsys_get_thm_all_relative_grid_address(
* @param relative_grid_addresses predefined relative grid addresses of given
* reciprocal basis vectors
* @param rec_lattice Reciprocal basis vectors in column vectors
* @return * long
* @return * int64_t
*/
long gridsys_get_thm_relative_grid_address(
long relative_grid_addresses[24][4][3], const double rec_lattice[3][3]);
int64_t gridsys_get_thm_relative_grid_address(
int64_t relative_grid_addresses[24][4][3], const double rec_lattice[3][3]);
long gridsys_get_integration_weight(
int64_t gridsys_get_integration_weight(
double *iw, char *iw_zero, const double *frequency_points,
const long num_band0, const long relative_grid_address[24][4][3],
const long D_diag[3], const long (*triplets)[3], const long num_triplets,
const long (*bz_grid_addresses)[3], const long *bz_map,
const long bz_grid_type, const double *frequencies1, const long num_band1,
const double *frequencies2, const long num_band2, const long tp_type,
const long openmp_per_triplets);
const int64_t num_band0, const int64_t relative_grid_address[24][4][3],
const int64_t D_diag[3], const int64_t (*triplets)[3],
const int64_t num_triplets, const int64_t (*bz_grid_addresses)[3],
const int64_t *bz_map, const int64_t bz_grid_type,
const double *frequencies1, const int64_t num_band1,
const double *frequencies2, const int64_t num_band2, const int64_t tp_type,
const int64_t openmp_per_triplets);
void gridsys_get_integration_weight_with_sigma(
double *iw, char *iw_zero, const double sigma, const double sigma_cutoff,
const double *frequency_points, const long num_band0,
const long (*triplets)[3], const long num_triplets,
const double *frequencies, const long num_band, const long tp_type);
const double *frequency_points, const int64_t num_band0,
const int64_t (*triplets)[3], const int64_t num_triplets,
const double *frequencies, const int64_t num_band, const int64_t tp_type);
#ifdef __cplusplus
}

View File

@ -35,6 +35,7 @@
#include "imag_self_energy_with_g.h"
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -43,38 +44,41 @@
#include "phonoc_array.h"
#include "triplet.h"
static long set_g_pos_frequency_point(long (*g_pos)[4], const long num_band0,
const long num_band, const char *g_zero);
static int64_t set_g_pos_frequency_point(int64_t (*g_pos)[4],
const int64_t num_band0,
const int64_t num_band,
const char *g_zero);
static void detailed_imag_self_energy_at_triplet(
double *detailed_imag_self_energy, double *imag_self_energy,
const long num_band0, const long num_band, const double *fc3_normal_squared,
const double *frequencies, const long triplet[3], const double *g1,
const double *g2_3, const char *g_zero, const double *temperatures,
const long num_temps, const double cutoff_frequency);
const int64_t num_band0, const int64_t num_band,
const double *fc3_normal_squared, const double *frequencies,
const int64_t triplet[3], const double *g1, const double *g2_3,
const char *g_zero, const double *temperatures_THz, const int64_t num_temps,
const double cutoff_frequency);
static double collect_detailed_imag_self_energy(
double *imag_self_energy, const long num_band,
double *imag_self_energy, const int64_t num_band,
const double *fc3_normal_squared, const double *n1, const double *n2,
const double *g1, const double *g2_3, const char *g_zero);
static double collect_detailed_imag_self_energy_0K(
double *imag_self_energy, const long num_band,
double *imag_self_energy, const int64_t num_band,
const double *fc3_normal_squared, const double *n1, const double *n2,
const double *g, const char *g_zero);
static void set_occupations(double *n1, double *n2, const long num_band,
const double temperature, const long triplet[3],
static void set_occupations(double *n1, double *n2, const int64_t num_band,
const double temperature, const int64_t triplet[3],
const double *frequencies,
const double cutoff_frequency);
void ise_get_imag_self_energy_with_g(
double *imag_self_energy, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const double *g, const char *g_zero,
const double temperature, const double cutoff_frequency,
const long num_frequency_points, const long frequency_point_index) {
long i, j, num_triplets, num_band0, num_band, num_band_prod;
long num_g_pos, g_index_dims, g_index_shift;
long(*g_pos)[4];
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const double *g, const char *g_zero,
const double temperature_THz, const double cutoff_frequency,
const int64_t num_frequency_points, const int64_t frequency_point_index) {
int64_t i, j, num_triplets, num_band0, num_band, num_band_prod;
int64_t num_g_pos, g_index_dims, g_index_shift;
int64_t (*g_pos)[4];
double *ise;
long at_a_frequency_point;
int64_t at_a_frequency_point;
g_pos = NULL;
ise = NULL;
@ -111,10 +115,10 @@ void ise_get_imag_self_energy_with_g(
/**
* g_pos contains the indices of g that are known non-zeros in series.
*
* ise_set_g_pos works for frquency points as bands.
* ise_set_g_pos works for frequency points as bands.
* set_g_pos_frequency_point works for frequency sampling mode.
*/
g_pos = (long(*)[4])malloc(sizeof(long[4]) * num_band_prod);
g_pos = (int64_t (*)[4])malloc(sizeof(int64_t[4]) * num_band_prod);
if (at_a_frequency_point) {
num_g_pos = set_g_pos_frequency_point(
g_pos, num_band0, num_band,
@ -130,7 +134,7 @@ void ise_get_imag_self_energy_with_g(
triplets[i], triplet_weights[i],
g + i * g_index_dims + g_index_shift,
g + (i + num_triplets) * g_index_dims + g_index_shift, g_pos,
num_g_pos, &temperature, 1, cutoff_frequency, 0,
num_g_pos, &temperature_THz, 1, cutoff_frequency, 0,
at_a_frequency_point);
free(g_pos);
@ -154,13 +158,13 @@ void ise_get_imag_self_energy_with_g(
void ise_get_detailed_imag_self_energy_with_g(
double *detailed_imag_self_energy, double *imag_self_energy_N,
double *imag_self_energy_U, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const long (*bz_grid_addresses)[3],
const double *g, const char *g_zero, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const int64_t (*bz_grid_addresses)[3],
const double *g, const char *g_zero, const double temperature_THz,
const double cutoff_frequency) {
double *ise;
long i, j, num_triplets, num_band0, num_band, num_band_prod;
long *is_N;
int64_t i, j, num_triplets, num_band0, num_band, num_band_prod;
int64_t *is_N;
double ise_tmp, N, U;
ise = NULL;
@ -183,10 +187,10 @@ void ise_get_detailed_imag_self_energy_with_g(
num_band0, num_band, fc3_normal_squared->data + i * num_band_prod,
frequencies, triplets[i], g + i * num_band_prod,
g + (i + num_triplets) * num_band_prod, g_zero + i * num_band_prod,
&temperature, 1, cutoff_frequency);
&temperature_THz, 1, cutoff_frequency);
}
is_N = (long *)malloc(sizeof(long) * num_triplets);
is_N = (int64_t *)malloc(sizeof(int64_t) * num_triplets);
for (i = 0; i < num_triplets; i++) {
is_N[i] = tpl_is_N(triplets[i], bz_grid_addresses);
}
@ -216,16 +220,16 @@ void ise_get_detailed_imag_self_energy_with_g(
}
void ise_imag_self_energy_at_triplet(
double *imag_self_energy, const long num_band0, const long num_band,
double *imag_self_energy, const int64_t num_band0, const int64_t num_band,
const double *fc3_normal_squared, const double *frequencies,
const long triplet[3], const long triplet_weight, const double *g1,
const double *g2_3, const long (*g_pos)[4], const long num_g_pos,
const double *temperatures, const long num_temps,
const double cutoff_frequency, const long openmp_per_triplets,
const long at_a_frequency_point) {
long i, j;
const int64_t triplet[3], const int64_t triplet_weight, const double *g1,
const double *g2_3, const int64_t (*g_pos)[4], const int64_t num_g_pos,
const double *temperatures_THz, const int64_t num_temps,
const double cutoff_frequency, const int64_t openmp_per_triplets,
const int64_t at_a_frequency_point) {
int64_t i, j;
double *n1, *n2, *ise_at_g_pos;
long g_pos_3;
int64_t g_pos_3;
n1 = (double *)malloc(sizeof(double) * num_temps * num_band);
n2 = (double *)malloc(sizeof(double) * num_temps * num_band);
@ -233,7 +237,7 @@ void ise_imag_self_energy_at_triplet(
for (i = 0; i < num_temps; i++) {
set_occupations(n1 + i * num_band, n2 + i * num_band, num_band,
temperatures[i], triplet, frequencies,
temperatures_THz[i], triplet, frequencies,
cutoff_frequency);
}
@ -255,7 +259,7 @@ void ise_imag_self_energy_at_triplet(
n2[j * num_band + g_pos[i][2]] < 0) {
ise_at_g_pos[i * num_temps + j] = 0;
} else {
if (temperatures[j] > 0) {
if (temperatures_THz[j] > 0) {
ise_at_g_pos[i * num_temps + j] =
((n1[j * num_band + g_pos[i][1]] +
n2[j * num_band + g_pos[i][2]] + 1) *
@ -291,9 +295,9 @@ void ise_imag_self_energy_at_triplet(
n2 = NULL;
}
long ise_set_g_pos(long (*g_pos)[4], const long num_band0, const long num_band,
const char *g_zero) {
long num_g_pos, j, k, l, jkl;
int64_t ise_set_g_pos(int64_t (*g_pos)[4], const int64_t num_band0,
const int64_t num_band, const char *g_zero) {
int64_t num_g_pos, j, k, l, jkl;
num_g_pos = 0;
jkl = 0;
@ -321,11 +325,13 @@ long ise_set_g_pos(long (*g_pos)[4], const long num_band0, const long num_band,
* @param num_band0
* @param num_band
* @param g_zero
* @return long
* @return int64_t
*/
static long set_g_pos_frequency_point(long (*g_pos)[4], const long num_band0,
const long num_band, const char *g_zero) {
long num_g_pos, j, k, l, kl, jkl;
static int64_t set_g_pos_frequency_point(int64_t (*g_pos)[4],
const int64_t num_band0,
const int64_t num_band,
const char *g_zero) {
int64_t num_g_pos, j, k, l, kl, jkl;
num_g_pos = 0;
jkl = 0;
@ -350,11 +356,12 @@ static long set_g_pos_frequency_point(long (*g_pos)[4], const long num_band0,
static void detailed_imag_self_energy_at_triplet(
double *detailed_imag_self_energy, double *imag_self_energy,
const long num_band0, const long num_band, const double *fc3_normal_squared,
const double *frequencies, const long triplet[3], const double *g1,
const double *g2_3, const char *g_zero, const double *temperatures,
const long num_temps, const double cutoff_frequency) {
long i, j, adrs_shift;
const int64_t num_band0, const int64_t num_band,
const double *fc3_normal_squared, const double *frequencies,
const int64_t triplet[3], const double *g1, const double *g2_3,
const char *g_zero, const double *temperatures_THz, const int64_t num_temps,
const double cutoff_frequency) {
int64_t i, j, adrs_shift;
double *n1, *n2;
n1 = NULL;
@ -364,12 +371,12 @@ static void detailed_imag_self_energy_at_triplet(
n2 = (double *)malloc(sizeof(double) * num_band);
for (i = 0; i < num_temps; i++) {
set_occupations(n1, n2, num_band, temperatures[i], triplet, frequencies,
cutoff_frequency);
set_occupations(n1, n2, num_band, temperatures_THz[i], triplet,
frequencies, cutoff_frequency);
for (j = 0; j < num_band0; j++) {
adrs_shift = j * num_band * num_band;
if (temperatures[i] > 0) {
if (temperatures_THz[i] > 0) {
imag_self_energy[i * num_band0 + j] =
collect_detailed_imag_self_energy(
detailed_imag_self_energy + adrs_shift, num_band,
@ -393,10 +400,10 @@ static void detailed_imag_self_energy_at_triplet(
}
static double collect_detailed_imag_self_energy(
double *imag_self_energy, const long num_band,
double *imag_self_energy, const int64_t num_band,
const double *fc3_normal_squared, const double *n1, const double *n2,
const double *g1, const double *g2_3, const char *g_zero) {
long ij, i, j;
int64_t ij, i, j;
double sum_g;
sum_g = 0;
@ -420,10 +427,10 @@ static double collect_detailed_imag_self_energy(
}
static double collect_detailed_imag_self_energy_0K(
double *imag_self_energy, const long num_band,
double *imag_self_energy, const int64_t num_band,
const double *fc3_normal_squared, const double *n1, const double *n2,
const double *g1, const char *g_zero) {
long ij, i, j;
int64_t ij, i, j;
double sum_g;
sum_g = 0;
@ -444,23 +451,23 @@ static double collect_detailed_imag_self_energy_0K(
return sum_g;
}
static void set_occupations(double *n1, double *n2, const long num_band,
const double temperature, const long triplet[3],
const double *frequencies,
static void set_occupations(double *n1, double *n2, const int64_t num_band,
const double temperature_THz,
const int64_t triplet[3], const double *frequencies,
const double cutoff_frequency) {
long j;
int64_t j;
double f1, f2;
for (j = 0; j < num_band; j++) {
f1 = frequencies[triplet[1] * num_band + j];
f2 = frequencies[triplet[2] * num_band + j];
if (f1 > cutoff_frequency) {
n1[j] = funcs_bose_einstein(f1, temperature);
n1[j] = funcs_bose_einstein(f1, temperature_THz);
} else {
n1[j] = -1;
}
if (f2 > cutoff_frequency) {
n2[j] = funcs_bose_einstein(f2, temperature);
n2[j] = funcs_bose_einstein(f2, temperature_THz);
} else {
n2[j] = -1;
}

View File

@ -36,31 +36,32 @@
#define __imag_self_energy_with_g_H__
#include <stddef.h>
#include <stdint.h>
#include "phonoc_array.h"
void ise_get_imag_self_energy_with_g(
double *imag_self_energy, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const double *g, const char *g_zero,
const double temperature, const double cutoff_frequency,
const long num_frequency_points, const long frequency_point_index);
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const double *g, const char *g_zero,
const double temperature_THz, const double cutoff_frequency,
const int64_t num_frequency_points, const int64_t frequency_point_index);
void ise_get_detailed_imag_self_energy_with_g(
double *detailed_imag_self_energy, double *imag_self_energy_N,
double *imag_self_energy_U, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const long (*bz_grid_addresses)[3],
const double *g, const char *g_zero, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const int64_t (*bz_grid_addresses)[3],
const double *g, const char *g_zero, const double temperature_THz,
const double cutoff_frequency);
void ise_imag_self_energy_at_triplet(
double *imag_self_energy, const long num_band0, const long num_band,
double *imag_self_energy, const int64_t num_band0, const int64_t num_band,
const double *fc3_normal_squared, const double *frequencies,
const long triplet[3], const long triplet_weight, const double *g1,
const double *g2_3, const long (*g_pos)[4], const long num_g_pos,
const double *temperatures, const long num_temps,
const double cutoff_frequency, const long openmp_possible,
const long at_a_frequency_point);
long ise_set_g_pos(long (*g_pos)[4], const long num_band0, const long num_band,
const char *g_zero);
const int64_t triplet[3], const int64_t triplet_weight, const double *g1,
const double *g2_3, const int64_t (*g_pos)[4], const int64_t num_g_pos,
const double *temperatures_THz, const int64_t num_temps,
const double cutoff_frequency, const int64_t openmp_possible,
const int64_t at_a_frequency_point);
int64_t ise_set_g_pos(int64_t (*g_pos)[4], const int64_t num_band0,
const int64_t num_band, const char *g_zero);
#endif

View File

@ -34,6 +34,7 @@
#include "interaction.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -45,43 +46,43 @@
#include "recgrid.h"
#include "reciprocal_to_normal.h"
static const long index_exchange[6][3] = {{0, 1, 2}, {2, 0, 1}, {1, 2, 0},
{2, 1, 0}, {0, 2, 1}, {1, 0, 2}};
static void real_to_normal(double *fc3_normal_squared, const long (*g_pos)[4],
const long num_g_pos, const double *freqs0,
const double *freqs1, const double *freqs2,
const lapack_complex_double *eigvecs0,
const lapack_complex_double *eigvecs1,
const lapack_complex_double *eigvecs2,
const double *fc3, const long is_compact_fc3,
const double q_vecs[3][3], /* q0, q1, q2 */
const AtomTriplets *atom_triplets,
const double *masses, const long *band_indices,
const long num_band, const double cutoff_frequency,
const long triplet_index, const long num_triplets,
const long openmp_per_triplets);
static void real_to_normal_sym_q(
double *fc3_normal_squared, const long (*g_pos)[4], const long num_g_pos,
double *const freqs[3], lapack_complex_double *const eigvecs[3],
const double *fc3, const long is_compact_fc3,
const double q_vecs[3][3], /* q0, q1, q2 */
static const int64_t index_exchange[6][3] = {{0, 1, 2}, {2, 0, 1}, {1, 2, 0},
{2, 1, 0}, {0, 2, 1}, {1, 0, 2}};
static void real_to_normal(
double *fc3_normal_squared, const int64_t (*g_pos)[4],
const int64_t num_g_pos, const double *freqs0, const double *freqs1,
const double *freqs2, const lapack_complex_double *eigvecs0,
const lapack_complex_double *eigvecs1,
const lapack_complex_double *eigvecs2, const double *fc3,
const int64_t is_compact_fc3, const double q_vecs[3][3], /* q0, q1, q2 */
const AtomTriplets *atom_triplets, const double *masses,
const long *band_indices, const long num_band0, const long num_band,
const double cutoff_frequency, const long triplet_index,
const long num_triplets, const long openmp_per_triplets);
const int64_t *band_indices, const int64_t num_band0,
const int64_t num_band, const double cutoff_frequency,
const int64_t triplet_index, const int64_t num_triplets,
const int64_t openmp_per_triplets);
static void real_to_normal_sym_q(
double *fc3_normal_squared, const int64_t (*g_pos)[4],
const int64_t num_g_pos, double *const freqs[3],
lapack_complex_double *const eigvecs[3], const double *fc3,
const int64_t is_compact_fc3, const double q_vecs[3][3], /* q0, q1, q2 */
const AtomTriplets *atom_triplets, const double *masses,
const int64_t *band_indices, const int64_t num_band0,
const int64_t num_band, const double cutoff_frequency,
const int64_t triplet_index, const int64_t num_triplets,
const int64_t openmp_per_triplets);
/* fc3_normal_squared[num_triplets, num_band0, num_band, num_band] */
void itr_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 RecgridConstBZGrid *bzgrid,
const double *fc3, const long is_compact_fc3,
const lapack_complex_double *eigenvectors, const int64_t (*triplets)[3],
const int64_t num_triplets, const RecgridConstBZGrid *bzgrid,
const double *fc3, const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets, const double *masses,
const long *band_indices, const long symmetrize_fc3_q,
const double cutoff_frequency, const long openmp_per_triplets) {
long(*g_pos)[4];
long i;
long num_band, num_band0, num_band_prod, num_g_pos;
const int64_t *band_indices, const int64_t symmetrize_fc3_q,
const double cutoff_frequency, const int64_t openmp_per_triplets) {
int64_t (*g_pos)[4];
int64_t i;
int64_t num_band, num_band0, num_band_prod, num_g_pos;
g_pos = NULL;
@ -90,11 +91,11 @@ void itr_get_interaction(
num_band_prod = num_band0 * num_band * num_band;
#ifdef _OPENMP
#pragma omp parallel for schedule(guided) private( \
num_g_pos, g_pos) if (openmp_per_triplets)
#pragma omp parallel for schedule(guided) \
private(num_g_pos, g_pos) if (openmp_per_triplets)
#endif
for (i = 0; i < num_triplets; i++) {
g_pos = (long(*)[4])malloc(sizeof(long[4]) * num_band_prod);
g_pos = (int64_t (*)[4])malloc(sizeof(int64_t[4]) * num_band_prod);
num_g_pos = ise_set_g_pos(g_pos, num_band0, num_band,
g_zero + i * num_band_prod);
@ -111,17 +112,18 @@ void itr_get_interaction(
}
void itr_get_interaction_at_triplet(
double *fc3_normal_squared, const long num_band0, const long num_band,
const long (*g_pos)[4], const long num_g_pos, const double *frequencies,
const lapack_complex_double *eigenvectors, const long triplet[3],
const RecgridConstBZGrid *bzgrid, const double *fc3,
const long is_compact_fc3, const AtomTriplets *atom_triplets,
const double *masses, const long *band_indices, const long symmetrize_fc3_q,
double *fc3_normal_squared, const int64_t num_band0, const int64_t num_band,
const int64_t (*g_pos)[4], const int64_t num_g_pos,
const double *frequencies, const lapack_complex_double *eigenvectors,
const int64_t triplet[3], const RecgridConstBZGrid *bzgrid,
const double *fc3, const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets, const double *masses,
const int64_t *band_indices, const int64_t symmetrize_fc3_q,
const double cutoff_frequency,
const long triplet_index, /* only for print */
const long num_triplets, /* only for print */
const long openmp_per_triplets) {
long j, k;
const int64_t triplet_index, /* only for print */
const int64_t num_triplets, /* only for print */
const int64_t openmp_per_triplets) {
int64_t j, k;
double *freqs[3];
lapack_complex_double *eigvecs[3];
double q_vecs[3][3];
@ -176,28 +178,27 @@ void itr_get_interaction_at_triplet(
eigenvectors + triplet[1] * num_band * num_band,
eigenvectors + triplet[2] * num_band * num_band, fc3,
is_compact_fc3, q_vecs, /* q0, q1, q2 */
atom_triplets, masses, band_indices, num_band,
atom_triplets, masses, band_indices, num_band0, num_band,
cutoff_frequency, triplet_index, num_triplets,
openmp_per_triplets);
}
}
static void real_to_normal(double *fc3_normal_squared, const long (*g_pos)[4],
const long num_g_pos, const double *freqs0,
const double *freqs1, const double *freqs2,
const lapack_complex_double *eigvecs0,
const lapack_complex_double *eigvecs1,
const lapack_complex_double *eigvecs2,
const double *fc3, const long is_compact_fc3,
const double q_vecs[3][3], /* q0, q1, q2 */
const AtomTriplets *atom_triplets,
const double *masses, const long *band_indices,
const long num_band, const double cutoff_frequency,
const long triplet_index, const long num_triplets,
const long openmp_per_triplets) {
static void real_to_normal(
double *fc3_normal_squared, const int64_t (*g_pos)[4],
const int64_t num_g_pos, const double *freqs0, const double *freqs1,
const double *freqs2, const lapack_complex_double *eigvecs0,
const lapack_complex_double *eigvecs1,
const lapack_complex_double *eigvecs2, const double *fc3,
const int64_t is_compact_fc3, const double q_vecs[3][3], /* q0, q1, q2 */
const AtomTriplets *atom_triplets, const double *masses,
const int64_t *band_indices, const int64_t num_band0,
const int64_t num_band, const double cutoff_frequency,
const int64_t triplet_index, const int64_t num_triplets,
const int64_t openmp_per_triplets) {
lapack_complex_double *fc3_reciprocal;
lapack_complex_double comp_zero;
long i;
int64_t i;
comp_zero = lapack_make_complex_double(0, 0);
fc3_reciprocal = (lapack_complex_double *)malloc(
@ -216,24 +217,25 @@ static void real_to_normal(double *fc3_normal_squared, const long (*g_pos)[4],
#endif
reciprocal_to_normal_squared(
fc3_normal_squared, g_pos, num_g_pos, fc3_reciprocal, freqs0, freqs1,
freqs2, eigvecs0, eigvecs1, eigvecs2, masses, band_indices, num_band,
cutoff_frequency, openmp_per_triplets);
freqs2, eigvecs0, eigvecs1, eigvecs2, masses, band_indices, num_band0,
num_band, cutoff_frequency, openmp_per_triplets);
free(fc3_reciprocal);
fc3_reciprocal = NULL;
}
static void real_to_normal_sym_q(
double *fc3_normal_squared, const long (*g_pos)[4], const long num_g_pos,
double *const freqs[3], lapack_complex_double *const eigvecs[3],
const double *fc3, const long is_compact_fc3,
const double q_vecs[3][3], /* q0, q1, q2 */
double *fc3_normal_squared, const int64_t (*g_pos)[4],
const int64_t num_g_pos, double *const freqs[3],
lapack_complex_double *const eigvecs[3], const double *fc3,
const int64_t is_compact_fc3, const double q_vecs[3][3], /* q0, q1, q2 */
const AtomTriplets *atom_triplets, const double *masses,
const long *band_indices, const long num_band0, const long num_band,
const double cutoff_frequency, const long triplet_index,
const long num_triplets, const long openmp_per_triplets) {
long i, j, k, l;
long band_ex[3];
const int64_t *band_indices, const int64_t num_band0,
const int64_t num_band, const double cutoff_frequency,
const int64_t triplet_index, const int64_t num_triplets,
const int64_t openmp_per_triplets) {
int64_t i, j, k, l;
int64_t band_ex[3];
double q_vecs_ex[3][3];
double *fc3_normal_squared_ex;
@ -256,8 +258,8 @@ static void real_to_normal_sym_q(
freqs[index_exchange[i][2]], eigvecs[index_exchange[i][0]],
eigvecs[index_exchange[i][1]], eigvecs[index_exchange[i][2]], fc3,
is_compact_fc3, q_vecs_ex, /* q0, q1, q2 */
atom_triplets, masses, band_indices, num_band, cutoff_frequency,
triplet_index, num_triplets, openmp_per_triplets);
atom_triplets, masses, band_indices, num_band0, num_band,
cutoff_frequency, triplet_index, num_triplets, openmp_per_triplets);
for (j = 0; j < num_band0; j++) {
for (k = 0; k < num_band; k++) {
for (l = 0; l < num_band; l++) {

View File

@ -35,6 +35,8 @@
#ifndef __interaction_H__
#define __interaction_H__
#include <stdint.h>
#include "lapack_wrapper.h"
#include "phonoc_array.h"
#include "real_to_reciprocal.h"
@ -42,22 +44,23 @@
void itr_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 RecgridConstBZGrid *bzgrid,
const double *fc3, const long is_compact_fc3,
const lapack_complex_double *eigenvectors, const int64_t (*triplets)[3],
const int64_t num_triplets, const RecgridConstBZGrid *bzgrid,
const double *fc3, const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets, const double *masses,
const long *band_indices, const long symmetrize_fc3_q,
const double cutoff_frequency, const long openmp_per_triplets);
const int64_t *band_indices, const int64_t symmetrize_fc3_q,
const double cutoff_frequency, const int64_t openmp_per_triplets);
void itr_get_interaction_at_triplet(
double *fc3_normal_squared, const long num_band0, const long num_band,
const long (*g_pos)[4], const long num_g_pos, const double *frequencies,
const lapack_complex_double *eigenvectors, const long triplet[3],
const RecgridConstBZGrid *bzgrid, const double *fc3,
const long is_compact_fc3, const AtomTriplets *atom_triplets,
const double *masses, const long *band_indices, const long symmetrize_fc3_q,
double *fc3_normal_squared, const int64_t num_band0, const int64_t num_band,
const int64_t (*g_pos)[4], const int64_t num_g_pos,
const double *frequencies, const lapack_complex_double *eigenvectors,
const int64_t triplet[3], const RecgridConstBZGrid *bzgrid,
const double *fc3, const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets, const double *masses,
const int64_t *band_indices, const int64_t symmetrize_fc3_q,
const double cutoff_frequency,
const long triplet_index, /* only for print */
const long num_triplets, /* only for print */
const long openmp_per_triplets);
const int64_t triplet_index, /* only for print */
const int64_t num_triplets, /* only for print */
const int64_t openmp_per_triplets);
#endif

View File

@ -34,6 +34,7 @@
#include "isotope.h"
#include <stdint.h>
#include <stdlib.h>
#include "funcs.h"
@ -41,12 +42,13 @@
#include "phonoc_const.h"
void iso_get_isotope_scattering_strength(
double *gamma, const long grid_point, const long *ir_grid_points,
double *gamma, const int64_t grid_point, const int64_t *ir_grid_points,
const double *weights, const double *mass_variances,
const double *frequencies, const lapack_complex_double *eigenvectors,
const long num_grid_points, const long *band_indices, const long num_band,
const long num_band0, const double sigma, const double cutoff_frequency) {
long i, j, k, l, m, gp;
const int64_t num_grid_points, const int64_t *band_indices,
const int64_t num_band, const int64_t num_band0, const double sigma,
const double cutoff_frequency) {
int64_t i, j, k, l, m, gp;
double *e0_r, *e0_i, e1_r, e1_i, a, b, f, *f0, dist, sum_g, sum_g_k;
e0_r = (double *)malloc(sizeof(double) * num_band * num_band0);
@ -126,13 +128,13 @@ void iso_get_isotope_scattering_strength(
}
void iso_get_thm_isotope_scattering_strength(
double *gamma, const long grid_point, const long *ir_grid_points,
double *gamma, const int64_t grid_point, const int64_t *ir_grid_points,
const double *weights, const double *mass_variances,
const double *frequencies, const lapack_complex_double *eigenvectors,
const long num_grid_points, const long *band_indices, const long num_band,
const long num_band0, const double *integration_weights,
const double cutoff_frequency) {
long i, j, k, l, m, gp;
const int64_t num_grid_points, const int64_t *band_indices,
const int64_t num_band, const int64_t num_band0,
const double *integration_weights, const double cutoff_frequency) {
int64_t i, j, k, l, m, gp;
double *e0_r, *e0_i, *f0, *gamma_ij;
double e1_r, e1_i, a, b, f, dist, sum_g_k;

View File

@ -35,19 +35,22 @@
#ifndef __isotope_H__
#define __isotope_H__
#include <stdint.h>
#include "lapack_wrapper.h"
void iso_get_isotope_scattering_strength(
double *gamma, const long grid_point, const long *ir_grid_points,
double *gamma, const int64_t grid_point, const int64_t *ir_grid_points,
const double *weights, const double *mass_variances,
const double *frequencies, const lapack_complex_double *eigenvectors,
const long num_grid_points, const long *band_indices, const long num_band,
const long num_band0, const double sigma, const double cutoff_frequency);
void iso_get_thm_isotope_scattering_strength(
double *gamma, const long grid_point, const long *ir_grid_points,
const double *weights, const double *mass_variances,
const double *frequencies, const lapack_complex_double *eigenvectors,
const long num_grid_points, const long *band_indices, const long num_band,
const long num_band0, const double *integration_weights,
const int64_t num_grid_points, const int64_t *band_indices,
const int64_t num_band, const int64_t num_band0, const double sigma,
const double cutoff_frequency);
void iso_get_thm_isotope_scattering_strength(
double *gamma, const int64_t grid_point, const int64_t *ir_grid_points,
const double *weights, const double *mass_variances,
const double *frequencies, const lapack_complex_double *eigenvectors,
const int64_t num_grid_points, const int64_t *band_indices,
const int64_t num_band, const int64_t num_band0,
const double *integration_weights, const double cutoff_frequency);
#endif

View File

@ -34,7 +34,9 @@
#include "lagrid.h"
long lagmat_get_determinant_l3(const long a[3][3]) {
#include <stdint.h>
int64_t lagmat_get_determinant_l3(const int64_t a[3][3]) {
return a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1]) +
a[0][1] * (a[1][2] * a[2][0] - a[1][0] * a[2][2]) +
a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]);
@ -46,7 +48,7 @@ double lagmat_get_determinant_d3(const double a[3][3]) {
a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]);
}
void lagmat_cast_matrix_3l_to_3d(double m[3][3], const long a[3][3]) {
void lagmat_cast_matrix_3l_to_3d(double m[3][3], const int64_t a[3][3]) {
m[0][0] = a[0][0];
m[0][1] = a[0][1];
m[0][2] = a[0][2];
@ -58,7 +60,7 @@ void lagmat_cast_matrix_3l_to_3d(double m[3][3], const long a[3][3]) {
m[2][2] = a[2][2];
}
void lagmat_cast_matrix_3d_to_3l(long m[3][3], const double a[3][3]) {
void lagmat_cast_matrix_3d_to_3l(int64_t m[3][3], const double a[3][3]) {
m[0][0] = lagmat_Nint(a[0][0]);
m[0][1] = lagmat_Nint(a[0][1]);
m[0][2] = lagmat_Nint(a[0][2]);
@ -70,9 +72,9 @@ void lagmat_cast_matrix_3d_to_3l(long m[3][3], const double a[3][3]) {
m[2][2] = lagmat_Nint(a[2][2]);
}
long lagmat_get_similar_matrix_ld3(double m[3][3], const long a[3][3],
const double b[3][3],
const double precision) {
int64_t lagmat_get_similar_matrix_ld3(double m[3][3], const int64_t a[3][3],
const double b[3][3],
const double precision) {
double c[3][3];
if (!lagmat_inverse_matrix_d3(c, b, precision)) {
warning_print("No similar matrix due to 0 determinant.\n");
@ -83,7 +85,8 @@ long lagmat_get_similar_matrix_ld3(double m[3][3], const long a[3][3],
return 1;
}
long lagmat_check_identity_matrix_l3(const long a[3][3], const long b[3][3]) {
int64_t lagmat_check_identity_matrix_l3(const int64_t a[3][3],
const int64_t b[3][3]) {
if (a[0][0] - b[0][0] || a[0][1] - b[0][1] || a[0][2] - b[0][2] ||
a[1][0] - b[1][0] || a[1][1] - b[1][1] || a[1][2] - b[1][2] ||
a[2][0] - b[2][0] || a[2][1] - b[2][1] || a[2][2] - b[2][2]) {
@ -93,8 +96,9 @@ long lagmat_check_identity_matrix_l3(const long a[3][3], const long b[3][3]) {
}
}
long lagmat_check_identity_matrix_ld3(const long a[3][3], const double b[3][3],
const double symprec) {
int64_t lagmat_check_identity_matrix_ld3(const int64_t a[3][3],
const double b[3][3],
const double symprec) {
if (lagmat_Dabs(a[0][0] - b[0][0]) > symprec ||
lagmat_Dabs(a[0][1] - b[0][1]) > symprec ||
lagmat_Dabs(a[0][2] - b[0][2]) > symprec ||
@ -110,8 +114,8 @@ long lagmat_check_identity_matrix_ld3(const long a[3][3], const double b[3][3],
}
}
long lagmat_inverse_matrix_d3(double m[3][3], const double a[3][3],
const double precision) {
int64_t lagmat_inverse_matrix_d3(double m[3][3], const double a[3][3],
const double precision) {
double det;
double c[3][3];
det = lagmat_get_determinant_d3(a);
@ -133,8 +137,8 @@ long lagmat_inverse_matrix_d3(double m[3][3], const double a[3][3],
return 1;
}
void lagmat_transpose_matrix_l3(long a[3][3], const long b[3][3]) {
long c[3][3];
void lagmat_transpose_matrix_l3(int64_t a[3][3], const int64_t b[3][3]) {
int64_t c[3][3];
c[0][0] = b[0][0];
c[0][1] = b[1][0];
c[0][2] = b[2][0];
@ -147,10 +151,10 @@ void lagmat_transpose_matrix_l3(long a[3][3], const long b[3][3]) {
lagmat_copy_matrix_l3(a, c);
}
void lagmat_multiply_matrix_vector_l3(long v[3], const long a[3][3],
const long b[3]) {
long i;
long c[3];
void lagmat_multiply_matrix_vector_l3(int64_t v[3], const int64_t a[3][3],
const int64_t b[3]) {
int64_t i;
int64_t c[3];
for (i = 0; i < 3; i++) {
c[i] = a[i][0] * b[0] + a[i][1] * b[1] + a[i][2] * b[2];
}
@ -159,10 +163,10 @@ void lagmat_multiply_matrix_vector_l3(long v[3], const long a[3][3],
}
}
void lagmat_multiply_matrix_l3(long m[3][3], const long a[3][3],
const long b[3][3]) {
long i, j; /* a_ij */
long c[3][3];
void lagmat_multiply_matrix_l3(int64_t m[3][3], const int64_t a[3][3],
const int64_t b[3][3]) {
int64_t i, j; /* a_ij */
int64_t c[3][3];
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
c[i][j] = a[i][0] * b[0][j] + a[i][1] * b[1][j] + a[i][2] * b[2][j];
@ -171,9 +175,9 @@ void lagmat_multiply_matrix_l3(long m[3][3], const long a[3][3],
lagmat_copy_matrix_l3(m, c);
}
void lagmat_multiply_matrix_ld3(double m[3][3], const long a[3][3],
void lagmat_multiply_matrix_ld3(double m[3][3], const int64_t a[3][3],
const double b[3][3]) {
long i, j; /* a_ij */
int64_t i, j; /* a_ij */
double c[3][3];
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
@ -185,7 +189,7 @@ void lagmat_multiply_matrix_ld3(double m[3][3], const long a[3][3],
void lagmat_multiply_matrix_d3(double m[3][3], const double a[3][3],
const double b[3][3]) {
long i, j; /* a_ij */
int64_t i, j; /* a_ij */
double c[3][3];
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
@ -195,7 +199,7 @@ void lagmat_multiply_matrix_d3(double m[3][3], const double a[3][3],
lagmat_copy_matrix_d3(m, c);
}
void lagmat_copy_matrix_l3(long a[3][3], const long b[3][3]) {
void lagmat_copy_matrix_l3(int64_t a[3][3], const int64_t b[3][3]) {
a[0][0] = b[0][0];
a[0][1] = b[0][1];
a[0][2] = b[0][2];
@ -219,14 +223,14 @@ void lagmat_copy_matrix_d3(double a[3][3], const double b[3][3]) {
a[2][2] = b[2][2];
}
void lagmat_copy_vector_l3(long a[3], const long b[3]) {
void lagmat_copy_vector_l3(int64_t a[3], const int64_t b[3]) {
a[0] = b[0];
a[1] = b[1];
a[2] = b[2];
}
long lagmat_modulo_l(const long a, const long b) {
long c;
int64_t lagmat_modulo_l(const int64_t a, const int64_t b) {
int64_t c;
c = a % b;
if (c < 0) {
c += b;
@ -234,11 +238,11 @@ long lagmat_modulo_l(const long a, const long b) {
return c;
}
long lagmat_Nint(const double a) {
int64_t lagmat_Nint(const double a) {
if (a < 0.0)
return (long)(a - 0.5);
return (int64_t)(a - 0.5);
else
return (long)(a + 0.5);
return (int64_t)(a + 0.5);
}
double lagmat_Dabs(const double a) {

View File

@ -35,38 +35,42 @@
#ifndef __lagrid_H__
#define __lagrid_H__
#include <stdint.h>
#ifdef LAGWARNING
#define warning_print(...) fprintf(stderr, __VA_ARGS__)
#else
#define warning_print(...)
#endif
long lagmat_get_determinant_l3(const long a[3][3]);
int64_t lagmat_get_determinant_l3(const int64_t a[3][3]);
double lagmat_get_determinant_d3(const double a[3][3]);
void lagmat_cast_matrix_3l_to_3d(double m[3][3], const long a[3][3]);
void lagmat_cast_matrix_3d_to_3l(long m[3][3], const double a[3][3]);
long lagmat_get_similar_matrix_ld3(double m[3][3], const long a[3][3],
const double b[3][3],
const double precision);
long lagmat_check_identity_matrix_l3(const long a[3][3], const long b[3][3]);
long lagmat_check_identity_matrix_ld3(const long a[3][3], const double b[3][3],
const double symprec);
long lagmat_inverse_matrix_d3(double m[3][3], const double a[3][3],
const double precision);
void lagmat_transpose_matrix_l3(long a[3][3], const long b[3][3]);
void lagmat_multiply_matrix_vector_l3(long v[3], const long a[3][3],
const long b[3]);
void lagmat_multiply_matrix_l3(long m[3][3], const long a[3][3],
const long b[3][3]);
void lagmat_multiply_matrix_ld3(double m[3][3], const long a[3][3],
void lagmat_cast_matrix_3l_to_3d(double m[3][3], const int64_t a[3][3]);
void lagmat_cast_matrix_3d_to_3l(int64_t m[3][3], const double a[3][3]);
int64_t lagmat_get_similar_matrix_ld3(double m[3][3], const int64_t a[3][3],
const double b[3][3],
const double precision);
int64_t lagmat_check_identity_matrix_l3(const int64_t a[3][3],
const int64_t b[3][3]);
int64_t lagmat_check_identity_matrix_ld3(const int64_t a[3][3],
const double b[3][3],
const double symprec);
int64_t lagmat_inverse_matrix_d3(double m[3][3], const double a[3][3],
const double precision);
void lagmat_transpose_matrix_l3(int64_t a[3][3], const int64_t b[3][3]);
void lagmat_multiply_matrix_vector_l3(int64_t v[3], const int64_t a[3][3],
const int64_t b[3]);
void lagmat_multiply_matrix_l3(int64_t m[3][3], const int64_t a[3][3],
const int64_t b[3][3]);
void lagmat_multiply_matrix_ld3(double m[3][3], const int64_t a[3][3],
const double b[3][3]);
void lagmat_multiply_matrix_d3(double m[3][3], const double a[3][3],
const double b[3][3]);
void lagmat_copy_matrix_l3(long a[3][3], const long b[3][3]);
void lagmat_copy_matrix_l3(int64_t a[3][3], const int64_t b[3][3]);
void lagmat_copy_matrix_d3(double a[3][3], const double b[3][3]);
void lagmat_copy_vector_l3(long a[3], const long b[3]);
long lagmat_modulo_l(const long a, const long b);
long lagmat_Nint(const double a);
void lagmat_copy_vector_l3(int64_t a[3], const int64_t b[3]);
int64_t lagmat_modulo_l(const int64_t a, const int64_t b);
int64_t lagmat_Nint(const double a);
double lagmat_Dabs(const double a);
#endif

View File

@ -35,10 +35,11 @@
#include "lapack_wrapper.h"
#include <math.h>
#include <stdint.h>
#define min(a, b) ((a) > (b) ? (b) : (a))
#if (defined(MKL_BLAS) || defined(SCIPY_MKL_H)) && !defined(NO_INCLUDE_LAPACKE)
#if defined(_MSC_VER) || defined(MKL_BLAS) || defined(SCIPY_MKL_H)
lapack_complex_double lapack_make_complex_double(double re, double im) {
lapack_complex_double z;
z.real = re;
@ -47,7 +48,8 @@ lapack_complex_double lapack_make_complex_double(double re, double im) {
}
#endif
#if defined(MKL_BLAS) || defined(SCIPY_MKL_H) || defined(NO_INCLUDE_LAPACKE)
#if defined(_MSC_VER) || defined(MKL_BLAS) || defined(SCIPY_MKL_H) || \
defined(NO_INCLUDE_LAPACKE)
#ifndef LAPACKE_malloc
#define LAPACKE_malloc(size) malloc(size)
#endif
@ -140,7 +142,7 @@ int phonopy_dsyev(double *data, double *eigvals, const int size,
lapack_int info;
lapack_int liwork;
long lwork;
int64_t lwork;
lapack_int *iwork;
double *work;
lapack_int iwork_query;
@ -163,7 +165,7 @@ int phonopy_dsyev(double *data, double *eigvals, const int size,
eigvals, &work_query, lwork,
&iwork_query, liwork);
liwork = iwork_query;
lwork = (long)work_query;
lwork = (int64_t)work_query;
/* printf("liwork %d, lwork %ld\n", liwork, lwork); */
if ((iwork = (lapack_int *)LAPACKE_malloc(sizeof(lapack_int) *
liwork)) == NULL) {
@ -202,12 +204,12 @@ int phonopy_dsyev(double *data, double *eigvals, const int size,
}
void pinv_from_eigensolution(double *data, const double *eigvals,
const long size, const double cutoff,
const long pinv_method) {
long i, ib, j, k, max_l, i_s, j_s;
const int64_t size, const double cutoff,
const int64_t pinv_method) {
int64_t i, ib, j, k, max_l, i_s, j_s;
double *tmp_data;
double e, sum;
long *l;
int64_t *l;
l = NULL;
tmp_data = NULL;
@ -221,7 +223,7 @@ void pinv_from_eigensolution(double *data, const double *eigvals,
tmp_data[i] = data[i];
}
l = (long *)malloc(sizeof(long) * size);
l = (int64_t *)malloc(sizeof(int64_t) * size);
max_l = 0;
for (i = 0; i < size; i++) {
if (pinv_method == 0) {

View File

@ -35,7 +35,23 @@
#ifndef __lapack_wrapper_H__
#define __lapack_wrapper_H__
#ifdef NO_INCLUDE_LAPACKE
#include <stdint.h>
#if defined(_MSC_VER) || defined(MKL_BLAS) || defined(SCIPY_MKL_H)
#if defined(_MSC_VER)
typedef struct {
double real;
double imag;
} lapack_complex_double;
#else
#include <mkl.h>
#define lapack_complex_double MKL_Complex16
#endif
lapack_complex_double lapack_make_complex_double(double re, double im);
#define lapack_complex_double_real(z) ((z).real)
#define lapack_complex_double_imag(z) ((z).imag)
#else
#if defined(NO_INCLUDE_LAPACKE)
#include <complex.h>
#define lapack_complex_double double _Complex
#ifdef CMPLX
@ -45,19 +61,12 @@
#endif
#define lapack_complex_double_real(z) (creal(z))
#define lapack_complex_double_imag(z) (cimag(z))
#endif
#if defined(MKL_BLAS) || defined(SCIPY_MKL_H)
#include <mkl.h>
#define lapack_complex_double MKL_Complex16
MKL_Complex16 lapack_make_complex_double(double re, double im);
#define lapack_complex_double_real(z) ((z).real)
#define lapack_complex_double_imag(z) ((z).imag)
#endif
#if !defined(MKL_BLAS) && !defined(SCIPY_MKL_H) && !defined(NO_INCLUDE_LAPACKE)
#else
#if !defined(MKL_BLAS) && !defined(SCIPY_MKL_H)
#include <lapacke.h>
#endif
#endif
#endif
lapack_complex_double phonoc_complex_prod(const lapack_complex_double a,
const lapack_complex_double b);
@ -75,8 +84,8 @@ int phonopy_dsyev(double *data, double *eigvals, const int size,
const int algorithm);
void pinv_from_eigensolution(double *data, const double *eigvals,
const long size, const double cutoff,
const long pinv_method);
const int64_t size, const double cutoff,
const int64_t pinv_method);
#endif
#endif

View File

@ -34,6 +34,7 @@
#include "phono3py.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -57,20 +58,21 @@
#include <omp.h>
#endif
long ph3py_get_interaction(
int64_t 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 (*bz_grid_addresses)[3],
const long D_diag[3], const long Q[3][3], const double *fc3,
const long is_compact_fc3, const double (*svecs)[3],
const long multi_dims[2], const long (*multiplicity)[2],
const double *masses, const long *p2s_map, const long *s2p_map,
const long *band_indices, const long symmetrize_fc3_q,
const long make_r0_average, const char *all_shortest,
const double cutoff_frequency, const long openmp_per_triplets) {
const _lapack_complex_double *eigenvectors, const int64_t (*triplets)[3],
const int64_t num_triplets, const int64_t (*bz_grid_addresses)[3],
const int64_t D_diag[3], const int64_t Q[3][3], const double *fc3,
const char *fc3_nonzero_indices, const int64_t is_compact_fc3,
const double (*svecs)[3], const int64_t multi_dims[2],
const int64_t (*multiplicity)[2], const double *masses,
const int64_t *p2s_map, const int64_t *s2p_map, const int64_t *band_indices,
const int64_t symmetrize_fc3_q, const int64_t make_r0_average,
const char *all_shortest, const double cutoff_frequency,
const int64_t openmp_per_triplets) {
RecgridConstBZGrid *bzgrid;
AtomTriplets *atom_triplets;
long i, j;
int64_t i, j;
if ((bzgrid = (RecgridConstBZGrid *)malloc(sizeof(RecgridConstBZGrid))) ==
NULL) {
@ -101,6 +103,7 @@ long ph3py_get_interaction(
atom_triplets->s2p_map = s2p_map;
atom_triplets->make_r0_average = make_r0_average;
atom_triplets->all_shortest = all_shortest;
atom_triplets->nonzero_indices = fc3_nonzero_indices;
itr_get_interaction(fc3_normal_squared, g_zero, frequencies,
(lapack_complex_double *)eigenvectors, triplets,
@ -117,24 +120,26 @@ long ph3py_get_interaction(
return 1;
}
long ph3py_get_pp_collision(
int64_t ph3py_get_pp_collision(
double *imag_self_energy,
const long relative_grid_address[24][4][3], /* thm */
const int64_t 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 (*bz_grid_addresses)[3], /* thm */
const long *bz_map, /* thm */
const long bz_grid_type, const long D_diag[3], const long Q[3][3],
const double *fc3, const long is_compact_fc3, const double (*svecs)[3],
const long multi_dims[2], const long (*multiplicity)[2],
const double *masses, const long *p2s_map, const long *s2p_map,
const Larray *band_indices, const Darray *temperatures, const long is_NU,
const long symmetrize_fc3_q, const long make_r0_average,
const char *all_shortest, const double cutoff_frequency,
const long openmp_per_triplets) {
const int64_t (*triplets)[3], const int64_t num_triplets,
const int64_t *triplet_weights,
const int64_t (*bz_grid_addresses)[3], /* thm */
const int64_t *bz_map, /* thm */
const int64_t bz_grid_type, const int64_t D_diag[3], const int64_t Q[3][3],
const double *fc3, const char *fc3_nonzero_indices,
const int64_t is_compact_fc3, const double (*svecs)[3],
const int64_t multi_dims[2], const int64_t (*multiplicity)[2],
const double *masses, const int64_t *p2s_map, const int64_t *s2p_map,
const Larray *band_indices, const Darray *temperatures_THz,
const int64_t is_NU, const int64_t symmetrize_fc3_q,
const int64_t make_r0_average, const char *all_shortest,
const double cutoff_frequency, const int64_t openmp_per_triplets) {
RecgridConstBZGrid *bzgrid;
AtomTriplets *atom_triplets;
long i, j;
int64_t i, j;
if ((bzgrid = (RecgridConstBZGrid *)malloc(sizeof(RecgridConstBZGrid))) ==
NULL) {
@ -167,12 +172,13 @@ long ph3py_get_pp_collision(
atom_triplets->s2p_map = s2p_map;
atom_triplets->make_r0_average = make_r0_average;
atom_triplets->all_shortest = all_shortest;
atom_triplets->nonzero_indices = fc3_nonzero_indices;
ppc_get_pp_collision(imag_self_energy, relative_grid_address, frequencies,
(lapack_complex_double *)eigenvectors, triplets,
num_triplets, triplet_weights, bzgrid, fc3,
is_compact_fc3, atom_triplets, masses, band_indices,
temperatures, is_NU, symmetrize_fc3_q,
temperatures_THz, is_NU, symmetrize_fc3_q,
cutoff_frequency, openmp_per_triplets);
free(atom_triplets);
@ -184,22 +190,23 @@ long ph3py_get_pp_collision(
return 1;
}
long ph3py_get_pp_collision_with_sigma(
int64_t ph3py_get_pp_collision_with_sigma(
double *imag_self_energy, const double sigma, const double sigma_cutoff,
const double *frequencies, const _lapack_complex_double *eigenvectors,
const long (*triplets)[3], const long num_triplets,
const long *triplet_weights, const long (*bz_grid_addresses)[3],
const long D_diag[3], const long Q[3][3], const double *fc3,
const long is_compact_fc3, const double (*svecs)[3],
const long multi_dims[2], const long (*multiplicity)[2],
const double *masses, const long *p2s_map, const long *s2p_map,
const Larray *band_indices, const Darray *temperatures, const long is_NU,
const long symmetrize_fc3_q, const long make_r0_average,
const int64_t (*triplets)[3], const int64_t num_triplets,
const int64_t *triplet_weights, const int64_t (*bz_grid_addresses)[3],
const int64_t D_diag[3], const int64_t Q[3][3], const double *fc3,
const char *fc3_nonzero_indices, const int64_t is_compact_fc3,
const double (*svecs)[3], const int64_t multi_dims[2],
const int64_t (*multiplicity)[2], const double *masses,
const int64_t *p2s_map, const int64_t *s2p_map, const Larray *band_indices,
const Darray *temperatures_THz, const int64_t is_NU,
const int64_t symmetrize_fc3_q, const int64_t make_r0_average,
const char *all_shortest, const double cutoff_frequency,
const long openmp_per_triplets) {
const int64_t openmp_per_triplets) {
RecgridConstBZGrid *bzgrid;
AtomTriplets *atom_triplets;
long i, j;
int64_t i, j;
if ((bzgrid = (RecgridConstBZGrid *)malloc(sizeof(RecgridConstBZGrid))) ==
NULL) {
@ -230,13 +237,14 @@ long ph3py_get_pp_collision_with_sigma(
atom_triplets->s2p_map = s2p_map;
atom_triplets->make_r0_average = make_r0_average;
atom_triplets->all_shortest = all_shortest;
atom_triplets->nonzero_indices = fc3_nonzero_indices;
ppc_get_pp_collision_with_sigma(
imag_self_energy, sigma, sigma_cutoff, frequencies,
(lapack_complex_double *)eigenvectors, triplets, num_triplets,
triplet_weights, bzgrid, fc3, is_compact_fc3, atom_triplets, masses,
band_indices, temperatures, is_NU, symmetrize_fc3_q, cutoff_frequency,
openmp_per_triplets);
band_indices, temperatures_THz, is_NU, symmetrize_fc3_q,
cutoff_frequency, openmp_per_triplets);
free(atom_triplets);
atom_triplets = NULL;
@ -249,86 +257,87 @@ long ph3py_get_pp_collision_with_sigma(
void ph3py_get_imag_self_energy_at_bands_with_g(
double *imag_self_energy, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const double *g, const char *g_zero,
const double temperature, const double cutoff_frequency,
const long num_frequency_points, const long frequency_point_index) {
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const double *g, const char *g_zero,
const double temperature_THz, const double cutoff_frequency,
const int64_t num_frequency_points, const int64_t frequency_point_index) {
ise_get_imag_self_energy_with_g(
imag_self_energy, fc3_normal_squared, frequencies, triplets,
triplet_weights, g, g_zero, temperature, cutoff_frequency,
triplet_weights, g, g_zero, temperature_THz, cutoff_frequency,
num_frequency_points, frequency_point_index);
}
void ph3py_get_detailed_imag_self_energy_at_bands_with_g(
double *detailed_imag_self_energy, double *imag_self_energy_N,
double *imag_self_energy_U, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const long (*bz_grid_addresses)[3],
const double *g, const char *g_zero, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const int64_t (*bz_grid_addresses)[3],
const double *g, const char *g_zero, const double temperature_THz,
const double cutoff_frequency) {
ise_get_detailed_imag_self_energy_with_g(
detailed_imag_self_energy, imag_self_energy_N, imag_self_energy_U,
fc3_normal_squared, frequencies, triplets, triplet_weights,
bz_grid_addresses, g, g_zero, temperature, cutoff_frequency);
bz_grid_addresses, g, g_zero, temperature_THz, cutoff_frequency);
}
void ph3py_get_real_self_energy_at_bands(
double *real_self_energy, const Darray *fc3_normal_squared,
const long *band_indices, const double *frequencies,
const long (*triplets)[3], const long *triplet_weights,
const double epsilon, const double temperature,
const int64_t *band_indices, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplet_weights,
const double epsilon, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency) {
rse_get_real_self_energy_at_bands(real_self_energy, fc3_normal_squared,
band_indices, frequencies, triplets,
triplet_weights, epsilon, temperature,
triplet_weights, epsilon, temperature_THz,
unit_conversion_factor, cutoff_frequency);
}
void ph3py_get_real_self_energy_at_frequency_point(
double *real_self_energy, const double frequency_point,
const Darray *fc3_normal_squared, const long *band_indices,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const double epsilon, const double temperature,
const double unit_conversion_factor, const double cutoff_frequency) {
const Darray *fc3_normal_squared, const int64_t *band_indices,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const double epsilon,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency) {
rse_get_real_self_energy_at_frequency_point(
real_self_energy, frequency_point, fc3_normal_squared, band_indices,
frequencies, triplets, triplet_weights, epsilon, temperature,
frequencies, triplets, triplet_weights, epsilon, temperature_THz,
unit_conversion_factor, cutoff_frequency);
}
void ph3py_get_collision_matrix(
double *collision_matrix, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplets_map, const long *map_q,
const long *rotated_grid_points, const double *rotations_cartesian,
const double *g, const long num_ir_gp, const long num_gp,
const long num_rot, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplets_map, const int64_t *map_q,
const int64_t *rotated_grid_points, const double *rotations_cartesian,
const double *g, const int64_t num_ir_gp, const int64_t num_gp,
const int64_t num_rot, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency) {
col_get_collision_matrix(collision_matrix, fc3_normal_squared, frequencies,
triplets, triplets_map, map_q, rotated_grid_points,
rotations_cartesian, g, num_ir_gp, num_gp, num_rot,
temperature, unit_conversion_factor,
temperature_THz, unit_conversion_factor,
cutoff_frequency);
}
void ph3py_get_reducible_collision_matrix(
double *collision_matrix, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplets_map, const long *map_q, const double *g,
const long num_gp, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplets_map, const int64_t *map_q, const double *g,
const int64_t num_gp, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency) {
col_get_reducible_collision_matrix(
collision_matrix, fc3_normal_squared, frequencies, triplets,
triplets_map, map_q, g, num_gp, temperature, unit_conversion_factor,
triplets_map, map_q, g, num_gp, temperature_THz, unit_conversion_factor,
cutoff_frequency);
}
void ph3py_get_isotope_scattering_strength(
double *gamma, const long grid_point, const long *ir_grid_points,
double *gamma, const int64_t grid_point, const int64_t *ir_grid_points,
const double *weights, const double *mass_variances,
const double *frequencies, const _lapack_complex_double *eigenvectors,
const long num_ir_grid_points, const long *band_indices,
const long num_band, const long num_band0, const double sigma,
const int64_t num_ir_grid_points, const int64_t *band_indices,
const int64_t num_band, const int64_t num_band0, const double sigma,
const double cutoff_frequency) {
iso_get_isotope_scattering_strength(
gamma, grid_point, ir_grid_points, weights, mass_variances, frequencies,
@ -337,11 +346,11 @@ void ph3py_get_isotope_scattering_strength(
}
void ph3py_get_thm_isotope_scattering_strength(
double *gamma, const long grid_point, const long *ir_grid_points,
double *gamma, const int64_t grid_point, const int64_t *ir_grid_points,
const double *weights, const double *mass_variances,
const double *frequencies, const _lapack_complex_double *eigenvectors,
const long num_ir_grid_points, const long *band_indices,
const long num_band, const long num_band0,
const int64_t num_ir_grid_points, const int64_t *band_indices,
const int64_t num_band, const int64_t num_band0,
const double *integration_weights, const double cutoff_frequency) {
iso_get_thm_isotope_scattering_strength(
gamma, grid_point, ir_grid_points, weights, mass_variances, frequencies,
@ -349,9 +358,9 @@ void ph3py_get_thm_isotope_scattering_strength(
num_band, num_band0, integration_weights, cutoff_frequency);
}
void ph3py_distribute_fc3(double *fc3, const long target, const long source,
const long *atom_mapping, const long num_atom,
const double *rot_cart) {
void ph3py_distribute_fc3(double *fc3, const int64_t target,
const int64_t source, const int64_t *atom_mapping,
const int64_t num_atom, const double *rot_cart) {
fc3_distribute_fc3(fc3, target, source, atom_mapping, num_atom, rot_cart);
}
@ -359,48 +368,52 @@ void ph3py_rotate_delta_fc2(double (*fc3)[3][3][3],
const double (*delta_fc2s)[3][3],
const double *inv_U,
const double (*site_sym_cart)[3][3],
const long *rot_map_syms, const long num_atom,
const long num_site_sym, const long num_disp) {
const int64_t *rot_map_syms, const int64_t num_atom,
const int64_t num_site_sym,
const int64_t num_disp) {
fc3_rotate_delta_fc2(fc3, delta_fc2s, inv_U, site_sym_cart, rot_map_syms,
num_atom, num_site_sym, num_disp);
}
void ph3py_get_permutation_symmetry_fc3(double *fc3, const long num_atom) {
void ph3py_get_permutation_symmetry_fc3(double *fc3, const int64_t num_atom) {
fc3_set_permutation_symmetry_fc3(fc3, num_atom);
}
void ph3py_get_permutation_symmetry_compact_fc3(
double *fc3, const long p2s[], const long s2pp[], const long nsym_list[],
const long perms[], const long n_satom, const long n_patom) {
double *fc3, const int64_t p2s[], const int64_t s2pp[],
const int64_t nsym_list[], const int64_t perms[], const int64_t n_satom,
const int64_t n_patom) {
fc3_set_permutation_symmetry_compact_fc3(fc3, p2s, s2pp, nsym_list, perms,
n_satom, n_patom);
}
void ph3py_transpose_compact_fc3(double *fc3, const long p2s[],
const long s2pp[], const long nsym_list[],
const long perms[], const long n_satom,
const long n_patom, const long t_type) {
void ph3py_transpose_compact_fc3(double *fc3, const int64_t p2s[],
const int64_t s2pp[],
const int64_t nsym_list[],
const int64_t perms[], const int64_t n_satom,
const int64_t n_patom, const int64_t t_type) {
fc3_transpose_compact_fc3(fc3, p2s, s2pp, nsym_list, perms, n_satom,
n_patom, t_type);
}
long ph3py_get_triplets_reciprocal_mesh_at_q(
long *map_triplets, long *map_q, const long grid_point,
const long D_diag[3], const long is_time_reversal, const long num_rot,
const long (*rec_rotations)[3][3], const long swappable) {
int64_t ph3py_get_triplets_reciprocal_mesh_at_q(
int64_t *map_triplets, int64_t *map_q, const int64_t grid_point,
const int64_t D_diag[3], const int64_t is_time_reversal,
const int64_t num_rot, const int64_t (*rec_rotations)[3][3],
const int64_t swappable) {
return tpl_get_triplets_reciprocal_mesh_at_q(
map_triplets, map_q, grid_point, D_diag, is_time_reversal, num_rot,
rec_rotations, swappable);
}
long ph3py_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point,
const long (*bz_grid_addresses)[3],
const long *bz_map, const long *map_triplets,
const long num_map_triplets,
const long D_diag[3], const long Q[3][3],
const long bz_grid_type) {
int64_t ph3py_get_BZ_triplets_at_q(
int64_t (*triplets)[3], const int64_t grid_point,
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t *map_triplets, const int64_t num_map_triplets,
const int64_t D_diag[3], const int64_t Q[3][3],
const double reciprocal_lattice[3][3], const int64_t bz_grid_type) {
RecgridConstBZGrid *bzgrid;
long i, j, num_ir;
int64_t i, j, num_ir;
if ((bzgrid = (RecgridConstBZGrid *)malloc(sizeof(RecgridConstBZGrid))) ==
NULL) {
@ -416,6 +429,7 @@ long ph3py_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point,
bzgrid->PS[i] = 0;
for (j = 0; j < 3; j++) {
bzgrid->Q[i][j] = Q[i][j];
bzgrid->reclat[i][j] = reciprocal_lattice[i][j];
}
}
bzgrid->size = num_map_triplets;
@ -428,19 +442,20 @@ long ph3py_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point,
return num_ir;
}
/* relative_grid_addresses are given as P multipled with those from dataset,
/* relative_grid_addresses are given as P multiplied with those from dataset,
* i.e.,
* np.dot(relative_grid_addresses, P.T) */
long ph3py_get_integration_weight(
int64_t ph3py_get_integration_weight(
double *iw, char *iw_zero, const double *frequency_points,
const long num_band0, const long relative_grid_address[24][4][3],
const long D_diag[3], const long (*triplets)[3], const long num_triplets,
const long (*bz_grid_addresses)[3], const long *bz_map,
const long bz_grid_type, const double *frequencies1, const long num_band1,
const double *frequencies2, const long num_band2, const long tp_type,
const long openmp_per_triplets) {
const int64_t num_band0, const int64_t relative_grid_address[24][4][3],
const int64_t D_diag[3], const int64_t (*triplets)[3],
const int64_t num_triplets, const int64_t (*bz_grid_addresses)[3],
const int64_t *bz_map, const int64_t bz_grid_type,
const double *frequencies1, const int64_t num_band1,
const double *frequencies2, const int64_t num_band2, const int64_t tp_type,
const int64_t openmp_per_triplets) {
RecgridConstBZGrid *bzgrid;
long i;
int64_t i;
if ((bzgrid = (RecgridConstBZGrid *)malloc(sizeof(RecgridConstBZGrid))) ==
NULL) {
@ -467,20 +482,20 @@ long ph3py_get_integration_weight(
void ph3py_get_integration_weight_with_sigma(
double *iw, char *iw_zero, const double sigma, const double sigma_cutoff,
const double *frequency_points, const long num_band0,
const long (*triplets)[3], const long num_triplets,
const double *frequencies, const long num_band, const long tp_type) {
const double *frequency_points, const int64_t num_band0,
const int64_t (*triplets)[3], const int64_t num_triplets,
const double *frequencies, const int64_t num_band, const int64_t tp_type) {
tpl_get_integration_weight_with_sigma(
iw, iw_zero, sigma, sigma_cutoff, frequency_points, num_band0, triplets,
num_triplets, frequencies, num_band, tp_type);
}
void ph3py_symmetrize_collision_matrix(double *collision_matrix,
const long num_column,
const long num_temp,
const long num_sigma) {
const int64_t num_column,
const int64_t num_temp,
const int64_t num_sigma) {
double val;
long i, j, k, l, adrs_shift;
int64_t i, j, k, l, adrs_shift;
for (i = 0; i < num_sigma; i++) {
for (j = 0; j < num_temp; j++) {
@ -503,21 +518,19 @@ void ph3py_symmetrize_collision_matrix(double *collision_matrix,
}
}
void ph3py_expand_collision_matrix(double *collision_matrix,
const long *rot_grid_points,
const long *ir_grid_points,
const long num_ir_gp,
const long num_grid_points,
const long num_rot, const long num_sigma,
const long num_temp, const long num_band)
void ph3py_expand_collision_matrix(
double *collision_matrix, const int64_t *rot_grid_points,
const int64_t *ir_grid_points, const int64_t num_ir_gp,
const int64_t num_grid_points, const int64_t num_rot,
const int64_t num_sigma, const int64_t num_temp, const int64_t num_band)
{
long i, j, k, l, m, n, p, adrs_shift, adrs_shift_plus, ir_gp, gp_r;
long num_column, num_bgb;
long *multi;
int64_t i, j, k, l, m, n, p, adrs_shift, adrs_shift_plus, ir_gp, gp_r;
int64_t num_column, num_bgb;
int64_t *multi;
double *colmat_copy;
multi = (long *)malloc(sizeof(long) * num_ir_gp);
multi = (int64_t *)malloc(sizeof(int64_t) * num_ir_gp);
colmat_copy = NULL;
num_column = num_grid_points * num_band;
@ -587,7 +600,7 @@ void ph3py_expand_collision_matrix(double *collision_matrix,
* @param relative_grid_address
* @param reciprocal_lattice
*/
void ph3py_get_relative_grid_address(long relative_grid_address[24][4][3],
void ph3py_get_relative_grid_address(int64_t relative_grid_address[24][4][3],
const double reciprocal_lattice[3][3]) {
thm_get_relative_grid_address(relative_grid_address, reciprocal_lattice);
}
@ -595,16 +608,16 @@ void ph3py_get_relative_grid_address(long relative_grid_address[24][4][3],
/* tpi_get_neighboring_grid_points around multiple grid points for using
* openmp
*
* relative_grid_addresses are given as P multipled with those from dataset,
* relative_grid_addresses are given as P multiplied with those from dataset,
* i.e.,
* np.dot(relative_grid_addresses, P.T) */
long ph3py_get_neighboring_gird_points(
long *relative_grid_points, const long *grid_points,
const long (*relative_grid_address)[3], const long D_diag[3],
const 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;
int64_t ph3py_get_neighboring_gird_points(
int64_t *relative_grid_points, const int64_t *grid_points,
const int64_t (*relative_grid_address)[3], const int64_t D_diag[3],
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t bz_grid_type, const int64_t num_grid_points,
const int64_t num_relative_grid_address) {
int64_t i;
RecgridConstBZGrid *bzgrid;
if ((bzgrid = (RecgridConstBZGrid *)malloc(sizeof(RecgridConstBZGrid))) ==
@ -638,18 +651,19 @@ long ph3py_get_neighboring_gird_points(
/* thm_get_integration_weight at multiple grid points for using openmp
*
* relative_grid_addresses are given as P multipled with those from dataset,
* relative_grid_addresses are given as P multiplied with those from dataset,
* i.e.,
* np.dot(relative_grid_addresses, P.T) */
long ph3py_get_thm_integration_weights_at_grid_points(
double *iw, const double *frequency_points, const long num_frequency_points,
const long num_band, const long num_gp,
const long (*relative_grid_address)[4][3], const long D_diag[3],
const long *grid_points, const long (*bz_grid_addresses)[3],
const long *bz_map, const long bz_grid_type, const double *frequencies,
const long *gp2irgp_map, const char function) {
long i, j, k, bi;
long vertices[24][4];
int64_t ph3py_get_thm_integration_weights_at_grid_points(
double *iw, const double *frequency_points,
const int64_t num_frequency_points, const int64_t num_band,
const int64_t num_gp, const int64_t (*relative_grid_address)[4][3],
const int64_t D_diag[3], const int64_t *grid_points,
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t bz_grid_type, const double *frequencies,
const int64_t *gp2irgp_map, const char function) {
int64_t i, j, k, bi;
int64_t vertices[24][4];
double freq_vertices[24][4];
RecgridConstBZGrid *bzgrid;
@ -697,7 +711,7 @@ long ph3py_get_thm_integration_weights_at_grid_points(
return 1;
}
long ph3py_get_max_threads(void) {
int64_t ph3py_get_max_threads(void) {
#ifdef _OPENMP
return omp_get_max_threads();
#else
@ -706,19 +720,20 @@ long ph3py_get_max_threads(void) {
}
#ifndef NO_INCLUDE_LAPACKE
long ph3py_phonopy_dsyev(double *data, double *eigvals, const long size,
const long algorithm) {
return (long)phonopy_dsyev(data, eigvals, (int)size, (int)algorithm);
int64_t ph3py_phonopy_dsyev(double *data, double *eigvals, const int64_t size,
const int64_t algorithm) {
return (int64_t)phonopy_dsyev(data, eigvals, (int)size, (int)algorithm);
}
long ph3py_phonopy_pinv(double *data_out, const double *data_in, const long m,
const long n, const double cutoff) {
return (long)phonopy_pinv(data_out, data_in, (int)m, (int)n, cutoff);
int64_t ph3py_phonopy_pinv(double *data_out, const double *data_in,
const int64_t m, const int64_t n,
const double cutoff) {
return (int64_t)phonopy_pinv(data_out, data_in, (int)m, (int)n, cutoff);
}
void ph3py_pinv_from_eigensolution(double *data, const double *eigvals,
const long size, const double cutoff,
const long pinv_method) {
const int64_t size, const double cutoff,
const int64_t pinv_method) {
pinv_from_eigensolution(data, eigvals, size, cutoff, pinv_method);
}
#endif

View File

@ -39,6 +39,8 @@
extern "C" {
#endif
#include <stdlib.h>
#include "phonoc_array.h"
typedef struct {
@ -46,203 +48,182 @@ typedef struct {
double im;
} _lapack_complex_double;
long ph3py_get_interaction(
int64_t 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 (*bz_grid_addresses)[3],
const long D_diag[3], const long Q[3][3], const double *fc3,
const long is_compact_fc3, const double (*svecs)[3],
const long multi_dims[2], const long (*multi)[2], const double *masses,
const long *p2s_map, const long *s2p_map, const long *band_indices,
const long symmetrize_fc3_q, const long make_r0_average,
const _lapack_complex_double *eigenvectors, const int64_t (*triplets)[3],
const int64_t num_triplets, const int64_t (*bz_grid_addresses)[3],
const int64_t D_diag[3], const int64_t Q[3][3], const double *fc3,
const char *fc3_nonzero_indices, const int64_t is_compact_fc3,
const double (*svecs)[3], const int64_t multi_dims[2],
const int64_t (*multi)[2], const double *masses, const int64_t *p2s_map,
const int64_t *s2p_map, const int64_t *band_indices,
const int64_t symmetrize_fc3_q, const int64_t make_r0_average,
const char *all_shortest, const double cutoff_frequency,
const long openmp_per_triplets);
long ph3py_get_pp_collision(
const int64_t openmp_per_triplets);
int64_t ph3py_get_pp_collision(
double *imag_self_energy,
const long relative_grid_address[24][4][3], /* thm */
const int64_t 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 (*bz_grid_addresses)[3], /* thm */
const long *bz_map, /* thm */
const long bz_grid_type, const long D_diag[3], const long Q[3][3],
const double *fc3, const long is_compact_fc3, const double (*svecs)[3],
const long multi_dims[2], const long (*multi)[2], const double *masses,
const long *p2s_map, const long *s2p_map, const Larray *band_indices,
const Darray *temperatures, const long is_NU, const long symmetrize_fc3_q,
const long make_r0_average, const char *all_shortest,
const double cutoff_frequency, const long openmp_per_triplets);
long ph3py_get_pp_collision_with_sigma(
const int64_t (*triplets)[3], const int64_t num_triplets,
const int64_t *triplet_weights,
const int64_t (*bz_grid_addresses)[3], /* thm */
const int64_t *bz_map, /* thm */
const int64_t bz_grid_type, const int64_t D_diag[3], const int64_t Q[3][3],
const double *fc3, const char *fc3_nonzero_indices,
const int64_t is_compact_fc3, const double (*svecs)[3],
const int64_t multi_dims[2], const int64_t (*multi)[2],
const double *masses, const int64_t *p2s_map, const int64_t *s2p_map,
const Larray *band_indices, const Darray *temperatures_THz,
const int64_t is_NU, const int64_t symmetrize_fc3_q,
const int64_t make_r0_average, const char *all_shortest,
const double cutoff_frequency, const int64_t openmp_per_triplets);
int64_t ph3py_get_pp_collision_with_sigma(
double *imag_self_energy, const double sigma, const double sigma_cutoff,
const double *frequencies, const _lapack_complex_double *eigenvectors,
const long (*triplets)[3], const long num_triplets,
const long *triplet_weights, const long (*bz_grid_addresses)[3],
const long D_diag[3], const long Q[3][3], const double *fc3,
const long is_compact_fc3, const double (*svecs)[3],
const long multi_dims[2], const long (*multi)[2], const double *masses,
const long *p2s_map, const long *s2p_map, const Larray *band_indices,
const Darray *temperatures, const long is_NU, const long symmetrize_fc3_q,
const long make_r0_average, const char *all_shortest,
const double cutoff_frequency, const long openmp_per_triplets);
const int64_t (*triplets)[3], const int64_t num_triplets,
const int64_t *triplet_weights, const int64_t (*bz_grid_addresses)[3],
const int64_t D_diag[3], const int64_t Q[3][3], const double *fc3,
const char *fc3_nonzero_indices, const int64_t is_compact_fc3,
const double (*svecs)[3], const int64_t multi_dims[2],
const int64_t (*multi)[2], const double *masses, const int64_t *p2s_map,
const int64_t *s2p_map, const Larray *band_indices,
const Darray *temperatures_THz, const int64_t is_NU,
const int64_t symmetrize_fc3_q, const int64_t make_r0_average,
const char *all_shortest, const double cutoff_frequency,
const int64_t openmp_per_triplets);
void ph3py_get_imag_self_energy_at_bands_with_g(
double *imag_self_energy, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const double *g, const char *g_zero,
const double temperature, const double cutoff_frequency,
const long num_frequency_points, const long frequency_point_index);
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const double *g, const char *g_zero,
const double temperature_THz, const double cutoff_frequency,
const int64_t num_frequency_points, const int64_t frequency_point_index);
void ph3py_get_detailed_imag_self_energy_at_bands_with_g(
double *detailed_imag_self_energy, double *imag_self_energy_N,
double *imag_self_energy_U, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const long (*bz_grid_addresses)[3],
const double *g, const char *g_zero, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const int64_t (*bz_grid_addresses)[3],
const double *g, const char *g_zero, const double temperature_THz,
const double cutoff_frequency);
void ph3py_get_real_self_energy_at_bands(
double *real_self_energy, const Darray *fc3_normal_squared,
const long *band_indices, const double *frequencies,
const long (*triplets)[3], const long *triplet_weights,
const double epsilon, const double temperature,
const int64_t *band_indices, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplet_weights,
const double epsilon, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency);
void ph3py_get_real_self_energy_at_frequency_point(
double *real_self_energy, const double frequency_point,
const Darray *fc3_normal_squared, const long *band_indices,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const double epsilon, const double temperature,
const double unit_conversion_factor, const double cutoff_frequency);
const Darray *fc3_normal_squared, const int64_t *band_indices,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const double epsilon,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency);
void ph3py_get_collision_matrix(
double *collision_matrix, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplets_map, const long *map_q,
const long *rotated_grid_points, const double *rotations_cartesian,
const double *g, const long num_ir_gp, const long num_gp,
const long num_rot, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplets_map, const int64_t *map_q,
const int64_t *rotated_grid_points, const double *rotations_cartesian,
const double *g, const int64_t num_ir_gp, const int64_t num_gp,
const int64_t num_rot, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency);
void ph3py_get_reducible_collision_matrix(
double *collision_matrix, const Darray *fc3_normal_squared,
const double *frequencies, const long (*triplets)[3],
const long *triplets_map, const long *map_q, const double *g,
const long num_gp, const double temperature,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplets_map, const int64_t *map_q, const double *g,
const int64_t num_gp, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency);
void ph3py_get_isotope_scattering_strength(
double *gamma, const long grid_point, const long *ir_grid_points,
double *gamma, const int64_t grid_point, const int64_t *ir_grid_points,
const double *weights, const double *mass_variances,
const double *frequencies, const _lapack_complex_double *eigenvectors,
const long num_ir_grid_points, const long *band_indices,
const long num_band, const long num_band0, const double sigma,
const int64_t num_ir_grid_points, const int64_t *band_indices,
const int64_t num_band, const int64_t num_band0, const double sigma,
const double cutoff_frequency);
void ph3py_get_thm_isotope_scattering_strength(
double *gamma, const long grid_point, const long *ir_grid_points,
double *gamma, const int64_t grid_point, const int64_t *ir_grid_points,
const double *weights, const double *mass_variances,
const double *frequencies, const _lapack_complex_double *eigenvectors,
const long num_ir_grid_points, const long *band_indices,
const long num_band, const long num_band0,
const int64_t num_ir_grid_points, const int64_t *band_indices,
const int64_t num_band, const int64_t num_band0,
const double *integration_weights, const double cutoff_frequency);
void ph3py_distribute_fc3(double *fc3, const long target, const long source,
const long *atom_mapping, const long num_atom,
const double *rot_cart);
void ph3py_distribute_fc3(double *fc3, const int64_t target,
const int64_t source, const int64_t *atom_mapping,
const int64_t num_atom, const double *rot_cart);
void ph3py_rotate_delta_fc2(double (*fc3)[3][3][3],
const double (*delta_fc2s)[3][3],
const double *inv_U,
const double (*site_sym_cart)[3][3],
const long *rot_map_syms, const long num_atom,
const long num_site_sym, const long num_disp);
void ph3py_get_permutation_symmetry_fc3(double *fc3, const long num_atom);
const int64_t *rot_map_syms, const int64_t num_atom,
const int64_t num_site_sym, const int64_t num_disp);
void ph3py_get_permutation_symmetry_fc3(double *fc3, const int64_t num_atom);
void ph3py_get_permutation_symmetry_compact_fc3(
double *fc3, const long p2s[], const long s2pp[], const long nsym_list[],
const long perms[], const long n_satom, const long n_patom);
void ph3py_transpose_compact_fc3(double *fc3, const long p2s[],
const long s2pp[], const long nsym_list[],
const long perms[], const long n_satom,
const long n_patom, const long t_type);
long ph3py_get_triplets_reciprocal_mesh_at_q(
long *map_triplets, long *map_q, const long grid_point, const long mesh[3],
const long is_time_reversal, const long num_rot,
const long (*rec_rotations)[3][3], const long swappable);
long ph3py_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point,
const long (*bz_grid_addresses)[3],
const long *bz_map, const long *map_triplets,
const long num_map_triplets,
const long D_diag[3], const long Q[3][3],
const long bz_grid_type);
long ph3py_get_integration_weight(
double *fc3, const int64_t p2s[], const int64_t s2pp[],
const int64_t nsym_list[], const int64_t perms[], const int64_t n_satom,
const int64_t n_patom);
void ph3py_transpose_compact_fc3(double *fc3, const int64_t p2s[],
const int64_t s2pp[],
const int64_t nsym_list[],
const int64_t perms[], const int64_t n_satom,
const int64_t n_patom, const int64_t t_type);
int64_t ph3py_get_triplets_reciprocal_mesh_at_q(
int64_t *map_triplets, int64_t *map_q, const int64_t grid_point,
const int64_t mesh[3], const int64_t is_time_reversal,
const int64_t num_rot, const int64_t (*rec_rotations)[3][3],
const int64_t swappable);
int64_t ph3py_get_BZ_triplets_at_q(
int64_t (*triplets)[3], const int64_t grid_point,
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t *map_triplets, const int64_t num_map_triplets,
const int64_t D_diag[3], const int64_t Q[3][3],
const double reciprocal_lattice[3][3], const int64_t bz_grid_type);
int64_t ph3py_get_integration_weight(
double *iw, char *iw_zero, const double *frequency_points,
const long num_band0, const long relative_grid_address[24][4][3],
const long mesh[3], const long (*triplets)[3], const long num_triplets,
const long (*bz_grid_addresses)[3], const long *bz_map,
const long bz_grid_type, const double *frequencies1, const long num_band1,
const double *frequencies2, const long num_band2, const long tp_type,
const long openmp_per_triplets);
const int64_t num_band0, const int64_t relative_grid_address[24][4][3],
const int64_t mesh[3], const int64_t (*triplets)[3],
const int64_t num_triplets, const int64_t (*bz_grid_addresses)[3],
const int64_t *bz_map, const int64_t bz_grid_type,
const double *frequencies1, const int64_t num_band1,
const double *frequencies2, const int64_t num_band2, const int64_t tp_type,
const int64_t openmp_per_triplets);
void ph3py_get_integration_weight_with_sigma(
double *iw, char *iw_zero, const double sigma, const double sigma_cutoff,
const double *frequency_points, const long num_band0,
const long (*triplets)[3], const long num_triplets,
const double *frequencies, const long num_band, const long tp_type);
long ph3py_get_grid_index_from_address(const long address[3],
const long mesh[3]);
void ph3py_get_gr_grid_addresses(long gr_grid_addresses[][3],
const long D_diag[3]);
long ph3py_get_reciprocal_rotations(long rec_rotations[48][3][3],
const long (*rotations)[3][3],
const long num_rot,
const long is_time_reversal);
long ph3py_transform_rotations(long (*transformed_rots)[3][3],
const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long Q[3][3]);
long ph3py_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3],
const long A[3][3]);
long ph3py_transform_rotations(long (*transformed_rots)[3][3],
const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long Q[3][3]);
long ph3py_get_ir_grid_map(long *ir_grid_map, const long D_diag[3],
const long PS[3], const long (*grg_rotations)[3][3],
const long num_rot);
long ph3py_get_bz_grid_addresses(long (*bz_grid_addresses)[3], long *bz_map,
long *bzg2grg, const long D_diag[3],
const long Q[3][3], const long PS[3],
const double rec_lattice[3][3],
const long type);
long ph3py_rotate_bz_grid_index(const long bz_grid_index,
const long rotation[3][3],
const long (*bz_grid_addresses)[3],
const long *bz_map, const long D_diag[3],
const long PS[3], const long bz_grid_type);
const double *frequency_points, const int64_t num_band0,
const int64_t (*triplets)[3], const int64_t num_triplets,
const double *frequencies, const int64_t num_band, const int64_t tp_type);
void ph3py_symmetrize_collision_matrix(double *collision_matrix,
const long num_column,
const long num_temp,
const long num_sigma);
void ph3py_expand_collision_matrix(double *collision_matrix,
const long *rot_grid_points,
const long *ir_grid_points,
const long num_ir_gp,
const long num_grid_points,
const long num_rot, const long num_sigma,
const long num_temp, const long num_band);
void ph3py_get_relative_grid_address(long relative_grid_address[24][4][3],
const int64_t num_column,
const int64_t num_temp,
const int64_t num_sigma);
void ph3py_expand_collision_matrix(
double *collision_matrix, const int64_t *rot_grid_points,
const int64_t *ir_grid_points, const int64_t num_ir_gp,
const int64_t num_grid_points, const int64_t num_rot,
const int64_t num_sigma, const int64_t num_temp, const int64_t num_band);
void ph3py_get_relative_grid_address(int64_t relative_grid_address[24][4][3],
const double reciprocal_lattice[3][3]);
long ph3py_get_neighboring_gird_points(
long *relative_grid_points, const long *grid_points,
const long (*relative_grid_address)[3], const long mesh[3],
const 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 ph3py_get_thm_integration_weights_at_grid_points(
double *iw, const double *frequency_points, const long num_band0,
const long num_band, const long num_gp,
const long (*relative_grid_address)[4][3], const long D_diag[3],
const long *grid_points, const long (*bz_grid_addresses)[3],
const long *bz_map, const long bz_grid_type, const double *frequencies,
const long *gp2irgp_map, const char function);
long ph3py_get_max_threads(void);
int64_t ph3py_get_neighboring_gird_points(
int64_t *relative_grid_points, const int64_t *grid_points,
const int64_t (*relative_grid_address)[3], const int64_t mesh[3],
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t bz_grid_type, const int64_t num_grid_points,
const int64_t num_relative_grid_address);
int64_t ph3py_get_thm_integration_weights_at_grid_points(
double *iw, const double *frequency_points, const int64_t num_band0,
const int64_t num_band, const int64_t num_gp,
const int64_t (*relative_grid_address)[4][3], const int64_t D_diag[3],
const int64_t *grid_points, const int64_t (*bz_grid_addresses)[3],
const int64_t *bz_map, const int64_t bz_grid_type,
const double *frequencies, const int64_t *gp2irgp_map, const char function);
int64_t ph3py_get_max_threads(void);
#ifndef NO_INCLUDE_LAPACKE
long ph3py_phonopy_dsyev(double *data, double *eigvals, const long size,
const long algorithm);
long ph3py_phonopy_pinv(double *data_out, const double *data_in, const long m,
const long n, const double cutoff);
int64_t ph3py_phonopy_dsyev(double *data, double *eigvals, const int64_t size,
const int64_t algorithm);
int64_t ph3py_phonopy_pinv(double *data_out, const double *data_in,
const int64_t m, const int64_t n,
const double cutoff);
void ph3py_pinv_from_eigensolution(double *data, const double *eigvals,
const long size, const double cutoff,
const long pinv_method);
const int64_t size, const double cutoff,
const int64_t pinv_method);
#endif
#ifdef __cplusplus

View File

@ -35,12 +35,14 @@
#ifndef __phonoc_array_H__
#define __phonoc_array_H__
#include <stdint.h>
#define MAX_NUM_DIM 20
/* It is assumed that number of dimensions is known for each array. */
typedef struct {
long dims[MAX_NUM_DIM];
long *data;
int64_t dims[MAX_NUM_DIM];
int64_t *data;
} Larray;
typedef struct {

View File

@ -36,6 +36,5 @@
#define __phonoc_const_H__
#define M_2PI 6.283185307179586
#define KB 8.6173382568083159E-05
#endif

View File

@ -36,78 +36,84 @@
#include <math.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "dynmat.h"
#include "lapack_wrapper.h"
static long collect_undone_grid_points(long *undone, char *phonon_done,
const long num_grid_points,
const long *grid_points);
static int64_t collect_undone_grid_points(int64_t *undone, char *phonon_done,
const int64_t num_grid_points,
const int64_t *grid_points);
static void get_undone_phonons(
double *frequencies, lapack_complex_double *eigenvectors,
const long *undone_grid_points, const long num_undone_grid_points,
const long (*grid_address)[3], const double QDinv[3][3], const double *fc2,
const double (*svecs_fc2)[3], const long (*multi_fc2)[2],
const long num_patom, const long num_satom, const double *masses_fc2,
const long *p2s_fc2, const long *s2p_fc2,
const double unit_conversion_factor, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, const double nac_factor, const char uplo);
const int64_t *undone_grid_points, const int64_t num_undone_grid_points,
const int64_t (*grid_address)[3], const double QDinv[3][3],
const double *fc2, const double (*svecs_fc2)[3],
const int64_t (*multi_fc2)[2], const int64_t num_patom,
const int64_t num_satom, const double *masses_fc2, const int64_t *p2s_fc2,
const int64_t *s2p_fc2, const double unit_conversion_factor,
const double (*born)[3][3], const double dielectric[3][3],
const double reciprocal_lattice[3][3], const double *q_direction,
const double nac_factor, const char uplo);
static void get_gonze_undone_phonons(
double *frequencies, lapack_complex_double *eigenvectors,
const long *undone_grid_points, const long num_undone_grid_points,
const long (*grid_address)[3], const double QDinv[3][3], const double *fc2,
const double (*svecs_fc2)[3], const long (*multi_fc2)[2],
const double (*positions)[3], const long num_patom, const long num_satom,
const double *masses_fc2, const long *p2s_fc2, const long *s2p_fc2,
const int64_t *undone_grid_points, const int64_t num_undone_grid_points,
const int64_t (*grid_address)[3], const double QDinv[3][3],
const double *fc2, const double (*svecs_fc2)[3],
const int64_t (*multi_fc2)[2], const double (*positions)[3],
const int64_t num_patom, const int64_t num_satom, const double *masses_fc2,
const int64_t *p2s_fc2, const int64_t *s2p_fc2,
const double unit_conversion_factor, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, const double nac_factor,
const double (*dd_q0)[2], const double (*G_list)[3],
const long num_G_points, const double lambda, const char uplo);
const int64_t num_G_points, const double lambda, const char uplo);
static void get_gonze_phonons(
lapack_complex_double *eigvecs, const double q[3], const double *fc2,
const double *masses, const long *p2s, const long *s2p,
const long (*multi)[2], const double (*positions)[3], const long num_patom,
const long num_satom, const double (*svecs)[3], const long is_nac,
const double (*born)[3][3], const double dielectric[3][3],
const double reciprocal_lattice[3][3], const double *q_direction,
const double nac_factor, const double (*dd_q0)[2],
const double (*G_list)[3], const long num_G_points, const double lambda);
const double *masses, const int64_t *p2s, const int64_t *s2p,
const int64_t (*multi)[2], const double (*positions)[3],
const int64_t num_patom, const int64_t num_satom, const double (*svecs)[3],
const int64_t is_nac, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, const double nac_factor,
const double (*dd_q0)[2], const double (*G_list)[3],
const int64_t num_G_points, const double lambda);
static void get_dynamical_matrix(
lapack_complex_double *dynmat, const double q[3], const double *fc2,
const double *masses, const long *p2s, const long *s2p,
const long (*multi)[2], const long num_patom, const long num_satom,
const double (*svecs)[3], const long is_nac,
const double *masses, const int64_t *p2s, const int64_t *s2p,
const int64_t (*multi)[2], const int64_t num_patom, const int64_t num_satom,
const double (*svecs)[3], const int64_t is_nac,
const double (*born)[3][3], /* Wang NAC unless NULL */
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, const double nac_factor);
static void get_charge_sum(double (*charge_sum)[3][3], const long num_patom,
const long num_satom, const double q[3],
static void get_charge_sum(double (*charge_sum)[3][3], const int64_t num_patom,
const int64_t num_satom, const double q[3],
const double (*born)[3][3],
const double dielectric[3][3],
const double reciprocal_lattice[3][3],
const double *q_direction, const double nac_factor);
static long needs_nac(const double (*born)[3][3], const long (*grid_address)[3],
const long gp, const double *q_direction);
static int64_t needs_nac(const double (*born)[3][3],
const int64_t (*grid_address)[3], const int64_t gp,
const double *q_direction);
void phn_get_phonons_at_gridpoints(
double *frequencies, lapack_complex_double *eigenvectors, char *phonon_done,
const long num_phonons, const long *grid_points, const long num_grid_points,
const long (*grid_address)[3], const double QDinv[3][3], const double *fc2,
const double (*svecs_fc2)[3], const long (*multi_fc2)[2],
const long num_patom, const long num_satom, const double *masses_fc2,
const long *p2s_fc2, const long *s2p_fc2,
const double unit_conversion_factor, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const int64_t num_phonons, const int64_t *grid_points,
const int64_t num_grid_points, const int64_t (*grid_address)[3],
const double QDinv[3][3], const double *fc2, const double (*svecs_fc2)[3],
const int64_t (*multi_fc2)[2], const int64_t num_patom,
const int64_t num_satom, const double *masses_fc2, const int64_t *p2s_fc2,
const int64_t *s2p_fc2, const double unit_conversion_factor,
const double (*born)[3][3], const double dielectric[3][3],
const double reciprocal_lattice[3][3],
const double *q_direction, /* must be pointer */
const double nac_factor, const char uplo) {
long num_undone;
long *undone;
int64_t num_undone;
int64_t *undone;
undone = (long *)malloc(sizeof(long) * num_phonons);
undone = (int64_t *)malloc(sizeof(int64_t) * num_phonons);
num_undone = collect_undone_grid_points(undone, phonon_done,
num_grid_points, grid_points);
@ -123,21 +129,22 @@ void phn_get_phonons_at_gridpoints(
void phn_get_gonze_phonons_at_gridpoints(
double *frequencies, lapack_complex_double *eigenvectors, char *phonon_done,
const long num_phonons, const long *grid_points, const long num_grid_points,
const long (*grid_address)[3], const double QDinv[3][3], const double *fc2,
const double (*svecs_fc2)[3], const long (*multi_fc2)[2],
const double (*positions)[3], const long num_patom, const long num_satom,
const double *masses_fc2, const long *p2s_fc2, const long *s2p_fc2,
const int64_t num_phonons, const int64_t *grid_points,
const int64_t num_grid_points, const int64_t (*grid_address)[3],
const double QDinv[3][3], const double *fc2, const double (*svecs_fc2)[3],
const int64_t (*multi_fc2)[2], const double (*positions)[3],
const int64_t num_patom, const int64_t num_satom, const double *masses_fc2,
const int64_t *p2s_fc2, const int64_t *s2p_fc2,
const double unit_conversion_factor, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, /* pointer */
const double nac_factor, const double (*dd_q0)[2],
const double (*G_list)[3], const long num_G_points, const double lambda,
const double (*G_list)[3], const int64_t num_G_points, const double lambda,
const char uplo) {
long num_undone;
long *undone;
int64_t num_undone;
int64_t *undone;
undone = (long *)malloc(sizeof(long) * num_phonons);
undone = (int64_t *)malloc(sizeof(int64_t) * num_phonons);
num_undone = collect_undone_grid_points(undone, phonon_done,
num_grid_points, grid_points);
@ -152,10 +159,10 @@ void phn_get_gonze_phonons_at_gridpoints(
undone = NULL;
}
static long collect_undone_grid_points(long *undone, char *phonon_done,
const long num_grid_points,
const long *grid_points) {
long i, gp, num_undone;
static int64_t collect_undone_grid_points(int64_t *undone, char *phonon_done,
const int64_t num_grid_points,
const int64_t *grid_points) {
int64_t i, gp, num_undone;
num_undone = 0;
for (i = 0; i < num_grid_points; i++) {
@ -172,16 +179,17 @@ static long collect_undone_grid_points(long *undone, char *phonon_done,
static void get_undone_phonons(
double *frequencies, lapack_complex_double *eigenvectors,
const long *undone_grid_points, const long num_undone_grid_points,
const long (*grid_address)[3], const double QDinv[3][3], const double *fc2,
const double (*svecs_fc2)[3], const long (*multi_fc2)[2],
const long num_patom, const long num_satom, const double *masses_fc2,
const long *p2s_fc2, const long *s2p_fc2,
const double unit_conversion_factor, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, const double nac_factor, const char uplo) {
long i, j, gp, num_band;
long is_nac, info;
const int64_t *undone_grid_points, const int64_t num_undone_grid_points,
const int64_t (*grid_address)[3], const double QDinv[3][3],
const double *fc2, const double (*svecs_fc2)[3],
const int64_t (*multi_fc2)[2], const int64_t num_patom,
const int64_t num_satom, const double *masses_fc2, const int64_t *p2s_fc2,
const int64_t *s2p_fc2, const double unit_conversion_factor,
const double (*born)[3][3], const double dielectric[3][3],
const double reciprocal_lattice[3][3], const double *q_direction,
const double nac_factor, const char uplo) {
int64_t i, j, gp, num_band;
int64_t is_nac, info;
double q[3];
double *freqs_tmp;
@ -232,18 +240,19 @@ static void get_undone_phonons(
static void get_gonze_undone_phonons(
double *frequencies, lapack_complex_double *eigenvectors,
const long *undone_grid_points, const long num_undone_grid_points,
const long (*grid_address)[3], const double QDinv[3][3], const double *fc2,
const double (*svecs_fc2)[3], const long (*multi_fc2)[2],
const double (*positions)[3], const long num_patom, const long num_satom,
const double *masses_fc2, const long *p2s_fc2, const long *s2p_fc2,
const int64_t *undone_grid_points, const int64_t num_undone_grid_points,
const int64_t (*grid_address)[3], const double QDinv[3][3],
const double *fc2, const double (*svecs_fc2)[3],
const int64_t (*multi_fc2)[2], const double (*positions)[3],
const int64_t num_patom, const int64_t num_satom, const double *masses_fc2,
const int64_t *p2s_fc2, const int64_t *s2p_fc2,
const double unit_conversion_factor, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, const double nac_factor,
const double (*dd_q0)[2], const double (*G_list)[3],
const long num_G_points, const double lambda, const char uplo) {
long i, j, gp, num_band;
long is_nac, info;
const int64_t num_G_points, const double lambda, const char uplo) {
int64_t i, j, gp, num_band;
int64_t is_nac, info;
double q[3];
double *freqs_tmp;
@ -294,14 +303,15 @@ static void get_gonze_undone_phonons(
static void get_gonze_phonons(
lapack_complex_double *eigvecs, const double q[3], const double *fc2,
const double *masses, const long *p2s, const long *s2p,
const long (*multi)[2], const double (*positions)[3], const long num_patom,
const long num_satom, const double (*svecs)[3], const long is_nac,
const double (*born)[3][3], const double dielectric[3][3],
const double reciprocal_lattice[3][3], const double *q_direction,
const double nac_factor, const double (*dd_q0)[2],
const double (*G_list)[3], const long num_G_points, const double lambda) {
long i, j, k, l, adrs, num_band;
const double *masses, const int64_t *p2s, const int64_t *s2p,
const int64_t (*multi)[2], const double (*positions)[3],
const int64_t num_patom, const int64_t num_satom, const double (*svecs)[3],
const int64_t is_nac, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, const double nac_factor,
const double (*dd_q0)[2], const double (*G_list)[3],
const int64_t num_G_points, const double lambda) {
int64_t i, j, k, l, adrs, num_band;
double mm;
double q_cart[3];
double *q_dir_cart;
@ -365,9 +375,9 @@ static void get_gonze_phonons(
static void get_dynamical_matrix(
lapack_complex_double *dynmat, const double q[3], const double *fc2,
const double *masses, const long *p2s, const long *s2p,
const long (*multi)[2], const long num_patom, const long num_satom,
const double (*svecs)[3], const long is_nac,
const double *masses, const int64_t *p2s, const int64_t *s2p,
const int64_t (*multi)[2], const int64_t num_patom, const int64_t num_satom,
const double (*svecs)[3], const int64_t is_nac,
const double (*born)[3][3], /* Wang NAC unless NULL */
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, const double nac_factor) {
@ -391,13 +401,13 @@ static void get_dynamical_matrix(
}
}
static void get_charge_sum(double (*charge_sum)[3][3], const long num_patom,
const long num_satom, const double q[3],
static void get_charge_sum(double (*charge_sum)[3][3], const int64_t num_patom,
const int64_t num_satom, const double q[3],
const double (*born)[3][3],
const double dielectric[3][3],
const double reciprocal_lattice[3][3],
const double *q_direction, const double nac_factor) {
long i, j;
int64_t i, j;
double inv_dielectric_factor, dielectric_factor, tmp_val;
double q_cart[3];
@ -432,9 +442,10 @@ static void get_charge_sum(double (*charge_sum)[3][3], const long num_patom,
dym_get_charge_sum(charge_sum, num_patom, dielectric_factor, q_cart, born);
}
static long needs_nac(const double (*born)[3][3], const long (*grid_address)[3],
const long gp, const double *q_direction) {
long is_nac;
static int64_t needs_nac(const double (*born)[3][3],
const int64_t (*grid_address)[3], const int64_t gp,
const double *q_direction) {
int64_t is_nac;
if (born) {
if (grid_address[gp][0] == 0 && grid_address[gp][1] == 0 &&

View File

@ -35,31 +35,35 @@
#ifndef __phonon_H__
#define __phonon_H__
#include <stdint.h>
#include "dynmat.h"
#include "lapack_wrapper.h"
void phn_get_phonons_at_gridpoints(
double *frequencies, lapack_complex_double *eigenvectors, char *phonon_done,
const long num_phonons, const long *grid_points, const long num_grid_points,
const long (*grid_address)[3], const double QDinv[3][3], const double *fc2,
const double (*svecs_fc2)[3], const long (*multi_fc2)[2],
const long num_patom, const long num_satom, const double *masses_fc2,
const long *p2s_fc2, const long *s2p_fc2,
const double unit_conversion_factor, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const int64_t num_phonons, const int64_t *grid_points,
const int64_t num_grid_points, const int64_t (*grid_address)[3],
const double QDinv[3][3], const double *fc2, const double (*svecs_fc2)[3],
const int64_t (*multi_fc2)[2], const int64_t num_patom,
const int64_t num_satom, const double *masses_fc2, const int64_t *p2s_fc2,
const int64_t *s2p_fc2, const double unit_conversion_factor,
const double (*born)[3][3], const double dielectric[3][3],
const double reciprocal_lattice[3][3],
const double *q_direction, /* must be pointer */
const double nac_factor, const char uplo);
void phn_get_gonze_phonons_at_gridpoints(
double *frequencies, lapack_complex_double *eigenvectors, char *phonon_done,
const long num_phonons, const long *grid_points, const long num_grid_points,
const long (*grid_address)[3], const double QDinv[3][3], const double *fc2,
const double (*svecs_fc2)[3], const long (*multi_fc2)[2],
const double (*positions)[3], const long num_patom, const long num_satom,
const double *masses_fc2, const long *p2s_fc2, const long *s2p_fc2,
const int64_t num_phonons, const int64_t *grid_points,
const int64_t num_grid_points, const int64_t (*grid_address)[3],
const double QDinv[3][3], const double *fc2, const double (*svecs_fc2)[3],
const int64_t (*multi_fc2)[2], const double (*positions)[3],
const int64_t num_patom, const int64_t num_satom, const double *masses_fc2,
const int64_t *p2s_fc2, const int64_t *s2p_fc2,
const double unit_conversion_factor, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, /* pointer */
const double nac_factor, const double (*dd_q0)[2],
const double (*G_list)[3], const long num_G_points, const double lambda,
const double (*G_list)[3], const int64_t num_G_points, const double lambda,
const char uplo);
#endif

View File

@ -34,22 +34,24 @@
#include "phononcalc.h"
#include <stdint.h>
#include "lapack_wrapper.h"
#include "phonon.h"
void phcalc_get_phonons_at_gridpoints(
double *frequencies, _lapack_complex_double *eigenvectors,
char *phonon_done, const long num_phonons, const long *grid_points,
const long num_grid_points, const long (*grid_address)[3],
char *phonon_done, const int64_t num_phonons, const int64_t *grid_points,
const int64_t num_grid_points, const int64_t (*grid_address)[3],
const double QDinv[3][3], const double *fc2, const double (*svecs_fc2)[3],
const long (*multi_fc2)[2], const double (*positions_fc2)[3],
const long num_patom, const long num_satom, const double *masses_fc2,
const long *p2s_fc2, const long *s2p_fc2,
const int64_t (*multi_fc2)[2], const double (*positions_fc2)[3],
const int64_t num_patom, const int64_t num_satom, const double *masses_fc2,
const int64_t *p2s_fc2, const int64_t *s2p_fc2,
const double unit_conversion_factor, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, /* pointer */
const double nac_factor, const double (*dd_q0)[2],
const double (*G_list)[3], const long num_G_points, const double lambda,
const double (*G_list)[3], const int64_t num_G_points, const double lambda,
const char uplo) {
if (!dd_q0) {
phn_get_phonons_at_gridpoints(

View File

@ -39,6 +39,8 @@
extern "C" {
#endif
#include <stdint.h>
typedef struct {
double re;
double im;
@ -46,17 +48,17 @@ typedef struct {
void phcalc_get_phonons_at_gridpoints(
double *frequencies, _lapack_complex_double *eigenvectors,
char *phonon_done, const long num_phonons, const long *grid_points,
const long num_grid_points, const long (*grid_address)[3],
char *phonon_done, const int64_t num_phonons, const int64_t *grid_points,
const int64_t num_grid_points, const int64_t (*grid_address)[3],
const double QDinv[3][3], const double *fc2, const double (*svecs_fc2)[3],
const long (*multi_fc2)[2], const double (*positions_fc2)[3],
const long num_patom, const long num_satom, const double *masses_fc2,
const long *p2s_fc2, const long *s2p_fc2,
const int64_t (*multi_fc2)[2], const double (*positions_fc2)[3],
const int64_t num_patom, const int64_t num_satom, const double *masses_fc2,
const int64_t *p2s_fc2, const int64_t *s2p_fc2,
const double unit_conversion_factor, const double (*born)[3][3],
const double dielectric[3][3], const double reciprocal_lattice[3][3],
const double *q_direction, /* pointer */
const double nac_factor, const double (*dd_q0)[2],
const double (*G_list)[3], const long num_G_points, const double lambda,
const double (*G_list)[3], const int64_t num_G_points, const double lambda,
const char uplo);
#ifdef __cplusplus

View File

@ -34,6 +34,7 @@
#include "pp_collision.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -48,37 +49,37 @@
#include "triplet_iw.h"
static void get_collision(
double *ise, const long num_band0, const long num_band,
const long num_temps, const double *temperatures, const double *g,
double *ise, const int64_t num_band0, const int64_t num_band,
const int64_t num_temps, const double *temperatures_THz, const double *g,
const char *g_zero, const double *frequencies,
const lapack_complex_double *eigenvectors, const long triplet[3],
const long triplet_weight, const RecgridConstBZGrid *bzgrid,
const double *fc3, const long is_compact_fc3,
const lapack_complex_double *eigenvectors, const int64_t triplet[3],
const int64_t triplet_weight, const RecgridConstBZGrid *bzgrid,
const double *fc3, const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets, const double *masses,
const long *band_indices, const long symmetrize_fc3_q,
const double cutoff_frequency, const long openmp_per_triplets);
const int64_t *band_indices, const int64_t symmetrize_fc3_q,
const double cutoff_frequency, const int64_t openmp_per_triplets);
static void finalize_ise(double *imag_self_energy, const double *ise,
const long (*bz_grid_address)[3],
const long (*triplets)[3], const long num_triplets,
const long num_temps, const long num_band0,
const long is_NU);
const int64_t (*bz_grid_address)[3],
const int64_t (*triplets)[3],
const int64_t num_triplets, const int64_t num_temps,
const int64_t num_band0, const int64_t is_NU);
void ppc_get_pp_collision(
double *imag_self_energy,
const long relative_grid_address[24][4][3], /* thm */
const int64_t 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 RecgridConstBZGrid *bzgrid,
const double *fc3, const long is_compact_fc3,
const int64_t (*triplets)[3], const int64_t num_triplets,
const int64_t *triplet_weights, const RecgridConstBZGrid *bzgrid,
const double *fc3, const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets, const double *masses,
const Larray *band_indices, const Darray *temperatures, const long is_NU,
const long symmetrize_fc3_q, const double cutoff_frequency,
const long openmp_per_triplets) {
long i;
long num_band, num_band0, num_band_prod, num_temps;
const Larray *band_indices, const Darray *temperatures_THz,
const int64_t is_NU, const int64_t symmetrize_fc3_q,
const double cutoff_frequency, const int64_t openmp_per_triplets) {
int64_t i;
int64_t num_band, num_band0, num_band_prod, num_temps;
double *ise, *freqs_at_gp, *g;
char *g_zero;
long tp_relative_grid_address[2][24][4][3];
int64_t tp_relative_grid_address[2][24][4][3];
ise = NULL;
freqs_at_gp = NULL;
@ -88,7 +89,7 @@ void ppc_get_pp_collision(
num_band0 = band_indices->dims[0];
num_band = atom_triplets->multi_dims[1] * 3;
num_band_prod = num_band0 * num_band * num_band;
num_temps = temperatures->dims[0];
num_temps = temperatures_THz->dims[0];
ise =
(double *)malloc(sizeof(double) * num_triplets * num_temps * num_band0);
freqs_at_gp = (double *)malloc(sizeof(double) * num_band0);
@ -100,8 +101,8 @@ void ppc_get_pp_collision(
tpl_set_relative_grid_address(tp_relative_grid_address,
relative_grid_address, 2);
#ifdef _OPENMP
#pragma omp parallel for schedule(guided) private( \
g, g_zero) if (openmp_per_triplets)
#pragma omp parallel for schedule(guided) \
private(g, g_zero) if (openmp_per_triplets)
#endif
for (i = 0; i < num_triplets; i++) {
g = (double *)malloc(sizeof(double) * 2 * num_band_prod);
@ -114,7 +115,7 @@ void ppc_get_pp_collision(
num_band, 2, openmp_per_triplets);
get_collision(ise + i * num_temps * num_band0, num_band0, num_band,
num_temps, temperatures->data, g, g_zero, frequencies,
num_temps, temperatures_THz->data, g, g_zero, frequencies,
eigenvectors, triplets[i], triplet_weights[i], bzgrid,
fc3, is_compact_fc3, atom_triplets, masses,
band_indices->data, symmetrize_fc3_q, cutoff_frequency,
@ -138,16 +139,16 @@ void ppc_get_pp_collision(
void ppc_get_pp_collision_with_sigma(
double *imag_self_energy, const double sigma, const double sigma_cutoff,
const double *frequencies, const lapack_complex_double *eigenvectors,
const long (*triplets)[3], const long num_triplets,
const long *triplet_weights, const RecgridConstBZGrid *bzgrid,
const double *fc3, const long is_compact_fc3,
const int64_t (*triplets)[3], const int64_t num_triplets,
const int64_t *triplet_weights, const RecgridConstBZGrid *bzgrid,
const double *fc3, const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets, const double *masses,
const Larray *band_indices, const Darray *temperatures, const long is_NU,
const long symmetrize_fc3_q, const double cutoff_frequency,
const long openmp_per_triplets) {
long i;
long num_band, num_band0, num_band_prod, num_temps;
long const_adrs_shift;
const Larray *band_indices, const Darray *temperatures_THz,
const int64_t is_NU, const int64_t symmetrize_fc3_q,
const double cutoff_frequency, const int64_t openmp_per_triplets) {
int64_t i;
int64_t num_band, num_band0, num_band_prod, num_temps;
int64_t const_adrs_shift;
double cutoff;
double *ise, *freqs_at_gp, *g;
char *g_zero;
@ -160,7 +161,7 @@ void ppc_get_pp_collision_with_sigma(
num_band0 = band_indices->dims[0];
num_band = atom_triplets->multi_dims[1] * 3;
num_band_prod = num_band0 * num_band * num_band;
num_temps = temperatures->dims[0];
num_temps = temperatures_THz->dims[0];
const_adrs_shift = num_band_prod;
ise =
@ -174,8 +175,8 @@ void ppc_get_pp_collision_with_sigma(
cutoff = sigma * sigma_cutoff;
#ifdef _OPENMP
#pragma omp parallel for schedule(guided) private( \
g, g_zero) if (openmp_per_triplets)
#pragma omp parallel for schedule(guided) \
private(g, g_zero) if (openmp_per_triplets)
#endif
for (i = 0; i < num_triplets; i++) {
g = (double *)malloc(sizeof(double) * 2 * num_band_prod);
@ -185,7 +186,7 @@ void ppc_get_pp_collision_with_sigma(
const_adrs_shift, frequencies, num_band, 2, 1);
get_collision(ise + i * num_temps * num_band0, num_band0, num_band,
num_temps, temperatures->data, g, g_zero, frequencies,
num_temps, temperatures_THz->data, g, g_zero, frequencies,
eigenvectors, triplets[i], triplet_weights[i], bzgrid,
fc3, is_compact_fc3, atom_triplets, masses,
band_indices->data, symmetrize_fc3_q, cutoff_frequency,
@ -207,26 +208,26 @@ void ppc_get_pp_collision_with_sigma(
}
static void get_collision(
double *ise, const long num_band0, const long num_band,
const long num_temps, const double *temperatures, const double *g,
double *ise, const int64_t num_band0, const int64_t num_band,
const int64_t num_temps, const double *temperatures_THz, const double *g,
const char *g_zero, const double *frequencies,
const lapack_complex_double *eigenvectors, const long triplet[3],
const long triplet_weight, const RecgridConstBZGrid *bzgrid,
const double *fc3, const long is_compact_fc3,
const lapack_complex_double *eigenvectors, const int64_t triplet[3],
const int64_t triplet_weight, const RecgridConstBZGrid *bzgrid,
const double *fc3, const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets, const double *masses,
const long *band_indices, const long symmetrize_fc3_q,
const double cutoff_frequency, const long openmp_per_triplets) {
long i;
long num_band_prod, num_g_pos;
const int64_t *band_indices, const int64_t symmetrize_fc3_q,
const double cutoff_frequency, const int64_t openmp_per_triplets) {
int64_t i;
int64_t num_band_prod, num_g_pos;
double *fc3_normal_squared;
long(*g_pos)[4];
int64_t (*g_pos)[4];
fc3_normal_squared = NULL;
g_pos = NULL;
num_band_prod = num_band0 * num_band * num_band;
fc3_normal_squared = (double *)malloc(sizeof(double) * num_band_prod);
g_pos = (long(*)[4])malloc(sizeof(long[4]) * num_band_prod);
g_pos = (int64_t (*)[4])malloc(sizeof(int64_t[4]) * num_band_prod);
for (i = 0; i < num_band_prod; i++) {
fc3_normal_squared[i] = 0;
@ -242,8 +243,8 @@ static void get_collision(
ise_imag_self_energy_at_triplet(
ise, num_band0, num_band, fc3_normal_squared, frequencies, triplet,
triplet_weight, g, g + num_band_prod, g_pos, num_g_pos, temperatures,
num_temps, cutoff_frequency, openmp_per_triplets, 0);
triplet_weight, g, g + num_band_prod, g_pos, num_g_pos,
temperatures_THz, num_temps, cutoff_frequency, openmp_per_triplets, 0);
free(fc3_normal_squared);
fc3_normal_squared = NULL;
@ -252,12 +253,12 @@ static void get_collision(
}
static void finalize_ise(double *imag_self_energy, const double *ise,
const long (*bz_grid_addresses)[3],
const long (*triplets)[3], const long num_triplets,
const long num_temps, const long num_band0,
const long is_NU) {
long i, j, k;
long is_N;
const int64_t (*bz_grid_addresses)[3],
const int64_t (*triplets)[3],
const int64_t num_triplets, const int64_t num_temps,
const int64_t num_band0, const int64_t is_NU) {
int64_t i, j, k;
int64_t is_N;
if (is_NU) {
for (i = 0; i < 2 * num_temps * num_band0; i++) {

View File

@ -35,6 +35,8 @@
#ifndef __pp_collision_H__
#define __pp_collision_H__
#include <stdint.h>
#include "lapack_wrapper.h"
#include "phonoc_array.h"
#include "real_to_reciprocal.h"
@ -42,24 +44,24 @@
void ppc_get_pp_collision(
double *imag_self_energy,
const long relative_grid_address[24][4][3], /* thm */
const int64_t 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 RecgridConstBZGrid *bzgrid,
const double *fc3, const long is_compact_fc3,
const int64_t (*triplets)[3], const int64_t num_triplets,
const int64_t *triplet_weights, const RecgridConstBZGrid *bzgrid,
const double *fc3, const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets, const double *masses,
const Larray *band_indices, const Darray *temperatures, const long is_NU,
const long symmetrize_fc3_q, const double cutoff_frequency,
const long openmp_per_triplets);
const Larray *band_indices, const Darray *temperatures_THz,
const int64_t is_NU, const int64_t symmetrize_fc3_q,
const double cutoff_frequency, const int64_t openmp_per_triplets);
void ppc_get_pp_collision_with_sigma(
double *imag_self_energy, const double sigma, const double sigma_cutoff,
const double *frequencies, const lapack_complex_double *eigenvectors,
const long (*triplets)[3], const long num_triplets,
const long *triplet_weights, const RecgridConstBZGrid *bzgrid,
const double *fc3, const long is_compact_fc3,
const int64_t (*triplets)[3], const int64_t num_triplets,
const int64_t *triplet_weights, const RecgridConstBZGrid *bzgrid,
const double *fc3, const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets, const double *masses,
const Larray *band_indices, const Darray *temperatures, const long is_NU,
const long symmetrize_fc3_q, const double cutoff_frequency,
const long openmp_per_triplets);
const Larray *band_indices, const Darray *temperatures_THz,
const int64_t is_NU, const int64_t symmetrize_fc3_q,
const double cutoff_frequency, const int64_t openmp_per_triplets);
#endif

View File

@ -35,6 +35,7 @@
#include "real_self_energy.h"
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include "funcs.h"
@ -42,26 +43,28 @@
#include "real_to_reciprocal.h"
static double get_real_self_energy_at_band(
const long band_index, const Darray *fc3_normal_squared,
const double fpoint, const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const double epsilon, const double temperature,
const int64_t band_index, const Darray *fc3_normal_squared,
const double fpoint, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplet_weights,
const double epsilon, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency);
static double sum_real_self_energy_at_band(
const long num_band, const double *fc3_normal_squared, const double fpoint,
const double *freqs1, const double *freqs2, const double epsilon,
const double temperature, const double cutoff_frequency);
static double sum_real_self_energy_at_band_0K(
const long num_band, const double *fc3_normal_squared, const double fpoint,
const double *freqs1, const double *freqs2, const double epsilon,
const int64_t num_band, const double *fc3_normal_squared,
const double fpoint, const double *freqs1, const double *freqs2,
const double epsilon, const double temperature_THz,
const double cutoff_frequency);
static double sum_real_self_energy_at_band_0K(
const int64_t num_band, const double *fc3_normal_squared,
const double fpoint, const double *freqs1, const double *freqs2,
const double epsilon, const double cutoff_frequency);
void rse_get_real_self_energy_at_bands(
double *real_self_energy, const Darray *fc3_normal_squared,
const long *band_indices, const double *frequencies,
const long (*triplets)[3], const long *triplet_weights,
const double epsilon, const double temperature,
const int64_t *band_indices, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplet_weights,
const double epsilon, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency) {
long i, num_band0, num_band, gp0;
int64_t i, num_band0, num_band, gp0;
double fpoint;
num_band0 = fc3_normal_squared->dims[1];
@ -76,19 +79,20 @@ void rse_get_real_self_energy_at_bands(
} else {
real_self_energy[i] = get_real_self_energy_at_band(
i, fc3_normal_squared, fpoint, frequencies, triplets,
triplet_weights, epsilon, temperature, unit_conversion_factor,
cutoff_frequency);
triplet_weights, epsilon, temperature_THz,
unit_conversion_factor, cutoff_frequency);
}
}
}
void rse_get_real_self_energy_at_frequency_point(
double *real_self_energy, const double frequency_point,
const Darray *fc3_normal_squared, const long *band_indices,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const double epsilon, const double temperature,
const double unit_conversion_factor, const double cutoff_frequency) {
long i, num_band0;
const Darray *fc3_normal_squared, const int64_t *band_indices,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const double epsilon,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency) {
int64_t i, num_band0;
num_band0 = fc3_normal_squared->dims[1];
@ -99,18 +103,19 @@ void rse_get_real_self_energy_at_frequency_point(
} else {
real_self_energy[i] = get_real_self_energy_at_band(
i, fc3_normal_squared, frequency_point, frequencies, triplets,
triplet_weights, epsilon, temperature, unit_conversion_factor,
cutoff_frequency);
triplet_weights, epsilon, temperature_THz,
unit_conversion_factor, cutoff_frequency);
}
}
}
static double get_real_self_energy_at_band(
const long band_index, const Darray *fc3_normal_squared,
const double fpoint, const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const double epsilon, const double temperature,
const int64_t band_index, const Darray *fc3_normal_squared,
const double fpoint, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplet_weights,
const double epsilon, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency) {
long i, num_triplets, num_band0, num_band, gp1, gp2;
int64_t i, num_triplets, num_band0, num_band, gp1, gp2;
double shift;
num_triplets = fc3_normal_squared->dims[0];
@ -124,14 +129,14 @@ static double get_real_self_energy_at_band(
for (i = 0; i < num_triplets; i++) {
gp1 = triplets[i][1];
gp2 = triplets[i][2];
if (temperature > 0) {
if (temperature_THz > 0) {
shift += sum_real_self_energy_at_band(
num_band,
fc3_normal_squared->data +
i * num_band0 * num_band * num_band +
band_index * num_band * num_band,
fpoint, frequencies + gp1 * num_band,
frequencies + gp2 * num_band, epsilon, temperature,
frequencies + gp2 * num_band, epsilon, temperature_THz,
cutoff_frequency) *
triplet_weights[i] * unit_conversion_factor;
} else {
@ -150,20 +155,21 @@ static double get_real_self_energy_at_band(
}
static double sum_real_self_energy_at_band(
const long num_band, const double *fc3_normal_squared, const double fpoint,
const double *freqs1, const double *freqs2, const double epsilon,
const double temperature, const double cutoff_frequency) {
long i, j;
const int64_t num_band, const double *fc3_normal_squared,
const double fpoint, const double *freqs1, const double *freqs2,
const double epsilon, const double temperature_THz,
const double cutoff_frequency) {
int64_t i, j;
double n1, n2, f1, f2, f3, f4, shift;
/* double sum; */
shift = 0;
for (i = 0; i < num_band; i++) {
if (freqs1[i] > cutoff_frequency) {
n1 = funcs_bose_einstein(freqs1[i], temperature);
n1 = funcs_bose_einstein(freqs1[i], temperature_THz);
for (j = 0; j < num_band; j++) {
if (freqs2[j] > cutoff_frequency) {
n2 = funcs_bose_einstein(freqs2[j], temperature);
n2 = funcs_bose_einstein(freqs2[j], temperature_THz);
f1 = fpoint + freqs1[i] + freqs2[j];
f2 = fpoint - freqs1[i] - freqs2[j];
f3 = fpoint - freqs1[i] + freqs2[j];
@ -198,10 +204,10 @@ static double sum_real_self_energy_at_band(
}
static double sum_real_self_energy_at_band_0K(
const long num_band, const double *fc3_normal_squared, const double fpoint,
const double *freqs1, const double *freqs2, const double epsilon,
const double cutoff_frequency) {
long i, j;
const int64_t num_band, const double *fc3_normal_squared,
const double fpoint, const double *freqs1, const double *freqs2,
const double epsilon, const double cutoff_frequency) {
int64_t i, j;
double f1, f2, shift;
shift = 0;

View File

@ -35,19 +35,22 @@
#ifndef __real_self_energy_H__
#define __real_self_energy_H__
#include <stdint.h>
#include "phonoc_array.h"
#endif
void rse_get_real_self_energy_at_bands(
double *real_self_energy, const Darray *fc3_normal_squared,
const long *band_indices, const double *frequencies,
const long (*triplets)[3], const long *triplet_weights,
const double epsilon, const double temperature,
const int64_t *band_indices, const double *frequencies,
const int64_t (*triplets)[3], const int64_t *triplet_weights,
const double epsilon, const double temperature_THz,
const double unit_conversion_factor, const double cutoff_frequency);
void rse_get_real_self_energy_at_frequency_point(
double *real_self_energy, const double frequency_point,
const Darray *fc3_normal_squared, const long *band_indices,
const double *frequencies, const long (*triplets)[3],
const long *triplet_weights, const double epsilon, const double temperature,
const double unit_conversion_factor, const double cutoff_frequency);
const Darray *fc3_normal_squared, const int64_t *band_indices,
const double *frequencies, const int64_t (*triplets)[3],
const int64_t *triplet_weights, const double epsilon,
const double temperature_THz, const double unit_conversion_factor,
const double cutoff_frequency);

View File

@ -36,6 +36,7 @@
#include <assert.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -48,38 +49,39 @@ static void real_to_reciprocal_legacy(
const lapack_complex_double *pre_phase_factors,
const lapack_complex_double *phase_factor1,
const lapack_complex_double *phase_factor2, const double *fc3,
const long is_compact_fc3, const AtomTriplets *atom_triplets,
const long openmp_per_triplets);
const int64_t is_compact_fc3, const AtomTriplets *atom_triplets,
const int64_t openmp_per_triplets);
static void real_to_reciprocal_r0_average(
lapack_complex_double *fc3_reciprocal,
const lapack_complex_double *pre_phase_factors,
const lapack_complex_double *phase_factor0,
const lapack_complex_double *phase_factor1,
const lapack_complex_double *phase_factor2, const double *fc3,
const long is_compact_fc3, const AtomTriplets *atom_triplets,
const long openmp_per_triplets);
const int64_t is_compact_fc3, const AtomTriplets *atom_triplets,
const int64_t openmp_per_triplets);
static void real_to_reciprocal_elements(
lapack_complex_double *fc3_rec_elem,
const lapack_complex_double *phase_factor1,
const lapack_complex_double *phase_factor2, const double *fc3,
const long is_compact_fc3, const AtomTriplets *atom_triplets,
const long pi0, const long pi1, const long pi2, const long leg_index);
const int64_t is_compact_fc3, const AtomTriplets *atom_triplets,
const int64_t pi0, const int64_t pi1, const int64_t pi2,
const int64_t leg_index);
static lapack_complex_double get_phase_factor(const double q[3],
const double (*svecs)[3],
const long multi[2]);
const int64_t multi[2]);
static lapack_complex_double get_pre_phase_factor(
const long i_patom, const double q_vecs[3][3],
const int64_t i_patom, const double q_vecs[3][3],
const AtomTriplets *atom_triplets);
static lapack_complex_double sum_lapack_complex_double(lapack_complex_double a,
lapack_complex_double b);
/* fc3_reciprocal[num_patom, num_patom, num_patom, 3, 3, 3] */
/* fc3_reciprocal[num_patom, 3, num_patom, 3, num_patom, 3] */
void r2r_real_to_reciprocal(lapack_complex_double *fc3_reciprocal,
const double q_vecs[3][3], const double *fc3,
const long is_compact_fc3,
const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets,
const long openmp_per_triplets) {
long i, j, num_band, num_patom, num_satom, adrs_vec;
const int64_t openmp_per_triplets) {
int64_t i, j, num_band, num_patom, num_satom, adrs_vec;
lapack_complex_double *pre_phase_factors, *phase_factors, *phase_factor0,
*phase_factor1, *phase_factor2;
@ -143,10 +145,10 @@ static void real_to_reciprocal_legacy(
const lapack_complex_double *pre_phase_factors,
const lapack_complex_double *phase_factor1,
const lapack_complex_double *phase_factor2, const double *fc3,
const long is_compact_fc3, const AtomTriplets *atom_triplets,
const long openmp_per_triplets) {
long i, j, k, l, m, n, ijk;
long num_patom, num_satom, num_band;
const int64_t is_compact_fc3, const AtomTriplets *atom_triplets,
const int64_t openmp_per_triplets) {
int64_t i, j, k, l, m, n, ijk;
int64_t num_patom, num_satom, num_band;
lapack_complex_double fc3_rec_elem[27];
num_patom = atom_triplets->multi_dims[1];
@ -190,10 +192,10 @@ static void real_to_reciprocal_r0_average(
const lapack_complex_double *phase_factor0,
const lapack_complex_double *phase_factor1,
const lapack_complex_double *phase_factor2, const double *fc3,
const long is_compact_fc3, const AtomTriplets *atom_triplets,
const long openmp_per_triplets) {
long i, j, k, l, m, n, ijk;
long num_patom, num_satom, num_band;
const int64_t is_compact_fc3, const AtomTriplets *atom_triplets,
const int64_t openmp_per_triplets) {
int64_t i, j, k, l, m, n, ijk;
int64_t num_patom, num_satom, num_band;
lapack_complex_double fc3_rec_elem[27], fc3_rec;
num_patom = atom_triplets->multi_dims[1];
@ -271,10 +273,11 @@ static void real_to_reciprocal_elements(
lapack_complex_double *fc3_rec_elem,
const lapack_complex_double *phase_factor1,
const lapack_complex_double *phase_factor2, const double *fc3,
const long is_compact_fc3, const AtomTriplets *atom_triplets,
const long pi0, const long pi1, const long pi2, const long leg_index) {
long i, j, k, l;
long num_satom, adrs_shift;
const int64_t is_compact_fc3, const AtomTriplets *atom_triplets,
const int64_t pi0, const int64_t pi1, const int64_t pi2,
const int64_t leg_index) {
int64_t i, j, k, l;
int64_t num_satom, adrs_shift_atoms, adrs_shift_fc3;
lapack_complex_double phase_factor;
double fc3_rec_real[27], fc3_rec_imag[27];
@ -306,8 +309,11 @@ static void real_to_reciprocal_elements(
continue;
}
}
adrs_shift =
i * 27 * num_satom * num_satom + j * 27 * num_satom + k * 27;
adrs_shift_atoms = i * num_satom * num_satom + j * num_satom + k;
if (!atom_triplets->nonzero_indices[adrs_shift_atoms]) {
continue;
}
adrs_shift_fc3 = adrs_shift_atoms * 27;
phase_factor =
phonoc_complex_prod(phase_factor1[j], phase_factor2[k]);
@ -317,19 +323,19 @@ static void real_to_reciprocal_elements(
for (l = 0; l < 27; l++) {
fc3_rec_real[l] +=
lapack_complex_double_real(phase_factor) *
fc3[adrs_shift + l] * 3;
fc3[adrs_shift_fc3 + l] * 3;
fc3_rec_imag[l] +=
lapack_complex_double_imag(phase_factor) *
fc3[adrs_shift + l] * 3;
fc3[adrs_shift_fc3 + l] * 3;
}
} else {
for (l = 0; l < 27; l++) {
fc3_rec_real[l] +=
lapack_complex_double_real(phase_factor) *
fc3[adrs_shift + l];
fc3[adrs_shift_fc3 + l];
fc3_rec_imag[l] +=
lapack_complex_double_imag(phase_factor) *
fc3[adrs_shift + l];
fc3[adrs_shift_fc3 + l];
}
}
}
@ -344,9 +350,9 @@ static void real_to_reciprocal_elements(
// This function doesn't need to think about position +
// lattice-translation because q+q'+q''=G.
static lapack_complex_double get_pre_phase_factor(
const long i_patom, const double q_vecs[3][3],
const int64_t i_patom, const double q_vecs[3][3],
const AtomTriplets *atom_triplets) {
long j, svecs_adrs;
int64_t j, svecs_adrs;
double pre_phase;
lapack_complex_double pre_phase_factor;
@ -366,8 +372,8 @@ static lapack_complex_double get_pre_phase_factor(
static lapack_complex_double get_phase_factor(const double q[3],
const double (*svecs)[3],
const long multi[2]) {
long i, j;
const int64_t multi[2]) {
int64_t i, j;
double sum_real, sum_imag, phase;
sum_real = 0;

View File

@ -35,22 +35,25 @@
#ifndef __real_to_reciprocal_H__
#define __real_to_reciprocal_H__
#include <stdint.h>
#include "lapack_wrapper.h"
#include "phonoc_array.h"
typedef struct {
const double (*svecs)[3];
long multi_dims[2];
const long (*multiplicity)[2];
const long *p2s_map;
const long *s2p_map;
long make_r0_average;
int64_t multi_dims[2];
const int64_t (*multiplicity)[2];
const int64_t *p2s_map;
const int64_t *s2p_map;
int64_t make_r0_average;
const char *all_shortest;
const char *nonzero_indices; // for compact fc3
} AtomTriplets;
void r2r_real_to_reciprocal(lapack_complex_double *fc3_reciprocal,
const double q_vecs[3][3], const double *fc3,
const long is_compact_fc3,
const int64_t is_compact_fc3,
const AtomTriplets *atom_triplets,
const long openmp_per_triplets);
const int64_t openmp_per_triplets);
#endif

View File

@ -34,6 +34,7 @@
#include "recgrid.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -44,64 +45,71 @@
#define GRID_TOLERANCE_FACTOR 0.01
void recgrid_get_all_grid_addresses(long (*gr_grid_addresses)[3],
const long D_diag[3]) {
void recgrid_get_all_grid_addresses(int64_t (*gr_grid_addresses)[3],
const int64_t D_diag[3]) {
grg_get_all_grid_addresses(gr_grid_addresses, D_diag);
}
void recgrid_get_double_grid_address(long address_double[3],
const long address[3], const long PS[3]) {
void recgrid_get_double_grid_address(int64_t address_double[3],
const int64_t address[3],
const int64_t PS[3]) {
grg_get_double_grid_address(address_double, address, PS);
}
void recgrid_get_grid_address_from_index(long address[3], const long grid_index,
const long D_diag[3]) {
void recgrid_get_grid_address_from_index(int64_t address[3],
const int64_t grid_index,
const int64_t D_diag[3]) {
grg_get_grid_address_from_index(address, grid_index, D_diag);
}
long recgrid_get_double_grid_index(const long address_double[3],
const long D_diag[3], const long PS[3]) {
int64_t recgrid_get_double_grid_index(const int64_t address_double[3],
const int64_t D_diag[3],
const int64_t PS[3]) {
return grg_get_double_grid_index(address_double, D_diag, PS);
}
long recgrid_get_grid_index_from_address(const long address[3],
const long D_diag[3]) {
int64_t recgrid_get_grid_index_from_address(const int64_t address[3],
const int64_t D_diag[3]) {
return grg_get_grid_index(address, D_diag);
}
long recgrid_rotate_grid_index(const long grid_index, const long rotation[3][3],
const long D_diag[3], const long PS[3]) {
int64_t recgrid_rotate_grid_index(const int64_t grid_index,
const int64_t rotation[3][3],
const int64_t D_diag[3],
const int64_t PS[3]) {
return grg_rotate_grid_index(grid_index, rotation, D_diag, PS);
}
long recgrid_get_reciprocal_point_group(long rec_rotations[48][3][3],
const long (*rotations)[3][3],
const long num_rot,
const long is_time_reversal,
const long is_transpose) {
int64_t recgrid_get_reciprocal_point_group(int64_t rec_rotations[48][3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot,
const int64_t is_time_reversal,
const int64_t is_transpose) {
return grg_get_reciprocal_point_group(rec_rotations, rotations, num_rot,
is_time_reversal, is_transpose);
}
long recgrid_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3],
const long A[3][3]) {
int64_t recgrid_get_snf3x3(int64_t D_diag[3], int64_t P[3][3], int64_t Q[3][3],
const int64_t A[3][3]) {
return grg_get_snf3x3(D_diag, P, Q, A);
}
long recgrid_transform_rotations(long (*transformed_rots)[3][3],
const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long Q[3][3]) {
long succeeded;
int64_t recgrid_transform_rotations(int64_t (*transformed_rots)[3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot,
const int64_t D_diag[3],
const int64_t Q[3][3]) {
int64_t succeeded;
succeeded = grg_transform_rotations(transformed_rots, rotations, num_rot,
D_diag, Q);
return succeeded;
}
long recgrid_get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long PS[3]) {
long num_ir, i;
int64_t recgrid_get_ir_grid_map(int64_t *ir_grid_map,
const int64_t (*rotations)[3][3],
const int64_t num_rot, const int64_t D_diag[3],
const int64_t PS[3]) {
int64_t num_ir, i;
grg_get_ir_grid_map(ir_grid_map, rotations, num_rot, D_diag, PS);
@ -114,13 +122,12 @@ long recgrid_get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
return num_ir;
}
long recgrid_get_bz_grid_addresses(long (*bz_grid_addresses)[3], long *bz_map,
long *bzg2grg, const long D_diag[3],
const long Q[3][3], const long PS[3],
const double rec_lattice[3][3],
const long bz_grid_type) {
int64_t recgrid_get_bz_grid_addresses(
int64_t (*bz_grid_addresses)[3], int64_t *bz_map, int64_t *bzg2grg,
const int64_t D_diag[3], const int64_t Q[3][3], const int64_t PS[3],
const double rec_lattice[3][3], const int64_t bz_grid_type) {
RecgridBZGrid *bzgrid;
long i, j, size;
int64_t i, j, size;
if ((bzgrid = (RecgridBZGrid *)malloc(sizeof(RecgridBZGrid))) == NULL) {
warning_print("Memory could not be allocated.");
@ -152,13 +159,12 @@ long recgrid_get_bz_grid_addresses(long (*bz_grid_addresses)[3], long *bz_map,
return size;
}
long recgrid_rotate_bz_grid_index(const long bz_grid_index,
const long rotation[3][3],
const long (*bz_grid_addresses)[3],
const long *bz_map, const long D_diag[3],
const long PS[3], const long bz_grid_type) {
int64_t recgrid_rotate_bz_grid_index(
const int64_t bz_grid_index, const int64_t rotation[3][3],
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t D_diag[3], const int64_t PS[3], const int64_t bz_grid_type) {
RecgridConstBZGrid *bzgrid;
long i, rot_bz_gp;
int64_t i, rot_bz_gp;
if ((bzgrid = (RecgridConstBZGrid *)malloc(sizeof(RecgridConstBZGrid))) ==
NULL) {
@ -184,23 +190,14 @@ long recgrid_rotate_bz_grid_index(const long bz_grid_index,
/* Note: Tolerance in squared distance. */
double recgrid_get_tolerance_for_BZ_reduction(const RecgridBZGrid *bzgrid) {
long i, j;
int64_t i, j;
double tolerance;
double length[3];
double reclatQ[3][3];
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
reclatQ[i][j] = bzgrid->reclat[i][0] * bzgrid->Q[0][j] +
bzgrid->reclat[i][1] * bzgrid->Q[1][j] +
bzgrid->reclat[i][2] * bzgrid->Q[2][j];
}
}
for (i = 0; i < 3; i++) {
length[i] = 0;
for (j = 0; j < 3; j++) {
length[i] += reclatQ[j][i] * reclatQ[j][i];
length[i] += bzgrid->reclat[j][i] * bzgrid->reclat[j][i];
}
length[i] /= bzgrid->D_diag[i] * bzgrid->D_diag[i];
}
@ -215,7 +212,7 @@ double recgrid_get_tolerance_for_BZ_reduction(const RecgridBZGrid *bzgrid) {
return tolerance;
}
RecgridMats *recgrid_alloc_RotMats(const long size) {
RecgridMats *recgrid_alloc_RotMats(const int64_t size) {
RecgridMats *rotmats;
rotmats = NULL;
@ -227,8 +224,8 @@ RecgridMats *recgrid_alloc_RotMats(const long size) {
rotmats->size = size;
if (size > 0) {
if ((rotmats->mat = (long(*)[3][3])malloc(sizeof(long[3][3]) * size)) ==
NULL) {
if ((rotmats->mat = (int64_t (*)[3][3])malloc(sizeof(int64_t[3][3]) *
size)) == NULL) {
warning_print("Memory could not be allocated ");
warning_print("(RecgridMats, line %d, %s).\n", __LINE__, __FILE__);
free(rotmats);

View File

@ -39,23 +39,25 @@
extern "C" {
#endif
#include <stdint.h>
typedef struct {
long size;
long (*mat)[3][3];
int64_t size;
int64_t (*mat)[3][3];
} RecgridMats;
/* Data structure of Brillouin zone grid
*
* size : long
* size : int64_t
* Number of grid points in Brillouin zone including its surface.
* D_diag : long array
* D_diag : int64_t array
* Diagonal part of matrix D of SNF.
* shape=(3, )
* PS : long array
* PS : int64_t array
* Matrix P of SNF multiplied by shift.
* shape=(3, )
* gp_map : long array
* Type1 : Twice enlarged grid space along basis vectors.
* gp_map : int64_t array
* Type1 : Twice enlarged grid space aint64_t basis vectors.
* Grid index is recovered in the same way as regular grid.
* shape=(prod(mesh * 2), )
* Type2 : In the last index, multiplicity and array index of
@ -63,36 +65,36 @@ typedef struct {
* multiplicity means the number of translationally
* equivalent grid points in BZ.
* shape=(prod(mesh), 2) -> flattened.
* addresses : long array
* addresses : int64_t array
* Grid point addresses.
* shape=(size, 3)
* reclat : double array
* Reciprocal basis vectors given as column vectors.
* shape=(3, 3)
* type : long
* type : int64_t
* 1 or 2. */
typedef struct {
long size;
long D_diag[3];
long Q[3][3];
long PS[3];
long *gp_map;
long *bzg2grg;
long (*addresses)[3];
int64_t size;
int64_t D_diag[3];
int64_t Q[3][3];
int64_t PS[3];
int64_t *gp_map;
int64_t *bzg2grg;
int64_t (*addresses)[3];
double reclat[3][3];
long type;
int64_t type;
} RecgridBZGrid;
typedef struct {
long size;
long D_diag[3];
long Q[3][3];
long PS[3];
const long *gp_map;
const long *bzg2grg;
const long (*addresses)[3];
int64_t size;
int64_t D_diag[3];
int64_t Q[3][3];
int64_t PS[3];
const int64_t *gp_map;
const int64_t *bzg2grg;
const int64_t (*addresses)[3];
double reclat[3][3];
long type;
int64_t type;
} RecgridConstBZGrid;
/* Generalized regular (GR) grid
@ -110,11 +112,11 @@ half-grid shift along an axis corresponds to 1.
* @brief Return all GR-grid addresses with respect to n_1, n_2, n_3
*
* @param gr_grid_addresses All GR-grid addresses
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @return void
*/
void recgrid_get_all_grid_addresses(long (*gr_grid_addresses)[3],
const long D_diag[3]);
void recgrid_get_all_grid_addresses(int64_t (*gr_grid_addresses)[3],
const int64_t D_diag[3]);
/**
* @brief Return double grid address in GR-grid
@ -125,53 +127,57 @@ void recgrid_get_all_grid_addresses(long (*gr_grid_addresses)[3],
* @param PS Shift in GR-grid
* @return void
*/
void recgrid_get_double_grid_address(long address_double[3],
const long address[3], const long PS[3]);
void recgrid_get_double_grid_address(int64_t address_double[3],
const int64_t address[3],
const int64_t PS[3]);
/**
* @brief Return single grid address in GR-grid with given grid point index.
*
* @param address Single grid address in GR-grid
* @param grid_index Grid point index in GR-grid
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @return void
*/
void recgrid_get_grid_address_from_index(long address[3], const long grid_index,
const long D_diag[3]);
void recgrid_get_grid_address_from_index(int64_t address[3],
const int64_t grid_index,
const int64_t D_diag[3]);
/**
* @brief Return grid point index of double grid address in GR-grid
*
* @param address_double Double grid address, i.e., possibly with shift in
* GR-grid
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @param PS Shift in GR-grid
* @return long
* @return int64_t
*/
long recgrid_get_double_grid_index(const long address_double[3],
const long D_diag[3], const long PS[3]);
int64_t recgrid_get_double_grid_index(const int64_t address_double[3],
const int64_t D_diag[3],
const int64_t PS[3]);
/**
* @brief Return grid point index of single grid address in GR-grid
*
* @param address Single grid address in GR-grid
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @return long
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @return int64_t
*/
long recgrid_get_grid_index_from_address(const long address[3],
const long D_diag[3]);
int64_t recgrid_get_grid_index_from_address(const int64_t address[3],
const int64_t D_diag[3]);
/**
* @brief Return grid point index of rotated address of given grid point index.
*
* @param grid_index Grid point index in GR-grid
* @param rotation Transformed rotation in reciprocal space tilde-R^T
* @param D_diag Numbers of divisions along a, b, c directions of GR-grid
* @param D_diag Numbers of divisions aint64_t a, b, c directions of GR-grid
* @param PS Shift in GR-grid
* @return long
* @return int64_t
*/
long recgrid_rotate_grid_index(const long grid_index, const long rotation[3][3],
const long D_diag[3], const long PS[3]);
int64_t recgrid_rotate_grid_index(const int64_t grid_index,
const int64_t rotation[3][3],
const int64_t D_diag[3], const int64_t PS[3]);
/**
* @brief Return {R^T} of crystallographic point group {R} with and without time
@ -182,24 +188,24 @@ long recgrid_rotate_grid_index(const long grid_index, const long rotation[3][3],
* @param num_rot Number of given rotations |{R}|
* @param is_time_reversal With (1) or without (0) time reversal symmetry
* @param is_transpose With (1) or without (0) transpose of rotation matrices
* @return long
* @return int64_t
*/
long recgrid_get_reciprocal_point_group(long rec_rotations[48][3][3],
const long (*rotations)[3][3],
const long num_rot,
const long is_time_reversal,
const long is_transpose);
int64_t recgrid_get_reciprocal_point_group(int64_t rec_rotations[48][3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot,
const int64_t is_time_reversal,
const int64_t is_transpose);
/**
* @brief Return D, P, Q of Smith normal form of A.
*
* @param D_diag Diagonal elements of diagnoal matrix D
* @param D_diag Diagonal elements of diagonal matrix D
* @param P Unimodular matrix P
* @param Q Unimodular matrix Q
* @param A Integer matrix
* @return long
* @return int64_t
*/
long recgrid_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3],
const long A[3][3]);
int64_t recgrid_get_snf3x3(int64_t D_diag[3], int64_t P[3][3], int64_t Q[3][3],
const int64_t A[3][3]);
/**
* @brief Transform {R^T} to {R^T} with respect to transformed microzone basis
@ -209,14 +215,15 @@ long recgrid_get_snf3x3(long D_diag[3], long P[3][3], long Q[3][3],
* {tilde-R^T}
* @param rotations Original rotations matrices in reciprocal space {R^T}
* @param num_rot Number of rotation matrices
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param Q Unimodular matrix Q of Smith normal form
* @return long
* @return int64_t
*/
long recgrid_transform_rotations(long (*transformed_rots)[3][3],
const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long Q[3][3]);
int64_t recgrid_transform_rotations(int64_t (*transformed_rots)[3][3],
const int64_t (*rotations)[3][3],
const int64_t num_rot,
const int64_t D_diag[3],
const int64_t Q[3][3]);
/**
* @brief Return mapping table from GR-grid points to GR-ir-grid points
@ -225,13 +232,14 @@ long recgrid_transform_rotations(long (*transformed_rots)[3][3],
* array size of prod(D_diag)
* @param rotations Transformed rotation matrices in reciprocal space
* @param num_rot Number of rotation matrices
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param PS Shift in GR-grid
* @return long Number of ir_grid_points.
* @return int64_t Number of ir_grid_points.
*/
long recgrid_get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
const long num_rot, const long D_diag[3],
const long PS[3]);
int64_t recgrid_get_ir_grid_map(int64_t *ir_grid_map,
const int64_t (*rotations)[3][3],
const int64_t num_rot, const int64_t D_diag[3],
const int64_t PS[3]);
/**
* @brief Find shortest grid points from Gamma considering periodicity of
@ -244,26 +252,25 @@ long recgrid_get_ir_grid_map(long *ir_grid_map, const long (*rotations)[3][3],
* @param bzg2grg Mapping table of bz_grid_addresses to gr_grid_addresses. In
* type-II, len(bzg2grg) == len(bz_grid_addresses) <= (D_diag[0] + 1) *
* (D_diag[1] + 1) * (D_diag[2] + 1).
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param Q Unimodular matrix Q of Smith normal form
* @param PS Shift in GR-grid
* @param rec_lattice Reduced reciprocal basis vectors in column vectors
* @param bz_grid_type Data structure type I (old and sparse) or II (new and
* dense, recommended) of bz_map
* @return long Number of bz_grid_addresses stored.
* @return int64_t Number of bz_grid_addresses stored.
*/
long recgrid_get_bz_grid_addresses(long (*bz_grid_addresses)[3], long *bz_map,
long *bzg2grg, const long D_diag[3],
const long Q[3][3], const long PS[3],
const double rec_lattice[3][3],
const long bz_grid_type);
int64_t recgrid_get_bz_grid_addresses(
int64_t (*bz_grid_addresses)[3], int64_t *bz_map, int64_t *bzg2grg,
const int64_t D_diag[3], const int64_t Q[3][3], const int64_t PS[3],
const double rec_lattice[3][3], const int64_t bz_grid_type);
/**
* @brief Return index of rotated bz grid point
*
* @param bz_grid_index BZ grid point index
* @param rotation Transformed rotation in reciprocal space tilde-R^T
* @param bz_grid_addresses BZ grid point adddresses
* @param bz_grid_addresses BZ grid point addresses
* @param bz_map List of accumulated numbers of BZ grid points from the
* first GR grid point to the last grid point. In type-II, [0, 1, 3, 4, ...]
* means multiplicities of [1, 2, 1, ...], with len(bz_map)=product(D_diag) + 1.
@ -271,15 +278,14 @@ long recgrid_get_bz_grid_addresses(long (*bz_grid_addresses)[3], long *bz_map,
* @param PS Shift in GR-grid
* @param bz_grid_type Data structure type I (old and sparse) or II (new and
* dense, recommended) of bz_map
* @return long
* @return int64_t
*/
long recgrid_rotate_bz_grid_index(const long bz_grid_index,
const long rotation[3][3],
const long (*bz_grid_addresses)[3],
const long *bz_map, const long D_diag[3],
const long PS[3], const long bz_grid_type);
int64_t recgrid_rotate_bz_grid_index(
const int64_t bz_grid_index, const int64_t rotation[3][3],
const int64_t (*bz_grid_addresses)[3], const int64_t *bz_map,
const int64_t D_diag[3], const int64_t PS[3], const int64_t bz_grid_type);
double recgrid_get_tolerance_for_BZ_reduction(const RecgridBZGrid *bzgrid);
RecgridMats *recgrid_alloc_RotMats(const long size);
RecgridMats *recgrid_alloc_RotMats(const int64_t size);
void recgrid_free_RotMats(RecgridMats *rotmats);
#ifdef __cplusplus

View File

@ -34,6 +34,8 @@
#include "reciprocal_to_normal.h"
#include <stdint.h>
#ifdef MULTITHREADED_BLAS
#if defined(MKL_BLAS) || defined(SCIPY_MKL_H)
#include <mkl_cblas.h>
@ -47,46 +49,56 @@
#include "lapack_wrapper.h"
#ifdef MEASURE_R2N
#include <time.h>
#include <unistd.h>
#endif
static double get_fc3_sum(const lapack_complex_double *e0,
const lapack_complex_double *e1,
static void get_fc3_e0_e1_e2(
double *fc3_normal_squared, const int64_t (*g_pos)[4],
const int64_t num_g_pos, const lapack_complex_double *fc3_reciprocal,
const double *freqs0, const double *freqs1, const double *freqs2,
const lapack_complex_double *e0, const lapack_complex_double *e1,
const lapack_complex_double *e2, const int64_t *band_indices,
const int64_t num_band0, const int64_t num_band,
const double cutoff_frequency, const int64_t openmp_per_triplets);
static void get_fc3_e0(lapack_complex_double *fc3_e0,
const lapack_complex_double *fc3_reciprocal,
const lapack_complex_double *e0,
const int64_t band_index_0, const int64_t num_band);
static double get_fc3_sum(const lapack_complex_double *e1,
const lapack_complex_double *e2,
const lapack_complex_double *fc3_reciprocal,
const long num_band);
const int64_t num_band);
static double get_fc3_sum_blas_like(const lapack_complex_double *e0,
const lapack_complex_double *e1,
const lapack_complex_double *e2,
const lapack_complex_double *fc3_reciprocal,
const int64_t num_band);
// Testing efficiency of BLAS
#ifdef MULTITHREADED_BLAS
static double get_fc3_sum_blas(const lapack_complex_double *e0,
const lapack_complex_double *e1,
const lapack_complex_double *e2,
const lapack_complex_double *fc3_reciprocal,
const long num_band);
const int64_t num_band);
#endif
static double get_fc3_sum_blas_like(const lapack_complex_double *e0,
const lapack_complex_double *e1,
const lapack_complex_double *e2,
const lapack_complex_double *fc3_reciprocal,
const long num_band);
void reciprocal_to_normal_squared(
double *fc3_normal_squared, const long (*g_pos)[4], const long num_g_pos,
const lapack_complex_double *fc3_reciprocal, const double *freqs0,
const double *freqs1, const double *freqs2,
double *fc3_normal_squared, const int64_t (*g_pos)[4],
const int64_t num_g_pos, const lapack_complex_double *fc3_reciprocal,
const double *freqs0, const double *freqs1, const double *freqs2,
const lapack_complex_double *eigvecs0,
const lapack_complex_double *eigvecs1,
const lapack_complex_double *eigvecs2, const double *masses,
const long *band_indices, const long num_band,
const double cutoff_frequency, const long openmp_per_triplets) {
long i, j, ij, num_atom, use_multithreaded_blas;
const int64_t *band_indices, const int64_t num_band0,
const int64_t num_band, const double cutoff_frequency,
const int64_t openmp_per_triplets) {
int64_t i, j, ij, num_atom;
double *inv_sqrt_masses;
lapack_complex_double *e0, *e1, *e2;
/* Inverse sqrt mass is multipled with eigenvectors to reduce number
* of */
/* operations in get_fc3_sum. Three eigenvector matrices are looped
* by */
/* first loop leveraging contiguous memory layout of [e0, e1, e2].
/* Inverse sqrt mass is multiplied with eigenvectors to reduce
* number of */
/* operations in get_fc3_sum. Three eigenvector matrices are
* looped by */
/* first loop leveraging contiguous memory layout of [e0,
* e1, e2].
*/
num_atom = num_band / 3;
inv_sqrt_masses = (double *)malloc(sizeof(double) * num_band);
@ -130,64 +142,10 @@ void reciprocal_to_normal_squared(
free(inv_sqrt_masses);
inv_sqrt_masses = NULL;
#ifdef MEASURE_R2N
double loopTotalCPUTime, loopTotalWallTime;
time_t loopStartWallTime;
clock_t loopStartCPUTime;
#endif
#ifdef MEASURE_R2N
loopStartWallTime = time(NULL);
loopStartCPUTime = clock();
#endif
#ifdef MULTITHREADED_BLAS
if (openmp_per_triplets) {
use_multithreaded_blas = 0;
} else {
use_multithreaded_blas = 1;
}
#else
use_multithreaded_blas = 0;
#ifdef _OPENMP
#pragma omp parallel for if (!openmp_per_triplets)
#endif
#endif
for (i = 0; i < num_g_pos; i++) {
if (freqs0[band_indices[g_pos[i][0]]] > cutoff_frequency &&
freqs1[g_pos[i][1]] > cutoff_frequency &&
freqs2[g_pos[i][2]] > cutoff_frequency) {
#ifdef MULTITHREADED_BLAS
if (use_multithreaded_blas) {
fc3_normal_squared[g_pos[i][3]] =
get_fc3_sum_blas(e0 + band_indices[g_pos[i][0]] * num_band,
e1 + g_pos[i][1] * num_band,
e2 + g_pos[i][2] * num_band,
fc3_reciprocal, num_band) /
(freqs0[band_indices[g_pos[i][0]]] * freqs1[g_pos[i][1]] *
freqs2[g_pos[i][2]]);
} else {
#endif
fc3_normal_squared[g_pos[i][3]] =
get_fc3_sum_blas_like(
e0 + band_indices[g_pos[i][0]] * num_band,
e1 + g_pos[i][1] * num_band,
e2 + g_pos[i][2] * num_band, fc3_reciprocal, num_band) /
(freqs0[band_indices[g_pos[i][0]]] * freqs1[g_pos[i][1]] *
freqs2[g_pos[i][2]]);
#ifdef MULTITHREADED_BLAS
}
#endif
} else {
fc3_normal_squared[g_pos[i][3]] = 0;
}
}
#ifdef MEASURE_R2N
loopTotalCPUTime = (double)(clock() - loopStartCPUTime) / CLOCKS_PER_SEC;
loopTotalWallTime = difftime(time(NULL), loopStartWallTime);
printf(" %1.3fs (%1.3fs CPU)\n", loopTotalWallTime, loopTotalCPUTime);
#endif
get_fc3_e0_e1_e2(fc3_normal_squared, g_pos, num_g_pos, fc3_reciprocal,
freqs0, freqs1, freqs2, e0, e1, e2, band_indices,
num_band0, num_band, cutoff_frequency,
openmp_per_triplets);
free(e0);
e0 = NULL;
@ -195,41 +153,158 @@ void reciprocal_to_normal_squared(
e2 = NULL;
}
static double get_fc3_sum(const lapack_complex_double *e0,
const lapack_complex_double *e1,
// This is less efficient than the one without multithreading
// but can be called when unit cell is large.
static void get_fc3_e0_e1_e2(
double *fc3_normal_squared, const int64_t (*g_pos)[4],
const int64_t num_g_pos, const lapack_complex_double *fc3_reciprocal,
const double *freqs0, const double *freqs1, const double *freqs2,
const lapack_complex_double *e0, const lapack_complex_double *e1,
const lapack_complex_double *e2, const int64_t *band_indices,
const int64_t num_band0, const int64_t num_band,
const double cutoff_frequency, const int64_t openmp_per_triplets) {
int64_t i;
lapack_complex_double *fc3_e0, zero;
zero = lapack_make_complex_double(0, 0);
fc3_e0 = (lapack_complex_double *)malloc(sizeof(lapack_complex_double) *
num_band0 * num_band * num_band);
for (i = 0; i < num_band0 * num_band * num_band; i++) {
fc3_e0[i] = zero;
}
#ifdef _OPENMP
#pragma omp parallel for if (!openmp_per_triplets)
#endif
for (i = 0; i < num_band0; i++) {
get_fc3_e0(fc3_e0 + i * num_band * num_band, fc3_reciprocal, e0,
band_indices[i], num_band);
}
#ifdef _OPENMP
#pragma omp parallel for if (!openmp_per_triplets)
#endif
for (i = 0; i < num_g_pos; i++) {
if (freqs0[band_indices[g_pos[i][0]]] > cutoff_frequency &&
freqs1[g_pos[i][1]] > cutoff_frequency &&
freqs2[g_pos[i][2]] > cutoff_frequency) {
fc3_normal_squared[g_pos[i][3]] =
get_fc3_sum(
e1 + g_pos[i][1] * num_band, e2 + g_pos[i][2] * num_band,
fc3_e0 + g_pos[i][0] * num_band * num_band, num_band) /
(freqs0[band_indices[g_pos[i][0]]] * freqs1[g_pos[i][1]] *
freqs2[g_pos[i][2]]);
} else {
fc3_normal_squared[g_pos[i][3]] = 0;
}
}
free(fc3_e0);
fc3_e0 = NULL;
}
static void get_fc3_e0(lapack_complex_double *fc3_e0,
const lapack_complex_double *fc3_reciprocal,
const lapack_complex_double *e0,
const int64_t band_index_0, const int64_t num_band) {
int64_t j, k;
lapack_complex_double fc3_elem;
for (j = 0; j < num_band; j++) {
for (k = 0; k < num_band * num_band; k++) {
fc3_elem =
phonoc_complex_prod(fc3_reciprocal[j * num_band * num_band + k],
e0[band_index_0 * num_band + j]);
fc3_e0[k] = lapack_make_complex_double(
lapack_complex_double_real(fc3_e0[k]) +
lapack_complex_double_real(fc3_elem),
lapack_complex_double_imag(fc3_e0[k]) +
lapack_complex_double_imag(fc3_elem));
}
}
}
static double get_fc3_sum(const lapack_complex_double *e1,
const lapack_complex_double *e2,
const lapack_complex_double *fc3_reciprocal,
const long num_band) {
long i, j, jk;
const lapack_complex_double *fc3_e0,
const int64_t num_band) {
int64_t i, j;
double sum_real, sum_imag;
lapack_complex_double e_012_fc3, fc3_i_e_12, *e_12_cache;
const lapack_complex_double *fc3_i;
lapack_complex_double *fc3_e0_e1, fc3_elem;
e_12_cache = (lapack_complex_double *)malloc(sizeof(lapack_complex_double) *
num_band * num_band);
fc3_e0_e1 = (lapack_complex_double *)malloc(sizeof(lapack_complex_double) *
num_band);
for (i = 0; i < num_band; i++) {
fc3_e0_e1[i] = lapack_make_complex_double(0, 0);
}
for (i = 0; i < num_band; i++) {
for (j = 0; j < num_band; j++) {
fc3_elem = phonoc_complex_prod(fc3_e0[i * num_band + j], e1[i]);
fc3_e0_e1[j] = lapack_make_complex_double(
lapack_complex_double_real(fc3_e0_e1[j]) +
lapack_complex_double_real(fc3_elem),
lapack_complex_double_imag(fc3_e0_e1[j]) +
lapack_complex_double_imag(fc3_elem));
}
}
sum_real = 0;
sum_imag = 0;
for (i = 0; i < num_band; i++) {
for (j = 0; j < num_band; j++) {
e_12_cache[i * num_band + j] = phonoc_complex_prod(e1[i], e2[j]);
}
fc3_elem = phonoc_complex_prod(fc3_e0_e1[i], e2[i]);
sum_real += lapack_complex_double_real(fc3_elem);
sum_imag += lapack_complex_double_imag(fc3_elem);
}
free(fc3_e0_e1);
fc3_e0_e1 = NULL;
return (sum_real * sum_real + sum_imag * sum_imag);
}
static double get_fc3_sum_blas_like(const lapack_complex_double *e0,
const lapack_complex_double *e1,
const lapack_complex_double *e2,
const lapack_complex_double *fc3_reciprocal,
const int64_t num_band) {
int64_t i, j;
double sum_real, sum_imag, retval_real, retval_imag;
lapack_complex_double *e_12, fc3_e_12, fc3_e_012;
e_12 = (lapack_complex_double *)malloc(sizeof(lapack_complex_double) *
num_band * num_band);
for (i = 0; i < num_band; i++) {
fc3_i = fc3_reciprocal + i * num_band * num_band;
for (jk = 0; jk < num_band * num_band; jk++) {
fc3_i_e_12 = phonoc_complex_prod(fc3_i[jk], e_12_cache[jk]);
e_012_fc3 = phonoc_complex_prod(e0[i], fc3_i_e_12);
sum_real += lapack_complex_double_real(e_012_fc3);
sum_imag += lapack_complex_double_imag(e_012_fc3);
memcpy(e_12 + i * num_band, e2,
sizeof(lapack_complex_double) * num_band);
for (j = 0; j < num_band; j++) {
e_12[i * num_band + j] =
phonoc_complex_prod(e1[i], e_12[i * num_band + j]);
}
}
free(e_12_cache);
e_12_cache = NULL;
return (sum_real * sum_real + sum_imag * sum_imag);
retval_real = 0;
retval_imag = 0;
for (i = 0; i < num_band; i++) {
sum_real = 0;
sum_imag = 0;
for (j = 0; j < num_band * num_band; j++) {
fc3_e_12 = phonoc_complex_prod(
fc3_reciprocal[i * num_band * num_band + j], e_12[j]);
sum_real += lapack_complex_double_real(fc3_e_12);
sum_imag += lapack_complex_double_imag(fc3_e_12);
}
fc3_e_012 = phonoc_complex_prod(
e0[i], lapack_make_complex_double(sum_real, sum_imag));
retval_real += lapack_complex_double_real(fc3_e_012);
retval_imag += lapack_complex_double_imag(fc3_e_012);
}
free(e_12);
e_12 = NULL;
return retval_real * retval_real + retval_imag * retval_imag;
}
#ifdef MULTITHREADED_BLAS
@ -237,8 +312,8 @@ static double get_fc3_sum_blas(const lapack_complex_double *e0,
const lapack_complex_double *e1,
const lapack_complex_double *e2,
const lapack_complex_double *fc3_reciprocal,
const long num_band) {
long i;
const int64_t num_band) {
int64_t i;
lapack_complex_double *fc3_e12, *e_12, zero, one, retval;
e_12 = (lapack_complex_double *)malloc(sizeof(lapack_complex_double) *
@ -269,46 +344,3 @@ static double get_fc3_sum_blas(const lapack_complex_double *e0,
lapack_complex_double_imag(retval);
}
#endif
static double get_fc3_sum_blas_like(const lapack_complex_double *e0,
const lapack_complex_double *e1,
const lapack_complex_double *e2,
const lapack_complex_double *fc3_reciprocal,
const long num_band) {
long i, j;
double sum_real, sum_imag, retval_real, retval_imag;
lapack_complex_double *e_12, fc3_e_12, fc3_e_012;
e_12 = (lapack_complex_double *)malloc(sizeof(lapack_complex_double) *
num_band * num_band);
for (i = 0; i < num_band; i++) {
memcpy(e_12 + i * num_band, e2, 16 * num_band);
for (j = 0; j < num_band; j++) {
e_12[i * num_band + j] =
phonoc_complex_prod(e1[i], e_12[i * num_band + j]);
}
}
retval_real = 0;
retval_imag = 0;
for (i = 0; i < num_band; i++) {
sum_real = 0;
sum_imag = 0;
for (j = 0; j < num_band * num_band; j++) {
fc3_e_12 = phonoc_complex_prod(
fc3_reciprocal[i * num_band * num_band + j], e_12[j]);
sum_real += lapack_complex_double_real(fc3_e_12);
sum_imag += lapack_complex_double_imag(fc3_e_12);
}
fc3_e_012 = phonoc_complex_prod(
e0[i], lapack_make_complex_double(sum_real, sum_imag));
retval_real += lapack_complex_double_real(fc3_e_012);
retval_imag += lapack_complex_double_imag(fc3_e_012);
}
free(e_12);
e_12 = NULL;
return retval_real * retval_real + retval_imag * retval_imag;
}

View File

@ -35,16 +35,19 @@
#ifndef __reciprocal_to_normal_H__
#define __reciprocal_to_normal_H__
#include <stdint.h>
#include "lapack_wrapper.h"
void reciprocal_to_normal_squared(
double *fc3_normal_squared, const long (*g_pos)[4], const long num_g_pos,
const lapack_complex_double *fc3_reciprocal, const double *freqs0,
const double *freqs1, const double *freqs2,
double *fc3_normal_squared, const int64_t (*g_pos)[4],
const int64_t num_g_pos, const lapack_complex_double *fc3_reciprocal,
const double *freqs0, const double *freqs1, const double *freqs2,
const lapack_complex_double *eigvecs0,
const lapack_complex_double *eigvecs1,
const lapack_complex_double *eigvecs2, const double *masses,
const long *band_indices, const long num_band,
const double cutoff_frequency, const long openmp_per_triplets);
const int64_t *band_indices, const int64_t num_band0,
const int64_t num_band, const double cutoff_frequency,
const int64_t openmp_per_triplets);
#endif

View File

@ -1,45 +1,47 @@
#include <assert.h>
#include <stdint.h>
/* #include <stdio.h> */
#ifndef SNF3x3CONST
#define SNF3x3CONST
#endif
static void initialize_PQ(long P[3][3], long Q[3][3]);
static int first(long A[3][3], long P[3][3], long Q[3][3]);
static void first_one_loop(long A[3][3], long P[3][3], long Q[3][3]);
static void first_column(long A[3][3], long P[3][3]);
static void zero_first_column(long L[3][3], const int j,
SNF3x3CONST long A[3][3]);
static int search_first_pivot(SNF3x3CONST long A[3][3]);
static void first_finalize(long L[3][3], SNF3x3CONST long A[3][3]);
static int second(long A[3][3], long P[3][3], long Q[3][3]);
static void second_one_loop(long A[3][3], long P[3][3], long Q[3][3]);
static void second_column(long A[3][3], long P[3][3]);
static void zero_second_column(long L[3][3], SNF3x3CONST long A[3][3]);
static void second_finalize(long L[3][3], SNF3x3CONST long A[3][3]);
static void finalize(long A[3][3], long P[3][3], long Q[3][3]);
static void finalize_sort(long A[3][3], long P[3][3], long Q[3][3]);
static void finalize_disturb(long A[3][3], long Q[3][3], const int i,
static void initialize_PQ(int64_t P[3][3], int64_t Q[3][3]);
static int first(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]);
static void first_one_loop(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]);
static void first_column(int64_t A[3][3], int64_t P[3][3]);
static void zero_first_column(int64_t L[3][3], const int j,
SNF3x3CONST int64_t A[3][3]);
static int search_first_pivot(SNF3x3CONST int64_t A[3][3]);
static void first_finalize(int64_t L[3][3], SNF3x3CONST int64_t A[3][3]);
static int second(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]);
static void second_one_loop(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]);
static void second_column(int64_t A[3][3], int64_t P[3][3]);
static void zero_second_column(int64_t L[3][3], SNF3x3CONST int64_t A[3][3]);
static void second_finalize(int64_t L[3][3], SNF3x3CONST int64_t A[3][3]);
static void finalize(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]);
static void finalize_sort(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]);
static void finalize_disturb(int64_t A[3][3], int64_t Q[3][3], const int i,
const int j);
static void disturb_rows(long L[3][3], const int i, const int j);
static void swap_diag_elems(long A[3][3], long P[3][3], long Q[3][3],
static void disturb_rows(int64_t L[3][3], const int i, const int j);
static void swap_diag_elems(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3],
const int i, const int j);
static void make_diagA_positive(long A[3][3], long P[3][3]);
static void flip_PQ(long P[3][3], long Q[3][3]);
static void swap_rows(long L[3][3], const int i, const int j);
static void set_zero(long L[3][3], const int i, const int j, const long a,
const long b, const long r, const long s, const long t);
static void extended_gcd(long retvals[3], const long a, const long b);
static void extended_gcd_step(long vals[6]);
static void flip_sign_row(long L[3][3], const int i);
static void transpose(long m[3][3]);
static void matmul(long m[3][3], SNF3x3CONST long a[3][3],
SNF3x3CONST long b[3][3]);
static long det(SNF3x3CONST long m[3][3]);
static void make_diagA_positive(int64_t A[3][3], int64_t P[3][3]);
static void flip_PQ(int64_t P[3][3], int64_t Q[3][3]);
static void swap_rows(int64_t L[3][3], const int i, const int j);
static void set_zero(int64_t L[3][3], const int i, const int j, const int64_t a,
const int64_t b, const int64_t r, const int64_t s,
const int64_t t);
static void extended_gcd(int64_t retvals[3], const int64_t a, const int64_t b);
static void extended_gcd_step(int64_t vals[6]);
static void flip_sign_row(int64_t L[3][3], const int i);
static void transpose(int64_t m[3][3]);
static void matmul(int64_t m[3][3], SNF3x3CONST int64_t a[3][3],
SNF3x3CONST int64_t b[3][3]);
static int64_t det(SNF3x3CONST int64_t m[3][3]);
/* static void test_set_A(long A[3][3]);
* static void test_show_A(SNF3x3CONST long A[3][3]);
/* static void test_set_A(int64_t A[3][3]);
* static void test_show_A(SNF3x3CONST int64_t A[3][3]);
* static void test_extended_gcd(void);
* static void test_transpose(void);
* static void test_swap_rows(void);
@ -51,7 +53,7 @@ static long det(SNF3x3CONST long m[3][3]);
* static void test_second_one_loop(void);
* static void test_second(void); */
int snf3x3(long A[3][3], long P[3][3], long Q[3][3]) {
int snf3x3(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]) {
int i;
initialize_PQ(P, Q);
@ -70,7 +72,7 @@ succeeded:
return 1;
}
static void initialize_PQ(long P[3][3], long Q[3][3]) {
static void initialize_PQ(int64_t P[3][3], int64_t Q[3][3]) {
int i, j;
for (i = 0; i < 3; i++) {
@ -86,8 +88,8 @@ static void initialize_PQ(long P[3][3], long Q[3][3]) {
}
}
static int first(long A[3][3], long P[3][3], long Q[3][3]) {
long L[3][3];
static int first(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]) {
int64_t L[3][3];
first_one_loop(A, P, Q);
@ -108,16 +110,16 @@ static int first(long A[3][3], long P[3][3], long Q[3][3]) {
return 0;
}
static void first_one_loop(long A[3][3], long P[3][3], long Q[3][3]) {
static void first_one_loop(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]) {
first_column(A, P);
transpose(A);
first_column(A, Q);
transpose(A);
}
static void first_column(long A[3][3], long P[3][3]) {
static void first_column(int64_t A[3][3], int64_t P[3][3]) {
int i;
long L[3][3];
int64_t L[3][3];
i = search_first_pivot(A);
if (i > 0) {
@ -143,15 +145,15 @@ static void first_column(long A[3][3], long P[3][3]) {
err:;
}
static void zero_first_column(long L[3][3], const int j,
SNF3x3CONST long A[3][3]) {
long vals[3];
static void zero_first_column(int64_t L[3][3], const int j,
SNF3x3CONST int64_t A[3][3]) {
int64_t vals[3];
extended_gcd(vals, A[0][0], A[j][0]);
set_zero(L, 0, j, A[0][0], A[j][0], vals[0], vals[1], vals[2]);
}
static int search_first_pivot(SNF3x3CONST long A[3][3]) {
static int search_first_pivot(SNF3x3CONST int64_t A[3][3]) {
int i;
for (i = 0; i < 3; i++) {
@ -162,7 +164,7 @@ static int search_first_pivot(SNF3x3CONST long A[3][3]) {
return -1;
}
static void first_finalize(long L[3][3], SNF3x3CONST long A[3][3]) {
static void first_finalize(int64_t L[3][3], SNF3x3CONST int64_t A[3][3]) {
L[0][0] = 1;
L[0][1] = 0;
L[0][2] = 0;
@ -174,8 +176,8 @@ static void first_finalize(long L[3][3], SNF3x3CONST long A[3][3]) {
L[2][2] = 1;
}
static int second(long A[3][3], long P[3][3], long Q[3][3]) {
long L[3][3];
static int second(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]) {
int64_t L[3][3];
second_one_loop(A, P, Q);
@ -193,15 +195,15 @@ static int second(long A[3][3], long P[3][3], long Q[3][3]) {
return 0;
}
static void second_one_loop(long A[3][3], long P[3][3], long Q[3][3]) {
static void second_one_loop(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]) {
second_column(A, P);
transpose(A);
second_column(A, Q);
transpose(A);
}
static void second_column(long A[3][3], long P[3][3]) {
long L[3][3];
static void second_column(int64_t A[3][3], int64_t P[3][3]) {
int64_t L[3][3];
if ((A[1][1] == 0) && (A[2][1] != 0)) {
swap_rows(L, 1, 2);
@ -216,14 +218,14 @@ static void second_column(long A[3][3], long P[3][3]) {
}
}
static void zero_second_column(long L[3][3], SNF3x3CONST long A[3][3]) {
long vals[3];
static void zero_second_column(int64_t L[3][3], SNF3x3CONST int64_t A[3][3]) {
int64_t vals[3];
extended_gcd(vals, A[1][1], A[2][1]);
set_zero(L, 1, 2, A[1][1], A[2][1], vals[0], vals[1], vals[2]);
}
static void second_finalize(long L[3][3], SNF3x3CONST long A[3][3]) {
static void second_finalize(int64_t L[3][3], SNF3x3CONST int64_t A[3][3]) {
L[0][0] = 1;
L[0][1] = 0;
L[0][2] = 0;
@ -235,7 +237,7 @@ static void second_finalize(long L[3][3], SNF3x3CONST long A[3][3]) {
L[2][2] = 1;
}
static void finalize(long A[3][3], long P[3][3], long Q[3][3]) {
static void finalize(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]) {
make_diagA_positive(A, P);
finalize_sort(A, P, Q);
@ -247,7 +249,7 @@ static void finalize(long A[3][3], long P[3][3], long Q[3][3]) {
flip_PQ(P, Q);
}
static void finalize_sort(long A[3][3], long P[3][3], long Q[3][3]) {
static void finalize_sort(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]) {
if (A[0][0] > A[1][1]) {
swap_diag_elems(A, P, Q, 0, 1);
}
@ -259,9 +261,9 @@ static void finalize_sort(long A[3][3], long P[3][3], long Q[3][3]) {
}
}
static void finalize_disturb(long A[3][3], long Q[3][3], const int i,
static void finalize_disturb(int64_t A[3][3], int64_t Q[3][3], const int i,
const int j) {
long L[3][3];
int64_t L[3][3];
if (A[j][j] % A[i][i] != 0) {
transpose(A);
@ -272,7 +274,7 @@ static void finalize_disturb(long A[3][3], long Q[3][3], const int i,
}
}
static void disturb_rows(long L[3][3], const int i, const int j) {
static void disturb_rows(int64_t L[3][3], const int i, const int j) {
L[0][0] = 1;
L[0][1] = 0;
L[0][2] = 0;
@ -288,9 +290,9 @@ static void disturb_rows(long L[3][3], const int i, const int j) {
L[j][j] = 1;
}
static void swap_diag_elems(long A[3][3], long P[3][3], long Q[3][3],
static void swap_diag_elems(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3],
const int i, const int j) {
long L[3][3];
int64_t L[3][3];
swap_rows(L, i, j);
matmul(A, L, A);
@ -302,9 +304,9 @@ static void swap_diag_elems(long A[3][3], long P[3][3], long Q[3][3],
transpose(A);
}
static void make_diagA_positive(long A[3][3], long P[3][3]) {
static void make_diagA_positive(int64_t A[3][3], int64_t P[3][3]) {
int i;
long L[3][3];
int64_t L[3][3];
for (i = 0; i < 3; i++) {
if (A[i][i] < 0) {
@ -315,7 +317,7 @@ static void make_diagA_positive(long A[3][3], long P[3][3]) {
}
}
static void flip_PQ(long P[3][3], long Q[3][3]) {
static void flip_PQ(int64_t P[3][3], int64_t Q[3][3]) {
int i, j;
if (det(P) < 0) {
@ -328,7 +330,7 @@ static void flip_PQ(long P[3][3], long Q[3][3]) {
}
}
static void swap_rows(long L[3][3], const int r1, const int r2) {
static void swap_rows(int64_t L[3][3], const int r1, const int r2) {
L[0][0] = 1;
L[0][1] = 0;
L[0][2] = 0;
@ -344,8 +346,9 @@ static void swap_rows(long L[3][3], const int r1, const int r2) {
L[r2][r1] = 1;
}
static void set_zero(long L[3][3], const int i, const int j, const long a,
const long b, const long r, const long s, const long t) {
static void set_zero(int64_t L[3][3], const int i, const int j, const int64_t a,
const int64_t b, const int64_t r, const int64_t s,
const int64_t t) {
L[0][0] = 1;
L[0][1] = 0;
L[0][2] = 0;
@ -365,9 +368,9 @@ static void set_zero(long L[3][3], const int i, const int j, const long a,
* Extended Euclidean algorithm
* See https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
*/
static void extended_gcd(long retvals[3], const long a, const long b) {
static void extended_gcd(int64_t retvals[3], const int64_t a, const int64_t b) {
int i;
long vals[6];
int64_t vals[6];
vals[0] = a; /* r0 */
vals[1] = b; /* r1 */
@ -390,8 +393,8 @@ static void extended_gcd(long retvals[3], const long a, const long b) {
assert(vals[0] == a * vals[2] + b * vals[4]);
}
static void extended_gcd_step(long vals[6]) {
long q, r2, s2, t2;
static void extended_gcd_step(int64_t vals[6]) {
int64_t q, r2, s2, t2;
q = vals[0] / vals[1];
r2 = vals[0] % vals[1];
@ -415,7 +418,7 @@ static void extended_gcd_step(long vals[6]) {
vals[5] = t2;
}
static void flip_sign_row(long L[3][3], const int i) {
static void flip_sign_row(int64_t L[3][3], const int i) {
L[0][0] = 1;
L[0][1] = 0;
L[0][2] = 0;
@ -431,8 +434,8 @@ static void flip_sign_row(long L[3][3], const int i) {
/**
* Matrix operation utils
*/
static void transpose(long m[3][3]) {
long tmp;
static void transpose(int64_t m[3][3]) {
int64_t tmp;
int i, j;
for (i = 0; i < 3; i++) {
@ -444,10 +447,10 @@ static void transpose(long m[3][3]) {
}
}
static void matmul(long m[3][3], SNF3x3CONST long a[3][3],
SNF3x3CONST long b[3][3]) {
static void matmul(int64_t m[3][3], SNF3x3CONST int64_t a[3][3],
SNF3x3CONST int64_t b[3][3]) {
int i, j;
long c[3][3];
int64_t c[3][3];
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
@ -462,7 +465,7 @@ static void matmul(long m[3][3], SNF3x3CONST long a[3][3],
}
}
static long det(SNF3x3CONST long m[3][3]) {
static int64_t det(SNF3x3CONST int64_t m[3][3]) {
return m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) +
m[0][1] * (m[1][2] * m[2][0] - m[1][0] * m[2][2]) +
m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
@ -482,7 +485,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* test_second();
* }
*
* static void test_set_A(long A[3][3])
* static void test_set_A(int64_t A[3][3])
* {
* int i, j;
*
@ -494,7 +497,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* A[0][0] = 1; /\* to avoid det(A) = 0 *\/
* }
*
* static void test_show_A(SNF3x3CONST long A[3][3])
* static void test_show_A(SNF3x3CONST int64_t A[3][3])
* {
* int i, j;
*
@ -518,7 +521,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* static void test_transpose(void)
* {
* int i, j;
* long A[3][3];
* int64_t A[3][3];
*
* printf("Test transpose\n");
*
@ -531,7 +534,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* static void test_swap_rows(void)
* {
* int i, j;
* long A[3][3], L[3][3];
* int64_t A[3][3], L[3][3];
*
* printf("Test swap_rows 1 <-> 2\n");
*
@ -545,7 +548,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* static void test_zero_first_column(void)
* {
* int i, j;
* long A[3][3], L[3][3];
* int64_t A[3][3], L[3][3];
*
* printf("Test zero_first_column\n");
*
@ -562,7 +565,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* static void test_first_column(void)
* {
* int i, j;
* long A[3][3], P[3][3];
* int64_t A[3][3], P[3][3];
*
* printf("Test first_column\n");
*
@ -579,7 +582,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* static void test_first_one_loop(void)
* {
* int i, j;
* long A[3][3], P[3][3], Q[3][3];
* int64_t A[3][3], P[3][3], Q[3][3];
*
* printf("Test first_one_loop\n");
*
@ -592,7 +595,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* static void test_first(void)
* {
* int i, j;
* long A[3][3], P[3][3], Q[3][3];
* int64_t A[3][3], P[3][3], Q[3][3];
*
* printf("Test first\n");
*
@ -605,7 +608,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* static void test_second_column(void)
* {
* int i, j;
* long A[3][3], P[3][3], Q[3][3];
* int64_t A[3][3], P[3][3], Q[3][3];
*
* printf("Test second_column\n");
*
@ -620,7 +623,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* static void test_second_one_loop(void)
* {
* int i, j;
* long A[3][3], P[3][3], Q[3][3];
* int64_t A[3][3], P[3][3], Q[3][3];
*
* printf("Test second_one_loop\n");
*
@ -635,7 +638,7 @@ static long det(SNF3x3CONST long m[3][3]) {
* static void test_second(void)
* {
* int i, j;
* long A[3][3], P[3][3], Q[3][3];
* int64_t A[3][3], P[3][3], Q[3][3];
*
* printf("Test second\n");
*

View File

@ -5,11 +5,13 @@
extern "C" {
#endif
#include <stdint.h>
#define SNF3X3_MAJOR_VERSION 0
#define SNF3X3_MINOR_VERSION 1
#define SNF3X3_MICRO_VERSION 0
int snf3x3(long A[3][3], long P[3][3], long Q[3][3]);
int snf3x3(int64_t A[3][3], int64_t P[3][3], int64_t Q[3][3]);
#ifdef __cplusplus
}

View File

@ -37,6 +37,7 @@
#include "tetrahedron_method.h"
#include <stddef.h>
#include <stdint.h>
#ifdef THMWARNING
#include <stdio.h>
@ -68,12 +69,12 @@
/* 6: c + b 2, 4, 7 */
/* 7: c + a + b 3, 5, 6 */
static long main_diagonals[4][3] = {{1, 1, 1}, /* 0-7 */
{-1, 1, 1}, /* 1-6 */
{1, -1, 1}, /* 2-5 */
{1, 1, -1}}; /* 3-4 */
static int64_t main_diagonals[4][3] = {{1, 1, 1}, /* 0-7 */
{-1, 1, 1}, /* 1-6 */
{1, -1, 1}, /* 2-5 */
{1, 1, -1}}; /* 3-4 */
static long db_relative_grid_address[4][24][4][3] = {
static int64_t db_relative_grid_address[4][24][4][3] = {
{
{
{0, 0, 0},
@ -662,22 +663,22 @@ static long db_relative_grid_address[4][24][4][3] = {
static double get_integration_weight(
const double omega, const double tetrahedra_omegas[24][4],
double (*gn)(const long, const double, const double[4]),
double (*IJ)(const long, const long, const double, const double[4]));
static long get_main_diagonal(const double rec_lattice[3][3]);
static long sort_omegas(double v[4]);
double (*gn)(const int64_t, const double, const double[4]),
double (*IJ)(const int64_t, const int64_t, const double, const double[4]));
static int64_t get_main_diagonal(const double rec_lattice[3][3]);
static int64_t sort_omegas(double v[4]);
static double norm_squared_d3(const double a[3]);
static void multiply_matrix_vector_dl3(double v[3], const double a[3][3],
const long b[3]);
static double _f(const long n, const long m, const double omega,
const int64_t b[3]);
static double _f(const int64_t n, const int64_t m, const double omega,
const double vertices_omegas[4]);
static double _J(const long i, const long ci, const double omega,
static double _J(const int64_t i, const int64_t ci, const double omega,
const double vertices_omegas[4]);
static double _I(const long i, const long ci, const double omega,
static double _I(const int64_t i, const int64_t ci, const double omega,
const double vertices_omegas[4]);
static double _n(const long i, const double omega,
static double _n(const int64_t i, const double omega,
const double vertices_omegas[4]);
static double _g(const long i, const double omega,
static double _g(const int64_t i, const double omega,
const double vertices_omegas[4]);
static double _n_0(void);
static double _n_1(const double omega, const double vertices_omegas[4]);
@ -718,9 +719,9 @@ static double _I_32(const double omega, const double vertices_omegas[4]);
static double _I_33(const double omega, const double vertices_omegas[4]);
static double _I_4(void);
long thm_get_relative_grid_address(long relative_grid_address[24][4][3],
const double rec_lattice[3][3]) {
long i, j, k, main_diag_index;
int64_t thm_get_relative_grid_address(int64_t relative_grid_address[24][4][3],
const double rec_lattice[3][3]) {
int64_t i, j, k, main_diag_index;
main_diag_index = get_main_diagonal(rec_lattice);
@ -736,8 +737,8 @@ long thm_get_relative_grid_address(long relative_grid_address[24][4][3],
}
void thm_get_all_relative_grid_address(
long relative_grid_address[4][24][4][3]) {
long i, j, k, main_diag_index;
int64_t relative_grid_address[4][24][4][3]) {
int64_t i, j, k, main_diag_index;
for (main_diag_index = 0; main_diag_index < 4; main_diag_index++) {
for (i = 0; i < 24; i++) {
@ -761,8 +762,8 @@ double thm_get_integration_weight(const double omega,
}
}
long thm_in_tetrahedra(const double f0, const double freq_vertices[24][4]) {
long i, j;
int64_t thm_in_tetrahedra(const double f0, const double freq_vertices[24][4]) {
int64_t i, j;
double fmin, fmax;
fmin = freq_vertices[0][0];
@ -788,9 +789,9 @@ long thm_in_tetrahedra(const double f0, const double freq_vertices[24][4]) {
static double get_integration_weight(
const double omega, const double tetrahedra_omegas[24][4],
double (*gn)(const long, const double, const double[4]),
double (*IJ)(const long, const long, const double, const double[4])) {
long i, j, ci;
double (*gn)(const int64_t, const double, const double[4]),
double (*IJ)(const int64_t, const int64_t, const double, const double[4])) {
int64_t i, j, ci;
double sum;
double v[4];
@ -823,8 +824,8 @@ static double get_integration_weight(
return sum / 6;
}
static long sort_omegas(double v[4]) {
long i;
static int64_t sort_omegas(double v[4]) {
int64_t i;
double w[4];
i = 0;
@ -892,8 +893,8 @@ static long sort_omegas(double v[4]) {
return i;
}
static long get_main_diagonal(const double rec_lattice[3][3]) {
long i, shortest;
static int64_t get_main_diagonal(const double rec_lattice[3][3]) {
int64_t i, shortest;
double length, min_length;
double main_diag[3];
@ -916,8 +917,8 @@ static double norm_squared_d3(const double a[3]) {
}
static void multiply_matrix_vector_dl3(double v[3], const double a[3][3],
const long b[3]) {
long i;
const int64_t b[3]) {
int64_t i;
double c[3];
for (i = 0; i < 3; i++) {
@ -929,7 +930,7 @@ static void multiply_matrix_vector_dl3(double v[3], const double a[3][3],
}
}
static double _f(const long n, const long m, const double omega,
static double _f(const int64_t n, const int64_t m, const double omega,
const double vertices_omegas[4]) {
double delta;
delta = vertices_omegas[n] - vertices_omegas[m];
@ -943,7 +944,7 @@ static double _f(const long n, const long m, const double omega,
return ((omega - vertices_omegas[m]) / delta);
}
static double _J(const long i, const long ci, const double omega,
static double _J(const int64_t i, const int64_t ci, const double omega,
const double vertices_omegas[4]) {
switch (i) {
case 0:
@ -993,7 +994,7 @@ static double _J(const long i, const long ci, const double omega,
return 0;
}
static double _I(const long i, const long ci, const double omega,
static double _I(const int64_t i, const int64_t ci, const double omega,
const double vertices_omegas[4]) {
switch (i) {
case 0:
@ -1043,7 +1044,7 @@ static double _I(const long i, const long ci, const double omega,
return 0;
}
static double _n(const long i, const double omega,
static double _n(const int64_t i, const double omega,
const double vertices_omegas[4]) {
switch (i) {
case 0:
@ -1066,7 +1067,7 @@ static double _n(const long i, const double omega,
return 0;
}
static double _g(const long i, const double omega,
static double _g(const int64_t i, const double omega,
const double vertices_omegas[4]) {
switch (i) {
case 0:

View File

@ -36,13 +36,15 @@
#define __tetrahedron_method_H__
#include <stddef.h>
#include <stdint.h>
long thm_get_relative_grid_address(long relative_grid_address[24][4][3],
const double rec_lattice[3][3]);
void thm_get_all_relative_grid_address(long relative_grid_address[4][24][4][3]);
int64_t thm_get_relative_grid_address(int64_t relative_grid_address[24][4][3],
const double rec_lattice[3][3]);
void thm_get_all_relative_grid_address(
int64_t relative_grid_address[4][24][4][3]);
double thm_get_integration_weight(const double omega,
const double tetrahedra_omegas[24][4],
const char function);
long thm_in_tetrahedra(const double f0, const double freq_vertices[24][4]);
int64_t thm_in_tetrahedra(const double f0, const double freq_vertices[24][4]);
#endif

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2015 Atsushi Togo */
/* All rights reserved. */
/* These codes were originally parts of spglib, but only develped */
/* These codes were originally parts of spglib, but only developed */
/* and used for phono3py. Therefore these were moved from spglib to */
/* phono3py. This file is part of phonopy. */
@ -36,21 +36,25 @@
#include "triplet.h"
#include <stdint.h>
#include "recgrid.h"
#include "triplet_grid.h"
#include "triplet_iw.h"
long tpl_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point,
const RecgridConstBZGrid *bzgrid,
const long *map_triplets) {
int64_t tpl_get_BZ_triplets_at_q(int64_t (*triplets)[3],
const int64_t grid_point,
const RecgridConstBZGrid *bzgrid,
const int64_t *map_triplets) {
return tpk_get_BZ_triplets_at_q(triplets, grid_point, bzgrid, map_triplets);
}
long tpl_get_triplets_reciprocal_mesh_at_q(
long *map_triplets, long *map_q, const long grid_point, const long mesh[3],
const long is_time_reversal, const long num_rot,
const long (*rec_rotations)[3][3], const long swappable) {
long num_ir;
int64_t tpl_get_triplets_reciprocal_mesh_at_q(
int64_t *map_triplets, int64_t *map_q, const int64_t grid_point,
const int64_t mesh[3], const int64_t is_time_reversal,
const int64_t num_rot, const int64_t (*rec_rotations)[3][3],
const int64_t swappable) {
int64_t num_ir;
num_ir = tpk_get_ir_triplets_at_q(map_triplets, map_q, grid_point, mesh,
is_time_reversal, rec_rotations, num_rot,
@ -60,13 +64,14 @@ long tpl_get_triplets_reciprocal_mesh_at_q(
void tpl_get_integration_weight(
double *iw, char *iw_zero, const double *frequency_points,
const long num_band0, const long relative_grid_address[24][4][3],
const long (*triplets)[3], const long num_triplets,
const int64_t num_band0, const int64_t relative_grid_address[24][4][3],
const int64_t (*triplets)[3], const int64_t num_triplets,
const RecgridConstBZGrid *bzgrid, const double *frequencies1,
const long num_band1, const double *frequencies2, const long num_band2,
const long tp_type, const long openmp_per_triplets) {
long i, num_band_prod;
long tp_relative_grid_address[2][24][4][3];
const int64_t num_band1, const double *frequencies2,
const int64_t num_band2, const int64_t tp_type,
const int64_t openmp_per_triplets) {
int64_t i, num_band_prod;
int64_t tp_relative_grid_address[2][24][4][3];
tpl_set_relative_grid_address(tp_relative_grid_address,
relative_grid_address, tp_type);
@ -88,10 +93,10 @@ void tpl_get_integration_weight(
void tpl_get_integration_weight_with_sigma(
double *iw, char *iw_zero, const double sigma, const double sigma_cutoff,
const double *frequency_points, const long num_band0,
const long (*triplets)[3], const long num_triplets,
const double *frequencies, const long num_band, const long tp_type) {
long i, num_band_prod, const_adrs_shift;
const double *frequency_points, const int64_t num_band0,
const int64_t (*triplets)[3], const int64_t num_triplets,
const double *frequencies, const int64_t num_band, const int64_t tp_type) {
int64_t i, num_band_prod, const_adrs_shift;
double cutoff;
cutoff = sigma * sigma_cutoff;
@ -109,8 +114,9 @@ void tpl_get_integration_weight_with_sigma(
}
}
long tpl_is_N(const long triplet[3], const long (*bz_grid_addresses)[3]) {
long i, j, sum_q, is_N;
int64_t tpl_is_N(const int64_t triplet[3],
const int64_t (*bz_grid_addresses)[3]) {
int64_t i, j, sum_q, is_N;
is_N = 1;
for (i = 0; i < 3; i++) {
@ -126,11 +132,11 @@ long tpl_is_N(const long triplet[3], const long (*bz_grid_addresses)[3]) {
return is_N;
}
void tpl_set_relative_grid_address(long tp_relative_grid_address[2][24][4][3],
const long relative_grid_address[24][4][3],
const long tp_type) {
long i, j, k, l;
long signs[2];
void tpl_set_relative_grid_address(
int64_t tp_relative_grid_address[2][24][4][3],
const int64_t relative_grid_address[24][4][3], const int64_t tp_type) {
int64_t i, j, k, l;
int64_t signs[2];
signs[0] = 1;
signs[1] = 1;

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2015 Atsushi Togo */
/* All rights reserved. */
/* Some of these codes were originally parts of spglib, but only develped */
/* Some of these codes were originally parts of spglib, but only developed */
/* and used for phono3py. Therefore these were moved from spglib to */
/* phono3py. This file is part of phonopy. */
@ -38,6 +38,7 @@
#define __triplet_H__
#include <stddef.h>
#include <stdint.h>
#include "recgrid.h"
@ -47,35 +48,39 @@
/* and map_q[prod(mesh)] are required. rotations are point-group- */
/* operations in real space for which duplicate operations are allowed */
/* in the input. */
long tpl_get_triplets_reciprocal_mesh_at_q(
long *map_triplets, long *map_q, const long grid_point, const long mesh[3],
const long is_time_reversal, const long num_rot,
const long (*rec_rotations)[3][3], const long swappable);
int64_t tpl_get_triplets_reciprocal_mesh_at_q(
int64_t *map_triplets, int64_t *map_q, const int64_t grid_point,
const int64_t mesh[3], const int64_t is_time_reversal,
const int64_t num_rot, const int64_t (*rec_rotations)[3][3],
const int64_t swappable);
/* Irreducible grid-point-triplets in BZ are stored. */
/* triplets are recovered from grid_point and triplet_weights. */
/* BZ boundary is considered in this recovery. Therefore grid addresses */
/* are given not by grid_address, but by bz_grid_address. */
/* triplets[num_ir_triplets][3] = number of non-zero triplets weights*/
/* Number of ir-triplets is returned. */
long tpl_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point,
const RecgridConstBZGrid *bzgrid,
const long *map_triplets);
int64_t tpl_get_BZ_triplets_at_q(int64_t (*triplets)[3],
const int64_t grid_point,
const RecgridConstBZGrid *bzgrid,
const int64_t *map_triplets);
void tpl_get_integration_weight(
double *iw, char *iw_zero, const double *frequency_points,
const long num_band0, const long relative_grid_address[24][4][3],
const long (*triplets)[3], const long num_triplets,
const int64_t num_band0, const int64_t relative_grid_address[24][4][3],
const int64_t (*triplets)[3], const int64_t num_triplets,
const RecgridConstBZGrid *bzgrid, const double *frequencies1,
const long num_band1, const double *frequencies2, const long num_band2,
const long tp_type, const long openmp_per_triplets);
const int64_t num_band1, const double *frequencies2,
const int64_t num_band2, const int64_t tp_type,
const int64_t openmp_per_triplets);
void tpl_get_integration_weight_with_sigma(
double *iw, char *iw_zero, const double sigma, const double sigma_cutoff,
const double *frequency_points, const long num_band0,
const long (*triplets)[3], const long num_triplets,
const double *frequencies, const long num_band, const long tp_type);
const double *frequency_points, const int64_t num_band0,
const int64_t (*triplets)[3], const int64_t num_triplets,
const double *frequencies, const int64_t num_band, const int64_t tp_type);
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],
const long relative_grid_address[24][4][3],
const long tp_type);
int64_t tpl_is_N(const int64_t triplet[3],
const int64_t (*bz_grid_addresses)[3]);
void tpl_set_relative_grid_address(
int64_t tp_relative_grid_address[2][24][4][3],
const int64_t relative_grid_address[24][4][3], const int64_t tp_type);
#endif

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2015 Atsushi Togo */
/* All rights reserved. */
/* These codes were originally parts of spglib, but only develped */
/* These codes were originally parts of spglib, but only developed */
/* and used for phono3py. Therefore these were moved from spglib to */
/* phono3py. This file is part of phonopy. */
@ -37,50 +37,57 @@
#include "triplet_grid.h"
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include "grgrid.h"
static long get_ir_triplets_at_q(long *map_triplets, long *map_q,
const long grid_point, const long D_diag[3],
const RecgridMats *rot_reciprocal,
const long swappable);
static long get_ir_triplets_at_q_perm_q1q2(long *map_triplets,
const long *map_q,
const long grid_point,
const long D_diag[3]);
static long get_ir_triplets_at_q_noperm(long *map_triplets, const long *map_q,
const long grid_point,
const long D_diag[3]);
static long get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point,
const RecgridConstBZGrid *bzgrid,
const long *map_triplets);
static void get_BZ_triplets_at_q_type1(long (*triplets)[3],
const long grid_point,
static int64_t get_ir_triplets_at_q(int64_t *map_triplets, int64_t *map_q,
const int64_t grid_point,
const int64_t D_diag[3],
const RecgridMats *rot_reciprocal,
const int64_t swappable);
static int64_t get_ir_triplets_at_q_perm_q1q2(int64_t *map_triplets,
const int64_t *map_q,
const int64_t grid_point,
const int64_t D_diag[3]);
static int64_t get_ir_triplets_at_q_noperm(int64_t *map_triplets,
const int64_t *map_q,
const int64_t grid_point,
const int64_t D_diag[3]);
static int64_t get_BZ_triplets_at_q(int64_t (*triplets)[3],
const int64_t grid_point,
const RecgridConstBZGrid *bzgrid,
const int64_t *map_triplets);
static void get_BZ_triplets_at_q_type1(int64_t (*triplets)[3],
const int64_t grid_point,
const RecgridConstBZGrid *bzgrid,
const long *ir_q1_gps,
const long num_ir);
static void get_BZ_triplets_at_q_type2(long (*triplets)[3],
const long grid_point,
const int64_t *ir_q1_gps,
const int64_t num_ir);
static void get_BZ_triplets_at_q_type2(int64_t (*triplets)[3],
const int64_t grid_point,
const RecgridConstBZGrid *bzgrid,
const long *ir_q1_gps,
const long num_ir);
static double get_squared_distance(const long G[3], const double LQD_inv[3][3]);
const int64_t *ir_q1_gps,
const int64_t num_ir);
static double get_squared_distance(const int64_t G[3],
const double LQD_inv[3][3]);
static void get_LQD_inv(double LQD_inv[3][3], const RecgridConstBZGrid *bzgrid);
static RecgridMats *get_reciprocal_point_group_with_q(
const RecgridMats *rot_reciprocal, const long D_diag[3],
const long grid_point);
const RecgridMats *rot_reciprocal, const int64_t D_diag[3],
const int64_t grid_point);
static RecgridMats *get_reciprocal_point_group(
const long (*rec_rotations_in)[3][3], const long num_rot,
const long is_time_reversal, const long is_transpose);
static void copy_matrix_l3(long a[3][3], const long b[3][3]);
const int64_t (*rec_rotations_in)[3][3], const int64_t num_rot,
const int64_t is_time_reversal, const int64_t is_transpose);
static void copy_matrix_l3(int64_t a[3][3], const int64_t b[3][3]);
long tpk_get_ir_triplets_at_q(long *map_triplets, long *map_q,
const long grid_point, const long D_diag[3],
const long is_time_reversal,
const long (*rec_rotations_in)[3][3],
const long num_rot, const long swappable) {
long num_ir;
int64_t tpk_get_ir_triplets_at_q(int64_t *map_triplets, int64_t *map_q,
const int64_t grid_point,
const int64_t D_diag[3],
const int64_t is_time_reversal,
const int64_t (*rec_rotations_in)[3][3],
const int64_t num_rot,
const int64_t swappable) {
int64_t num_ir;
RecgridMats *rotations;
rotations = get_reciprocal_point_group(rec_rotations_in, num_rot,
@ -97,18 +104,20 @@ long tpk_get_ir_triplets_at_q(long *map_triplets, long *map_q,
return num_ir;
}
long tpk_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point,
const RecgridConstBZGrid *bzgrid,
const long *map_triplets) {
int64_t tpk_get_BZ_triplets_at_q(int64_t (*triplets)[3],
const int64_t grid_point,
const RecgridConstBZGrid *bzgrid,
const int64_t *map_triplets) {
return get_BZ_triplets_at_q(triplets, grid_point, bzgrid, map_triplets);
}
static long get_ir_triplets_at_q(long *map_triplets, long *map_q,
const long grid_point, const long D_diag[3],
const RecgridMats *rot_reciprocal,
const long swappable) {
long i, num_ir_q, num_ir_triplets;
long PS[3];
static int64_t get_ir_triplets_at_q(int64_t *map_triplets, int64_t *map_q,
const int64_t grid_point,
const int64_t D_diag[3],
const RecgridMats *rot_reciprocal,
const int64_t swappable) {
int64_t i, num_ir_q, num_ir_triplets;
int64_t PS[3];
RecgridMats *rot_reciprocal_q;
rot_reciprocal_q = NULL;
@ -138,12 +147,12 @@ static long get_ir_triplets_at_q(long *map_triplets, long *map_q,
return num_ir_triplets;
}
static long get_ir_triplets_at_q_perm_q1q2(long *map_triplets,
const long *map_q,
const long grid_point,
const long D_diag[3]) {
long j, num_grid, num_ir_triplets, gp1, gp2;
long adrs0[3], adrs1[3], adrs2[3];
static int64_t get_ir_triplets_at_q_perm_q1q2(int64_t *map_triplets,
const int64_t *map_q,
const int64_t grid_point,
const int64_t D_diag[3]) {
int64_t j, num_grid, num_ir_triplets, gp1, gp2;
int64_t adrs0[3], adrs1[3], adrs2[3];
num_ir_triplets = 0;
num_grid = D_diag[0] * D_diag[1] * D_diag[2];
@ -185,10 +194,11 @@ static long get_ir_triplets_at_q_perm_q1q2(long *map_triplets,
return num_ir_triplets;
}
static long get_ir_triplets_at_q_noperm(long *map_triplets, const long *map_q,
const long grid_point,
const long D_diag[3]) {
long gp1, num_grid, num_ir_triplets;
static int64_t get_ir_triplets_at_q_noperm(int64_t *map_triplets,
const int64_t *map_q,
const int64_t grid_point,
const int64_t D_diag[3]) {
int64_t gp1, num_grid, num_ir_triplets;
num_ir_triplets = 0;
num_grid = D_diag[0] * D_diag[1] * D_diag[2];
@ -205,16 +215,18 @@ static long get_ir_triplets_at_q_noperm(long *map_triplets, const long *map_q,
return num_ir_triplets;
}
static long get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point,
const RecgridConstBZGrid *bzgrid,
const long *map_triplets) {
long gp1, num_ir;
long *ir_q1_gps;
static int64_t get_BZ_triplets_at_q(int64_t (*triplets)[3],
const int64_t grid_point,
const RecgridConstBZGrid *bzgrid,
const int64_t *map_triplets) {
int64_t gp1, num_ir;
int64_t *ir_q1_gps;
ir_q1_gps = NULL;
num_ir = 0;
if ((ir_q1_gps = (long *)malloc(sizeof(long) * bzgrid->size)) == NULL) {
if ((ir_q1_gps = (int64_t *)malloc(sizeof(int64_t) * bzgrid->size)) ==
NULL) {
warning_print("Memory could not be allocated.");
goto ret;
}
@ -241,16 +253,16 @@ ret:
return num_ir;
}
static void get_BZ_triplets_at_q_type1(long (*triplets)[3],
const long grid_point,
static void get_BZ_triplets_at_q_type1(int64_t (*triplets)[3],
const int64_t grid_point,
const RecgridConstBZGrid *bzgrid,
const long *ir_q1_gps,
const long num_ir) {
long i, j, gp2, num_gp, num_bzgp, bz0, bz1, bz2;
long bzgp[3], G[3];
long bz_adrs0[3], bz_adrs1[3], bz_adrs2[3];
const long *gp_map;
const long(*bz_adrs)[3];
const int64_t *ir_q1_gps,
const int64_t num_ir) {
int64_t i, j, gp2, num_gp, num_bzgp, bz0, bz1, bz2;
int64_t bzgp[3], G[3];
int64_t bz_adrs0[3], bz_adrs1[3], bz_adrs2[3];
const int64_t *gp_map;
const int64_t (*bz_adrs)[3];
double d2, min_d2, tolerance;
double LQD_inv[3][3];
@ -327,22 +339,23 @@ static void get_BZ_triplets_at_q_type1(long (*triplets)[3],
}
}
static void get_BZ_triplets_at_q_type2(long (*triplets)[3],
const long grid_point,
static void get_BZ_triplets_at_q_type2(int64_t (*triplets)[3],
const int64_t grid_point,
const RecgridConstBZGrid *bzgrid,
const long *ir_q1_gps,
const long num_ir) {
long i, j, gp0, gp2;
long bzgp[3], G[3];
long bz_adrs0[3], bz_adrs1[3], bz_adrs2[3];
const long *gp_map;
const long(*bz_adrs)[3];
const int64_t *ir_q1_gps,
const int64_t num_ir) {
int64_t i, j, gp0, gp2;
int64_t bzgp[3], G[3];
int64_t bz_adrs0[3], bz_adrs1[3], bz_adrs2[3];
const int64_t *gp_map;
const int64_t (*bz_adrs)[3];
double d2, min_d2, tolerance;
double LQD_inv[3][3];
gp_map = bzgrid->gp_map;
bz_adrs = bzgrid->addresses;
get_LQD_inv(LQD_inv, bzgrid);
/* This tolerance is used to be consistent to BZ reduction in bzgrid. */
tolerance = recgrid_get_tolerance_for_BZ_reduction((RecgridBZGrid *)bzgrid);
@ -392,10 +405,10 @@ static void get_BZ_triplets_at_q_type2(long (*triplets)[3],
}
}
static double get_squared_distance(const long G[3],
static double get_squared_distance(const int64_t G[3],
const double LQD_inv[3][3]) {
double d, d2;
long i;
int64_t i;
d2 = 0;
for (i = 0; i < 3; i++) {
@ -408,13 +421,18 @@ static double get_squared_distance(const long G[3],
static void get_LQD_inv(double LQD_inv[3][3],
const RecgridConstBZGrid *bzgrid) {
long i, j, k;
int64_t i, j, k;
/* LQD^-1 */
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
LQD_inv[i][j] = 0;
}
}
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 3; k++) {
LQD_inv[i][k] =
LQD_inv[i][k] +=
bzgrid->reclat[i][j] * bzgrid->Q[j][k] / bzgrid->D_diag[k];
}
}
@ -423,11 +441,11 @@ static void get_LQD_inv(double LQD_inv[3][3],
/* Return NULL if failed */
static RecgridMats *get_reciprocal_point_group_with_q(
const RecgridMats *rot_reciprocal, const long D_diag[3],
const long grid_point) {
long i, j, num_rot, gp_rot;
long *ir_rot;
long adrs[3], adrs_rot[3];
const RecgridMats *rot_reciprocal, const int64_t D_diag[3],
const int64_t grid_point) {
int64_t i, j, num_rot, gp_rot;
int64_t *ir_rot;
int64_t adrs[3], adrs_rot[3];
RecgridMats *rot_reciprocal_q;
ir_rot = NULL;
@ -436,7 +454,7 @@ static RecgridMats *get_reciprocal_point_group_with_q(
recgrid_get_grid_address_from_index(adrs, grid_point, D_diag);
if ((ir_rot = (long *)malloc(sizeof(long) * rot_reciprocal->size)) ==
if ((ir_rot = (int64_t *)malloc(sizeof(int64_t) * rot_reciprocal->size)) ==
NULL) {
warning_print("Memory of ir_rot could not be allocated.");
return NULL;
@ -473,10 +491,10 @@ static RecgridMats *get_reciprocal_point_group_with_q(
}
static RecgridMats *get_reciprocal_point_group(
const long (*rec_rotations_in)[3][3], const long num_rot,
const long is_time_reversal, const long is_transpose) {
long i, num_rot_out;
long rec_rotations_out[48][3][3];
const int64_t (*rec_rotations_in)[3][3], const int64_t num_rot,
const int64_t is_time_reversal, const int64_t is_transpose) {
int64_t i, num_rot_out;
int64_t rec_rotations_out[48][3][3];
RecgridMats *rec_rotations;
num_rot_out = recgrid_get_reciprocal_point_group(
@ -494,7 +512,7 @@ static RecgridMats *get_reciprocal_point_group(
return rec_rotations;
}
static void copy_matrix_l3(long a[3][3], const long b[3][3]) {
static void copy_matrix_l3(int64_t a[3][3], const int64_t b[3][3]) {
a[0][0] = b[0][0];
a[0][1] = b[0][1];
a[0][2] = b[0][2];

View File

@ -1,7 +1,7 @@
/* Copyright (C) 2015 Atsushi Togo */
/* All rights reserved. */
/* These codes were originally parts of spglib, but only develped */
/* These codes were originally parts of spglib, but only developed */
/* and used for phono3py. Therefore these were moved from spglib to */
/* phono3py. This file is part of phonopy. */
@ -37,16 +37,21 @@
#ifndef __triplet_grid_H__
#define __triplet_grid_H__
#include <stdint.h>
#include "bzgrid.h"
#include "lagrid.h"
long tpk_get_ir_triplets_at_q(long *map_triplets, long *map_q,
const long grid_point, const long D_diag[3],
const long is_time_reversal,
const long (*rec_rotations_in)[3][3],
const long num_rot, const long swappable);
long tpk_get_BZ_triplets_at_q(long (*triplets)[3], const long grid_point,
const RecgridConstBZGrid *bzgrid,
const long *map_triplets);
int64_t tpk_get_ir_triplets_at_q(int64_t *map_triplets, int64_t *map_q,
const int64_t grid_point,
const int64_t D_diag[3],
const int64_t is_time_reversal,
const int64_t (*rec_rotations_in)[3][3],
const int64_t num_rot,
const int64_t swappable);
int64_t tpk_get_BZ_triplets_at_q(int64_t (*triplets)[3],
const int64_t grid_point,
const RecgridConstBZGrid *bzgrid,
const int64_t *map_triplets);
#endif

View File

@ -35,6 +35,7 @@
#include "triplet_iw.h"
#include <math.h>
#include <stdint.h>
#include "funcs.h"
#include "grgrid.h"
@ -43,32 +44,36 @@
static void set_freq_vertices(double freq_vertices[3][24][4],
const double *frequencies1,
const double *frequencies2,
const long vertices[2][24][4],
const long num_band1, const long num_band2,
const long b1, const long b2, const long tp_type);
static long set_g(double g[3], const double f0,
const double freq_vertices[3][24][4], const long max_i);
const int64_t vertices[2][24][4],
const int64_t num_band1, const int64_t num_band2,
const int64_t b1, const int64_t b2,
const int64_t tp_type);
static int64_t set_g(double g[3], const double f0,
const double freq_vertices[3][24][4], const int64_t max_i);
static void get_triplet_tetrahedra_vertices(
long vertices[2][24][4], const long tp_relative_grid_address[2][24][4][3],
const long triplet[3], const RecgridConstBZGrid *bzgrid);
int64_t vertices[2][24][4],
const int64_t tp_relative_grid_address[2][24][4][3],
const int64_t triplet[3], const RecgridConstBZGrid *bzgrid);
static void get_neighboring_grid_points_type1(
long *neighboring_grid_points, const long grid_point,
const long (*relative_grid_address)[3],
const long num_relative_grid_address, const RecgridConstBZGrid *bzgrid);
int64_t *neighboring_grid_points, const int64_t grid_point,
const int64_t (*relative_grid_address)[3],
const int64_t num_relative_grid_address, const RecgridConstBZGrid *bzgrid);
static void get_neighboring_grid_points_type2(
long *neighboring_grid_points, const long grid_point,
const long (*relative_grid_address)[3],
const long num_relative_grid_address, const RecgridConstBZGrid *bzgrid);
int64_t *neighboring_grid_points, const int64_t grid_point,
const int64_t (*relative_grid_address)[3],
const int64_t num_relative_grid_address, const RecgridConstBZGrid *bzgrid);
void tpi_get_integration_weight(
double *iw, char *iw_zero, const double *frequency_points,
const long num_band0, const long tp_relative_grid_address[2][24][4][3],
const long triplets[3], const long num_triplets,
const int64_t num_band0,
const int64_t tp_relative_grid_address[2][24][4][3],
const int64_t triplets[3], const int64_t num_triplets,
const RecgridConstBZGrid *bzgrid, const double *frequencies1,
const long num_band1, const double *frequencies2, const long num_band2,
const long tp_type, const long openmp_per_triplets) {
long max_i, j, b1, b2, b12, num_band_prod, adrs_shift;
long vertices[2][24][4];
const int64_t num_band1, const double *frequencies2,
const int64_t num_band2, const int64_t tp_type,
const int64_t openmp_per_triplets) {
int64_t max_i, j, b1, b2, b12, num_band_prod, adrs_shift;
int64_t vertices[2][24][4];
double g[3];
double freq_vertices[3][24][4];
@ -129,10 +134,11 @@ void tpi_get_integration_weight(
void tpi_get_integration_weight_with_sigma(
double *iw, char *iw_zero, const double sigma, const double cutoff,
const double *frequency_points, const long num_band0, const long triplet[3],
const long const_adrs_shift, const double *frequencies, const long num_band,
const long tp_type, const long openmp_per_triplets) {
long j, b12, b1, b2, adrs_shift;
const double *frequency_points, const int64_t num_band0,
const int64_t triplet[3], const int64_t const_adrs_shift,
const double *frequencies, const int64_t num_band, const int64_t tp_type,
const int64_t openmp_per_triplets) {
int64_t j, b12, b1, b2, adrs_shift;
double f0, f1, f2, g0, g1, g2;
#ifdef _OPENMP
@ -189,7 +195,7 @@ void tpi_get_integration_weight_with_sigma(
}
/**
* @brief Return grid points of relative grid adddresses in BZ-grid
* @brief Return grid points of relative grid addresses in BZ-grid
*
* @param neighboring_grid_points Grid points of relative grid addresses in
* BZ-grid.
@ -199,10 +205,10 @@ void tpi_get_integration_weight_with_sigma(
* @param num_relative_grid_address Number of relative grid addresses.
* @param bzgrid
*/
void tpi_get_neighboring_grid_points(long *neighboring_grid_points,
const long grid_point,
const long (*relative_grid_address)[3],
const long num_relative_grid_address,
void tpi_get_neighboring_grid_points(int64_t *neighboring_grid_points,
const int64_t grid_point,
const int64_t (*relative_grid_address)[3],
const int64_t num_relative_grid_address,
const RecgridConstBZGrid *bzgrid) {
if (bzgrid->type == 1) {
get_neighboring_grid_points_type1(neighboring_grid_points, grid_point,
@ -218,11 +224,11 @@ void tpi_get_neighboring_grid_points(long *neighboring_grid_points,
static void set_freq_vertices(double freq_vertices[3][24][4],
const double *frequencies1,
const double *frequencies2,
const long vertices[2][24][4],
const long num_band1, const long num_band2,
const long b1, const long b2,
const long tp_type) {
long i, j;
const int64_t vertices[2][24][4],
const int64_t num_band1, const int64_t num_band2,
const int64_t b1, const int64_t b2,
const int64_t tp_type) {
int64_t i, j;
double f1, f2;
for (i = 0; i < 24; i++) {
@ -255,9 +261,10 @@ static void set_freq_vertices(double freq_vertices[3][24][4],
/* iw_zero=1 information can be used to omit to compute particles */
/* interaction strength that is often heaviest part in throughout */
/* calculation. */
static long set_g(double g[3], const double f0,
const double freq_vertices[3][24][4], const long max_i) {
long i, iw_zero;
static int64_t set_g(double g[3], const double f0,
const double freq_vertices[3][24][4],
const int64_t max_i) {
int64_t i, iw_zero;
iw_zero = 1;
@ -274,9 +281,10 @@ static long set_g(double g[3], const double f0,
}
static void get_triplet_tetrahedra_vertices(
long vertices[2][24][4], const long tp_relative_grid_address[2][24][4][3],
const long triplet[3], const RecgridConstBZGrid *bzgrid) {
long i, j;
int64_t vertices[2][24][4],
const int64_t tp_relative_grid_address[2][24][4][3],
const int64_t triplet[3], const RecgridConstBZGrid *bzgrid) {
int64_t i, j;
for (i = 0; i < 2; i++) {
for (j = 0; j < 24; j++) {
@ -288,11 +296,11 @@ static void get_triplet_tetrahedra_vertices(
}
static void get_neighboring_grid_points_type1(
long *neighboring_grid_points, const long grid_point,
const long (*relative_grid_address)[3],
const long num_relative_grid_address, const RecgridConstBZGrid *bzgrid) {
long bzmesh[3], bz_address[3];
long i, j, bz_gp, prod_bz_mesh;
int64_t *neighboring_grid_points, const int64_t grid_point,
const int64_t (*relative_grid_address)[3],
const int64_t num_relative_grid_address, const RecgridConstBZGrid *bzgrid) {
int64_t bzmesh[3], bz_address[3];
int64_t i, j, bz_gp, prod_bz_mesh;
for (i = 0; i < 3; i++) {
bzmesh[i] = bzgrid->D_diag[i] * 2;
@ -315,11 +323,11 @@ static void get_neighboring_grid_points_type1(
}
static void get_neighboring_grid_points_type2(
long *neighboring_grid_points, const long grid_point,
const long (*relative_grid_address)[3],
const long num_relative_grid_address, const RecgridConstBZGrid *bzgrid) {
long bz_address[3];
long i, j, gp;
int64_t *neighboring_grid_points, const int64_t grid_point,
const int64_t (*relative_grid_address)[3],
const int64_t num_relative_grid_address, const RecgridConstBZGrid *bzgrid) {
int64_t bz_address[3];
int64_t i, j, gp;
for (i = 0; i < num_relative_grid_address; i++) {
for (j = 0; j < 3; j++) {

View File

@ -35,24 +35,29 @@
#ifndef __triplet_iw_H__
#define __triplet_iw_H__
#include <stdint.h>
#include "bzgrid.h"
void tpi_get_integration_weight(
double *iw, char *iw_zero, const double *frequency_points,
const long num_band0, const long tp_relative_grid_address[2][24][4][3],
const long triplets[3], const long num_triplets,
const int64_t num_band0,
const int64_t tp_relative_grid_address[2][24][4][3],
const int64_t triplets[3], const int64_t num_triplets,
const RecgridConstBZGrid *bzgrid, const double *frequencies1,
const long num_band1, const double *frequencies2, const long num_band2,
const long tp_type, const long openmp_per_triplets);
const int64_t num_band1, const double *frequencies2,
const int64_t num_band2, const int64_t tp_type,
const int64_t openmp_per_triplets);
void tpi_get_integration_weight_with_sigma(
double *iw, char *iw_zero, const double sigma, const double cutoff,
const double *frequency_points, const long num_band0, const long triplet[3],
const long const_adrs_shift, const double *frequencies, const long num_band,
const long tp_type, const long openmp_per_triplets);
void tpi_get_neighboring_grid_points(long *neighboring_grid_points,
const long grid_point,
const long (*relative_grid_address)[3],
const long num_relative_grid_address,
const double *frequency_points, const int64_t num_band0,
const int64_t triplet[3], const int64_t const_adrs_shift,
const double *frequencies, const int64_t num_band, const int64_t tp_type,
const int64_t openmp_per_triplets);
void tpi_get_neighboring_grid_points(int64_t *neighboring_grid_points,
const int64_t grid_point,
const int64_t (*relative_grid_address)[3],
const int64_t num_relative_grid_address,
const RecgridConstBZGrid *bzgrid);
#endif

View File

@ -4,30 +4,33 @@ This directory contains python-sphinx documentation source.
## How to compile
```
```bash
make html
```
## Source files
* `conf.py` contains the sphinx setting confiuration.
* `conf.py` contains the sphinx setting configuration.
* `*.rst` are the usual sphinx documentation source and the filenames without `.rst` are the keys to link from toctree mainly in `index.rst`.
## How to publish
Web page files are copied to `gh-pages` branch. At the phono3py github top directory,
```
```bash
git checkout gh-pages
rm -r .buildinfo .doctrees *
```
From the directory the sphinx doc is complied,
```
```bash
rsync -avh _build/ <phono3py-repository-directory>/
```
Again, at the phono3py github top directory,
```
```bash
git add .
git commit -a -m "Update documentation ..."
git push

View File

@ -102,7 +102,7 @@ Number of points to be sampled in the x-axis.
### Options for tensor properties
For cummulative thermal conductivity, the last value is given as the thermal
For cumulative thermal conductivity, the last value is given as the thermal
conductivity in W/mK. For the other properties, the last value is effectively
the sum of values on all mesh grids divided by number of mesh grids. This is
understood as normalized for one primitive cell. Before version 1.11.13.1, the

View File

@ -2,6 +2,82 @@
# Change Log
## Jul-22-2025: Version 3.18.0
- Changed `Phono3py.run_imag_self_energy()` to return `ImagSelfEnergyValues`.
- Traditional force constants symmetrizer now applies translational and
permutation symmetries alternately 3 times in succession (previously once).
## Jul-5-2025: Version 3.17.1
- Fix direct-solution crashing when executed via command line
## Jun-26-2025: Version 3.17.0
- Major refactoring of command-user interface. Most of routines behind the
`phono3py` and `phono3py-load` commands were unified.
- For `phono3py-load`, symfc-projector is used to symmetrize force constants
calculated by finite difference approach as the default behavior. The previous
behavior of the symmetrization can be recovered by `--fc-calculator
traditional` option.
## Jun-12-2025: Version 3.16.0
- Release to follow the change of phonopy
## Apr-30-2025: Version 3.15.1
- Release to follow the change of phonopy
## Mar-4-2025: Version 3.15.0
- Release to follow the change of phonopy
## Mar-1-2025: Version 3.14.1
- Release to follow the change of phonopy
## Feb-7-2025: Version 3.14.0
- Release to follow the change of phonopy
## Feb-5-2025: Version 3.13.0
- Release to follow the change of phonopy
## Feb-1-2025: Version 3.12.2
- Fix an openmp related bug in computing collision matrix in C
## Jan-28-2025: Version 3.12.1
- Update `pyproject.toml`.
## Jan-28-2025: Version 3.12.0
- `dtype="long"` was replaced by `dtype="int64"` aiming making Windows build. In
C, `long` was replaced by `int64_t`.
- Fix `phono3py-kaccum`.
## Jan-18-2025: Version 3.11.2
- Maintenance release.
## Jan-12-2025: Version 3.11.1
- `-i`, `-o`, `--io` options have been deprecated.
- The `--amplitude` option can now be used to specify the displacement distance
for `phono3py-load --pypolymlp`.
## Jan-2-2025: Version 3.11.0
- Release to follow the change of phonopy
- Add `--rd auto` and `--rd-fc2 auto` options
## Dec-26-2024: Version 3.10.2
- `BUILD_WITHOUT_LAPACKE=ON` was made as the default compilation choice.
## Dec-23-2024: Version 3.10.1
- Replace `dtype="int_"` by `dtype="long"`.
@ -114,7 +190,7 @@ This is a major version release. There are backward-incompatible changes.
- Calculation method to transform supercell third-order force constants fc3 in
real to reciprocal space was changed as described at {ref}`changelog_v290`.
This results in the change of results with respect to those obtained by
phono3py version 2. To emulate v2 behaviour, use `--v2` option in phono3py
phono3py version 2. To emulate v2 behavior, use `--v2` option in phono3py
command line script. For `Phono3py` class , `make_r0_average=True` (default)
when instantiating it, and similarly for `phono3py.load` function.
- Completely dropped support of `disp_fc3.yaml` and `disp_fc2.yaml`.
@ -142,7 +218,7 @@ This is a major version release. There are backward-incompatible changes.
## Dec-25-2023: Version 2.9.0
- Pre-release of version 3.0.
- `--v3` option enables phono3py version 3 behaviour. In phono3py-v3, it is
- `--v3` option enables phono3py version 3 behavior. In phono3py-v3, it is
planned to replace $\sum_{l'l''}\Phi_{\alpha\beta\gamma}(0\kappa, l'\kappa',
l''\kappa'') \cdots$ in Eq.(41) of
<https://journals.jps.jp/doi/10.7566/JPSJ.92.012001> by
@ -202,7 +278,7 @@ This is a major version release. There are backward-incompatible changes.
- Installation using `setup.py` now requires creating `site.cfg` file. See
<https://phonopy.github.io/phono3py/install.html> and
[PR #59](https://github.com/phonopy/phono3py/pull/59).
- Dorp python 3.6 support, and dependencies of numpy and matplotlib versions are
- Drop python 3.6 support, and dependencies of numpy and matplotlib versions are
updated:
- Python >= 3.7
@ -232,9 +308,9 @@ This is a major version release. There are some backward-incompatible changes.
from `dtype='intc'`.
3. Python 3.5 or later is required.
To emulate the version 1.x behaviour in `phono3py` command, try `--v1` option.
To emurate the version 1.x behaviour in API, specify `store_dense_gp_map=False`
and `store_dense_svecs=False` in instatiation of `Phono3py` class or phon3py
To emulate the version 1.x behavior in `phono3py` command, try `--v1` option.
To emurate the version 1.x behavior in API, specify `store_dense_gp_map=False`
and `store_dense_svecs=False` in instantiation of `Phono3py` class or phono3py
loader.
## Mar-17-2021: Version 1.22.3
@ -248,7 +324,7 @@ loader.
## Feb-21-2021: Version 1.22.1
- `phono3py` command didn't work. This was fixed.
- Fix behaviour when specifying `--thm` and `--sigma` simultaneously.
- Fix behavior when specifying `--thm` and `--sigma` simultaneously.
## Jan-29-2021: Version 1.22.0
@ -304,8 +380,7 @@ loader.
`FORCES_FC3` is assumed.
- TURBOMOLE interface is provided by Antti Karttunen (`--turbomole`).
- Compatibility of `fc2.hdf5` and `force_constants.hdf5` was improved for all
calculators to store physical unit information in the hdf5 file. See
{ref}`file_format_compatibility`.
calculators to store physical unit information in the hdf5 file.
## Mar-24-2019: Version 1.16.0
@ -333,7 +408,7 @@ loader.
- Update to work with phonopy v1.14.2.
- Ph-ph interaction can be read (`--read-pp`) and write (`--write-pp`) in RTA
thermal conductivity calculation, too. Mind that the data stored are different
with and without `--full-pp`. Wihtout `--full-pp` the data are stored in
with and without `--full-pp`. Without `--full-pp` the data are stored in
complicated way to save data side, so it is not considered readable by usual
users.
@ -362,7 +437,7 @@ loader.
- `--sym-fc` option is added. This is just an alias to specify both `--sym-fc3r`
and `--sym-fc2` together.
- Documentation on `--write-phonon` and `--read-phonon` options is written.
These options are used to save harmonic phonon infromation on strage.
These options are used to save harmonic phonon information on storage.
## Nov-22-2017: version 1.12.5
@ -377,7 +452,7 @@ loader.
(3) happens when the primitive cell is relatively large. Number of triplets
can be shown using `--stp` option. A race condition of OpenMP multithreading
is the source of the bug. Therefore, if it occurs, the same calculation comes
up with the different thermal conductivity value in every run time, for whcih
up with the different thermal conductivity value in every run time, for which
it behaves like randomly.
- RTA thermal conductivity with smearing method (`--sigma`) is made to run with
@ -433,7 +508,7 @@ loader.
## Apr-16-2016: version 1.10.7
- API example is prepared and it is found in `Si` example. No doucment yet.
- API example is prepared and it is found in `Si` example. No documentation yet.
- Si pwscf example was placed in `example-phono3py` directory.
- User interface bug fix.
@ -445,10 +520,10 @@ loader.
to phonopy-1.10.4.
- Python3 support
- For the RTA thermal conductivity calculation mode with using the linear
tetrahedron method, only necessary part of phonon-phonon interaction strengh
among phonons. This improves lifetime calculation performance, but as the
drawback, averaged ph-ph interaction strength can not be given. See
{ref}`full_pp_option`.
tetrahedron method, only necessary part of phonon-phonon interaction strength
among phonons is calculated. This improves lifetime calculation performance,
but as the drawback, averaged ph-ph interaction strength can not be given.
See {ref}`full_pp_option`.
- Pwscf interface ({ref}`calculator_interfaces`)
## Oct-10-2015: version 0.9.14
@ -545,7 +620,7 @@ loader.
## Changes in version 0.8.0
- `--q_direction` didn't work. Fix it.
- Implementation of tetrahedron method whcih is activated by `--thm`.
- Implementation of tetrahedron method which is activated by `--thm`.
- Grid addresses are written out by `--wgp` option.
## Changes in version 0.7.6
@ -559,8 +634,9 @@ loader.
that needed for creating fc3 if index permutation symmetry is considered.
Therefore using index permutation symmetry, some elements of fc3 can be
recovered even if some of supercell force calculations are missing. In
paticular, all pair distances among triplet atoms are larger than cutoff pair
distance, any fc3 elements are not recovered, i.e., the element will be zero.
particular, all pair distances among triplet atoms are larger than cutoff
pair distance, any fc3 elements are not recovered, i.e., the element will be
zero.
## Changes in version 0.7.2

View File

@ -197,7 +197,6 @@ created from `FORCES_FC2` and `phono3py_disp.yaml` instead of `FORCES_FC3` and
```
(sp_option)=
### `--sp` or `--save-params`
Instead of `FORCES_FC3`, `phono3py_params.yaml` is generated. This option must
@ -329,16 +328,15 @@ information about primitive cell (`primitive_matrix` key) in
```
(random_displacements_option)=
### `--rd` (`RANDOM_DISPLACEMENTS`), `--rd-fc2` (`RANDOM_DISPLACEMENTS_FC2`) and `--random-seed` (`RANDOM_SEED`)
**`phono3py-load` doesn't have this option.**
See also {ref}`random-displacements`.
Random directional displacements are generated for fc3 and fc2 supercells by
`--rd` and `--rd-fc2`, respectively. `--amplitude` and `--random-seed` options
may be used together. These are used in the equivalent way to [`--rd` of
`--rd` and `--rd-fc2`, respectively. `--rd auto` can estimate a possible number
of supercells required (see {ref}`rd_number_estimation_factor_option`).
`--amplitude` and `--random-seed` options may be used together. These are used
in the equivalent way to [`--rd` of
phonopy](https://phonopy.github.io/phonopy/setting-tags.html#random-displacements).
Like `-d` option, it is recommended to specify `--pa auto` together with `--rd`
@ -348,6 +346,15 @@ and/or `--rd-fc2`,
% phono3py -c POSCAR-unitcell --dim 2 2 2 --dim-fc2 4 4 4 --rd 100 --rd-fc2 2 --pa auto
```
(rd_number_estimation_factor_option)=
### `--rd-auto-factor` (`RD_NUMBER_ESTIMATION_FACTOR`)
This scales the number of supercells generated by `--rd auto` by the specified
factor.
See
[RD_NUMBER_ESTIMATION_FACTOR](https://phonopy.github.io/phonopy/setting-tags.html#rd-number-estimation-factor).
(amplitude_option)=
### `--amplitude` (`DISPLACEMENT_DISTANCE`)
@ -377,7 +384,7 @@ To use different force constants calculators for fc2 and fc3
% phono3py-load --fc-calc "symfc|" ...
```
Those for fc2 and fc3 are seprated by `|` such as `symfc|` . Blank means to
Those for fc2 and fc3 are separated by `|` such as `symfc|` . Blank means to
employ the finite difference method for systematic displacements generated by
the option `-d`.
@ -596,7 +603,7 @@ expected.
### `--sigma` (`SIGMA`)
$\sigma$ value of Gaussian function for smearing when calculating imaginary part
of self energy. See the detail at {ref}`brillouinzone_sum`.
of self energy.
Multiple $\sigma$ values are also specified by space separated numerical values.
This is used when we want to test several $\sigma$ values simultaneously.
@ -721,7 +728,7 @@ out, i.e., `gamma` is still imaginary part of self energy of ph-ph scattering.
A most simple phonon boundary scattering treatment is included. $v_g/L$ is just
used as the scattering rate, where $v_g$ is the group velocity and $L$ is the
boundary mean free path. The value is given in micrometre. The default value, 1
boundary mean free path. The value is given in micrometer. The default value, 1
metre, is just used to avoid divergence of phonon lifetime and the contribution
to the thermal conductivity is considered negligible.
@ -760,8 +767,8 @@ where the averaged phonon-phonon interaction that is read from
`kappa-mxxx(-sx-sdx).hdf5` file is used if it exists in the file. Therefore the
averaged phonon-phonon interaction has to be stored before using this option
(see {ref}`--full-pp <full_pp_option>`). The calculation result **overwrites**
`kappa-mxxx(-sx-sdx).hdf5` file. Therefore to use this option together with `-o`
option is strongly recommended.
`kappa-mxxx(-sx-sdx).hdf5` file. Therefore the original
`kappa-mxxx(-sx-sdx).hdf5` file should be backed up.
First, run full conductivity calculation,
@ -804,50 +811,10 @@ $\Gamma^\text{U}_\lambda(\omega_\lambda)$ processes. The sum of them is usual
$\Gamma_\lambda(\omega_\lambda) =
\Gamma^\text{N}_\lambda(\omega_\lambda) +
\Gamma^\text{U}_\lambda(\omega_\lambda)$
and this is used to calcualte thermal conductivity in single-mode RTA. The
and this is used to calculate thermal conductivity in single-mode RTA. The
separation, i.e., the choice of G-vector, is made based on the first Brillouin
zone.
zone. See {ref}`iofile_kappa_hdf5_gamma_NU`.
The data are stored in `kappa-mxxx(-gx-sx-sdx).hdf5` file and accessed by
`gamma_N` and `gamma_U` keys. The shape of the arrays is the same as that of
`gamma` (see {ref}`kappa_hdf5_file_gamma`). An example (Si-PBEsol) is shown
below:
```bash
% phono3py-load --mesh 11 11 11 --fc3 --fc2 --br --nu
...
% ipython
In [1]: import h5py
In [2]: f = h5py.File("kappa-m111111.hdf5", 'r')
In [3]: list(f)
Out[3]:
['frequency',
'gamma',
'gamma_N',
'gamma_U',
'group_velocity',
'gv_by_gv',
'heat_capacity',
'kappa',
'kappa_unit_conversion',
'mesh',
'mode_kappa',
'qpoint',
'temperature',
'weight']
In [4]: f['gamma'].shape
Out[4]: (101, 56, 6)
In [5]: f['gamma_N'].shape
Out[5]: (101, 56, 6)
In [6]: f['gamma_U'].shape
Out[6]: (101, 56, 6)
```
### `--scattering-event-class` (`SCATTERING_EVENT_CLASS`)
@ -1051,7 +1018,7 @@ See also {ref}`reference papers <spectral_function_reference>`.
Spectral function of self energy $A_\lambda(\omega)$ is calculated with respect
to frequency $\omega$, where $\omega$ is sampled following
{ref}`freq_sampling_option`. First, imaginary part of self-energy is calculated
and then the real part is calculatd using the KramersKronig relation. The
and then the real part is calculated using the KramersKronig relation. The
output of $A_\lambda(\omega)$ is written to `spectral-mxxx-gx(-sx)-tx-bx.dat` in
THz (without $2\pi$) with respect to samplied frequency points of $\omega$ in
THz (without $2\pi$), and `spectral-mxxx-gx.hdf5`.
@ -1202,68 +1169,9 @@ not found, `kappa-mxxx-gx-bx(-sx-sdx).hdf5` files for band indices are searched.
### `--write-gamma-detail` (`WRITE_GAMMA_DETAIL = .TRUE.`)
Each q-point triplet contribution to imaginary part of self energy is written
into `gamma_detail-mxxx-gx(-sx-sdx).hdf5` file. Be careful that this is large
data.
into `gamma_detail-mxxx-gx(-sx-sdx).hdf5` file. Be careful that this can be a
large file. See {ref}`iofile_gamma_detail_hdf5`.
In the output file in hdf5, following keys are used to extract the detailed
information.
```{table}
| dataset | Array shape |
|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| gamma_detail for `--ise` | (temperature, sampling frequency point, symmetry reduced set of triplets at a grid point, band1, band2, band3) in THz (without $2\pi$) |
| gamma_detail for `--br` | (temperature, symmetry reduced set of triplets at a grid point, band1, band2, band3) in THz (without $2\pi$) |
| mesh | Numbers of sampling mesh along reciprocal axes. |
| frequency_point for `--ise` | Sampling frequency points in THz (without $2\pi$), i.e., $\omega$ in $\Gamma_\lambda(\omega)$ |
| temperature | (temperature,), Temperatures in K |
| triplet | (symmetry reduced set of triplets at a grid point, 3), Triplets are given by the grid point indices (see below). |
| weight | (symmetry reduced set of triplets at a grid point,), Weight of each triplet to imaginary part of self energy |
```
Imaginary part of self energy (linewidth/2) is recovered by the following
script:
```python
import h5py
import numpy as np
gd = h5py.File("gamma_detail-mxxx-gx.hdf5")
temp_index = 30 # index of temperature
temperature = gd['temperature'][temp_index]
gamma_tp = gd['gamma_detail'][:].sum(axis=-1).sum(axis=-1)
weight = gd['weight'][:]
gamma = np.dot(weight, gamma_tp[temp_index])
```
For example, for `--br`, this `gamma` gives $\Gamma_\lambda(\omega_\lambda)$ of
the band indices at the grid point indicated by $\lambda$ at the temperature of
index 30. If any bands are degenerated, those `gamma` in
`kappa-mxxx-gx(-sx-sdx).hdf5` or `gamma-mxxx-gx(-sx-sdx).hdf5` type file are
averaged, but the `gamma` obtained here in this way are not symmetrized. Apart
from this symmetrization, the values must be equivalent between them.
To understand each contribution of triptle to imaginary part of self energy,
reading `phonon-mxxx.hdf5` is useful (see {ref}`write_phonon_option`). For
example, phonon triplets of three phonon scatterings are obtained by
```python
import h5py
import numpy as np
gd = h5py.File("gamma_detail-mxxx-gx.hdf5", 'r')
ph = h5py.File("phonon-mxxx.hdf5", 'r')
gp1 = gd['grid_point'][()]
triplets = gd['triplet'][:] # Sets of (gp1, gp2, gp3) where gp1 is fixed
mesh = gd['mesh'][:]
grid_address = ph['grid_address'][:]
q_triplets = grid_address[triplets] / mesh.astype('double')
# Phonons of triplets[2]
phonon_tp = [(ph['frequency'][i], ph['eigenvector'][i]) for i in triplets[2]]
# Fractions of contributions of tripltes at this grid point and temperture index 30
gamma_sum_over_bands = np.dot(weight, gd['gamma_detail'][30].sum(axis=-1).sum(axis=-1).sum(axis=-1))
contrib_tp = [gd['gamma_detail'][30, i].sum() / gamma_sum_over_bands for i in range(len(weight))]
np.dot(weight, contrib_tp) # is one
```
(write_phonon_option)=
@ -1271,45 +1179,12 @@ np.dot(weight, contrib_tp) # is one
Phonon frequencies, eigenvectors, and grid point addresses are stored in
`phonon-mxxx.hdf5` file. {ref}`--pa <pa_option>` and {ref}`--nac <nac_option>`
may be required depending on calculation setting.
may be required depending on calculation setting. See {ref}`iofile_phonon_hdf5`.
```bash
% phono3py-load --mesh 11 11 11 --nac --write-phoonon
```
Contents of `phonon-mxxx.hdf5` are watched by:
```bash
In [1]: import h5py
In [2]: ph = h5py.File("phonon-m111111.hdf5", 'r')
In [3]: list(ph)
Out[3]: ['eigenvector', 'frequency', 'grid_address', 'mesh']
In [4]: ph['mesh'][:]
Out[4]: array([11, 11, 11], dtype=int32)
In [5]: ph['grid_address'].shape
Out[5]: (1367, 3)
In [6]: ph['frequency'].shape
Out[6]: (1367, 6)
In [7]: ph['eigenvector'].shape
Out[7]: (1367, 6, 6)
```
The first axis of `ph['grid_address']`, `ph['frequency']`, and
`ph['eigenvector']` corresponds to the number of q-points where phonons are
calculated. Here the number of phonons may not be equal to product of mesh
numbers ($1367 \neq 11^3$). This is because all q-points on Brillouin zone
boundary are included, i.e., even if multiple q-points are translationally
equivalent, those phonons are stored separately though these phonons are
physically equivalent within the equations employed in phono3py. Here Brillouin
zone is defined by WignerSeitz cell of reciprocal primitive basis vectors. This
is convenient to categorize phonon triplets into Umklapp and Normal scatterings
based on the Brillouin zone.
(read_phonon_option)=
@ -1358,8 +1233,7 @@ set. Other filters (`lzf` or integer values of 0 to 9) may be used, see h5py
documentation
(<http://docs.h5py.org/en/stable/high/dataset.html#filter-pipeline>).
(output_filename_option)=
<!-- (output_filename_option)=
### `-o` (command option only)
This modifies default output file names to write.
@ -1378,7 +1252,6 @@ This rule is applied to
* `gamma_detail-xxx.hdf5` (write only)
(input_filename_option)=
### `-i` (command option only)
This modifies default input file names to read.
@ -1399,7 +1272,7 @@ This rule is applied to
This modifies default input and output file names.
This is equivalent to setting `-i` and `-o` simultaneously.
This is equivalent to setting `-i` and `-o` simultaneously. -->
<!-- ## References

View File

@ -58,9 +58,9 @@ copyright = "2015, Atsushi Togo"
# built documents.
#
# The short X.Y version.
version = "3.10"
version = "3.18"
# The full version, including alpha/beta/rc tags.
release = "3.10.1"
release = "3.18.0"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -142,7 +142,7 @@ pygments_style = "sphinx"
# # Allow a separate homepage from the master_doc
# "homepage": "index",
# # Allow the project link to be overriden to a custom URL.
# # Allow the project link to be overridden to a custom URL.
# "projectlink": "http://myproject.url",
# # Visible levels of the global TOC; -1 means unlimited

View File

@ -25,7 +25,7 @@ In phono3py, to obtain supercell-fc3,
$\Phi_{\alpha\beta\gamma}(jl, j'l', j''l'')$, forces in many
supercells having different pairs of displaced atoms are computed
using some force-calculator such as ab-initio code. In the phono3py
default behaviour, full elements of supercell-fc3 are computed. In
default behavior, full elements of supercell-fc3 are computed. In
this case, though depending on the number of atoms in the supercell
and the crystal symmetry, the number of atomic-pair configuration can
be huge and beyond our computational resource.

View File

@ -253,10 +253,10 @@ contained.
:width: 50%
:name: coleigplot
Eigenvalues are plotted in log scale (Si-PBEsol exmaple with
Eigenvalues are plotted in log scale (Si-PBEsol example with
15x15x15 mesh). The number in x-axis is just the index where each
eigenvalue is stored. Normally the eigenvalues are stored ascending
order. The bule points show the positive values, and
order. The blue points show the positive values, and
the red points show the negative values as positive values
(absolute values) to be able to plot in log scale. In this plot, we
can see the gap between $10^{-4}$ and $10^{-16}$, which
@ -295,24 +295,23 @@ language implementation through the python C-API.
## Solver choice for diagonalization
For larger systems, diagonalization of collision matrix takes longest time and
requires large memory space. Phono3py relies on LAPACK for the diagonalization
and so the performance is dependent on the choice of the diagonalization solver.
Diagonalizing the collision matrix for larger systems is the most time-consuming
step and requires significant memory. Phono3py uses LAPACK for diagonalization,
making performance highly dependent on the solver choice. Utilizing
multithreaded BLAS on many-core nodes can significantly reduce computation time,
allowing calculations to complete within practical limits. Currently, Phono3py
supports diagonalization via scipy, numpy, and LAPACKE as LAPACK wrappers.
Using multithreaded BLAS with many-core computing node, computing time may be
well reduced and the calculation can finish in a realistic time. Currently
scipy, numpy and LAPACKE can be used as the LAPACK wrapper in phono3py. Scipy
and numpy distributed by anaconda are MKL linked, therefore MKL multithread BLAS
is used through them. Multithreaded OpenBLAS is installed by conda and can be
used via LAPACKE in phono3py. MKL LAPACK and BLAS are also able to be used via
LAPACKE in phono3py with appropriate setting in `setup.py`.
The default choice of the diagonalization solver is `scipy.linalg.lapack.dsyev`
(`--pinv-solver=4`). Using `--pinv-solver NUMBER`, one of the following solvers
is specified:
Using `--pinv-solver NUMBER`, one of the following solver is chosen:
1. Lapacke `dsyev`: Smaller memory consumption than `dsyevd`, but slower. This
1. (Only available when {ref}`compiling with LAPACKE <install_with_lapacke>`)
Lapacke `dsyev`: Smaller memory consumption than `dsyevd`, but slower. This
is the default solver when MKL LAPACKE is integrated or scipy is not
installed.
2. Lapacke `dsyevd`: Larger memory consumption than `dsyev`, but faster. This is
2. (Only available when {ref}`compiling with LAPACKE <install_with_lapacke>`)
Lapacke `dsyevd`: Larger memory consumption than `dsyev`, but faster. This is
not considered as stable as `dsyev` but can be significantly faster than
`dsyev` for solving large collision matrix. It is recommended to compare the
result with that by `dsyev` solver using smaller collision matrix (e.g.,
@ -323,8 +322,3 @@ Using `--pinv-solver NUMBER`, one of the following solver is chosen:
LAPACKE is not integrated.
5. Scipy's `dsyevd`: Similar to solver (2), this solver should be used
carefully.
```{note}
`pinv-solver` =3, 4, and 5 are only available when phono3py is compiled
without LAPACKE.
```

303
doc/grid.md Normal file
View File

@ -0,0 +1,303 @@
(grid)=
# Grids in reciprocal space
The regular grid can be a conventional regular grid or a generalized regular
grid. Here the conventional regular grid means that the grids are cut parallel
to the reciprocal basis vectors. In most cases, the conventional regular grid is
used. In special case, e.g., for crystals with body center tetragonal symmetry,
the generalized regular grid can be useful. In phono3py, the generalized regular
grid is defined to be cut parallel to the reciprocal basis vectors of the
conventional unit cell.
Two types of grid data structure are used in phono3py. Normal regular grid
contains translationally unique grid points (regular grid). The other grid
includes the points on Brillouin zone (BZ) boundary (BZ grid).
## `BZGrid` class instance
Grid point information in reciprocal space is stored in the `BZGrid` class. This
class instance can be easily accessed in the following way.
```python
In [1]: import phono3py
In [2]: ph3 = phono3py.load("phono3py.yaml", produce_fc=False)
In [3]: ph3.mesh_numbers = [11, 11, 11]
In [4]: ph3.grid
Out[4]: <phono3py.phonon.grid.BZGrid at 0x1070f3b60>
```
It is recommended to read docstring in `BZGrid` by
```python
In [5]: help(ph3.grid)
```
Some attributes of this class are presented below.
```python
In [6]: ph3.grid.addresses.shape
Out[6]: (1367, 3)
In [7]: ph3.grid.D_diag
Out[7]: array([11, 11, 11])
In [8]: ph3.grid.P
Out[8]:
array([[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
In [9]: ph3.grid.Q
Out[9]:
array([[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
In [10]: ph3.grid.QDinv
Out[10]:
array([[0.09090909, 0. , 0. ],
[0. , 0.09090909, 0. ],
[0. , 0. , 0.09090909]])
In [11]: ph3.grid.PS
Out[11]: array([0, 0, 0])
```
The integer array `addresses` contains grid point addresses. Every grid point
address is represented by the unique series of three integers. These addresses
are converted to the q-points in fractional coordinates as explained in the
{ref}`section below<grid_address_to_q>`.
Unless generalized regular grid is employed, the other attributes are not
important. `D_diag` is equivalent to the three integer numbers of the specified
conventional regular grid. `P` and `Q` are are the left and right unimodular
matrix after Smith normal form: $\mathrm{D}=\mathrm{PAQ}$, respectively, where
$\mathrm{A}$ is the grid matrix. `D_diag` is the three diagonal elements of the
matrix $\mathrm{D}$. The grid matrix is usually a diagonal matrix, then
$\mathrm{P}$ and $\mathrm{Q}$ are chosen as identity matrix. `QDinv` is given
by $\mathrm{Q}\mathrm{D}^{-1}$. `PS` represents half-grid-shifts (usually always
`[0, 0, 0]` in phono3py).
## Find grid point index corresponding to grid point address
Grid point index corresponding to a grid point address is obtained using the
instance method `BZGrid.get_indices_from_addresses` as follows:
```python
In [1]: import phono3py
In [2]: ph3 = phono3py.load("phono3py_disp.yaml")
In [3]: ph3.mesh_numbers = [20, 20, 20]
In [4]: ph3.grid.get_indices_from_addresses([0, 10, 10])
Out[4]: 4448
```
This index number is different between phono3py version 1.x and 2.x.
To get the number corresponding to the phono3py version 1.x,
`store_dense_gp_map=False` should be specified in `phono3py.load`,
```python
In [5]: ph3 = phono3py.load("phono3py_disp.yaml", store_dense_gp_map=False)
In [6]: ph3.mesh_numbers = [20, 20, 20]
In [7]: ph3.grid.get_indices_from_addresses([0, 10, 10])
Out[7]: 4200
```
(grid_address_to_q)=
## q-points in fractional coordinates corresponding to grid addresses
For Gamma centered regular grid, q-points in fractional coordinates
are obtained by
```python
qpoints = addresses @ QDinv.T
```
For shifted regular grid (usually unused in phono3py),
```python
qpoints = (addresses * 2 + PS) @ (QDinv.T / 2.0)
```
The grid addresses are stored in `phonon-*.hdf5`. So for conventional
Gamma-centered regular grid, those information can be used to recover the
corresponding q-points. For example,
```python
In [1]: import h5py
In [2]: f = h5py.File("phonon-m111111.hdf5")
In [3]: import numpy as np
In [8]: f['grid_address'][:] @ np.diag(1.0 / f['mesh'][:])
Out[8]:
array([[ 0. , 0. , 0. ],
[ 0.09090909, 0. , 0. ],
[ 0.18181818, 0. , 0. ],
...,
[-0.27272727, -0.09090909, -0.09090909],
[-0.18181818, -0.09090909, -0.09090909],
[-0.09090909, -0.09090909, -0.09090909]], shape=(1367, 3))
```
(grid_triplets)=
## Grid point triplets
Three grid point indices are used to represent a q-point triplet. For example
the following command generates `gamma_detail-m111111-g5.hdf5`,
```bash
% phono3py-load phono3py.yaml --gp 5 --br --mesh 11 11 11 --write-gamma-detail
```
This file contains various information:
```python
In [1]: import h5py
In [2]: f = h5py.File("gamma_detail-m111111-g5.hdf5")
In [3]: list(f)
Out[3]:
['gamma_detail',
'grid_point',
'mesh',
'temperature',
'triplet',
'triplet_all',
'version',
'weight']
In [4]: f['gamma_detail'].shape
Out[4]: (101, 146, 6, 6, 6)
```
For the detailed analysis of contributions of triplets to imaginary part of
self energy a phonon mode of the grid point, it is necessary to understand the
data structure of `triplet` and `weight`.
```python
In [5]: f['triplet'].shape
Out[5]: (146, 3)
In [6]: f['weight'].shape
Out[6]: (146,)
In [7]: f['triplet'][:10]
Out[7]:
array([[ 5, 0, 6],
[ 5, 1, 5],
[ 5, 2, 4],
[ 5, 3, 3],
[ 5, 7, 10],
[ 5, 8, 9],
[ 5, 11, 118],
[ 5, 12, 117],
[ 5, 13, 116],
[ 5, 14, 115]])
```
The second index of `gamma_detail` corresponds to the first index of `triplet`.
Three integers of each triplet are the grid point indices, which means, the grid
addresses and their q-points are recovered by
```python
In [8]: import phono3py
In [9]: ph3 = phono3py.load("phono3py.yaml", produce_fc=False)
In [10]: ph3.mesh_numbers = [11, 11, 11]
In [11]: ph3.grid.addresses[f['triplet'][:10]]
Out[11]:
array([[[ 5, 0, 0],
[ 0, 0, 0],
[-5, 0, 0]],
[[ 5, 0, 0],
[ 1, 0, 0],
[ 5, 0, 0]],
[[ 5, 0, 0],
[ 2, 0, 0],
[ 4, 0, 0]],
[[ 5, 0, 0],
[ 3, 0, 0],
[ 3, 0, 0]],
[[ 5, 0, 0],
[-4, 0, 0],
[-1, 0, 0]],
[[ 5, 0, 0],
[-3, 0, 0],
[-2, 0, 0]],
[[ 5, 0, 0],
[ 0, 1, 0],
[-5, -1, 0]],
[[ 5, 0, 0],
[ 1, 1, 0],
[ 5, -1, 0]],
[[ 5, 0, 0],
[ 2, 1, 0],
[ 4, -1, 0]],
[[ 5, 0, 0],
[ 3, 1, 0],
[ 3, -1, 0]]])
n [14]: ph3.grid.addresses[f['triplet'][:10]] @ ph3.grid.QDinv
Out[14]:
array([[[ 0.45454545, 0. , 0. ],
[ 0. , 0. , 0. ],
[-0.45454545, 0. , 0. ]],
[[ 0.45454545, 0. , 0. ],
[ 0.09090909, 0. , 0. ],
[ 0.45454545, 0. , 0. ]],
[[ 0.45454545, 0. , 0. ],
[ 0.18181818, 0. , 0. ],
[ 0.36363636, 0. , 0. ]],
[[ 0.45454545, 0. , 0. ],
[ 0.27272727, 0. , 0. ],
[ 0.27272727, 0. , 0. ]],
[[ 0.45454545, 0. , 0. ],
[-0.36363636, 0. , 0. ],
[-0.09090909, 0. , 0. ]],
[[ 0.45454545, 0. , 0. ],
[-0.27272727, 0. , 0. ],
[-0.18181818, 0. , 0. ]],
[[ 0.45454545, 0. , 0. ],
[ 0. , 0.09090909, 0. ],
[-0.45454545, -0.09090909, 0. ]],
[[ 0.45454545, 0. , 0. ],
[ 0.09090909, 0.09090909, 0. ],
[ 0.45454545, -0.09090909, 0. ]],
[[ 0.45454545, 0. , 0. ],
[ 0.18181818, 0.09090909, 0. ],
[ 0.36363636, -0.09090909, 0. ]],
[[ 0.45454545, 0. , 0. ],
[ 0.27272727, 0.09090909, 0. ],
[ 0.27272727, -0.09090909, 0. ]]])
```

View File

@ -1,23 +1,18 @@
(hdf5_howto)=
# How to read the results stored in hdf5 files
# Using phono3py hdf5 files
```{contents}
:depth: 3
:local:
```
## Using `h5py` in ipython
## How to use HDF5 python library
It is assumed that `python-h5py` is installed on the computer you interactively
use. In the following, how to see the contents of `.hdf5` files in the
interactive mode of Python. The basic usage of reading `.hdf5` files using
`h5py` is found at
[here](http://docs.h5py.org/en/latest/high/dataset.html#reading-writing-data>).
In the following example, an MgO result of thermal conductivity calculation
stored in `kappa-m111111.hdf5` (see {ref}`iofile_kappa_hdf5`) is loaded and
thermal conductivity tensor at 300 K is watched.
It is assumed that `python-h5py` is installed on the computer you
interactively use. In the following, how to see the contents of
`.hdf5` files in the interactive mode of Python. The basic usage of
reading `.hdf5` files using `h5py` is found at [here](http://docs.h5py.org/en/latest/high/dataset.html#reading-writing-data>).
Usually for running interactive python, `ipython` is recommended to
use but not the plain python. In the following example, an MgO result
of thermal conductivity calculation is loaded and thermal conductivity
tensor at 300 K is watched.
```bash
```python
In [1]: import h5py
In [2]: f = h5py.File("kappa-m111111.hdf5")
@ -90,256 +85,3 @@ In [11]: g = np.where(g > 0, g, -1)
In [12]: lifetime = np.where(g > 0, 1.0 / (2 * 2 * np.pi * g), 0)
```
(kappa_hdf5_file)=
## Details of `kappa-*.hdf5` file
Files name, e.g. `kappa-m323220.hdf5`, is determined by some
specific options. `mxxx`, show the numbers of sampling
mesh. `sxxx` and `gxxx` appear optionally. `sxxx` gives the
smearing width in the smearing method for Brillouin zone integration
for phonon lifetime, and `gxxx` denotes the grid number. Using the
command option of `-o`, the file name can be modified slightly. For
example `-o nac` gives `kappa-m323220.nac.hdf5` to
memorize the option `--nac` was used.
Currently `kappa-*.hdf5` file (not for the specific grid points)
contains the properties shown below.
### mesh
(Versions 1.10.11 or later)
The numbers of mesh points for reciprocal space sampling along
reciprocal axes, $a^*, b^*, c^*$.
### frequency
Phonon frequencies. The physical unit is THz, where THz
is in the ordinal frequency not the angular frequency.
The array shape is (irreducible q-point, phonon band).
(kappa_hdf5_file_gamma)=
### gamma
Imaginary part of self energy of phonon bubble diagram (phonon-phonon
scattering). The physical unit is THz, where THz is in the ordinal frequency not
the angular frequency.
The array shape for all grid-points (irreducible q-points) is
(temperature, irreducible q-point, phonon band).
The array shape for a specific grid-point is
(temperature, phonon band).
Phonon lifetime ($\tau_\lambda=1/2\Gamma_\lambda(\omega_\lambda)$) may
be estimated from `gamma`. $2\pi$ has to be multiplied with
`gamma` values in the hdf5 file to convert the unit of ordinal
frequency to angular frequency. Zeros in `gamma` values mean that
those elements were not calculated such as for three acoustic modes at
$\Gamma$ point. The below is the copy-and-paste from the
previous section to show how to obtain phonon lifetime in pico
second:
```bash
In [8]: g = f['gamma'][30]
In [9]: import numpy as np
In [10]: g = np.where(g > 0, g, -1)
In [11]: lifetime = np.where(g > 0, 1.0 / (2 * 2 * np.pi * g), 0)
```
### gamma_isotope
Isotope scattering of $1/2\tau^\mathrm{iso}_\lambda$.
The physical unit is same as that of gamma.
The array shape is same as that of frequency.
### group_velocity
Phonon group velocity, $\nabla_\mathbf{q}\omega_\lambda$. The
physical unit is $\text{THz}\cdot\text{Angstrom}$, where THz
is in the ordinal frequency not the angular frequency.
The array shape is (irreducible q-point, phonon band, 3 = Cartesian coordinates).
### heat_capacity
Mode-heat-capacity defined by
$$
C_\lambda = k_\mathrm{B}
\left(\frac{\hbar\omega_\lambda}{k_\mathrm{B} T} \right)^2
\frac{\exp(\hbar\omega_\lambda/k_\mathrm{B}
T)}{[\exp(\hbar\omega_\lambda/k_\mathrm{B} T)-1]^2}.
$$
The physical unit is eV/K.
The array shape is (temperature, irreducible q-point, phonon band).
(output_kappa)=
### kappa
Thermal conductivity tensor. The physical unit is W/m-K.
The array shape is (temperature, 6 = (xx, yy, zz, yz, xz, xy)).
(output_mode_kappa)=
### mode-kappa
Thermal conductivity tensors at k-stars (${}^*\mathbf{k}$):
$$
\sum_{\mathbf{q} \in {}^*\mathbf{k}} \kappa_{\mathbf{q}j}.
$$
The sum of this over ${}^*\mathbf{k}$ corresponding to
irreducible q-points divided by number of grid points gives
$\kappa$ ({ref}`output_kappa`), e.g.,:
```python
kappa_xx_at_index_30 = mode_kappa[30, :, :, 0].sum()/ weight.sum()
```
Be careful that until version 1.12.7, mode-kappa values were divided
by number of grid points.
The physical unit is W/m-K. Each tensor element is the sum of tensor
elements on the members of ${}^*\mathbf{k}$, i.e., symmetrically
equivalent q-points by crystallographic point group and time reversal
symmetry.
The array shape is (temperature, irreducible q-point, phonon band, 6 =
(xx, yy, zz, yz, xz, xy)).
### gv_by_gv
Outer products of group velocities for k-stars
(${}^*\mathbf{k}$) for each irreducible q-point and phonon band
($j$):
$$
\sum_{\mathbf{q} \in {}^*\mathbf{k}} \mathbf{v}_{\mathbf{q}j} \otimes
\mathbf{v}_{\mathbf{q}j}.
$$
The physical unit is
$\text{THz}^2\cdot\text{Angstrom}^2$, where THz is in the
ordinal frequency not the angular frequency.
The array shape is (irreducible q-point, phonon band, 6 = (xx, yy, zz,
yz, xz, xy)).
### q-point
Irreducible q-points in reduced coordinates.
The array shape is (irreducible q-point, 3 = reduced
coordinates in reciprocal space).
### temperature
Temperatures where thermal conductivities are calculated. The physical
unit is K.
### weight
Weights corresponding to irreducible q-points. Sum of weights equals to
the number of mesh grid points.
### ave_pp
Averaged phonon-phonon interaction in $\text{eV}^2,
$P_{\mathbf{q}j}$:
$$
P_{\mathbf{q}j} = \frac{1}{(3n_\mathrm{a})^2} \sum_{\lambda'\lambda''}
|\Phi_{\lambda\lambda'\lambda''}|^2.
$$
This is not going to be calculated in the RTA thermal coductivity
calculation mode by default. To calculate this, `--full-pp` option
has to be specified (see {ref}`full_pp_option`).
### boundary_mfp
A value specified by {ref}`boundary_mfp_option`. The physical unit is
micrometre.
When `--boundary-mfp` option is explicitly specified, its value is stored here.
### kappa_unit_conversion
This is used to convert the physical unit of lattice thermal
conductivity made of `heat_capacity`, `group_velocity`, and
`gamma`, to W/m-K. In the single mode relaxation time (SMRT) method,
a mode contribution to the lattice thermal conductivity is given by
$$
\kappa_\lambda = \frac{1}{V_0} C_\lambda \mathbf{v}_\lambda \otimes
\mathbf{v}_\lambda \tau_\lambda^{\mathrm{SMRT}}.
$$
For example, $\kappa_{\lambda,{xx}}$ is calculated by:
```bash
In [1]: import h5py
In [2]: f = h5py.File("kappa-m111111.hdf5")
In [3]: kappa_unit_conversion = f['kappa_unit_conversion'][()]
In [4]: weight = f['weight'][:]
In [5]: heat_capacity = f['heat_capacity'][:]
In [6]: gv_by_gv = f['gv_by_gv'][:]
In [7]: gamma = f['gamma'][:]
In [8]: kappa_unit_conversion * heat_capacity[30, 2, 0] * gv_by_gv[2, 0] / (2 * gamma[30, 2, 0])
Out[8]:
array([ 1.02050241e+03, 1.02050241e+03, 1.02050241e+03,
4.40486382e-15, 0.00000000e+00, -4.40486382e-15])
In [9]: f['mode_kappa'][30, 2, 0]
Out[9]:
array([ 1.02050201e+03, 1.02050201e+03, 1.02050201e+03,
4.40486209e-15, 0.00000000e+00, -4.40486209e-15])
```
## How to know grid point index number corresponding to grid address
Runngin with `--write-gamma`, hdf5 files are written out with file names
such as `kappa-m202020-g4448.hdf5`. You may want to know the grid point
index number with given grid address. This is done as follows:
```bash
In [1]: import phono3py
In [2]: ph3 = phono3py.load("phono3py_disp.yaml")
In [3]: ph3.mesh_numbers = [20, 20, 20]
In [4]: ph3.grid.get_indices_from_addresses([0, 10, 10])
Out[4]: 4448
```
This index number is different between phono3py version 1.x and 2.x.
To get the number corresponding to the phono3py version 1.x,
`store_dense_gp_map=False` should be specified in `phono3py.load`,
```bash
In [5]: ph3 = phono3py.load("phono3py_disp.yaml", store_dense_gp_map=False)
In [6]: ph3.mesh_numbers = [20, 20, 20]
In [7]: ph3.grid.get_indices_from_addresses([0, 10, 10])
Out[7]: 4200
```

View File

@ -6,7 +6,7 @@ the supercell approach. For example, the following physical values are obtained:
- {ref}`Lattice thermal conductivity by relaxation time approximation
and direct-solution of phonon Boltzmann equation and
the Wigner transport equation <LTC_options>`
- {ref}`Cummulative lattice thermal conductivity and related properties <auxiliary_tools_kaccum>`
- {ref}`Cumulative lattice thermal conductivity and related properties <auxiliary_tools_kaccum>`
- {ref}`self_energy_options` (Phonon lifetime/linewidth)
- {ref}`jdos_option`
- {ref}`spectral_function_option`
@ -38,7 +38,6 @@ examples
Interfaces to calculators (VASP, QE, CRYSTAL, Abinit, TURBOMOLE) <interfaces>
command-options
input-output-files
hdf5_howto
auxiliary-tools
direct-solution
wigner-solution
@ -49,7 +48,8 @@ cutoff-pair
external-tools
phono3py-api
phono3py-load
tips
hdf5_howto
grid
citation
reference
changelog

View File

@ -2,34 +2,30 @@
# Input / Output files
```{contents}
:depth: 3
:local:
```
The calculation results are written into files. Mostly the data are stored in
HDF5 format, therefore how to read the data from HDF5 files is also shown.
## Intermediate text files
The following files are not compatible with phonopy. But phonopy's `FORCE_SETS`
file can be created using phono3py command options from the following files. See
the detail at {ref}`file_format_compatibility`.
### `phono3py_disp.yaml`
This is created with `-d` option. See {ref}`create_displacements_option`.
## `phono3py_disp.yaml`
This is created with {ref}`-d <create_displacements_option>` or
{ref}`--rd <random_displacements_option>` option.
This file contains displacement dataset and crystal structure information.
Parameters for non-analytical term correction can be also included.
(input-output_files_FORCES_FC3)=
## `phono3py_params.yaml`
### `FORCES_FC3`
This is created with `--cf3` option. See {ref}`cf3_option`.
This is created with the combination of {ref}`--cf3 <cf3_option>` and {ref}`--sp
<sp_option>` options. This file contains displacement-force dataset and crystal
structure information. In addition, energies of supercells may be included in
the dataset. Parameters for non-analytical term correction can be also included.
There are two formats of `FORCES_FC3`. The type-I format is like that shown
below
(iofile_FORCES_FC3)=
## `FORCES_FC3`
This is created with {ref}`--cf3 <cf3_option>` option . There are two formats of
`FORCES_FC3`. The type-I format is like that shown below
```
# File: 1
@ -79,22 +75,13 @@ The type-II format is the same as
[phonopy's type-II format](https://phonopy.github.io/phonopy/input-files.html#type-2)
of `FORCE_SETS`.
### `FORCES_FC2`
## `FORCES_FC2`
This is created with `--cf2` option. See {ref}`cf2_option` and
{ref}`dim_fc2_option`.
This is created with {ref}`--cf2 <dim_fc2_option>` option. The file formats
(type-I and type-II) are same as those of `FORCES_FC3`.
The file formats (type-I and type-II) are same as those of `FORCES_FC3`.
## HDF5 files
### `kappa-*.hdf5`
See the detail at {ref}`kappa_hdf5_file`.
(fc3_hdf5_file)=
### `fc3.hdf5`
(iofile_fc3_hdf5)=
## `fc3.hdf5`
Third order force constants (in real space) are stored in
$\mathrm{eV}/\text{Angstrom}^3$.
@ -145,9 +132,8 @@ $$
So what you have to set is `--pa="0 1/4 1/4 1/4 0 1/4 1/4 1/4 0"`.
(fc2_hdf5_file)=
### `fc2.hdf5`
(iofile_fc2_hdf5)=
## `fc2.hdf5`
Second order force constants are stored in $\mathrm{eV}/\text{Angstrom}^2$.
@ -159,29 +145,434 @@ in the shape of:
```
against $\Phi_{\alpha\beta}(l\kappa, l'\kappa')$. More detail is similar to the
case for {ref}`fc3_hdf5_file`.
case for {ref}`iofile_fc3_hdf5`.
### `gamma-*.hdf5`
(iofile_kappa_hdf5)=
## `kappa-*.hdf5`
Files name, e.g. `kappa-m323220.hdf5`, is determined by some
specific options. `mxxx`, show the numbers of sampling
mesh. `sxxx` and `gxxx` appear optionally. `sxxx` gives the
smearing width in the smearing method for Brillouin zone integration
for phonon lifetime, and `gxxx` denotes the grid number. Using the
command option of `-o`, the file name can be modified slightly. For
example `-o nac` gives `kappa-m323220.nac.hdf5` to
memorize the option `--nac` was used.
### `mesh`
(Versions 1.10.11 or later)
The numbers of mesh points for reciprocal space sampling along
reciprocal axes, $a^*, b^*, c^*$.
### `frequency`
Phonon frequencies. The physical unit is THz, where THz
is in the ordinal frequency not the angular frequency.
The array shape is (irreducible q-point, phonon band).
(iofile_kappa_hdf5_gamma)=
### `gamma`
Imaginary part of self energy of phonon bubble diagram (phonon-phonon
scattering). The physical unit is THz, where THz is in the ordinal frequency not
the angular frequency.
The array shape for all grid-points (irreducible q-points) is
(temperature, irreducible q-point, phonon band).
The array shape for a specific grid-point is
(temperature, phonon band).
Phonon lifetime ($\tau_\lambda=1/2\Gamma_\lambda(\omega_\lambda)$) may
be estimated from `gamma`. $2\pi$ has to be multiplied with
`gamma` values in the hdf5 file to convert the unit of ordinal
frequency to angular frequency. Zeros in `gamma` values mean that
those elements were not calculated such as for three acoustic modes at
$\Gamma$ point. The below is the copy-and-paste from the
previous section to show how to obtain phonon lifetime in pico
second:
```python
In [8]: g = f['gamma'][30]
In [9]: import numpy as np
In [10]: g = np.where(g > 0, g, -1)
In [11]: lifetime = np.where(g > 0, 1.0 / (2 * 2 * np.pi * g), 0)
```
### `gamma_isotope`
Isotope scattering of $1/2\tau^\mathrm{iso}_\lambda$.
The physical unit is same as that of gamma.
The array shape is same as that of frequency.
### `group_velocity`
Phonon group velocity, $\nabla_\mathbf{q}\omega_\lambda$. The
physical unit is $\text{THz}\cdot\text{Angstrom}$, where THz
is in the ordinal frequency not the angular frequency.
The array shape is (irreducible q-point, phonon band, 3 = Cartesian coordinates).
### `heat_capacity`
Mode-heat-capacity defined by
$$
C_\lambda = k_\mathrm{B}
\left(\frac{\hbar\omega_\lambda}{k_\mathrm{B} T} \right)^2
\frac{\exp(\hbar\omega_\lambda/k_\mathrm{B}
T)}{[\exp(\hbar\omega_\lambda/k_\mathrm{B} T)-1]^2}.
$$
The physical unit is eV/K.
The array shape is (temperature, irreducible q-point, phonon band).
(iofile_kappa_hdf5_kappa)=
### `kappa`
Thermal conductivity tensor. The physical unit is W/m-K.
The array shape is (temperature, 6 = (xx, yy, zz, yz, xz, xy)).
### `mode-kappa`
Thermal conductivity tensors at k-stars (${}^*\mathbf{k}$):
$$
\sum_{\mathbf{q} \in {}^*\mathbf{k}} \kappa_{\mathbf{q}j}.
$$
The sum of this over ${}^*\mathbf{k}$ corresponding to
irreducible q-points divided by number of grid points gives
$\kappa$ ({ref}`iofile_kappa_hdf5_kappa`), e.g.,:
```python
kappa_xx_at_index_30 = mode_kappa[30, :, :, 0].sum()/ weight.sum()
```
Be careful that until version 1.12.7, mode-kappa values were divided
by number of grid points.
The physical unit is W/m-K. Each tensor element is the sum of tensor
elements on the members of ${}^*\mathbf{k}$, i.e., symmetrically
equivalent q-points by crystallographic point group and time reversal
symmetry.
The array shape is (temperature, irreducible q-point, phonon band, 6 =
(xx, yy, zz, yz, xz, xy)).
### `gv_by_gv`
Outer products of group velocities for k-stars
(${}^*\mathbf{k}$) for each irreducible q-point and phonon band
($j$):
$$
\sum_{\mathbf{q} \in {}^*\mathbf{k}} \mathbf{v}_{\mathbf{q}j} \otimes
\mathbf{v}_{\mathbf{q}j}.
$$
The physical unit is
$\text{THz}^2\cdot\text{Angstrom}^2$, where THz is in the
ordinal frequency not the angular frequency.
The array shape is (irreducible q-point, phonon band, 6 = (xx, yy, zz,
yz, xz, xy)).
### `q-point`
Irreducible q-points in reduced coordinates.
The array shape is (irreducible q-point, 3 = reduced
coordinates in reciprocal space).
### `temperature`
Temperatures where thermal conductivities are calculated. The physical
unit is K.
### `weight`
Weights corresponding to irreducible q-points. Sum of weights equals to
the number of mesh grid points.
### `ave_pp`
Averaged phonon-phonon interaction $P_{\mathbf{q}j}$ in $\text{eV}^2$:
$$
P_{\mathbf{q}j} = \frac{1}{(3n_\mathrm{a})^2} \sum_{\lambda'\lambda''}
|\Phi_{\lambda\lambda'\lambda''}|^2.
$$
This is not going to be calculated in the RTA thermal coductivity
calculation mode by default. To calculate this, `--full-pp` option
has to be specified (see {ref}`full_pp_option`).
### `boundary_mfp`
A value specified by {ref}`boundary_mfp_option`. The physical unit is
micrometer.
When `--boundary-mfp` option is explicitly specified, its value is stored here.
### `kappa_unit_conversion`
This is used to convert the physical unit of lattice thermal
conductivity made of `heat_capacity`, `group_velocity`, and
`gamma`, to W/m-K. In the single mode relaxation time (SMRT) method,
a mode contribution to the lattice thermal conductivity is given by
$$
\kappa_\lambda = \frac{1}{V_0} C_\lambda \mathbf{v}_\lambda \otimes
\mathbf{v}_\lambda \tau_\lambda^{\mathrm{SMRT}}.
$$
For example, $\kappa_{\lambda,{xx}}$ is calculated by:
```python
In [1]: import h5py
In [2]: f = h5py.File("kappa-m111111.hdf5")
In [3]: kappa_unit_conversion = f['kappa_unit_conversion'][()]
In [4]: weight = f['weight'][:]
In [5]: heat_capacity = f['heat_capacity'][:]
In [6]: gv_by_gv = f['gv_by_gv'][:]
In [7]: gamma = f['gamma'][:]
In [8]: kappa_unit_conversion * heat_capacity[30, 2, 0] * gv_by_gv[2, 0] / (2 * gamma[30, 2, 0])
Out[8]:
array([ 1.02050241e+03, 1.02050241e+03, 1.02050241e+03,
4.40486382e-15, 0.00000000e+00, -4.40486382e-15])
In [9]: f['mode_kappa'][30, 2, 0]
Out[9]:
array([ 1.02050201e+03, 1.02050201e+03, 1.02050201e+03,
4.40486209e-15, 0.00000000e+00, -4.40486209e-15])
```
(iofile_kappa_hdf5_gamma_NU)=
### `gamma_N` and `gamma_U`
The data are stored in `kappa-mxxx(-gx-sx-sdx).hdf5` file and accessed by
`gamma_N` and `gamma_U` keys. The shape of the arrays is the same as that of
`gamma` (see {ref}`iofile_kappa_hdf5_gamma`). An example (Si-PBEsol) is shown
below:
```bash
% phono3py-load --mesh 11 11 11 --fc3 --fc2 --br --nu
...
% ipython
```
```python
In [1]: import h5py
In [2]: f = h5py.File("kappa-m111111.hdf5", 'r')
In [3]: list(f)
Out[3]:
['frequency',
'gamma',
'gamma_N',
'gamma_U',
'group_velocity',
'gv_by_gv',
'heat_capacity',
'kappa',
'kappa_unit_conversion',
'mesh',
'mode_kappa',
'qpoint',
'temperature',
'weight']
In [4]: f['gamma'].shape
Out[4]: (101, 56, 6)
In [5]: f['gamma_N'].shape
Out[5]: (101, 56, 6)
In [6]: f['gamma_U'].shape
Out[6]: (101, 56, 6)
```
## `gamma-*.hdf5`
Imaginary parts of self energies at harmonic phonon frequencies
($\Gamma_\lambda(\omega_\lambda)$ = half linewidths) are stored in THz. See
{ref}`write_gamma_option`.
### `gamma_detail-*.hdf5`
(iofile_gamma_detail_hdf5)=
## `gamma_detail-*.hdf5`
Q-point triplet contributions to imaginary parts of self energies at phonon
frequencies (half linewidths) are stored in THz. See
{ref}`write_detailed_gamma_option`.
{ref}`--write-gamma-detail <write_detailed_gamma_option>` option.
## Simple text file
In the output file in hdf5, following keys are used to extract the detailed
information.
### `gammas-*.dat`
```{table}
| dataset | Array shape |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| gamma_detail for `--ise` | (temperature, sampling frequency point, symmetry reduced set of triplets at given grid point, band1, band2, band3) in THz (without $2\pi$) |
| gamma_detail for `--br` | (temperature, symmetry reduced set of triplets at gvien grid point, band1, band2, band3) in THz (without $2\pi$) |
| mesh | Numbers of sampling mesh along reciprocal axes. |
| frequency_point for `--ise` | Sampling frequency points in THz (without $2\pi$), i.e., $\omega$ in $\Gamma_\lambda(\omega)$ |
| temperature | (temperature,), Temperatures in K |
| triplet | (symmetry reduced set of triplets at given grid point, 3), Triplets are given by the grid point indices (see below). |
| weight | (symmetry reduced set of triplets at given grid point,), Weight of each triplet to imaginary part of self energy |
| triplet_all | (triplets at given grid point, 3), symmetry non-reduced version of the triplet information. |
```
See {ref}`grid_triplets` to recover the q-points of each triplet.
Imaginary part of self energy (linewidth/2) is recovered by the following
script:
```python
import h5py
import numpy as np
gd = h5py.File("gamma_detail-mxxx-gx.hdf5")
temp_index = 30 # index of temperature
temperature = gd['temperature'][temp_index]
gamma_tp = gd['gamma_detail'][:].sum(axis=-1).sum(axis=-1)
weight = gd['weight'][:]
gamma = np.dot(weight, gamma_tp[temp_index])
```
For example, for `--br`, this `gamma` gives $\Gamma_\lambda(\omega_\lambda)$ of
the band indices at the grid point indicated by $\lambda$ at the temperature of
index 30. If any bands are degenerated, those `gamma` in
`kappa-mxxx-gx(-sx-sdx).hdf5` or `gamma-mxxx-gx(-sx-sdx).hdf5` type file are
averaged, but the `gamma` obtained here in this way are not symmetrized. Apart
from this symmetrization, the values must be equivalent between them.
To understand each contribution of triptle to imaginary part of self energy,
reading `phonon-mxxx.hdf5` is useful (see {ref}`write_phonon_option`). For
example, phonon triplets of three phonon scatterings are obtained by
```python
import h5py
import numpy as np
gd = h5py.File("gamma_detail-mxxx-gx.hdf5", 'r')
ph = h5py.File("phonon-mxxx.hdf5", 'r')
gp1 = gd['grid_point'][()]
triplets = gd['triplet'][:] # Sets of (gp1, gp2, gp3) where gp1 is fixed
mesh = gd['mesh'][:]
grid_address = ph['grid_address'][:]
q_triplets = grid_address[triplets] / mesh.astype('double') # For conventional regular grid
# Phonons of triplets[2]
phonon_tp = [(ph['frequency'][i], ph['eigenvector'][i]) for i in triplets[2]]
# Fractions of contributions of triplets at this grid point and temperature index 30
gamma_sum_over_bands = np.dot(weight, gd['gamma_detail'][30].sum(axis=-1).sum(axis=-1).sum(axis=-1))
contrib_tp = [gd['gamma_detail'][30, i].sum() / gamma_sum_over_bands for i in range(len(weight))]
np.dot(weight, contrib_tp) # is one
```
(iofile_phonon_hdf5)=
## `phonon-*.hdf5`
Contents of `phonon-mxxx.hdf5` are watched by:
```python
In [1]: import h5py
In [2]: f = h5py.File("phonon-m111111.hdf5")
In [3]: list(f)
Out[3]:
['eigenvector',
'frequency',
'grid_address',
'ir_grid_points',
'ir_grid_weights',
'mesh',
'version']
In [4]: f['mesh'][:]
Out[4]: array([11, 11, 11])
In [5]: f['grid_address'].shape
Out[5]: (1367, 3)
In [6]: f['frequency'].shape
Out[6]: (1367, 6)
In [7]: f['eigenvector'].shape
Out[7]: (1367, 6, 6)
In [8]: f['ir_grid_points'].shape
Out[8]: (56,)
```
The first axis of `ph['grid_address']`, `ph['frequency']`, and
`ph['eigenvector']` corresponds to the number of q-points where phonons are
calculated. Here the number of phonons may not be equal to product of mesh
numbers ($1367 \neq 11^3$). This is because all q-points on Brillouin zone
boundary are included, i.e., even if multiple q-points are translationally
equivalent, those phonons are stored separately though these phonons are
physically equivalent within the equations employed in phono3py. Here Brillouin
zone is defined by WignerSeitz cell of reciprocal primitive basis vectors. This
is convenient to categorize phonon triplets into Umklapp and Normal scatterings
based on the Brillouin zone.
## `pp-*.hdf5`
This file contains phonon-phonon interaction strength
$\bigl|\Phi_{\lambda\lambda'\lambda''}\bigl|^2$. To use the data in this
file, it is recommended to generate with `--full-pp` option because the data
structure to access becomes simpler.
```bash
% phono3py-load phono3py.yaml --gp 5 --br --mesh 11 11 11 --write-pp --full-pp
```
```python
In [1]: import h5py
In [2]: f = h5py.File("pp-m111111-g5.hdf5")
In [3]: list(f)
Out[3]: ['pp', 'triplet', 'triplet_all', 'version', 'weight']
In [4]: f['pp'].shape
Out[4]: (146, 6, 6, 6)
```
Indices of the `pp` array are (symmetry reduced set of triplets at given grid
point, band1, band2, band3), and the values are given in $\text{eV}^2$. See
{ref}`grid_triplets` to recover the q-points of each triplet.
Except for `pp`, all the other information are equivalent to those found in
{ref}`iofile_gamma_detail_hdf5`.
## `gammas-*.dat`
Imaginary parts of self energies with respect to frequency
$\Gamma_\lambda(\omega)$ are stored in THz. See {ref}`ise_option`.
### `jdos-*.dat`
## `jdos-*.dat`
Joint densities of states are stored in Thz. See {ref}`jdos_option`.
### `linewidth-*.dat`
## `linewidth-*.dat`

View File

@ -42,7 +42,7 @@ If phono3py is compiled with a special compiler or special options, manual
modification of `CMakeLists.txt` may be needed.
- {ref}`Linear algebra library <install_lapacke>`: BLAS, LAPACK, and LAPACKE
- {ref}`OpenMP library <install_openmp>`: For the multithreding support.
(optional, see {ref}`install_with_lapacke`)
These packages may be installed by the package manager of OS (e.g. `apt`) or
conda environment. Automatic search of required libraries and flags that are
@ -61,24 +61,6 @@ See an example at {ref}`install_an_example`. In the standard output, flags and
libraries found by cmake are shown. Please carefully check if those
configurations are expected ones or not.
(install_without_lapacke)=
### Building without linking LAPACKE
**Experimental**
To compile phono3py without linking LAPACKE in C, use the following command:
```
% BUILD_WITHOUT_LAPACKE=ON pip install -e . -vvv
```
When this option is enabled, linking to BLAS and LAPACKE libraries is not
required, so installing these libraries for C compilation may not be necessary.
However, since numpy and scipy rely on BLAS and LAPACK libraries, their runtime
versions are still required.
(install_an_example)=
## Installation instruction of latest development version of phono3py
When using conda, `PYTHONPATH` should not be set if possible because potentially
@ -122,7 +104,7 @@ wrong python libraries can be imported.
% conda install numpy scipy h5py pyyaml matplotlib-base c-compiler cxx-compiler cmake spglib
```
Unless {ref}`install_without_lapacke`, the following packages will be
Unless {ref}`install_with_lapacke`, the following packages will be
necessary to compile phono3py:
```bash
@ -142,7 +124,7 @@ wrong python libraries can be imported.
% conda install numpy scipy h5py pyyaml matplotlib-base c-compiler cxx-compiler spglib cmake
```
Unless {ref}`install_without_lapacke`, the following package will be
Unless {ref}`install_with_lapacke`, the following package will be
necessary to compile phono3py:
```bash
@ -185,6 +167,27 @@ LAPACK*E* is the C-wrapper of LAPACK and LAPACK relies on BLAS. Both
single-thread or multithread BLAS can be used in phono3py. In the following,
multiple different ways of installation of LAPACKE are explained.
(install_with_lapacke)=
#### Building with linking LAPACKE
Phono3py can operate without linking to LAPACKE, which is the default
compilation setting. However, it is also possible to compile Phono3py with
LAPACKE support. When compiled this way, the diagonalization of the dynamical
matrix is handled by LAPACK routines within the C code of Phono3py.
Additionally, LAPACK is used for the diagonalization of the collision matrix
in the direct solution.
To compile phono3py with linking LAPACKE in C, use the following command:
```
% BUILD_WITHOUT_LAPACKE=OFF pip install -e . -vvv
```
For this, BLAS and LAPACKE libraries are required.
(install_an_example)=
#### OpenBLAS provided by conda
The installation of LAPACKE is easy by conda. It is:

View File

@ -148,7 +148,7 @@ shape of `(num_supercells, num_atoms_in_supercell, 3)`. In the above example,
the array shape is `(1254, 72, 3)`.
If the calculated force sets are stored in the
{ref}`input-output_files_FORCES_FC3` file, the numpy array of `forces` is
{ref}`iofile_FORCES_FC3` file, the numpy array of `forces` is
obtained by
```python

View File

@ -9,7 +9,7 @@ over many different force calculators. Once `phono3py_disp.yaml` is created, the
following operations will be the same using this command.
This is used almost in the same way as `phono3py` command, e.g., but there are
some differences. The following default behaviours are different from that of
some differences. The following default behaviors are different from that of
those of `phono3py` command:
1. `phono3py_xxx.yaml` type file is always necessary in either of two ways:

View File

@ -2,8 +2,6 @@
# Force constants calculation using pypolymlp (machine learning potential)
**This is an experimental feature.**
With the `--pypolymlp` option, phono3py can interface with the polynomial
machine learning potential (MLP) code,
[pypolymlp](https://github.com/sekocha/pypolymlp), to perform training and
@ -20,8 +18,8 @@ For further details on combining phono3py calculations with pypolymlp, refer to
[[doi](https://doi.org/10.1063/5.0211296)]
[[arxiv](https://arxiv.org/abs/2401.17531)].
An example of its usage can be found in the `example/NaCl-pypolymlp` directory
in the distribution from GitHub or PyPI.
Examples of its usage can be found in the `example/NaCl-pypolymlp` and
`example/AlN-rd` directories in the distribution from GitHub or PyPI.
## Citation of pypolymlp
@ -61,7 +59,7 @@ in the distribution from GitHub or PyPI.
`phono3py_params.yaml`. Use {ref}`--cf3 <cf3_option>` and {ref}`--sp
<sp_option>` option simultaneously.
4. Develop MLPs. By default, 90 and 10 percents of the dataset are used for the
training and test, respectively. At this step `phono3py.pmlp` is saved.
training and test, respectively. At this step `polymlp.yaml` is saved.
5. Generate displacements in supercells either systematic or random displacements.
6. Evaluate MLPs for forces of the supercells generated in step 5.
7. Calculate force constants from displacement-force dataset from steps 5 and 6.
@ -153,30 +151,28 @@ obtained by
```
``````
### Step 4: Development of MLPs
### Steps 4-7: Force constants calculation (systematic displacements in step 5)
After developing MLPs, displacements are generated systematically considering
crystal symmetry.
Having `phono3py_params.yaml`, phono3py is executed with `--pypolymlp` option,
The `phono3py_params.yaml` file contains the training data required for
developing polynomial MLPs when running with the `--pypolymlp` option.
```
% phono3py-load --pypolymlp phono3py_params.yaml
phono3py-load --pypolymlp phono3py_params.yaml
_ _____
_ __ | |__ ___ _ __ ___|___ / _ __ _ _
| '_ \| '_ \ / _ \| '_ \ / _ \ |_ \| '_ \| | | |
| |_) | | | | (_) | | | | (_) |__) | |_) | |_| |
| .__/|_| |_|\___/|_| |_|\___/____/| .__/ \__, |
|_| |_| |___/
3.5.0
3.18.0
-------------------------[time 2024-09-19 15:20:27]-------------------------
-------------------------[time 2025-07-26 13:59:10]-------------------------
Compiled with OpenMP support (max 10 threads).
Running in phono3py.load mode.
Python version 3.12.6
Spglib version 2.5.0
Python version 3.13.3
Spglib version 2.6.1
----------------------------- General settings -----------------------------
Run mode: pypolymlp
HDF5 data compression filter: gzip
Crystal structure was read from "phono3py_params.yaml".
Supercell (dim): [2 2 2]
@ -187,52 +183,26 @@ Primitive matrix:
Spacegroup: Fm-3m (225)
Use -v option to watch primitive cell, unit cell, and supercell structures.
NAC parameters were read from "phono3py_params.yaml".
----------------------------- Force constants ------------------------------
Displacement dataset for fc3 was read from "phono3py_params.yaml".
----------------------------- pypolymlp start ------------------------------
Pypolymlp version 0.12.9
Pypolymlp is a generator of polynomial machine learning potentials.
Please cite the paper: A. Seko, J. Appl. Phys. 133, 011101 (2023).
Pypolymlp is developed at https://github.com/sekocha/pypolymlp.
Parameters:
cutoff: 8.0
model_type: 3
max_p: 2
gtinv_order: 3
gtinv_maxl: (8, 8)
gaussian_params1: (1.0, 1.0, 1)
gaussian_params2: (0.0, 7.0, 10)
Developing MLPs by pypolymlp...
Regression: cholesky decomposition ...
- alpha: 0.001
- alpha: 0.01
- alpha: 0.1
- alpha: 1.0
- alpha: 10.0
Clear training X.T @ X
Calculate X.T @ X for test data
Clear test X.T @ X
Regression: model selection ...
- alpha = 1.000e-03 : rmse (train, test) = 9.39542e+14 9.39543e+14
- alpha = 1.000e-02 : rmse (train, test) = 9.39542e+14 9.39543e+14
- alpha = 1.000e-01 : rmse (train, test) = 0.03738 0.04961
- alpha = 1.000e+00 : rmse (train, test) = 0.03900 0.04742
- alpha = 1.000e+01 : rmse (train, test) = 0.04058 0.04584
MLPs were written into "phono3py.pmlp"
MLPs were written into "polymlp.yaml"
------------------------------ pypolymlp end -------------------------------
Generate displacements
Displacement distance: 0.001
Evaluate forces in 292 supercells by pypolymlp
Computing fc3[ 1, x, x ] using numpy.linalg.pinv.
Displacements (in Angstrom):
[ 0.0010 0.0000 0.0000]
[-0.0010 0.0000 0.0000]
Computing fc3[ 33, x, x ] using numpy.linalg.pinv.
Displacements (in Angstrom):
[ 0.0010 0.0000 0.0000]
[-0.0010 0.0000 0.0000]
Expanding fc3.
fc3 was symmetrized.
fc2 was symmetrized.
Max drift of fc3: -0.000000 (zzz) -0.000000 (zzz) -0.000000 (zzz)
Max drift of fc2: -0.000000 (zz) -0.000000 (zz)
fc3 was written into "fc3.hdf5".
fc2 was written into "fc2.hdf5".
----------- None of ph-ph interaction calculation was performed. -----------
Dataset generated using MMLPs was written in "phono3py_mlp_eval_dataset.yaml".
Generate displacements (--rd or -d) for proceeding to phonon calculations.
Summary of calculation was written in "phono3py.yaml".
-------------------------[time 2024-09-19 15:21:41]-------------------------
-------------------------[time 2025-07-26 14:00:12]-------------------------
_
___ _ __ __| |
/ _ \ '_ \ / _` |
@ -242,43 +212,38 @@ Summary of calculation was written in "phono3py.yaml".
Information about the development of MLPs using pypolymlp is provided between
the `pypolymlp start` and `pypolymlp end` sections. The polynomial MLPs are
saved in the `phono3py.pmlp` file, which can be reused in subsequent phono3py
saved in the `polymlp.yaml` file, which can be reused in subsequent phono3py
executions with the `--pypolymlp` option when only displacements (and no forces)
are provided.
After the MLPs are developed, systematic displacements, such as those involving
the displacement of one or two atoms in supercells, are generated with a
displacement distance of 0.001 Angstrom. The forces for these supercells are
then evaluated using pypolymlp. Both the generated displacements and the
corresponding forces are stored in the `phono3py_mlp_eval_dataset` file.
(systematic displacements)
### Steps 5-7: Force constants calculation (systematic displacements in step 5)
### Steps 4-7: Force constants calculation (random displacements in step 5)
After developing MLPs, random displacements are generated by specifying
{ref}`--rd <random_displacements_option>` option. To compute force constants
with random displacements, an external force constants calculator is necessary.
For this, symfc is used which is invoked by `--symfc` option.
Having `phono3py_params.yaml`, phono3py is executed with `--pypolymlp` option,
With the `-d` option, displacements are systematically generated while taking
crystal symmetry into account. When running with the `--pypolymlp` option, MLPs
are read from `polymlp.yaml` if the file exists. In this case, training data is
no longer required, and files such as `phono3py.yaml` can be used as the input
structure file.
```
% phono3py-load --pypolymlp --rd 200 --symfc phono3py_params.yaml
% phono3py-load --pypolymlp -d phono3py.yaml
_ _____
_ __ | |__ ___ _ __ ___|___ / _ __ _ _
| '_ \| '_ \ / _ \| '_ \ / _ \ |_ \| '_ \| | | |
| |_) | | | | (_) | | | | (_) |__) | |_) | |_| |
| .__/|_| |_|\___/|_| |_|\___/____/| .__/ \__, |
|_| |_| |___/
3.5.0
3.18.0
-------------------------[time 2024-09-19 15:33:23]-------------------------
-------------------------[time 2025-07-26 14:00:49]-------------------------
Compiled with OpenMP support (max 10 threads).
Running in phono3py.load mode.
Python version 3.12.6
Spglib version 2.5.0
Python version 3.13.3
Spglib version 2.6.1
----------------------------- General settings -----------------------------
Run mode: pypolymlp + force constants
HDF5 data compression filter: gzip
Crystal structure was read from "phono3py_params.yaml".
Crystal structure was read from "phono3py.yaml".
Supercell (dim): [2 2 2]
Primitive matrix:
[0. 0.5 0.5]
@ -286,57 +251,48 @@ Primitive matrix:
[0.5 0.5 0. ]
Spacegroup: Fm-3m (225)
Use -v option to watch primitive cell, unit cell, and supercell structures.
NAC parameters were read from "phono3py_params.yaml".
----------------------------- Force constants ------------------------------
Displacement dataset for fc3 was read from "phono3py_params.yaml".
NAC parameters were read from "phono3py.yaml".
----------------------------- pypolymlp start ------------------------------
Pypolymlp version 0.12.9
Pypolymlp is a generator of polynomial machine learning potentials.
Please cite the paper: A. Seko, J. Appl. Phys. 133, 011101 (2023).
Pypolymlp is developed at https://github.com/sekocha/pypolymlp.
Developing MLPs by pypolymlp...
Regression: cholesky decomposition ...
- alpha: 0.001
- alpha: 0.01
- alpha: 0.1
- alpha: 1.0
- alpha: 10.0
Clear training X.T @ X
Calculate X.T @ X for test data
Clear test X.T @ X
Regression: model selection ...
- alpha = 1.000e-03 : rmse (train, test) = 9.39542e+14 9.39543e+14
- alpha = 1.000e-02 : rmse (train, test) = 9.39542e+14 9.39543e+14
- alpha = 1.000e-01 : rmse (train, test) = 0.03738 0.04961
- alpha = 1.000e+00 : rmse (train, test) = 0.03900 0.04742
- alpha = 1.000e+01 : rmse (train, test) = 0.04058 0.04584
MLPs were written into "phono3py.pmlp"
Load MLPs from "polymlp.yaml".
------------------------------ pypolymlp end -------------------------------
Generate random displacements
Twice of number of snapshots will be generated for plus-minus displacements.
Displacement distance: 0.001
Evaluate forces in 400 supercells by pypolymlp
-------------------------------- Symfc start -------------------------------
Symfc is a non-trivial force constants calculator. Please cite the paper:
A. Seko and A. Togo, arXiv:2403.03588.
Symfc is developed at https://github.com/symfc/symfc.
Computing [2, 3] order force constants.
Increase log-level to watch detailed symfc log.
--------------------------------- Symfc end --------------------------------
-------------------------------- Symfc start -------------------------------
Symfc is a non-trivial force constants calculator. Please cite the paper:
A. Seko and A. Togo, arXiv:2403.03588.
Symfc is developed at https://github.com/symfc/symfc.
Computing [2] order force constants.
Increase log-level to watch detailed symfc log.
--------------------------------- Symfc end --------------------------------
Max drift of fc3: -0.000000 (xyx) 0.000000 (zyy) -0.000000 (xyx)
Max drift of fc2: 0.000000 (xx) 0.000000 (xx)
Generate displacements
Displacement distance: 0.01
Evaluate forces in 292 supercells by pypolymlp
Dataset generated using MLPs was written in "phono3py_mlp_eval_dataset.yaml".
----------------------------- Force constants ------------------------------
Computing fc3[ 1, x, x ] using numpy.linalg.pinv.
Displacements (in Angstrom):
[ 0.0100 0.0000 0.0000]
[-0.0100 0.0000 0.0000]
Computing fc3[ 33, x, x ] using numpy.linalg.pinv.
Displacements (in Angstrom):
[ 0.0100 0.0000 0.0000]
[-0.0100 0.0000 0.0000]
Expanding fc3.
Symmetrizing fc3 by symfc projector.
Symfc version 1.5.3 (https://github.com/symfc/symfc)
Citation: A. Seko and A. Togo, Phys. Rev. B, 110, 214302 (2024)
Symmetrizing fc2 by symfc projector.
Symfc version 1.5.3 (https://github.com/symfc/symfc)
Citation: A. Seko and A. Togo, Phys. Rev. B, 110, 214302 (2024)
Max drift of fc3: 0.00000000 (zyz) 0.00000000 (yzz) 0.00000000 (yzz)
Max drift of fc2: -0.00000000 (yy) -0.00000000 (yy)
fc3 was written into "fc3.hdf5".
fc2 was written into "fc2.hdf5".
--------------------------- Calculation settings ---------------------------
Non-analytical term correction (NAC): True
NAC unit conversion factor: 14.39965
BZ integration: Tetrahedron-method
Temperatures: 0.0 300.0
Cutoff frequency: 0.01
Frequency conversion factor to THz: 15.63330
----------- None of ph-ph interaction calculation was performed. -----------
Dataset generated using MMLPs was written in "phono3py_mlp_eval_dataset.yaml".
Summary of calculation was written in "phono3py.yaml".
-------------------------[time 2024-09-19 15:34:41]-------------------------
-------------------------[time 2025-07-26 14:00:58]-------------------------
_
___ _ __ __| |
/ _ \ '_ \ / _` |
@ -344,14 +300,213 @@ Summary of calculation was written in "phono3py.yaml".
\___|_| |_|\__,_|
```
The development of MLPs follows the same procedure as described for the
systematic displacements (in step 5) above.
After the MLPs are read, systematic displacements, such as those involving the
displacement of one or two atoms in supercells, are generated with a
displacement distance of 0.01 Angstrom. The forces for these supercells are then
evaluated using pypolymlp. Both the generated displacements and the
corresponding forces are stored in the `phono3py_mlp_eval_dataset.yaml` file.
After the MLPs are developed, 200 supercells with random directional
displacements are generated. These displacements are then inverted, resulting in
an additional 200 supercells. In total, 400 supercells are created. The forces
for these supercells are then evaluated. Finally, the force constants are
calculated using symfc.
### Steps 5-7: Force constants calculation (random displacements in step 5)
Random displacements are generated by specifying {ref}`--rd
<random_displacements_option>` option. When running with the `--pypolymlp`
option, MLPs are read from `polymlp.yaml` if the file exists. In this case,
training data is no longer required, and files such as `phono3py.yaml` can be
used as the input structure file.
```
% phono3py-load --pypolymlp --rd auto phono3py.yaml
_ _____
_ __ | |__ ___ _ __ ___|___ / _ __ _ _
| '_ \| '_ \ / _ \| '_ \ / _ \ |_ \| '_ \| | | |
| |_) | | | | (_) | | | | (_) |__) | |_) | |_| |
| .__/|_| |_|\___/|_| |_|\___/____/| .__/ \__, |
|_| |_| |___/
3.18.0
-------------------------[time 2025-07-26 14:02:24]-------------------------
Compiled with OpenMP support (max 10 threads).
Running in phono3py.load mode.
Python version 3.13.3
Spglib version 2.6.1
----------------------------- General settings -----------------------------
Run mode: pypolymlp + force constants
HDF5 data compression filter: gzip
Crystal structure was read from "phono3py.yaml".
Supercell (dim): [2 2 2]
Primitive matrix:
[0. 0.5 0.5]
[0.5 0. 0.5]
[0.5 0.5 0. ]
Spacegroup: Fm-3m (225)
Use -v option to watch primitive cell, unit cell, and supercell structures.
NAC parameters were read from "phono3py.yaml".
----------------------------- pypolymlp start ------------------------------
Pypolymlp version 0.12.9
Pypolymlp is a generator of polynomial machine learning potentials.
Please cite the paper: A. Seko, J. Appl. Phys. 133, 011101 (2023).
Pypolymlp is developed at https://github.com/sekocha/pypolymlp.
Load MLPs from "polymlp.yaml".
------------------------------ pypolymlp end -------------------------------
Generate random displacements
Twice of number of snapshots will be generated for plus-minus displacements.
Displacement distance: 0.01
Evaluate forces in 32 supercells by pypolymlp
Dataset generated using MLPs was written in "phono3py_mlp_eval_dataset.yaml".
----------------------------- Force constants ------------------------------
Type-II dataset for displacements and forces was provided,
but the selected force constants calculator cannot process it.
Use another force constants calculator, e.g., symfc,
to generate force constants.
Try symfc to handle general (or random) displacements.
-------------------------------- Symfc start -------------------------------
Symfc version 1.5.3 (https://github.com/symfc/symfc)
Citation: A. Seko and A. Togo, Phys. Rev. B, 110, 214302 (2024)
Computing [2, 3] order force constants.
Increase log-level to watch detailed symfc log.
--------------------------------- Symfc end --------------------------------
Max drift of fc3: -0.00000000 (xyx) -0.00000000 (yxx) -0.00000000 (yxx)
Max drift of fc2: -0.00000000 (yy) -0.00000000 (yy)
fc3 was written into "fc3.hdf5".
fc2 was written into "fc2.hdf5".
--------------------------- Calculation settings ---------------------------
Non-analytical term correction (NAC): True
NAC unit conversion factor: 14.39965
BZ integration: Tetrahedron-method
Temperatures: 0.0 300.0
Cutoff frequency: 0.01
Frequency conversion factor to THz: 15.63330
----------- None of ph-ph interaction calculation was performed. -----------
Summary of calculation was written in "phono3py.yaml".
-------------------------[time 2025-07-26 14:02:29]-------------------------
_
___ _ __ __| |
/ _ \ '_ \ / _` |
| __/ | | | (_| |
\___|_| |_|\__,_|
```
After the MLPs are read, 16 supercells with random directional displacements are
generated by the option `--rd auto`. These displacements are then inverted (such
as $\Delta \mathbf{u}_i$ and $-\Delta \mathbf{u}_i$ of all atoms $i$ in each
supercell), resulting in an additional 16 supercells. In total, 32 supercells
are created. The forces for these supercells are then evaluated. Finally, the
force constants are calculated using symfc. The `--rd-auto-factor` option can
change the number of supercells generated.
## Command options for force constants calculation
After obtaining the MLPs, displacements are generated using these MLPs, and the
resulting forces are computed. The displacement distance is controlled by the
`--amplitude` option, with a default value of 0.01 Angstrom. When `-d` is
specified, systematic displacements are introduced. When the `--rd` option is
used, it specifies the number of supercells with random directional
displacements. To ensure accurate force constants, the actual number of
generated supercells is twice the specified value.
When atoms in the unit cell have positional degrees of freedom within the
crystal symmetry, the `--relax-atomic-positions` option can relax their
positions using MLPs. In the `example/AlN-rd` case, the following command
develops polynomial MLPs and then relaxes atomic positions using these MLPs. The
force constants are calculated using supercells with 0.005 Angstrom systematic
displacements.
```
% phono3py-load phonopy_params_mp-661.yaml.xz --pypolymlp --relax-atomic-positions -d
_ _____
_ __ | |__ ___ _ __ ___|___ / _ __ _ _
| '_ \| '_ \ / _ \| '_ \ / _ \ |_ \| '_ \| | | |
| |_) | | | | (_) | | | | (_) |__) | |_) | |_| |
| .__/|_| |_|\___/|_| |_|\___/____/| .__/ \__, |
|_| |_| |___/
3.18.0-dev21+ge26f3ecb
-------------------------[time 2025-07-26 14:29:16]-------------------------
Compiled with OpenMP support (max 10 threads).
Running in phono3py.load mode.
Python version 3.13.3
Spglib version 2.6.1
----------------------------- General settings -----------------------------
Run mode: pypolymlp + force constants
HDF5 data compression filter: gzip
Crystal structure was read from "phonopy_params_mp-661.yaml.xz".
Supercell (dim): [4 4 2]
Primitive matrix:
[1. 0. 0.]
[0. 1. 0.]
[0. 0. 1.]
Spacegroup: P6_3mc (186)
Use -v option to watch primitive cell, unit cell, and supercell structures.
NAC parameters were read from "phonopy_params_mp-661.yaml.xz".
Displacement dataset for fc3 was read from "phonopy_params_mp-661.yaml.xz".
----------------------------- pypolymlp start ------------------------------
Pypolymlp version 0.12.9.post0
Pypolymlp is a generator of polynomial machine learning potentials.
Please cite the paper: A. Seko, J. Appl. Phys. 133, 011101 (2023).
Pypolymlp is developed at https://github.com/sekocha/pypolymlp.
Parameters:
cutoff: 8.0
model_type: 3
max_p: 2
gtinv_order: 3
gtinv_maxl: (8, 8)
gaussian_params1: (1.0, 1.0, 1)
gaussian_params2: (0.0, 7.0, 10)
Developing MLPs by pypolymlp...
MLPs were written into "polymlp.yaml"
------------------------------ pypolymlp end -------------------------------
Relaxing atomic positions using polynomial MLPs...
Change in fractional position and in distance:
1 N : 0.00000000 0.00000000 -0.00000021 (|d|=0.00000105)
2 N : 0.00000000 0.00000000 -0.00000021 (|d|=0.00000105)
3 Al: 0.00000000 0.00000000 0.00000021 (|d|=0.00000105)
4 Al: 0.00000000 0.00000000 0.00000021 (|d|=0.00000105)
----------------------------------------------------------------------------
Generate displacements
Displacement distance: 0.005
Evaluate forces in 3720 supercells by pypolymlp
Dataset generated using MLPs was written in "phono3py_mlp_eval_dataset.yaml".
----------------------------- Force constants ------------------------------
Computing fc3[ 1, x, x ] using numpy.linalg.pinv.
Displacements (in Angstrom):
[ 0.0050 0.0000 0.0000]
[-0.0050 0.0000 0.0000]
[ 0.0000 0.0000 0.0050]
[ 0.0000 0.0000 -0.0050]
Computing fc3[ 65, x, x ] using numpy.linalg.pinv.
Displacements (in Angstrom):
[ 0.0050 0.0000 0.0000]
[-0.0050 0.0000 0.0000]
[ 0.0000 0.0000 0.0050]
[ 0.0000 0.0000 -0.0050]
Expanding fc3.
Symmetrizing fc3 by symfc projector.
Symfc version 1.5.3 (https://github.com/symfc/symfc)
Citation: A. Seko and A. Togo, Phys. Rev. B, 110, 214302 (2024)
Symmetrizing fc2 by symfc projector.
Symfc version 1.5.3 (https://github.com/symfc/symfc)
Citation: A. Seko and A. Togo, Phys. Rev. B, 110, 214302 (2024)
Max drift of fc3: -0.00000000 (xxz) -0.00000000 (xxz) -0.00000000 (xzx)
Max drift of fc2: -0.00000000 (xx) -0.00000000 (xx)
fc3 was written into "fc3.hdf5".
fc2 was written into "fc2.hdf5".
--------------------------- Calculation settings ---------------------------
Non-analytical term correction (NAC): True
NAC unit conversion factor: 14.39965
BZ integration: Tetrahedron-method
Temperatures: 0.0 300.0
Cutoff frequency: 0.01
Frequency conversion factor to THz: 15.63330
----------- None of ph-ph interaction calculation was performed. -----------
Summary of calculation was written in "phono3py.yaml".
-------------------------[time 2025-07-26 14:39:11]-------------------------
_
___ _ __ __| |
/ _ \ '_ \ / _` |
| __/ | | | (_| |
\___|_| |_|\__,_|
```
## Parameters for developing MLPs
@ -416,3 +571,14 @@ the next 100 supercells) will be computed and included. With this procedure in
mind, it may be convenient to generate a sufficiently large number of supercells
with random displacements in advance, such as 1000 supercells, before starting
the LTC calculation with pypolymlp.
## Converting `phono3py.pmlp` to `polymlp.yaml`
In older versions, polynomial MLPs were stored in `phono3py.pmlp`. This file can
be converted to `polymlp.yaml` using the following Python snippet.
```python
from pypolymlp.mlp_dev.pypolymlp import Pypolymlp
polymlp = Pypolymlp()
polymlp.convert_to_yaml(filename_txt="phono3py.pmlp", filename_yaml="polymlp.yaml”)
```

View File

@ -22,7 +22,7 @@ The option `--rd NUM` is used instead of `-d` in generating displacements as fol
`NUM` means the number of supercells with random directional displacements. This
must be specified, and the initial guess may be from around the number of
supecells generated for the systematic displacements by `-d`. In the case of the
supercells generated for the systematic displacements by `-d`. In the case of the
`NaCl-rd` example, 146 supercells are generated with `-d`, so similar
number `--rd 100` was chosen here.

View File

@ -1,111 +0,0 @@
(tips)=
# Tips
```{contents}
:depth: 2
:local:
```
(brillouinzone_sum)=
## Brillouin zone summation
Brillouin zone (BZ) summations appear at different two points in
phonon lifetime calculation. First it is used for the Fourier
transform of force constants, and second to obtain imaginary part of
phonon-self-energy. For the summation, usually uniform sampling meshes
are employed. To obtain more accurate result, it is always better to
use denser meshes. But the denser mesh requires more computational
demand.
The second BZ summation contains delta functions. In
phono3py calculation, a linear tetrahedron method ({ref}`thm option <thm_option>`, default option) and a smearing method ({ref}`sigma option <sigma_option>`) can be used for this BZ
integration. In most cases, the tetrahedron method is better. Especially in high
thermal conductivity materials, the smearing method results in
underestimation of lattice thermal conductivity.
The figure below shows Si thermal conductivity convergence with
respect to number of mesh points along an axis from n=19 to 65. This
is calculated with RTA and the linear tetrahedron method. Within the
methods and phono3py implementation, it is converging at around n=55,
however this computational demand is not trivial. As far as observing
this result, an extrapolation to $1/n \rightarrow 0$ seems not a
good idea, since it gives overestimation in the case of this Si
example. This plot tells that we have to decide how much value is
acceptable as lattice thermal conductivity value. Therefore it
important to describe the number of sampling mesh and method of BZ
integration to let other people reproduce the computational results.
```{image} Si-convergence.png
:width: 25%
```
In case the smearing method is necessary to use, the convergence of
q-point mesh together with smearing width has to be checked
carefully. Since smearing parameter is used to approximate delta
functions, small `sigma` value is better to describe the detailed
structure of three-phonon-space, however it requires a denser sampling
mesh to converge the result. To check the convergence with respect to
the `sigma` value, multiple sigma values can be set. This can be
computationally efficient, since it is avoided to re-calculate
phonon-phonon interaction strength for different `sigma` values in
this case. Convergence with respect to the sampling mesh and smearing
parameter strongly depends on materials. For Si example, a
$20\times 20\times 20$ sampling mesh (or 8000 reducible sampling
points) and 0.1 THz smearing value for reciprocal of the volume of an
atom may be a good starting choice. The tetrahedron method requires no
such parameter as the smearing width.
## Importance of numerical quality of force constants
Third-order force constants (fc3) are much weaker to numerical noise
of a force calculator than second-order force constants
(fc2). Therefore supercell force calculations have to be done very
carefully.
Numerical quality of forces given by force calculators is the most
important factor for the numerical quality of lattice thermal
conductivity calculation. We may be able to apply symmetry constraints
to force constants, however even if force constants fulfill those
symmetries, the numerical quality of force constants is not guaranteed
since elements of force constants just suffice the symmetries but most
of those intensities are not constrained.
It is important to use the best possible force calculator in the
possibly best way. The knowledge of the force calculator from the
theory and method to the practical usage is required to obtain
good results of lattice thermal conductivity calculation.
In the following, a few things that may be good to know are
presented.
### A practical way to check lattice thermal conductivity result
Some feeling whether our calculation result is OK or not may be
obtained by comparing lattice thermal conductivities calculated with
and without {ref}`symmetrizations of force constants <symmetrization_option>`. If they are enough different, e.g., more
than twice different, it is better to re-consider about the force
calculation. In the case of DFT calculations, the choice of input
settings such as k-point sampling mesh, plane-wave energy cutoff, and
exchange-correlational potential, etc, should be reconsidered.
### Displacement distance of atoms
The phono3py default displacement distance is 0.03
$\text{Angstrom}$. In some cases, accurate result may not be obtained
due to the numerical noise of the force calculator. Usually increasing
the displacement distance by the {ref}`amplitude option <amplitude_option>` reduces the numerical noise, but as its drawback
higher order anharmonicity is involved (renormalized) into fc3 and fc2.
(file_format_compatibility)=
## File format compatibility with phonopy
- `FORCES_FC3` and `FORCES_FC2` are not
compatible with phonopy's `FORCE_SETS`.
- `FORCE_SETS` can be created using {ref}`--cfs <cfs_option>` from
`FORCES_FC3` and `phono3py_disp.yaml` or `FORCES_FC2` and
`phono3py_disp.yaml` (needs to specify `--dim-fc2`).
- `FORCES_FC2` can be created using {ref}`--fs2f2 <fs2f2_option>` from `FORCE_SETS`.
- `fc2.hdf5` can be used in phonopy in the `hdf5` mode when it is
renamed to `force_constants.hdf5`. In the previous combinations of
phonopy and phono3py, depending on the physical unit of force
constants of calculators, the direct compatibility is not guranteed.

View File

@ -54,13 +54,11 @@ indices are chosen and executed as follows:
% phono3py-load --mesh 19 19 19 --br --gp "0,1,2,3,4,5,6,7,8,9,20,21,22,23,24,25" --write-gamma
```
Then many `kappa-m191919-gx.hdf5` files are generated. These file
names should not be altered because in reading the data by phono3py,
those file names are supposed to be so, though there is a little
freedom to arrange those file names, for which see {ref}`-o <output_filename_option>` and {ref}`-i <input_filename_option>`
options. After completing calculations for all irreducible grid-point
indices, the RTA thermal conductivity is computed by another run in a
short time from the stored data:
Then many `kappa-m191919-gx.hdf5` files are generated. These file names should
not be altered because in reading the data by phono3py, those file names are
supposed to be so. After completing calculations for all irreducible grid-point
indices, the RTA thermal conductivity is computed by another run in a short time
from the stored data:
```bash
% phono3py-load --mesh 19 19 19 --br --read-gamma

63
example/AlN-rd/README.md Normal file
View File

@ -0,0 +1,63 @@
# AlN lattice thermal conductivity calculation from dataset for pypolymlp
## Computational setting of VASP calculations
For supercell forces and energies
- Supercell 4x4x2 of wurtzite unit cell
- Random directional displacements of 0.03 Angstrom
- PBE-sol
- 520 eV cutoff energy
- Gamma centered 2x2x2 kpoint mesh
- LREAL = .FALSE.
- ADDGRID = .TRUE.
For parameters of non-analytical term correction,
- PBE-sol
- 520 eV cutoff energy
- Gamma centered 7x7x4 kpoint mesh
- LEPSION = .TRUE.
- LREAL = .FALSE.
These data are stored in `phonopy_params_mp-661.yaml.xz`.
## Example of lattice thermal conductivity calculation
MLPs by pypolymlp are developed by
```bash
% phono3py-load phonopy_params_mp-661.yaml.xz --pypolymlp -v
```
Dataset with 180 supercells is used for training and 20 for the test. This
calculation will take 5-10 minutes depending on computer resource.
`pypolymlp.yaml` is made by this command.
Force constants are calculated by
```bash
% phono3py-load phonopy_params_mp-661.yaml.xz --pypolymlp --relax-atomic-positions -d
```
With the `--relax-atomic-positions` option, internal atomic positions in unit
cell are optimized by pypolymlp. The displacement-force dataset is stored in
`phono3py_mlp_eval_dataset.yaml`. Force constants are symmetried using symfc,
but the phono3py's traditional symmetrizer can be used with the option
`--fc-calculator traditional`. The symmetry constraints applied by this
traditional symmetrizer is weaker, but the calculation demands less memory
space.
Lattice thermal conductivity is calculated by
```bash
% phono3py-load phonopy_params_mp-661.yaml.xz --mesh 40 --br
```
Steps written above are performed in one-shot by
```bash
% phono3py-load phonopy_params_mp-661.yaml.xz --pypolymlp --relax-atomic-positions -d --mesh 40 --br
```
The lattice thermal conductivity calculated at 300 K will be around k_xx=252 and k_zz=232.

Binary file not shown.

View File

@ -1,6 +1,6 @@
This is the example of NaCl calculation. Since all atoms are displaced, to
obtain force constants, an external force constants calculator is necessary,
i.e., build-in force constants calculator has no ability to compute force
i.e., built-in force constants calculator has no ability to compute force
constants for such dataset. In this example, ALM is used. See
https://phonopy.github.io/phonopy/setting-tags.html#alm. The easiest way to
install ALM is to use conda.

View File

@ -0,0 +1,9 @@
# Example to create force constants using MLPs by pypolymlp
This is an example to follow the documentation
https://phonopy.github.io/phono3py/pypolymlp.html.
`phono3py_params.yaml` can be also generated by
```bash
% python make_phono3py_params.py ../NaCl-rd/phono3py_params_NaCl.yaml.xz
```

View File

@ -0,0 +1,13 @@
import sys
import phono3py
ph3 = phono3py.load(sys.argv[1], produce_fc=False, log_level=1)
ph3_new = phono3py.Phono3py(
ph3.unitcell,
supercell_matrix=ph3.supercell_matrix,
primitive_matrix=ph3.primitive_matrix,
)
ph3_new.dataset = ph3.dataset
ph3_new.nac_params = ph3.nac_params
ph3_new.save("phono3py_params.yaml")

View File

@ -0,0 +1,13 @@
import phonopy
import phono3py
ph3 = phono3py.load("phono3py_params_NaCl.yaml.xz", produce_fc=False, log_level=2)
ph = phonopy.Phonopy(
unitcell=ph3.unitcell,
supercell_matrix=ph3.phonon_supercell_matrix,
primitive_matrix=ph3.primitive_matrix,
)
ph.dataset = ph3.phonon_dataset
ph.nac_params = ph3.nac_params
ph.save("phonopy_params_NaCl.yaml")

7436
example/Si-wien2k/FORCES_FC3 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
This is the example of silicon calculation. The Wien2k calculation was made to
obtain forces with 2x2x2 k-point mesh for the supercell, PBE, and the lattice
parameters in Si.struct.
`phono3py_disp.yaml` is generated by
```
% phono3py --wien2k -d --dim 2 2 2 -c Si.struct
```
To create `fc3.hdf5` and `fc2.hdf5`,
```
% phono3py-load
```
Using 11x11x11 sampling mesh, lattice thermal conductivity is calculated by
```
% phono3py-load --mesh 11 11 11 --br --ts 300
```
`kappa-m111111.hdf5` is written as the result. The lattice thermal conductivity
is calculated as 119.1 W/m-K at 300 K. This becomes, with 19x19x19 sampling
mesh, 128.1 W/m-K.
The .scf files for supercells are found in `Si1_structS_scf.tar.xz`. If phono3py
is properly installed, the following command should work.
```
% phono3py --cf3 Si1_structS_scf/Si1.structS-{00001..00111}.scf
```

View File

@ -0,0 +1,53 @@
Si
P LATTICE,NONEQUIV.ATOMS: 8
MODE OF CALC=RELA unit=ang
10.329744 10.329744 10.329744 90.000000 90.000000 90.000000
ATOM -1: X=0.87500000 Y=0.87500000 Z=0.87500000
MULT= 1 ISPLIT= 8
SiSi1 NPT= 781 R0=0.00010000 RMT= 2.1100 Z: 14.000
LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000
ATOM 2: X=0.87500000 Y=0.37500000 Z=0.37500000
MULT= 1 ISPLIT= 8
SiSi2 NPT= 781 R0=0.00010000 RMT= 2.1100 Z: 14.000
LOCAL ROT MATRIX: 0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
ATOM 3: X=0.37500000 Y=0.87500000 Z=0.37500000
MULT= 1 ISPLIT= 8
SiSi3 NPT= 781 R0=0.00010000 RMT= 2.1100 Z: 14.000
LOCAL ROT MATRIX: 0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
ATOM 4: X=0.37500000 Y=0.37500000 Z=0.87500000
MULT= 1 ISPLIT= 8
SiSi4 NPT= 781 R0=0.00010000 RMT= 2.1100 Z: 14.000
LOCAL ROT MATRIX: 0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
ATOM 5: X=0.12500000 Y=0.12500000 Z=0.12500000
MULT= 1 ISPLIT= 8
SiSi5 NPT= 781 R0=0.00010000 RMT= 2.1100 Z: 14.000
LOCAL ROT MATRIX: 0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
ATOM 6: X=0.12500000 Y=0.62500000 Z=0.62500000
MULT= 1 ISPLIT= 8
SiSi6 NPT= 781 R0=0.00010000 RMT= 2.1100 Z: 14.000
LOCAL ROT MATRIX: 0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
ATOM 7: X=0.62500000 Y=0.12500000 Z=0.62500000
MULT= 1 ISPLIT= 8
SiSi7 NPT= 781 R0=0.00010000 RMT= 2.1100 Z: 14.000
LOCAL ROT MATRIX: 0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
ATOM 8: X=0.62500000 Y=0.62500000 Z=0.12500000
MULT= 1 ISPLIT= 8
SiSi8 NPT= 781 R0=0.00010000 RMT= 2.1100 Z: 14.000
LOCAL ROT MATRIX: 0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
0.0000000 0.0000000 0.0000000
0 NUMBER OF SYMMETRY OPERATIONS

Binary file not shown.

View File

@ -0,0 +1,587 @@
phono3py:
version: "3.10.1"
calculator: wien2k
frequency_unit_conversion_factor: 15.633302
symmetry_tolerance: 1.00000e-05
configuration:
cell_filename: "Si1.struct"
create_displacements: ".true."
dim: "2 2 2"
calculator: "wien2k"
fc3_r0_average: ".true."
physical_unit:
atomic_mass: "AMU"
length: "au"
space_group:
type: "Fd-3m"
number: 227
Hall_symbol: "F 4d 2 3 -1d"
supercell_matrix:
- [ 2, 0, 0 ]
- [ 0, 2, 0 ]
- [ 0, 0, 2 ]
primitive_cell:
lattice:
- [ 10.329744000000000, 0.000000000000001, 0.000000000000001 ] # a
- [ 0.000000000000000, 10.329744000000000, 0.000000000000001 ] # b
- [ 0.000000000000000, 0.000000000000000, 10.329744000000000 ] # c
points:
- symbol: Si # 1
coordinates: [ 0.875000000000000, 0.875000000000000, 0.875000000000000 ]
mass: 28.085500
- symbol: Si # 2
coordinates: [ 0.875000000000000, 0.375000000000000, 0.375000000000000 ]
mass: 28.085500
- symbol: Si # 3
coordinates: [ 0.375000000000000, 0.875000000000000, 0.375000000000000 ]
mass: 28.085500
- symbol: Si # 4
coordinates: [ 0.375000000000000, 0.375000000000000, 0.875000000000000 ]
mass: 28.085500
- symbol: Si # 5
coordinates: [ 0.125000000000000, 0.125000000000000, 0.125000000000000 ]
mass: 28.085500
- symbol: Si # 6
coordinates: [ 0.125000000000000, 0.625000000000000, 0.625000000000000 ]
mass: 28.085500
- symbol: Si # 7
coordinates: [ 0.625000000000000, 0.125000000000000, 0.625000000000000 ]
mass: 28.085500
- symbol: Si # 8
coordinates: [ 0.625000000000000, 0.625000000000000, 0.125000000000000 ]
mass: 28.085500
reciprocal_lattice: # without 2pi
- [ 0.096807820213163, 0.000000000000000, 0.000000000000000 ] # a*
- [ -0.000000000000000, 0.096807820213163, 0.000000000000000 ] # b*
- [ -0.000000000000000, -0.000000000000000, 0.096807820213163 ] # c*
unit_cell:
lattice:
- [ 10.329744000000000, 0.000000000000001, 0.000000000000001 ] # a
- [ 0.000000000000000, 10.329744000000000, 0.000000000000001 ] # b
- [ 0.000000000000000, 0.000000000000000, 10.329744000000000 ] # c
points:
- symbol: Si # 1
coordinates: [ 0.875000000000000, 0.875000000000000, 0.875000000000000 ]
mass: 28.085500
reduced_to: 1
- symbol: Si # 2
coordinates: [ 0.875000000000000, 0.375000000000000, 0.375000000000000 ]
mass: 28.085500
reduced_to: 2
- symbol: Si # 3
coordinates: [ 0.375000000000000, 0.875000000000000, 0.375000000000000 ]
mass: 28.085500
reduced_to: 3
- symbol: Si # 4
coordinates: [ 0.375000000000000, 0.375000000000000, 0.875000000000000 ]
mass: 28.085500
reduced_to: 4
- symbol: Si # 5
coordinates: [ 0.125000000000000, 0.125000000000000, 0.125000000000000 ]
mass: 28.085500
reduced_to: 5
- symbol: Si # 6
coordinates: [ 0.125000000000000, 0.625000000000000, 0.625000000000000 ]
mass: 28.085500
reduced_to: 6
- symbol: Si # 7
coordinates: [ 0.625000000000000, 0.125000000000000, 0.625000000000000 ]
mass: 28.085500
reduced_to: 7
- symbol: Si # 8
coordinates: [ 0.625000000000000, 0.625000000000000, 0.125000000000000 ]
mass: 28.085500
reduced_to: 8
supercell:
lattice:
- [ 20.659488000000000, 0.000000000000001, 0.000000000000001 ] # a
- [ 0.000000000000000, 20.659488000000000, 0.000000000000001 ] # b
- [ 0.000000000000000, 0.000000000000000, 20.659488000000000 ] # c
points:
- symbol: Si # 1
coordinates: [ 0.437500000000000, 0.437500000000000, 0.437500000000000 ]
mass: 28.085500
reduced_to: 1
- symbol: Si # 2
coordinates: [ 0.937500000000000, 0.437500000000000, 0.437500000000000 ]
mass: 28.085500
reduced_to: 1
- symbol: Si # 3
coordinates: [ 0.437500000000000, 0.937500000000000, 0.437500000000000 ]
mass: 28.085500
reduced_to: 1
- symbol: Si # 4
coordinates: [ 0.937500000000000, 0.937500000000000, 0.437500000000000 ]
mass: 28.085500
reduced_to: 1
- symbol: Si # 5
coordinates: [ 0.437500000000000, 0.437500000000000, 0.937500000000000 ]
mass: 28.085500
reduced_to: 1
- symbol: Si # 6
coordinates: [ 0.937500000000000, 0.437500000000000, 0.937500000000000 ]
mass: 28.085500
reduced_to: 1
- symbol: Si # 7
coordinates: [ 0.437500000000000, 0.937500000000000, 0.937500000000000 ]
mass: 28.085500
reduced_to: 1
- symbol: Si # 8
coordinates: [ 0.937500000000000, 0.937500000000000, 0.937500000000000 ]
mass: 28.085500
reduced_to: 1
- symbol: Si # 9
coordinates: [ 0.437500000000000, 0.187500000000000, 0.187500000000000 ]
mass: 28.085500
reduced_to: 9
- symbol: Si # 10
coordinates: [ 0.937500000000000, 0.187500000000000, 0.187500000000000 ]
mass: 28.085500
reduced_to: 9
- symbol: Si # 11
coordinates: [ 0.437500000000000, 0.687500000000000, 0.187500000000000 ]
mass: 28.085500
reduced_to: 9
- symbol: Si # 12
coordinates: [ 0.937500000000000, 0.687500000000000, 0.187500000000000 ]
mass: 28.085500
reduced_to: 9
- symbol: Si # 13
coordinates: [ 0.437500000000000, 0.187500000000000, 0.687500000000000 ]
mass: 28.085500
reduced_to: 9
- symbol: Si # 14
coordinates: [ 0.937500000000000, 0.187500000000000, 0.687500000000000 ]
mass: 28.085500
reduced_to: 9
- symbol: Si # 15
coordinates: [ 0.437500000000000, 0.687500000000000, 0.687500000000000 ]
mass: 28.085500
reduced_to: 9
- symbol: Si # 16
coordinates: [ 0.937500000000000, 0.687500000000000, 0.687500000000000 ]
mass: 28.085500
reduced_to: 9
- symbol: Si # 17
coordinates: [ 0.187500000000000, 0.437500000000000, 0.187500000000000 ]
mass: 28.085500
reduced_to: 17
- symbol: Si # 18
coordinates: [ 0.687500000000000, 0.437500000000000, 0.187500000000000 ]
mass: 28.085500
reduced_to: 17
- symbol: Si # 19
coordinates: [ 0.187500000000000, 0.937500000000000, 0.187500000000000 ]
mass: 28.085500
reduced_to: 17
- symbol: Si # 20
coordinates: [ 0.687500000000000, 0.937500000000000, 0.187500000000000 ]
mass: 28.085500
reduced_to: 17
- symbol: Si # 21
coordinates: [ 0.187500000000000, 0.437500000000000, 0.687500000000000 ]
mass: 28.085500
reduced_to: 17
- symbol: Si # 22
coordinates: [ 0.687500000000000, 0.437500000000000, 0.687500000000000 ]
mass: 28.085500
reduced_to: 17
- symbol: Si # 23
coordinates: [ 0.187500000000000, 0.937500000000000, 0.687500000000000 ]
mass: 28.085500
reduced_to: 17
- symbol: Si # 24
coordinates: [ 0.687500000000000, 0.937500000000000, 0.687500000000000 ]
mass: 28.085500
reduced_to: 17
- symbol: Si # 25
coordinates: [ 0.187500000000000, 0.187500000000000, 0.437500000000000 ]
mass: 28.085500
reduced_to: 25
- symbol: Si # 26
coordinates: [ 0.687500000000000, 0.187500000000000, 0.437500000000000 ]
mass: 28.085500
reduced_to: 25
- symbol: Si # 27
coordinates: [ 0.187500000000000, 0.687500000000000, 0.437500000000000 ]
mass: 28.085500
reduced_to: 25
- symbol: Si # 28
coordinates: [ 0.687500000000000, 0.687500000000000, 0.437500000000000 ]
mass: 28.085500
reduced_to: 25
- symbol: Si # 29
coordinates: [ 0.187500000000000, 0.187500000000000, 0.937500000000000 ]
mass: 28.085500
reduced_to: 25
- symbol: Si # 30
coordinates: [ 0.687500000000000, 0.187500000000000, 0.937500000000000 ]
mass: 28.085500
reduced_to: 25
- symbol: Si # 31
coordinates: [ 0.187500000000000, 0.687500000000000, 0.937500000000000 ]
mass: 28.085500
reduced_to: 25
- symbol: Si # 32
coordinates: [ 0.687500000000000, 0.687500000000000, 0.937500000000000 ]
mass: 28.085500
reduced_to: 25
- symbol: Si # 33
coordinates: [ 0.062500000000000, 0.062500000000000, 0.062500000000000 ]
mass: 28.085500
reduced_to: 33
- symbol: Si # 34
coordinates: [ 0.562500000000000, 0.062500000000000, 0.062500000000000 ]
mass: 28.085500
reduced_to: 33
- symbol: Si # 35
coordinates: [ 0.062500000000000, 0.562500000000000, 0.062500000000000 ]
mass: 28.085500
reduced_to: 33
- symbol: Si # 36
coordinates: [ 0.562500000000000, 0.562500000000000, 0.062500000000000 ]
mass: 28.085500
reduced_to: 33
- symbol: Si # 37
coordinates: [ 0.062500000000000, 0.062500000000000, 0.562500000000000 ]
mass: 28.085500
reduced_to: 33
- symbol: Si # 38
coordinates: [ 0.562500000000000, 0.062500000000000, 0.562500000000000 ]
mass: 28.085500
reduced_to: 33
- symbol: Si # 39
coordinates: [ 0.062500000000000, 0.562500000000000, 0.562500000000000 ]
mass: 28.085500
reduced_to: 33
- symbol: Si # 40
coordinates: [ 0.562500000000000, 0.562500000000000, 0.562500000000000 ]
mass: 28.085500
reduced_to: 33
- symbol: Si # 41
coordinates: [ 0.062500000000000, 0.312500000000000, 0.312500000000000 ]
mass: 28.085500
reduced_to: 41
- symbol: Si # 42
coordinates: [ 0.562500000000000, 0.312500000000000, 0.312500000000000 ]
mass: 28.085500
reduced_to: 41
- symbol: Si # 43
coordinates: [ 0.062500000000000, 0.812500000000000, 0.312500000000000 ]
mass: 28.085500
reduced_to: 41
- symbol: Si # 44
coordinates: [ 0.562500000000000, 0.812500000000000, 0.312500000000000 ]
mass: 28.085500
reduced_to: 41
- symbol: Si # 45
coordinates: [ 0.062500000000000, 0.312500000000000, 0.812500000000000 ]
mass: 28.085500
reduced_to: 41
- symbol: Si # 46
coordinates: [ 0.562500000000000, 0.312500000000000, 0.812500000000000 ]
mass: 28.085500
reduced_to: 41
- symbol: Si # 47
coordinates: [ 0.062500000000000, 0.812500000000000, 0.812500000000000 ]
mass: 28.085500
reduced_to: 41
- symbol: Si # 48
coordinates: [ 0.562500000000000, 0.812500000000000, 0.812500000000000 ]
mass: 28.085500
reduced_to: 41
- symbol: Si # 49
coordinates: [ 0.312500000000000, 0.062500000000000, 0.312500000000000 ]
mass: 28.085500
reduced_to: 49
- symbol: Si # 50
coordinates: [ 0.812500000000000, 0.062500000000000, 0.312500000000000 ]
mass: 28.085500
reduced_to: 49
- symbol: Si # 51
coordinates: [ 0.312500000000000, 0.562500000000000, 0.312500000000000 ]
mass: 28.085500
reduced_to: 49
- symbol: Si # 52
coordinates: [ 0.812500000000000, 0.562500000000000, 0.312500000000000 ]
mass: 28.085500
reduced_to: 49
- symbol: Si # 53
coordinates: [ 0.312500000000000, 0.062500000000000, 0.812500000000000 ]
mass: 28.085500
reduced_to: 49
- symbol: Si # 54
coordinates: [ 0.812500000000000, 0.062500000000000, 0.812500000000000 ]
mass: 28.085500
reduced_to: 49
- symbol: Si # 55
coordinates: [ 0.312500000000000, 0.562500000000000, 0.812500000000000 ]
mass: 28.085500
reduced_to: 49
- symbol: Si # 56
coordinates: [ 0.812500000000000, 0.562500000000000, 0.812500000000000 ]
mass: 28.085500
reduced_to: 49
- symbol: Si # 57
coordinates: [ 0.312500000000000, 0.312500000000000, 0.062500000000000 ]
mass: 28.085500
reduced_to: 57
- symbol: Si # 58
coordinates: [ 0.812500000000000, 0.312500000000000, 0.062500000000000 ]
mass: 28.085500
reduced_to: 57
- symbol: Si # 59
coordinates: [ 0.312500000000000, 0.812500000000000, 0.062500000000000 ]
mass: 28.085500
reduced_to: 57
- symbol: Si # 60
coordinates: [ 0.812500000000000, 0.812500000000000, 0.062500000000000 ]
mass: 28.085500
reduced_to: 57
- symbol: Si # 61
coordinates: [ 0.312500000000000, 0.312500000000000, 0.562500000000000 ]
mass: 28.085500
reduced_to: 57
- symbol: Si # 62
coordinates: [ 0.812500000000000, 0.312500000000000, 0.562500000000000 ]
mass: 28.085500
reduced_to: 57
- symbol: Si # 63
coordinates: [ 0.312500000000000, 0.812500000000000, 0.562500000000000 ]
mass: 28.085500
reduced_to: 57
- symbol: Si # 64
coordinates: [ 0.812500000000000, 0.812500000000000, 0.562500000000000 ]
mass: 28.085500
reduced_to: 57
displacement_pairs:
- atom: 1
displacement:
[ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
displacement_id: 1
paired_with:
- atom: 1
pair_distance: 0.00000000
displacements:
- [ 0.0212132034355964, 0.0212132034355964, 0.0000000000000000 ]
- [ -0.0212132034355964, -0.0212132034355964, -0.0000000000000000 ]
displacement_ids: [ 2, 3 ]
- atom: 2
pair_distance: 10.32974400
displacements:
- [ 0.0212132034355964, 0.0212132034355964, 0.0000000000000000 ]
- [ -0.0212132034355964, -0.0212132034355964, -0.0000000000000000 ]
displacement_ids: [ 4, 5 ]
- atom: 3
pair_distance: 10.32974400
displacements:
- [ 0.0212132034355964, 0.0212132034355964, 0.0000000000000000 ]
- [ -0.0212132034355964, -0.0212132034355964, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, 0.0300000000000000 ]
displacement_ids: [ 6, 7, 8 ]
- atom: 4
pair_distance: 14.60846406
displacements:
- [ 0.0212132034355964, 0.0212132034355964, 0.0000000000000000 ]
- [ -0.0212132034355964, -0.0212132034355964, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, 0.0300000000000000 ]
displacement_ids: [ 9, 10, 11 ]
- atom: 7
pair_distance: 14.60846406
displacements:
- [ 0.0212132034355964, 0.0212132034355964, 0.0000000000000000 ]
- [ -0.0212132034355964, -0.0212132034355964, -0.0000000000000000 ]
displacement_ids: [ 12, 13 ]
- atom: 8
pair_distance: 17.89164144
displacements:
- [ 0.0212132034355964, 0.0212132034355964, 0.0000000000000000 ]
- [ -0.0212132034355964, -0.0212132034355964, -0.0000000000000000 ]
displacement_ids: [ 14, 15 ]
- atom: 9
pair_distance: 7.30423203
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 16, 17, 18, 19 ]
- atom: 10
pair_distance: 12.65130099
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 20, 21, 22, 23 ]
- atom: 11
pair_distance: 7.30423203
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 24, 25, 26, 27 ]
- atom: 12
pair_distance: 12.65130099
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 28, 29, 30, 31 ]
- atom: 17
pair_distance: 7.30423203
displacements:
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, 0.0300000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, -0.0300000000000000 ]
displacement_ids: [ 32, 33, 34, 35, 36, 37 ]
- atom: 18
pair_distance: 7.30423203
displacements:
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, 0.0300000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, -0.0300000000000000 ]
displacement_ids: [ 38, 39, 40, 41, 42, 43 ]
- atom: 19
pair_distance: 12.65130099
displacements:
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, 0.0300000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, -0.0300000000000000 ]
displacement_ids: [ 44, 45, 46, 47, 48, 49 ]
- atom: 20
pair_distance: 12.65130099
displacements:
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, 0.0300000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, -0.0300000000000000 ]
displacement_ids: [ 50, 51, 52, 53, 54, 55 ]
- atom: 33
pair_distance: 13.41873108
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 56, 57, 58, 59 ]
- atom: 34
pair_distance: 11.25657755
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 60, 61, 62, 63 ]
- atom: 35
pair_distance: 11.25657755
displacements:
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, 0.0300000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, -0.0300000000000000 ]
displacement_ids: [ 64, 65, 66, 67, 68, 69 ]
- atom: 36
pair_distance: 8.56497126
displacements:
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, 0.0300000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, -0.0300000000000000 ]
displacement_ids: [ 70, 71, 72, 73, 74, 75 ]
- atom: 39
pair_distance: 8.56497126
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 76, 77, 78, 79 ]
- atom: 40
pair_distance: 4.47291036
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 80, 81, 82, 83 ]
- atom: 49
pair_distance: 8.56497126
displacements:
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, 0.0300000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, -0.0300000000000000 ]
displacement_ids: [ 84, 85, 86, 87, 88, 89 ]
- atom: 50
pair_distance: 11.25657755
displacements:
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, 0.0300000000000000 ]
- [ 0.0000000000000000, 0.0000000000000000, -0.0300000000000000 ]
displacement_ids: [ 90, 91, 92, 93, 94, 95 ]
- atom: 51
pair_distance: 4.47291036
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 96, 97, 98, 99 ]
- atom: 52
pair_distance: 8.56497126
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 100, 101, 102, 103 ]
- atom: 53
pair_distance: 11.25657755
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 104, 105, 106, 107 ]
- atom: 54
pair_distance: 13.41873108
displacements:
- [ 0.0000000000000000, 0.0300000000000000, 0.0000000000000000 ]
- [ 0.0000000000000000, -0.0300000000000000, -0.0000000000000000 ]
- [ 0.0300000000000000, 0.0000000000000000, 0.0000000000000000 ]
- [ -0.0300000000000000, -0.0000000000000000, -0.0000000000000000 ]
displacement_ids: [ 108, 109, 110, 111 ]
displacement_pair_info:
number_of_singles: 1
number_of_pairs: 110

View File

@ -34,8 +34,16 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
from phono3py.api_isotope import Phono3pyIsotope # noqa F401
from phono3py.api_jointdos import Phono3pyJointDos # noqa F401
from phono3py.api_phono3py import Phono3py # noqa F401
from phono3py.cui.load import load # noqa F401
from phono3py.version import __version__ # noqa F401
from phono3py.api_isotope import Phono3pyIsotope
from phono3py.api_jointdos import Phono3pyJointDos
from phono3py.api_phono3py import Phono3py
from phono3py.cui.load import load
from phono3py.version import __version__
__all__ = [
"Phono3pyIsotope",
"Phono3pyJointDos",
"Phono3py",
"load",
"__version__",
]

View File

@ -35,9 +35,9 @@
# POSSIBILITY OF SUCH DAMAGE.
import numpy as np
from phonopy.units import VaspToTHz
from phono3py.other.isotope import Isotope
from phono3py.phonon.grid import BZGrid
class Phono3pyIsotope:
@ -50,7 +50,7 @@ class Phono3pyIsotope:
mass_variances=None, # length of list is num_atom.
band_indices=None,
sigmas=None,
frequency_factor_to_THz=VaspToTHz,
frequency_factor_to_THz=None,
use_grg=False,
symprec=1e-5,
cutoff_frequency=None,
@ -82,7 +82,7 @@ class Phono3pyIsotope:
return self._iso.dynamical_matrix
@property
def grid(self):
def grid(self) -> BZGrid:
"""Return BZGrid class instance."""
return self._iso.bz_grid
@ -107,7 +107,7 @@ class Phono3pyIsotope:
(len(self._sigmas), len(grid_points), len(self._iso.band_indices)),
dtype="double",
)
self._grid_points = np.array(grid_points, dtype="long")
self._grid_points = np.array(grid_points, dtype="int64")
for j, gp in enumerate(grid_points):
self._iso.set_grid_point(gp)

View File

@ -34,10 +34,13 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
from __future__ import annotations
import numpy as np
from phonopy.harmonic.dynamical_matrix import DynamicalMatrix
from phonopy.physical_units import get_physical_units
from phonopy.structure.cells import Primitive, Supercell
from phonopy.structure.symmetry import Symmetry
from phonopy.units import VaspToTHz
from phono3py.file_IO import write_joint_dos
from phono3py.phonon.grid import BZGrid
@ -65,7 +68,7 @@ class Phono3pyJointDos:
num_frequency_points=None,
num_points_in_batch=None,
temperatures=None,
frequency_factor_to_THz=VaspToTHz,
frequency_factor_to_THz=None,
frequency_scale_factor=None,
use_grg=False,
SNF_coordinates="reciprocal",
@ -87,7 +90,10 @@ class Phono3pyJointDos:
else:
self._sigmas = sigmas
self._cutoff_frequency = cutoff_frequency
self._frequency_factor_to_THz = frequency_factor_to_THz
if frequency_factor_to_THz is None:
self._frequency_factor_to_THz = get_physical_units().DefaultToTHz
else:
self._frequency_factor_to_THz = frequency_factor_to_THz
self._frequency_scale_factor = frequency_scale_factor
self._is_mesh_symmetry = is_mesh_symmetry
self._is_symmetry = is_symmetry
@ -113,7 +119,7 @@ class Phono3pyJointDos:
self.initialize(mesh)
@property
def grid(self):
def grid(self) -> BZGrid | None:
"""Return BZGrid class instance."""
return self._bz_grid
@ -267,7 +273,7 @@ class Phono3pyJointDos:
print("Smearing method with sigma=%s is used." % sigma)
print(
f"Calculations at {len(self._frequency_points)} "
f"frequency points are devided into {len(batches)} batches."
f"frequency points are divided into {len(batches)} batches."
)
for i_t, temperature in enumerate(temperatures):
self._jdos.temperature = temperature
@ -290,7 +296,7 @@ class Phono3pyJointDos:
print('JDOS is written into "%s".' % filename)
@property
def dynamical_matrix(self):
def dynamical_matrix(self) -> DynamicalMatrix:
"""Return DynamicalMatrix class instance."""
return self._jdos.dynamical_matrix

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More