mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
gnu: Add python-euphonic.
* gnu/packages/python-science.scm (python-euphonic): New variable. Change-Id: I10ce0b9193e5d342ead24b9e16daefd9d16d40eb
This commit is contained in:
@@ -6750,6 +6750,79 @@ Information File) format files. CIF is the standard format for
|
||||
crystallographic data exchange endorsed by the International Union of
|
||||
Crystallography.")
|
||||
(license license:psfl)))
|
||||
|
||||
(define-public python-euphonic
|
||||
(package
|
||||
(name "python-euphonic")
|
||||
(version "1.4.5")
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/pace-neutrons/Euphonic.git")
|
||||
(commit (string-append "v" version))))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32 "1n3w2acwi9x1v4wavigrd0qwd559rx6aaz0xknhd4gnbqwzn05qp"))))
|
||||
(build-system pyproject-build-system)
|
||||
(arguments
|
||||
(list
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-before 'build 'fix-numpy-include
|
||||
(lambda* (#:key inputs #:allow-other-keys)
|
||||
(let ((numpy (assoc-ref inputs "python-numpy")))
|
||||
;; Patch meson.build to use the correct numpy include path
|
||||
(substitute* "meson.build"
|
||||
(("np_inc = include_directories\\(py\\.get_path\\('platlib'\\) / 'numpy/core/include'\\)")
|
||||
(string-append "np_inc = include_directories('"
|
||||
numpy "/lib/python3.11/site-packages/numpy/core/include')"))))))
|
||||
(add-before 'build 'fix-lazy-fixture
|
||||
(lambda _
|
||||
;; Migrate from pytest-lazy-fixture to pytest-lazy-fixtures.
|
||||
;; Add import and replace pytest.lazy_fixture with lf.
|
||||
(for-each
|
||||
(lambda (file)
|
||||
(substitute* file
|
||||
(("^import pytest" all)
|
||||
(string-append "from pytest_lazy_fixtures import lf\n" all))
|
||||
(("pytest\\.lazy_fixture")
|
||||
"lf")))
|
||||
(find-files "tests_and_analysis" "\\.py$"))))
|
||||
;; Run tests after install so the C extension is available.
|
||||
(delete 'check)
|
||||
(add-after 'install 'check
|
||||
(lambda* (#:key tests? inputs outputs #:allow-other-keys)
|
||||
(when tests?
|
||||
(add-installed-pythonpath inputs outputs)
|
||||
;; Remove source euphonic dir so tests use installed package.
|
||||
(delete-file-recursively "euphonic")
|
||||
(invoke "pytest" "-vv" "tests_and_analysis")))))))
|
||||
(propagated-inputs
|
||||
(list python-brille ; optional
|
||||
python-h5py ; optional, for phonopy-reader
|
||||
python-matplotlib ; optional
|
||||
python-pyyaml ; optional, for phonopy-reader
|
||||
python-numpy
|
||||
python-scipy
|
||||
python-pint
|
||||
python-seekpath
|
||||
python-spglib
|
||||
python-threadpoolctl
|
||||
python-toolz))
|
||||
(native-inputs
|
||||
;; Note: build-backend is mesonpy.
|
||||
(list meson-python ninja python-numpy python-packaging python-pytest
|
||||
python-pytest-lazy-fixtures python-pytest-mock
|
||||
pkg-config))
|
||||
(home-page "https://github.com/pace-neutrons/Euphonic")
|
||||
(synopsis "Phonon calculations for inelastic neutron scattering")
|
||||
(description
|
||||
"Euphonic is a Python package for calculating phonon bandstructures and
|
||||
simulating inelastic neutron scattering (INS) from force constants. It can
|
||||
read output from CASTEP and Phonopy and calculate phonon frequencies,
|
||||
eigenvectors, and structure factors.")
|
||||
(license license:gpl3+)))
|
||||
;;;
|
||||
;;; Avoid adding new packages to the end of this file. To reduce the chances
|
||||
;;; of a merge conflict, place them above by existing packages with similar
|
||||
|
||||
Reference in New Issue
Block a user