Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update how summary magnetic ordering is determined for electronic structure docs #1171

Merged
merged 2 commits into from
Jan 9, 2025
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
10 changes: 7 additions & 3 deletions emmet-core/emmet/core/electronic_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ def from_bsdos( # type: ignore[override]
summary_efermi = bs_entry.setyawan_curtarolo.efermi # type: ignore
is_gap_direct = bs_entry.setyawan_curtarolo.is_gap_direct # type: ignore
is_metal = bs_entry.setyawan_curtarolo.is_metal # type: ignore
summary_magnetic_ordering = bs_entry.setyawan_curtarolo.magnetic_ordering # type: ignore

for origin in origins:
if origin["name"] == "setyawan_curtarolo":
Expand All @@ -473,7 +472,6 @@ def from_bsdos( # type: ignore[override]
summary_cbm = dos_cbm
summary_vbm = dos_vbm
summary_efermi = dos_efermi
summary_magnetic_ordering = dos_mag_ordering
is_metal = True if np.isclose(dos_gap, 0.0, atol=0.01, rtol=0) else False

for origin in origins:
Expand All @@ -487,10 +485,16 @@ def from_bsdos( # type: ignore[override]
origin["last_updated"] = new_origin_last_updated
origin["task_id"] = new_origin_task_id

summary_magnetic_ordering = CollinearMagneticStructureAnalyzer(
kwargs["meta_structure"],
round_magmoms=True,
threshold_nonmag=0.2,
threshold=0,
).ordering

return cls.from_structure(
material_id=MPID(material_id),
task_id=summary_task,
meta_structure=structure,
band_gap=summary_band_gap,
cbm=summary_cbm,
vbm=summary_vbm,
Expand Down
2 changes: 2 additions & 0 deletions emmet-core/tests/test_electronic_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_from_bsdos_1(bandstructure, dos, structure):
deprecated=False,
setyawan_curtarolo={"mp-1056141": bandstructure},
structures={"mp-1671247": structure, "mp-1056141": structure},
meta_structure=structure,
)

assert str(es_doc.material_id) == "mp-13"
Expand Down Expand Up @@ -80,6 +81,7 @@ def test_from_bsdos_2(bandstructure_fs, dos_fs):
is_metal=True,
deprecated=False,
setyawan_curtarolo={"mp-1612487": bs},
meta_structure=dos.structure,
)

assert str(es_doc.material_id) == "mp-25375"
Expand Down
Loading