Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 1 addition & 46 deletions crystal_toolkit/components/phonon.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import itertools
from copy import deepcopy
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING

import numpy as np
import plotly.graph_objects as go
Expand All @@ -16,7 +16,6 @@
from pymatgen.analysis.graphs import StructureGraph
from pymatgen.analysis.local_env import CrystalNN
from pymatgen.core import Species
from pymatgen.ext.matproj import MPRester
from pymatgen.phonon.bandstructure import PhononBandStructureSymmLine
from pymatgen.phonon.dos import CompletePhononDos
from pymatgen.phonon.plotter import PhononBSPlotter
Expand Down Expand Up @@ -470,50 +469,6 @@ def _get_time_function_json(

return rdata

@staticmethod
def _get_ph_bs_dos(
data: dict[str, Any] | None,
) -> tuple[PhononBandStructureSymmLine, CompletePhononDos]:
data = data or {}

# this component can be loaded either from mpid or
# directly from BandStructureSymmLine or CompleteDos objects
# if mpid is supplied, it takes precedence

mpid = data.get("mpid")
bandstructure_symm_line = data.get("bandstructure_symm_line")
density_of_states = data.get("density_of_states")

if not mpid and (bandstructure_symm_line is None or density_of_states is None):
return None, None

if mpid:
with MPRester() as mpr:
try:
bandstructure_symm_line = (
mpr.get_phonon_bandstructure_by_material_id(mpid)
)
except Exception as exc:
print(exc)
bandstructure_symm_line = None

try:
density_of_states = mpr.get_phonon_dos_by_material_id(mpid)
except Exception as exc:
print(exc)
density_of_states = None

else:
if bandstructure_symm_line and isinstance(bandstructure_symm_line, dict):
bandstructure_symm_line = PhononBandStructureSymmLine.from_dict(
bandstructure_symm_line
)

if density_of_states and isinstance(density_of_states, dict):
density_of_states = CompletePhononDos.from_dict(density_of_states)

return bandstructure_symm_line, density_of_states

@staticmethod
def get_brillouin_zone_scene(bs: PhononBandStructureSymmLine) -> Scene:
if not bs:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ requires-python = ">=3.10"
authors = [{ name = "Matt Horton", email = "mkhorton@lbl.gov" }]

dependencies = [
"dash-mp-components==0.5.1rc2",
"dash-mp-components==0.5.1rc5",
"dash>=2.11.0",
"flask-caching",
"frozendict",
Expand Down
Loading