Skip to content

Commit b01b885

Browse files
Merge branch 'main' into main
2 parents 44e6c33 + 073eac1 commit b01b885

File tree

94 files changed

+48
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+48
-152
lines changed

pyproject.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defects = [
5151
]
5252
forcefields = [
5353
"ase>=3.23.0",
54-
"calorine<=2.2.1",
54+
"calorine>=3.0",
5555
"chgnet>=0.2.2",
5656
"mace-torch>=0.3.3",
5757
"matgl>=1.1.3",
@@ -74,7 +74,7 @@ docs = [
7474
"FireWorks==2.0.3",
7575
"autodoc_pydantic==2.2.0",
7676
"furo==2024.8.6",
77-
"ipython==8.29.0",
77+
"ipython==8.30.0",
7878
"jsonschema[format]",
7979
"myst_parser==4.0.0",
8080
"numpydoc==1.8.0",
@@ -89,7 +89,7 @@ tests = [
8989
"pytest-cov==6.0.0",
9090
"pytest-mock==3.14.0",
9191
"pytest-split==0.10.0",
92-
"pytest==8.3.3",
92+
"pytest==8.3.4",
9393
]
9494
strict = [
9595
"PyYAML==6.0.2",
@@ -98,17 +98,17 @@ strict = [
9898
"click==8.1.7",
9999
"custodian==2024.10.16",
100100
"dscribe==2.1.1",
101-
"emmet-core==0.84.3rc4",
101+
"emmet-core==0.84.3rc6",
102102
"ijson==3.3.0",
103103
"jobflow==0.1.19",
104104
"lobsterpy==0.4.9",
105105
"mdanalysis==2.7.0",
106106
"monty==2024.10.21",
107-
"mp-api==0.42.2",
107+
"mp-api==0.43.0",
108108
"numpy",
109109
"openmm-mdanalysis-reporter==0.1.0",
110110
"openmm==8.1.1",
111-
"phonopy==2.27.0",
111+
"phonopy==2.30.1",
112112
"pydantic-settings==2.6.1",
113113
"pydantic==2.9.2",
114114
"pymatgen-analysis-defects==2024.10.22",
@@ -124,7 +124,7 @@ strict-forcefields = [
124124
"mace-torch>=0.3.6",
125125
"matgl==1.1.3",
126126
"quippy-ase==0.9.14; python_version < '3.12'",
127-
"sevenn==0.10.1",
127+
"sevenn==0.10.2",
128128
"torch==2.5.1",
129129
"torchdata==0.7.1", # TODO: remove when issue fixed
130130
]

src/atomate2/common/schemas/gruneisen.py

Lines changed: 11 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44
from pathlib import Path
55
from typing import Optional, Union
66

7-
import matplotlib.pyplot as plt
8-
import numpy as np
97
import phonopy
108
from emmet.core.structure import StructureMetadata
11-
from matplotlib import colors
12-
from matplotlib.colors import LinearSegmentedColormap
139
from phonopy.api_gruneisen import PhonopyGruneisen
1410
from phonopy.phonon.band_structure import get_band_qpoints_and_path_connections
1511
from pydantic import BaseModel, Field
@@ -24,12 +20,7 @@
2420
GruneisenParameter,
2521
GruneisenPhononBandStructureSymmLine,
2622
)
27-
from pymatgen.phonon.plotter import (
28-
GruneisenPhononBSPlotter,
29-
GruneisenPlotter,
30-
freq_units,
31-
)
32-
from pymatgen.util.plotting import pretty_plot
23+
from pymatgen.phonon.plotter import GruneisenPhononBSPlotter, GruneisenPlotter
3324
from typing_extensions import Self
3425

3526
from atomate2.common.schemas.phonons import PhononBSDOSDoc
@@ -164,7 +155,7 @@ def from_phonon_yamls(
164155
mesh=mesh,
165156
shift=compute_gruneisen_param_kwargs.get("shift"),
166157
is_gamma_center=compute_gruneisen_param_kwargs.get(
167-
"is_gamma_center", True
158+
"is_gamma_center", False
168159
),
169160
is_time_reversal=compute_gruneisen_param_kwargs.get(
170161
"is_time_reversal", True
@@ -184,7 +175,7 @@ def from_phonon_yamls(
184175
mesh=kpoint.kpts[0],
185176
shift=compute_gruneisen_param_kwargs.get("shift"),
186177
is_gamma_center=compute_gruneisen_param_kwargs.get(
187-
"is_gamma_center", True
178+
"is_gamma_center", False
188179
),
189180
is_time_reversal=compute_gruneisen_param_kwargs.get(
190181
"is_time_reversal", True
@@ -228,9 +219,14 @@ def from_phonon_yamls(
228219
labels_dict=kpath_dict,
229220
)
230221
gp_bs_plot = GruneisenPhononBSPlotter(bs=gruneisen_band_structure)
231-
GruneisenParameterDocument.get_gruneisen_weighted_bandstructure(
232-
gruneisen_band_symline_plotter=gp_bs_plot,
233-
save_fig=True,
222+
223+
gruneisen_bs_plot = compute_gruneisen_param_kwargs.get(
224+
"gruneisen_bs", "gruneisen_band.pdf"
225+
)
226+
gp_bs_plot.save_plot_gs(
227+
filename=gruneisen_bs_plot,
228+
plot_ph_bs_with_gruneisen=True,
229+
img_format=compute_gruneisen_param_kwargs.get("img_format", "pdf"),
234230
**compute_gruneisen_param_kwargs,
235231
)
236232
gruneisen_parameter_inputs = {
@@ -261,82 +257,3 @@ def from_phonon_yamls(
261257
gruneisen_band_structure=gruneisen_band_structure,
262258
derived_properties=derived_properties,
263259
)
264-
265-
@staticmethod
266-
def get_gruneisen_weighted_bandstructure(
267-
gruneisen_band_symline_plotter: GruneisenPhononBSPlotter,
268-
save_fig: bool = True,
269-
**kwargs,
270-
) -> None:
271-
"""Save a phonon band structure weighted with Grueneisen parameters.
272-
273-
Parameters
274-
----------
275-
gruneisen_band_symline_plotter: GruneisenPhononBSPlotter
276-
pymatgen GruneisenPhononBSPlotter obj
277-
save_fig: bool
278-
bool to save plots
279-
kwargs: dict
280-
keyword arguments to adjust plotter
281-
282-
Returns
283-
-------
284-
None
285-
"""
286-
u = freq_units(kwargs.get("units", "THz"))
287-
ax = pretty_plot(12, 8)
288-
gruneisen_band_symline_plotter._make_ticks(ax) # noqa: SLF001
289-
290-
# plot y=0 line
291-
ax.axhline(0, linewidth=1, color="black")
292-
293-
# Create custom colormap (default is red to blue)
294-
cmap = LinearSegmentedColormap.from_list(
295-
"mycmap", kwargs.get("mycmap", ["red", "blue"])
296-
)
297-
298-
data = gruneisen_band_symline_plotter.bs_plot_data()
299-
300-
# extract min and max Grüneisen parameter values
301-
max_gruneisen = np.array(data["gruneisen"]).max()
302-
min_gruneisen = np.array(data["gruneisen"]).min()
303-
304-
# LogNormalize colormap based on the min and max Grüneisen parameter values
305-
norm = colors.SymLogNorm(
306-
vmin=min_gruneisen,
307-
vmax=max_gruneisen,
308-
linthresh=1e-2,
309-
linscale=1,
310-
)
311-
312-
for (dists_inx, dists), (_, freqs) in zip(
313-
enumerate(data["distances"]), enumerate(data["frequency"]), strict=True
314-
):
315-
for band_idx in range(gruneisen_band_symline_plotter.n_bands):
316-
ys = [freqs[band_idx][j] * u.factor for j in range(len(dists))]
317-
ys_gru = [
318-
data["gruneisen"][dists_inx][band_idx][idx]
319-
for idx in range(len(data["distances"][dists_inx]))
320-
]
321-
sc = ax.scatter(
322-
dists, ys, c=ys_gru, cmap=cmap, norm=norm, marker="o", s=1
323-
)
324-
325-
# Main X and Y Labels
326-
ax.set_xlabel(r"$\mathrm{Wave\ Vector}$", fontsize=30)
327-
units = kwargs.get("units", "THz")
328-
ax.set_ylabel(f"Frequencies ({units})", fontsize=30)
329-
# X range (K)
330-
# last distance point
331-
x_max = data["distances"][-1][-1]
332-
ax.set_xlim(0, x_max)
333-
334-
cbar = plt.colorbar(sc, ax=ax)
335-
cbar.set_label(r"$\gamma \ \mathrm{(logarithmized)}$", fontsize=30)
336-
plt.tight_layout()
337-
gruneisen_band_plot = kwargs.get("gruneisen_bs", "gruneisen_band.pdf")
338-
if save_fig:
339-
plt.savefig(fname=gruneisen_band_plot)
340-
plt.close()
341-
else:
342-
plt.close()

tests/common/jobs/test_gruneisen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def test_compute_gruneisen_param(tmp_dir, test_dir):
5353
"minus": False,
5454
}
5555
assert gp_doc.derived_properties.average_gruneisen == pytest.approx(
56-
1.1882292157682082
56+
1.1203420586842452, abs=1e-2
5757
)
5858
assert gp_doc.derived_properties.thermal_conductivity_slack == pytest.approx(
59-
38.861289530152796
59+
44.078885068152346, abs=1e-2
6060
)

tests/test_data/vasp/Si_phonons_4/dielectric/inputs/INCAR.gz renamed to tests/test_data/vasp/Si_phonons_3/dielectric/inputs/INCAR.gz

File renamed without changes.

tests/test_data/vasp/Si_phonons_4/dielectric/inputs/KPOINTS.gz renamed to tests/test_data/vasp/Si_phonons_3/dielectric/inputs/KPOINTS.gz

File renamed without changes.

tests/test_data/vasp/Si_phonons_4/dielectric/inputs/POSCAR.gz renamed to tests/test_data/vasp/Si_phonons_3/dielectric/inputs/POSCAR.gz

File renamed without changes.

tests/test_data/vasp/Si_phonons_4/dielectric/inputs/POTCAR.spec.gz renamed to tests/test_data/vasp/Si_phonons_3/dielectric/inputs/POTCAR.spec.gz

File renamed without changes.

tests/test_data/vasp/Si_phonons_4/dielectric/outputs/CONTCAR.gz renamed to tests/test_data/vasp/Si_phonons_3/dielectric/outputs/CONTCAR.gz

File renamed without changes.

tests/test_data/vasp/Si_phonons_4/dielectric/outputs/INCAR.gz renamed to tests/test_data/vasp/Si_phonons_3/dielectric/outputs/INCAR.gz

File renamed without changes.

tests/test_data/vasp/Si_phonons_4/dielectric/outputs/INCAR.orig.gz renamed to tests/test_data/vasp/Si_phonons_3/dielectric/outputs/INCAR.orig.gz

File renamed without changes.

0 commit comments

Comments
 (0)