Requirements
Euphonic now provides PyPI wheels for Linux ARM (aarch64). Like Mac, this platform has a slightly increased h5py version requirement in order to access pre-built wheels.
The setuptools build-time requirement has been increased to 83.0.0 due to a security advisory.
Bug fixes
- Fixed out-of-bounds write in ZHEEVD workspace-query code, which
could corrupt adjacent stack variables. A C
doublearray was used to receive fortranCOMPLEX*16; this requires 2 elements to safely contain real and imaginary parts. - All the int "length" values passed-by-reference to the same
function are now properly initialised to
-1; as far as we are aware this didn't cause problems yet, but could misbehave in some environment.
- Fixed out-of-bounds write in ZHEEVD workspace-query code, which
could corrupt adjacent stack variables. A C
New features
- Added VASP HDF5 input support (vaspout.h5) for importing force
constants, Born effective charges, and dielectric tensors via
ForceConstants.from_vasp, as well as precalculated phonon mode data viaQpointPhononModes.from_vaspandQpointFrequencies.from_vasp. When primitive cell data is present, a supercell-to-primitive force constant transformation is attempted: less data is available is available than the equivalent phonopy scenario, which may impact reliability.
- Added VASP HDF5 input support (vaspout.h5) for importing force
constants, Born effective charges, and dielectric tensors via
Compatibility fixes
Removed the deprecated
phonopy_readerentry frompyproject.toml, retaining preferredphonopy-reader. This duplication was treated as an error by some modern package installers.euphonic[phonopy_reader]will continue to resolve for end-users withpip >= 22.2(oruv; anything that supports PEP 685). Developers installing PEP 735 dependency groups via--groupalready requiredpip >= 25.0.The [brille] optional dependency group will no longer attempt to install brille on Linux ARM; this platform has no pre-built wheels and currently brille doesn not build reliably from source there.
Tests requiring brille will be skipped on Linux ARM via a new
brille_or_skip_if_unsupportedfixture; on other platforms, missing brille will still cause those tests to fail.
Documentation
- Added documentation for readers, isotopes, broadening modules and updated related sections of existing docs.
- Recommend IsotopeData interface, not old get_reference_data function.
- Other minor improvements.
Maintenance
Unit-testing with
tox- brille and non-brille tests are now run by
toxas separate pytest invocations on all platforms; previously this was just done for Mac. The purpose is to reduce the number of tests forced into serial operation by OpenMP conflicts. - Minimum requirements are now tested on all platforms using a
common
toxenvironment specification. - All
toxenvironments can now pass options such as--parallelas{posargs}usingtox run --; previously this was limited to a subset.
- brille and non-brille tests are now run by
A py314-cov environment is added which runs all tests with coverage enabled and converts the raw .coverage file into an interoperable coverage.xml. A coverage-badge environment is added which creates an SVG badge from the XML results.
Markers have been created for useful environment groups, included a coverage-local marker which will run coverage with the same Python version as CI and generate the badge for inspection.
Github Actions configuration
Linux ARM (
ubuntu-24.04-arm) has been added to the test matrix inrun_tests.yml.Simplified Windows CI workflows on Github: take advantage of Meson's
--vsenvhandling (which is more robust than last time we tried!) and avoid setting explicit environment variables.This does require a new bit of Windows-runner wrangling in the workflow: we delete the
ccacche.exefrom Strawberry Perl which was polluting the path.Coverage xml files are no longer combined as a workflow step; this is handled by pytest-cov while still working with the .coverage file.
Coverage badge is now created within the tox run, not as a workflow step.
Coverage reporting uses
py-cov-action/python-coverage-comment@v1instead oforgoro/coverage@v3.2; this uses a different mechanism and should work better with PRs from external forks.It provides a similar "badge on branch" mechanism to the existing setup, so those workflow steps are removed. The coverage badge in README now links to an interactive HTML report.
This release collects a number of API-breaking changes, creating a sustainable platform for futher development. It doesn't add a drastic number of new features compared with recent minor releases. Still, we would draw particular attention to the work on isotope data, which includes an expanded "Sears1992" reference data set. This should allow proper comparison incoherent and coherent DOS weightings for systems including isotopic substitutions, and support work on incoherent structure factor calculations in the new "abinslib" library.
During the v1 era Euphonic has done a decent job of "semantic versioning", and we intend to continue this way. It is recommended that once downstream code is adapted to work with Euphonic 2.0, Euphonic is pinned to the range 2.x,<3 (by your favourite mechanism and syntax).
CLI changes
- The
--instrument-broadeningparameter ofeuphonic-dosis deprecated and hidden. The old--energy-broadeningparameter is now functionally the same; i.e. it can no longer set the adaptive broadening width and--adaptive-scalemust be used for that purpose.
- The
API changes
- Many public functions and methods now use keyword-only arguments
where previously these were permitted to be keyword or positional.
- This will break code that depends on these arguments being in a specific order rather than calling them by name
- The most "obvious" arguments can still be accessed by position for concise "standard" function calls; the goal is not to make downstream code drastically more verbose.
- The purpose of this is to give more flexibility to add features or alias arguments while deprecating/changing their behaviour, without breaking the public API between major releases.
- The various Spectrum classes have an
assert_regular_binsmethod. It is now forbidden to use positional arguments and in the 2D casesbin_axhas a default value of "y". This makes the API safer and more formally correct. - Unused argument
use_brilleis removed fromeuphonic.cli.brille_convergence.check_brille_settings. get_args()function removed fromeuphonic.cli.utils; this was previously simplified to a one-liner so brings no DRY benefit.- Some public functions in
Crystal(reciprocal_lattice,cell_volume) are now@cached_propertyand don't need(). The cache will be cleared on settingcell_vectorsso direct changes to the_cell_vectorsattribute may cause desynchronisation. euphonic.cli.utilshas been broken up into submodules. All the appropriate functions are re-exported to__all__so this should not break API in practice, but e.g. Quantity can no longer be imported fromeuphonic.cli.utils.- The
euphonic.datapackage has been redistributed to keep data files underneath their relevant module/package. Isotopic data is now undereuphonic.isotopes.dataand unit registry configuration is undereuphonic.ureg.data. - The "adaptive fit" parameter is removed from spectrum broaden() methods and euphonic-dos; "cubic" parametrisation is removed and superior "cheby-log" fit always used.
validate._check_constructor_inputsis reworked to use a sequence ofvalidate.InputCheckNamedTupleclasses as arguments.- The
.copy()method has been removed from Spectrum classes; usecopy.copy()orcopy.deepcopy()from the standard library instead. Note thatcopy.deepcopy()is closer to the legacy behaviour and carries much less risk of unintended side-effects. euphonic.util.get_reference_datais deprecated and will be removed in Euphonic 2.0. Please useIsotopeData.get_propertyinstead.
- Many public functions and methods now use keyword-only arguments
where previously these were permitted to be keyword or positional.
Features
Spectrum classes now implement
__eq__and can be compared with==.Spectrum1DCollection and Spectrum2DCollection can be indexed with slices where the stop value exceeds the collection length. (e.g. if a collection of 5 spectra is indexed with [3:10] it will return a collection with the spectra at indices 3 and 4.) This is consistent with the behaviour of Python lists and numpy arrays.
These slices can also be 0-size.
Previously this would raise an IndexError. Technically it is a breaking change as somebody's code could depend on this IndexError.
A new API has been created for isotope data. The IsotopeData protocol promises a method .get_property(Structure, key) which will return per-atom values; typically these are neutron cross-sections.
Currently this is backward-compatible and datasets may still be specified as a string or provided as a dict; these methods are likely to be deprecated as the system matures.
A new implementation of the Sears1992 dataset has been created. This now supports more data columns (i.e. it can be used for both incoherent and coherent scattering lengths and cross sections) and has a full set of isotopes (as per 1992 data, anyway). The correct isotope or mixture is selected automatically using element symbols and mass data from Crystal.
Other changes
Fixed several typing issues with Spectrum collections.
Error messages have been overhauled and now follow a consistent format:
summary [reason] fix
Maintenance
- Extend use of Python 3.10
matches overifwhere relevant.
- Extend use of Python 3.10
This is intended as the final release of version 1.x; it collects a few small changes which didn't require API breakage. Mostly they only affect development, but the "typing-extensions" dependency addition is a bugfix which might affect users.
- Requirements
- Migrate dev dependencies from "optional dependencies" to dependency groups. This decouples them from the actual package and changes their installation process from e.g. pip install .[test] to pip install --group test.
- Update docs dependencies and drop
sphinx_autodoc_typehintsin favour of nativesphinx>8type-hint processing. - Explicitly include typing-extensions dependency.
- Maintenance
- Ensure
build_utils/version.pyworks for uncommitted changes to tagged HEADs.
- Ensure
- Requirements
- Security
- Bumped pytest requirement for testing to 9.0.3. (CVE-2025-71176)
- Security
_check_constructor_inputsrefactored to list arguments as sequence of- tuples for each input.
- Requirements
- Increased minimum version of SeeK-path to 2.2.1
- Recent updates provide improved compatibility with recent spglib versions and allow q-point paths to be generated in the input cell orientation.
- Security
- Bumped wheel requirement for docs and testing to 0.46.2. (CVE-2026-24049)
- Increased minimum version of SeeK-path to 2.2.1
- Bug fixes
- Band structures paths could be generated with incorrect correspondence of q-points to symmetry labels if the input cell was transformation of reference primitive cell. (e.g. different order of lattive vectors). This is now fixed by using features of SeeK-path 2.1+.
- Band structure paths would be inappropriately generated and labelled if the input cell was a supercell of the primitive cell. This scenario now emits a warning (from Seek-path) and the tick labels will not use the traditional high-symmetry labels.
- Improvements
- Extended
pathlib.Pathsupport and annotations throughout the code. Removing references toos.pathwhere no longer relevant. - Rework
Spectrum*.copy()to meet Python copy specifications.
- Extended
- Maintenance
- Replace
tmpdirin tests withtmp_pathand usePathhandling.
- Replace
- Requirements
- Test requirements
- Added pytest-xdist and pytest-cov requirements for parallel testing at pytest level.
- Test requirements
- Bug fixes
- Fix typing of calls to Spectrum.broaden() by brille_convergence and intensity_map command-line tools.
- Compatibility fixes
- Fixed handling of new SpglibError class for expected errors from spglib 2.7.0
- Include required arguments to np.divide call, avoiding deprecation warning which would trigger test failure.
- Maintenance
- Reworked CI strategy from parallelism over tox environments to parallelism over unit tests. This addresses OpenMP conflicts between simultaneous test environments, and gives a large speedup when testing a single Python version. (i.e. typical local testing scenario before pushing to CI.)
- Stopped testing every master push against Python 3.15
Requirements
- Python 3.10-3.14 is supported
- Test requirements
- Migrated from pytest 7 to pytest 8
- Migrated from pytest-lazy-fixture (which appears to be unmaintained and incompatible) to pytest-lazy-fixtures, an active project with similar functionality.
Bug fixes
Added defences at runtime against OpenMP library conflicts. This scenario is most commonly encounted when using PyPI wheels for Euphonic and Brille on MacOS. If multiple OpenMP libraries are loaded, Euphonic will raise a warning and fallback to serial operation to reduce the risk of a deadlock or other unpleasant interaction.
This is a known problem with OpenMP distributed in Python wheels, cited as a reason to avoid use of OpenMP in SciPy. See e.g. https://pypackaging-native.github.io/key-issues/native-dependencies/blas_openmp/
To get high performance of Euphonic Fourier interpolation while loading another OpenMP-using library (such as brille) it may be necessary for users to build the software from source. (Pip install with --no-binary may be sufficient.) Compatibility can also be ensured when programs are distributed with a beyond-python package manager such as Conda or apt.
Improvements
- Improved error message when C extension import fails due to missing dynamic libraries.
- Random sampling functions (including deterministic sampling
functions with a random jitter option) accept a new
rngparameter for a numpy.random Generator (generally preferred) or RandomState (used for testing). This allows the user to manipulate the random seed and bit generator to ensure reproducible or independent calculations. - The default argument to
rngis a quasi-global Generator instance ineuphonic.util. This avoids the computational overhead of creating a new generator every time a random function is called.
Maintenance
- Bumped cibuildwheel to v3.3.0
- Bumped github action versions: actions/checkout@v6, actions/setup-python@v6
- Started testing with Python 3.15 pre-release. (Currently there are Numpy build problems, this is ok.)
- On Mac, unit tests with and without brille are run separately. This enables full OpenMP parallelism for tests that don't require brille to be loaded.
- Features
- CLI tools will now accept phonopy data produced by janus-core, with filenames in the form "{label}-phonopy.yml" and "{label}-force_constants.hdf5".
- Bug fixes
- Fixed a bug in subtraction of dipole-dipole contribution from force constants with non-symmetric supercell matrix. (This affects import from Phonopy results where a) Born effective charges and dielectric tensor were included; b) sc_matrix != sc_matrix.T .)
- Maintenance
- Pytest configuration has been moved from tests_and_analysis/test/pytest.ini to the main pyproject.toml. This means it is more likely to be picked up automatically when running tests outside of the CI workflows.
- Some Einstein summations have been replaced with equivalent matrix multiplications; this should improve performance and legibility.
- Fixed a unit test which used
pytest.approx()incorrectly.
- Requirements
- The minimum required version of spglib is increased to 2.1.0
- Bug fixes
- euphonic-intensity-map incorrectly rejecting files with phonon mode data for coherent scattering calculations. (Introduced in v1.4.3.)
- Maintenance
- Numpy random number generators have been updated to use a Generator from
np.random.default_rng - Improved test coverage of error states
- Numpy random number generators have been updated to use a Generator from
- Features
- Add methods get_bin_edges, get_bin_centers to Spectrum2DCollection, making interface consistent with other Spectrum classes.
- Bug fixes
- Fix tox version number in Pyproject.toml; installation with [ci] "extra" was broken.
- Fix the mode_gradients_unit argument to
euphonic.readers.castep.read_phonon_dos_data; this was returning consistent data/units but ignoring the preference expressed in that argument.
- Maintenance
- Avoid incompatible-pointer-types in C compilation; this is an error in GCC14 and warning in older versions.
- Moved unit register definition to new "ureg" module. This is to defend against
internal import loops: users remain welcome to access things via
from euphonic import ureg, Quantity. - Introduced ruff-based linting with a (fair-sized) subset of rules enabled.
- This cleanup may have introduced some small improvements to error and warning messages.
- The executable bits on some files have changed, for better consistency and to express more clearly how they are used.
- Improved test coverage, removed some unused code
- Bug fixes
- Make Spectrum directly accessible from euphonic.spectra. (This was accidentally lost in a refactor, affecting downstream that uses Spectrum as a type annotation.)
Bug fixes
CASTEP 25.1 allows Born effective charges to be calculated by Berry Phase methods without a corresponding dielectric tensor. In such cases, no long-range term can be subtracted from the Force Constants (or reconstructed). Euphonic uses the presence of Born effective charges to indicate such a subtraction; to prevent ill-defined cases, ForceConstants now sets both Born charges and dielectric tensor to None if only one was provided.
An optional parameter is provided to change how bin edges are obtained from bin centres: previously the bin edges were constrained to the initial data range, but this can lead to incorrect scaling when performing broadening. Variable-width broadening schemes are now allowed to extrapolate the bin edges in order to get the correct width scaling.
Outside of broadening, the default behaviour is unchanged in order to maintain backward compatibility. This is likely to be changed in the next "major version" (i.e. API-breaking release) of Euphonic.
Maintenance
- The euphonic.spectra module has been broken up into a subpackage with the single-spectrum classes defined in euphonic.spectra.base and the collections in euphonic.spectra.collections. This is not a breaking change: the public classes, functions and type annotations remain importable from euphonic.spectra.
- CASTEP 25.1 includes an extra field in .castep_bin files, indicating whether Born effective charges were read from an external file. For clarity and safety, this field is now explicitly read by the Euphonic .castep_bin parser, but remains unused.
- The release process has been reworked to reduce manual steps: a top-level "release" action will now sequence most of the steps. (Post-release testing is still separate.)
This post-release makes some changes to the source-distribution build process:
- A bug is fixed in the version-numbering script; this particularly affected Windows
- A copies of the unit tests and documentation were mistakenly included in tarballs, making them excessively large. This is no longer present.
- Bug fixes
- Fixed a bug in the version numbering mechanism affecting builds from sdist on Windows and environments where Git is unavailable
- Reduce size of sdist, removing docs and tests from archive. (Restoring similar size to pre-v1.4.0 releases.)
- Maintenance
- Source builds automatically tested on Windows as part of build/deployment process
This release includes some significant modernisation and maintenance, as well as new features and performance enhancements.
Requirements
- Python 3.8, 3.9 is no longer supported
- Python 3.12 is supported
- importlib_resources backport is no longer required
- toolz is a new requirement
- Some other dependency requirements have been increased in order
to simplify maintenance and testing:
- Minimum version of numpy increased from 1.19.3 to 1.24.0
- Minimum version of matplotlib increased from 3.2 to 3.8
- Minimum version of Pint increased from 0.19 to 0.22
- Minimum version of PyYAML increased from 3.13 to 6.0
- Minimum version of h5py increaased from 2.10 to 3.6
- Minimum version of threadpoolctl increased from 1.0 to 3.0.
Improvements
A "reciprocal_spectroscopy" Pint context is made available in the unit registry for tricky conversions between reciprocal frequency/energy units. It is not active by default but can be enabled with e.g.
(10 * ureg("1 / meV")).to("cm", "reciprocal_spectroscopy")
This can also help to avoid divide-by-zero issues when performing energy <-> wavenumber conversions.
A Spectrum2DCollection class has been added to euphonic.spectra, which shares many features with Spectrum1DCollection
- In particular, the
iter_metadatamethod is recommended when one needs to iterate over the collection metadata without copying the spectral data to new objects.
- In particular, the
Both Spectrum1DCollection and Spectrum2DCollection have a
.from_spectra()constructor with an "unsafe" option which bypasses some consistency checks on the component data. This should only be used when confident that these will be consistent, such as when iterating over an existing collection.Performance optimisations have been made to the "item getter" for Spectrum1DCollection (and Spectrum2DCollection); it should now be significantly faster to access and iterate over the contained spectra.
A
euphonic.writers.phonon_websitemodule has been added with a function to export QpointPhononModes to appropriate JSON for use with the phonon visualisation website http://henriquemiranda.github.io/phononwebsite/From the command-line, this can be accessed with a
--save-web-jsonargument to theeuphonic-dispersiontool.
Bug fixes
- Metadata strings from Castep-imported PDOS data are now converted from numpy strings to native Python strings.
- Spectra from CASTEP .phonon_dos files are now imported with units of reciprocal energy (e.g. 1/meV)
Maintenance
- Cleared up unit-conversion-related warnings, de-cluttering the expected test suite output.
- The Spectrum1DCollection class was significantly refactored to support addition of Spectrum2DCollection and improve maintainability.
- Entire build system rework, migrating to
pyproject.tomlform withmeson-python,cibuildwheeland removingversioneerto simplify future development and maintenance.
- Requirements
packaginglibrary added to dependencies.
- Bug fixes
- Fixed an error loading QpointPhononModes from JSON when there is a single q-point in the data
- Improvements
- When loading
.castep_binfiles, explicitly check the CASTEP version number and give a useful error message if this is < 17.1. (These files are missing information about the unit cell origins, and would previously cause an error with an unhelpful message.)
- When loading
- Maintenance
- Compatibility fix for spglib 2.4 update: a new sanity-check in spglib raises TypeError when using empty unit cell and this needs handling when looking for high-symmetry labels
- Compatibility fix for Numpy 2.0 update: avoid some
broadcasting issues with array shape returned by
np.unique - Update reference to scipy.integrate.simpson (scipy.integrate.simps is deprecated)
- Filter out spglib deprecation warnings caused by SeeK-path.
- Maintenance
- Updated versioneer for compatibility with Python 3.12
- In tests, avoid checking an attribute of 3D plots which is unreliable in recent matplotlib versions
- Update readthedocs configuration to fix documentation builds
- Requirements
- Python 3.7 is no longer supported
- Minimum version of scipy increased from 1.1 to 1.10
- This requires numpy >= 1.19.5
- Minimum version of matplotlib increased from 2.2.2 to 3.2.0
- Minimum version of pint increased from 0.10.1 to 0.19
- Minimum version of h5py increaased form 2.8 to 2.10
- Improvements
- Added variable-width broadening for 1-D and 2-D spectra. An
arbitrary Callable can be provided relating the axis position to
Gaussian or Lorentzian width parameter.
euphonic-dosandeuphonic-powder-mapCLI tools accept polynomial coefficients as input. The broadening is implemented with the fast approximate interpolation method already available for adaptive broadening of DOS. - Added features to Spectrum classes
- Added
copy()methods returning an independent duplicate of data - Added
__mul__and__imul__methods to Spectrum classes. This allows results to be conveniently scaled with infix notation*or*=
- Added
- Added --scale parameter to
euphonic-dos,euphonic-intensity-map,euphonic-powder-mapto allow arbitrary scaling of results from command-line. (e.g. for comparison with experiment, or changing DOS normalisation from 1 to 3N.)
- Added variable-width broadening for 1-D and 2-D spectra. An
arbitrary Callable can be provided relating the axis position to
Gaussian or Lorentzian width parameter.
- Bug Fixes:
- Changed the masking logic for kinematic constraints: instead of requiring energy bin to _entirely_ fall within accessible range at Q-bin mid-point, unmask bins if _any_ part of energy range is accessible at this Q value. This gives much more intuitive behaviour, especially for narrow angle ranges.
Improvements
Added "prefer_non_loto" option to Castep .phonon file importers. When this is enabled, a block of q-points are encountered with splitting directions, and one q-point does not have a splitting direction, the data at this "exact" q-point is preferred and the other weights in the group are set to zero.
This provides the intended behaviour of the Abins Castep parser and should give a reasonable result for Gamma-point only Castep calculations.
The option is disabled by default, so existing scripts will not be affected.
Bug Fixes:
- Allow
colorto be passed as an extra kwarg toplot_1dandplot_1d_to_axis. Previously this caused aTypeError. - Fix bug where
Py_Nonewas not incremented before returning fromcalculate_phonons()in the C-extension causing a deallocation crash - Support phonopy.yaml files from Phonopy versions >= 1.18, which have moved the data relating to dipole-dipole corrections. (i.e. Born effective charges, static dielectric tensor and a related unit conversion factor.)
- Allow
Maintenance:
- A deprecation in Numpy 1.25, which indirectly caused a test failure, has been addressed.
- Improvements:
- Euphonic now tests on Python 3.11
- Euphonic now provides PyPI wheels for Python 3.11
- New features:
- You can now perform linear interpolation of phonon frequencies and
eigenvectors with the Brille
library using the new
euphonic.brille.BrilleInterpolatorobject. This should provide performance improvements for large unit cells which require the dipole correction. - There is a new command-line tool
euphonic-brille-convergenceto assist with choosing theBrilleInterpolator.from_force_constantsarguments to achieve the desired accuracy. - Brille interpolation can be accessed from the
euphonic-powder-maptool using the new--use-brille,--brille-grid-type,--brille-nptsand--brille-npts-densityarguments.
- You can now perform linear interpolation of phonon frequencies and
eigenvectors with the Brille
library using the new
- New features:
- There is a new function
ForceConstants.from_total_fc_with_dipoleto allow reading force constants from other programs which contain long-ranged dipole-dipole interactions.
- There is a new function
- Bug fixes:
- Changes:
- Support for Python 3.6 has been dropped. This has also resulted in
changes to the following dependencies:
- numpy requirement increased from
1.12.1to1.14.5 - scipy requirement increased from
1.0.0to1.1.0 - pint requirement increased from
0.9to0.10.1 - matplotlib requirement increased from
2.0.0to2.2.2 - h5py requirement increased from
2.7.0to2.8.0
- numpy requirement increased from
- The following deprecated features have been removed:
- The
return_mode_widthsargument inForceConstants.calculate_qpoint_phonon_modesandForceConstants.calculate_qpoint_frequencieshas been removed - The
eta_scaleargument incalculate_qpoint_phonon_modes/frequencieshas been removed - The alias command-line tool argument
--weightshas been removed - The alias arguments
x_label,y_label,y_minandy_maxtoplot_1d/2dhave been removed - The
modes_from_fileandforce_constants_from_filefunctions fromeuphonic.cli.utilshave been removed - Calling
broadenon aSpectrumwith uneven bin widths without specifying themethod='convolve'argument will now raise aValueError
- The
- DOS and PDOS calculated by the
calculate_dosandcalculate_dos_mapmethods ofQpointPhononModesandQpointFrequencies, andQpointPhononModes.calculate_pdosare now calculated per atom rather than per unit cell (integrated area is3rather than3*N_atom). This is to keep consistency with the structure factors calculated byQpointPhononModes.calculate_structure_factorwhich are calculated per atom. - The option
average_repeat_pointswhen importing q-point modes or frequencies from a CASTEP .phonon file withQpointFrequencies/QpointPhononModes.from_castepis nowTrueby default. To recover previous behaviour set this toFalse.
- Support for Python 3.6 has been dropped. This has also resulted in
changes to the following dependencies:
- New Features:
- Kinematic constraints have been implemented for 2-D S(q,w)-like data.
- A function
euphonic.spectra.apply_kinematic_constraints(Spectrum2d, **kwargs) -> Spectrum2Dis implemented which masks out inaccessible data, replacing it with NaN. - Both direct-geometry and indirect-geometry are supported, by using the appropriate argument to set incident or final neutron energy.
- This function is exposed to the
euphonic-powder-maptool, so these plots can be produced directly from the CLI. - Some parameters from real-world instruments are collected in the documentation for convenience.
- A function
- There is a new function
euphonic.util.convert_fc_phases, which converts a force constants matrix which uses the atom coordinates in the phase during interpolation (Phonopy-like), to one which uses the cell origin coordinates (Euphonic, CASTEP-like). - When importing q-point modes or frequencies from a CASTEP .phonon
file, a new option (
average_repeat_points=True) allows repeated entries (with the same q-point index) to be identified and their weights divided down by the number of entries. This option should give better statistics for sampling meshes that include the Gamma-point with LO-TO splitting.
- Kinematic constraints have been implemented for 2-D S(q,w)-like data.
- Improvements:
- Documentation on the shape and format of the force constants, and how to read them from other programs has been improved.
- The
euphonic.util.get_qpoint_labelsfunction, which is called when importing band-structure data to identify and label significant points, primarily identifies these points by searching for turning-points in the band path. The function will now also pick up any q-point that appears twice in succession. This is a common convention in band-structure calculations and helps with edge-cases such as when the path passes through a high-symmetry point without changing direction. This may pick up some previously-missing points in band-structure plots generated witheuphonic-dispersionandeuphonic-intensity-map
- Bug fixes:
- Allow read of
phonopy.yamlquantities in'au'(bohr) units. Previously this was interpreted as an astronomical unit by Pint.
- Allow read of
- Improvements:
- The
euphonic-dos,euphonic-dispersionandeuphonic-intensity-mapcommand-line tools can now read files that don't contain eigenvectors, if eigenvectors are not required for the chosen options. - A new
--save-jsonoption is available for command-line tools which produce plots, this will output the produced spectrum to a Euphonic .json file. - There is now the option to use a fast, approximate variable-width broadening method when
adaptively broadening dos:
- Added new
adaptive_methodandadaptive_errorarguments forcalculate_doswhich specify which adaptive broadening method to use (referenceorfast) and an acceptable error level when using thefastmethod. - Fast adaptive broadening can be used in the
euphonic-dostool with the--adaptive-methodand--adaptive-errorarguments.
- Added new
- The
- Changes:
euphonic.cli.force_constants_from_fileandmodes_from_filehave been deprecated in favour ofeuphonic.cli.load_data_from_file.- Using
Spectrum1D/1DCollection/2D.broadenon an axis with unequal bin widths is now deprecated, as broadening is performed via convolution, which is incorrect in this case. In the future, this will raise aValueError. To broaden anyway,method='convolve'can be supplied, which will just emit a warning.
- New Features:
- New
Spectrum1D.to_text_fileandSpectrum1DCollection.to_text_filemethods to write to column text files - An expanded and consistent set of styling options is made available for command-line tools that produce plots.
- Consistent styling and advanced changes can be made using
Matplotlib stylesheet files, either as a CLI argument or
using
matplotlib.style.context()in a Python script.
- New
- Improvements:
- Internally, plot theming has been adjusted to rely on Matplotlib style contexts. This means user changes and style context are more likely to be respected.
- Additional aliases for plot arguments in the command-line tools have
been added, for example either
--x-labelor--xlabelcan be used.
- Changes:
x_label,y_label,y_minandy_maxineuphonic.plotfunctions have been deprecated in favour ofxlabel,ylabel,yminandymaxrespectively, to match the Matplotlib arguments they refer to, and to match other arguments likevmin,vmax.
- Improvements:
- Wheels are now provided with PyPI releases
- Type hinting is now handled more consistently across different Euphonic classes and functions
- Bug Fixes:
- Will no longer raise a KeyError reading from
phonopy.yamlifphysical_unitkey is not present, instead will assume default units - Can now read Phonopy BORN files where the (optional) NAC conversion factor is not present
- Will no longer raise a KeyError reading from
- Bug fixes:
- The scaling of S(Q,w) as produced by
StructureFactor.calculate_sqw_mapwas incorrect, and did not correctly scale with energy bin size (given its units are nowlength**2/energy). This has been fixed, and S(Q,w) scale has changed by a factor of (hartee to energy bin unit conversion)/(energy bin width magnitude). e.g. if using an energy bin width of 0.1 meV, the new S(Q,w) will be scaled by 2.72e4/0.1 = 2.72e5. The original structure factors can now be correctly recovered by multiplying S(Q,w) by the energy bin width.
- The scaling of S(Q,w) as produced by
- Euphonic can now calculate neutron-weighted partial density of states, and
has new
Spectrafeatures to handle PDOS data:- Added
QpointPhononModes.calculate_pdosmethod - Added
QpointFrequencies.calculate_dos_mapmethod - New
Spectrum1D.__add__method, which adds 2 spectra together - New
Spectrum1DCollection.__add__method, which concatenates 2 collections - Enabled indexing of
Spectrum1DCollectionby a sequence - Added
Spectrum1DCollection.group_bymethod, which allows grouping and summing spectra by metadata keys e.g.group_by('species') - Added
Spectrum1DCollection.selectmethod, which allows selection of spectra by metadata keys e.g.select(species='Si') - Added
Spectrum1DCollection.summethod, which sums all spectra in a collection - Added
-w={'coherent-dos','incoherent-dos','coherent-plus-incoherent-dos'}neutron-weighted PDOS options toeuphonic-dosandeuphonic-powder-map - Added
--pdosoptions for plotting specific species PDOS toeuphonic-dosandeuphonic-powder-map - Deprecated
--weightscommand-line argument in favour of--weightingfor consistency withcalculate_pdos
- Added
- Improvements:
- LICENSE and CITATION.cff files are now included in Euphonic's installation
- Add ability to interactively change the colormap intensity limits
in
euphonic-powder-map euphonic-optimise-dipole-parametercan now read from Phonopy sourceseuphonic-optimise-dipole-parametercan now also be used for non-polar materials to get general per-qpoint timings- Dimensioned Euphonic properties (e.g.
frequencies,cell_vectors) now have setters so can be set, previously this would raise anAttributeError
- Changes:
- The units of density of states as produced by
calculate_doshave changed from dimensionless to1/energy - The scaling of density of states has also changed. Previously the
integration would sum to 1 (if the
x_datawere converted to Hartree units), now the integration will sum to 3N in the same units asx_data StructureFactor.structure_factorshave been changed to be in absolute units per atom (rather than per unit cell) so will have changed by a factor of 1/2*n_atoms, this formulation change has been reflected in thecalculate_structure_factordocstring- The default unit of
StructureFactor.structure_factorshas been changed fromangstrom**2tomillibarn - The unit of S(Q,w) as produced by
StructureFactor.calculate_sqw_maphas changed dimension fromlength**2tolength**2/energy. Also, as its unit is derived from the inputStructureFactorobject, its default units are nowmillibarn/meV - The
eta_scaleargument incalculate_qpoint_phonon_modeshas been deprecated,dipole_parametershould be used instead. - This means the
euphonic-optimise-etascript has been renamed toeuphonic-optimise-dipole-parameter.
- The units of density of states as produced by
- Improvements:
- Added
broadenmethod toSpectrum1DCollection
- Added
- Changes:
- The
return_mode_widthsargument incalculate_qpoint_phonon_modeshas been deprecated in favour ofreturn_mode_gradients. The mode widths can still be obtained from the mode gradients withutil.mode_gradients_to_widths
- The
- Bug fixes:
- Fixed memory leak when using the C extension and making multiple calls to
calculate_qpoint_phonon_modes/frequencies - Fixed bug which resulted in incorrect energy bins being generated
in
euphonic-powder-mapif units other than meV are used and--e-maxand--e-minaren't specified - Use correct number of energy bins in
euphonic-intensity-map,euphonic-powder-mapandeuphonic-dos. Previously onlyebins - 1bins were generated
- Fixed memory leak when using the C extension and making multiple calls to
- New Features:
- New
Crystal.get_symmetry_equivalent_atomsmethod which uses spglib to get the symmetry operations and equivalent atoms under each operation
- New
- Improvements:
- Added
symmetriseargument toQpointPhononModes.calculate_debye_wallerwhich will symmetrise it under the crystal symmetry operations. This means that there will no longer be a discrepancy betweenDebyeWallercalculated on a symmetry-reduced or full Monkhorst-Pack grid. By default,symmetrise=True - Added
frequencies_minargument tocalculate_debye_wallerto exclude very small frequencies. This will also exclude negative frequencies. This improves on the previous behaviour which only excluded gamma-point acoustic modes, so would miss small/negative frequencies elsewhere - Loading the LAPACK libraries for the C extension now uses the interface provided by scipy for cython instead of loading directly from a DLL. The new method means we don't have to guess the DLL filename anymore!
- Added
- Changes:
- New dependency on
spglib>=1.9.4 - Fixed formula in
calculate_debye_wallerdocstring to match actual implementation: moved1/2factor and added explicit q-point weights
- New dependency on
New Features:
- New command-line tool
euphonic-powder-mapallows generation and plotting of powder-averaged S(|q|,w) and DOS maps. - New
QpointFrequenciesobject which allows storage of frequencies without eigenvectors, meaning that memory usage can be reduced if eigenvectors are not required. StructureFactornow has aweightsattribute and can be used to calculate DOS withcalculate_dosand get dispersion withget_dispersionSpectrum1D,Spectrum1DCollectionandSpectrum2Dobjects have a newmetadataattribute, see their docstrings for details- Euphonic can now read DOS/PDOS from CASTEP .phonon_dos files with
Spectrum1D.from_castep_phonon_dosandSpectrum1DCollection.from_castep_phonon_dos - Adaptive broadening is now available for DOS, which can obtain a more representative DOS than standard fixed-width broadening. See the docs for details
- Adaptive broadening can be used in the
euphonic-dostool with the--adaptiveargument
- New command-line tool
Improvements:
Improved default behaviour for C extension use and number of threads:
- By default the C extension will be used if it is installed
- By default the number of threads will be set by
multiprocessing.cpu_count() - The environment variable
EUPHONIC_NUM_THREADScan be used to set a specific number of threads, which takes priority overmultiprocessing.cpu_count() fall_back_on_pythonargument has been removed and superseded by the defaultuse_c=Nonebehaviourthreadpoolctl.threadpool_limitsis used to limit the number of threads used by numerical libraries in Euphonic C function calls, resulting in better overall performance
Command-line interfaces have been refactored, giving a more uniform set of options and clearer sections of related arguments on the interactive help pages.
- It is now possible where appropriate to specify Monkhorst-Pack
sampling with a single-parameter
--q-spacingas an alternative to setting Monkhorst-Pack divisions. This approach will account for the size and shape of reciprocal-lattice cells.
- It is now possible where appropriate to specify Monkhorst-Pack
sampling with a single-parameter
Build process tweaks
- On Linux, the build process will now respect a user-defined
C-compiler variable
CC. - On Mac OSX, the build process will now respect a user-defined
C-compiler variable
CC. Homebrew library paths will only be set ifCCis empty and thebrewcommand is available.
These tweaks are intended to facilitate Conda packaging.
- On Linux, the build process will now respect a user-defined
C-compiler variable
Breaking changes:
- The
--q-distanceargument toeuphonic-intensity-maphas been renamed to--q-spacingfor consistency with other tools. - Debye-Waller calculation in
euphonic-intensity-mapis now enabled by setting--temperature, which no longer has a default value. - Default Monkhorst-Pack meshes (i.e. [6, 6, 6] in
euphonic-dosand [20, 20, 20] insample_sphere_structure_factor()) have been replaced by default grid-spacing values. - The scaling of density of states has changed, due to a change in implementation
- The
- There have been some major changes and improvements to spectra, plotting
and command line tools, including:
- New command line tool
euphonic-intensity-mapfor plotting weighted 2D Spectra e.g. Coherent neutron S(Q,w) - Existing command line tools
euphonic-dispersionandeuphonic-doshave been updated to also read force constants and Phonopy files. Arguments are also more consistent across tools so some may have changed, check the command line tool help for details. - New
Spectrum1DCollectionobject for containing 1D spectra with a shared x-axis (e.g. phonon dispersion modes) - New
plot_1d_to_axisandplot_2d_to_axisfunctions to allow plotting on specific axes get_bin_centresandget_bin_edgesutility functions on spectra- The
ratioargument toplot_2dhas been removed, it should no longer be required due to better management of relative axis sizes. - The
btolargument toplot_1dhas been removed, it is recommended to useSpectrum1D.split()orSpectrum1DCollection.split()instead. - The
plot_dispersionfunction has been removed. It is now recommended to plot dispersion usingplot_1d(QpointPhononModes.get_dispersion()). See docs for details.
- New command line tool
- Other changes:
- Some of Euphonic's dependency version requirements have been changed, but
can now be relied on with more certainty due to better CI testing. This
includes:
- numpy requirement increased from
1.9.1to1.12.1 - matplotlib requirement increased from
1.4.2to2.0.0 - pint requirement decreased from
0.10.1to0.9 - h5py requirement decreased from
2.9.0to2.7.0 - pyyaml requirement decreased from
5.1.2to3.13
- numpy requirement increased from
- Some of Euphonic's dependency version requirements have been changed, but
can now be relied on with more certainty due to better CI testing. This
includes:
- Improvements:
yaml.CSafeLoaderis now used instead ofyaml.SafeLoaderby default, so Phonopy.yamlfiles should load faster- Metadata
__euphonic_version__and__euphonic_class__have been added to .json file output for better provenance
- Bug fixes:
- Fix read of Phonopy 'full' force constants from phonopy.yaml and FORCE_CONSTANTS files
- Fix structure factor calculation at gamma points with splitting, see #107
- Change broadening implementation from
scipy.signal.fftconvolveto usescipy.ndimagefunctions for better handling of bright Bragg peaks, see #108
- New Features:
- Added weights as an argument to ForceConstants.calculate_qpoint_phonon_modes, this will allow easier use of symmetry reduction for calculating density of states, for example.
- Modules have been added to support spherical averaging from 3D
q-points to mod(q)
- euphonic.sampling provides pure functions for the generation of points on (2D) unit square and (3D) unit sphere surfaces.
- A script is provided for visualisation of the different schemes implemented in euphonic.sampling. This is primarily intended for education and debugging.
- euphonic.powder provides functions which, given force constants data, can use these sampling methods to obtain spherically-averaged phonon DOS and coherent structure factor data as 1D spectrum objects. (It is anticipated that this module will grow to include schemes beyond this average over a single sphere.)
- Added
Crystal.to_spglib_cellconvenience function
- Changes:
- The Scripts folder has been removed. Command-line tools are now located in the euphonic.cli module. The entry-points are managed in setup.py, and each tool has the prefix "euphonic-" to avoid namespace clashes with other tools on the user's computer. (e.g. euphonic-dos)
- From an interactive shell with tab-completion, one can find all the euphonic tools by typing "euphonic-<TAB>".
- Changed arguments for
util.get_qpoint_labels(Crystal, qpts)toutil.get_qpoint_labels(qpts, cell=None)wherecell = Crystal.to_spglib_cell()
- Bug fixes:
- Correctly convert from Phonopy's q-point weight convention to Euphonic's when reading from mesh.yaml (see 7509043)
- Avoid IndexError in
ForceConstants.calculate_qpoint_phonon_modeswhen there is only one q-point (which is gamma) andsplitting=True
- New Features:
- A system has been added for reference data in JSON files. These
are accessed via
euphonic.utils.get_reference_dataand some data has been added for coherent scattering lengths and cross-sections. This system has been made available to thecalculate_structure_factor()method; it is no longer necessary to craft a data dict every time a program uses this function.
- A system has been added for reference data in JSON files. These
are accessed via
- Changes:
- Fixed structure factor formula in docs (
|F(Q, nu)|->|F(Q, \\nu)|^2ande^(Q.r)->e^(iQ.r))
- Fixed structure factor formula in docs (
- Bug fixes:
- Fix
'born':nullinForceConstants.json files when Born is not present in the calculation (see c20679c) - Fix incorrect calculation of LO-TO splitting when
reduce_qpts=True, as the 'reduced' q rather than the actual q was used as the q-direction (see 3958072) - Fix interpolation for materials with non-symmetric supcercell matrices, see #81
- Fix interpolation for force constants read from Phonopy for materials that have a primitive matrix and more than 1 species, see #77
- Fix
- Breaking Changes:
- New Features:
- Euphonic can now read Phonopy input! See the docs for details.
- Improvements:
- Added
fall_back_on_pythonboolean keyword argument toForceConstants.calculate_qpoint_phonon_modesto control whether the Python implementation is used as a fallback to the C extension or not, see #35 - Added
--python-onlyoption tosetup.pyto enable install without the C extension
- Added
- Bug fixes:
- On reading CASTEP phonon file header information, switch from a fixed number of lines skipped to a search for a specific line, fixing issue #23
- Fix NaN frequencies/eigenvectors for consecutive gamma points, see #25
- Fix issue saving plots to file with dispersion.py, see #27
- Fix incorrect frequencies at gamma point when using dipole correction in C, #45
- Bug fixes:
- Add MANIFEST.in for PyPI distribution
- Bug fixes:
- Cannot easily upload C header files to PyPI without an accompanying source file, so refactor C files to avoid this
- There are several breaking changes:
- Changes to the object instantiation API. The former interface
InterpolationData(seedname)has been changed toInterpolationData.from_castep(seedname)in anticipation of more codes being added which require more varied arguments. - Changes to the Debye-Waller calculation API when calculating the structure
factor. The previous
dw_argkwarg accepted either a seedname or length 3 list describing a grid. The new kwarg is nowdw_dataand accepts aPhononDataorInterpolationDataobject with the frequencies calculated on a grid. This is to make it clearer to the user exactly what arguments are being used when calculating phonons on the grid. - Changes to parallel functionality. The previous parallel implementation
based on Python's multiprocessing has been removed and replaced by a
C/OpenMP version. This has both better performance and is more robust. As
a result the
n_procskwarg tocalculate_fine_phononshas been replaced byuse_candn_threadskwargs.
- Changes to the object instantiation API. The former interface
- Improvements:
- The parallel implementation based on Python's multiprocessing has been removed and now uses C/OpenMP which both has better performance and is more robust
- Documentation has been moved to readthedocs and is more detailed
- Clearer interface for calculating the Debye-Waller factor
- Better error handling (e.g. empty
InterpolationDataobjects, Matplotlib is not installed...)
- Bug fixes:
- Fix gwidth for DOS not being converted to correct units
- Fix qwidth for S(Q,w) broadening being incorrectly calculated