Skip to content

Commit

Permalink
Phonon convenience imports (#3544)
Browse files Browse the repository at this point in the history
* add pymatgen/phonon/__init__.py convenience imports

* test_convenience_imports()
  • Loading branch information
janosh authored Jan 9, 2024
1 parent ba655df commit 9751f96
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
22 changes: 21 additions & 1 deletion pymatgen/phonon/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
"""Phonon DOS and bandstructure analysis package."""
"""pymatgen phonon package with functionality for phonon DOS + bandstructure analysis and more."""

from __future__ import annotations

from pymatgen.phonon.bandstructure import PhononBandStructure, PhononBandStructureSymmLine
from pymatgen.phonon.dos import CompletePhononDos, PhononDos
from pymatgen.phonon.gruneisen import (
GruneisenParameter,
GruneisenPhononBandStructure,
GruneisenPhononBandStructureSymmLine,
)
from pymatgen.phonon.ir_spectra import IRDielectricTensor
from pymatgen.phonon.plotter import (
GruneisenPhononBSPlotter,
GruneisenPlotter,
PhononBSPlotter,
PhononDosPlotter,
ThermoPlotter,
plot_brillouin_zone,
)
from pymatgen.phonon.thermal_displacements import ThermalDisplacementMatrices
Empty file removed tests/phonon/__init__.py
Empty file.
21 changes: 21 additions & 0 deletions tests/phonon/test_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from __future__ import annotations

import pymatgen.phonon as ph
import pymatgen.phonon.bandstructure as bs
import pymatgen.phonon.dos as dos
import pymatgen.phonon.gruneisen as gru
import pymatgen.phonon.plotter as plotter


def test_convenience_imports():
assert ph.PhononBandStructure == bs.PhononBandStructure
assert ph.PhononBandStructureSymmLine == bs.PhononBandStructureSymmLine
assert ph.PhononDos == dos.PhononDos
assert ph.CompletePhononDos == dos.CompletePhononDos
assert ph.GruneisenParameter == gru.GruneisenParameter
assert ph.GruneisenPhononBandStructure == gru.GruneisenPhononBandStructure
assert ph.GruneisenPhononBandStructureSymmLine == gru.GruneisenPhononBandStructureSymmLine
assert ph.PhononDosPlotter == plotter.PhononDosPlotter
assert ph.PhononBSPlotter == plotter.PhononBSPlotter
assert ph.GruneisenPlotter == plotter.GruneisenPlotter
assert ph.GruneisenPhononBSPlotter == plotter.GruneisenPhononBSPlotter

0 comments on commit 9751f96

Please sign in to comment.