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

Restore MPTrj EDA to working order #130

Merged
merged 8 commits into from
Sep 6, 2024
Merged

Restore MPTrj EDA to working order #130

merged 8 commits into from
Sep 6, 2024

Conversation

CompRhys
Copy link
Collaborator

Still missing Magmoms and there are some older pmv heatmap arguments that are no longer valid and consequently cause issues

@CompRhys CompRhys marked this pull request as draft August 27, 2024 20:59
@CompRhys CompRhys added reproducibility Issues or improvements to reproducibility housekeeping Housekeeping fix Bug fix labels Aug 27, 2024
@CompRhys
Copy link
Collaborator Author

Lattice="-5.957734 5.957734 5.957734 5.957734 -5.957734 5.957734 5.957734 5.957734 -5.957734" Properties=species:S:1:pos:R:3:forces:R:3:magmoms:R:1 energy=-121.58871292 stress="-0.0007078916364624561 0.0 0.0 0.0 -0.0007078916364624561 0.0 -0.0 -0.0 -0.0007078916364624561" bandgap=0.0 e_per_atom_relaxed=-4.19202103275862 mp_id=mp-1207815 energy_per_atom=-4.19271423862069 ef_per_atom_relaxed=-4.19202103275862 corrected_total_energy=-121.58871292 ef_per_atom=-0.029657690229884855 task_id=mp-1357272 calc_id=0 ionic_step=0 pbc="T T T"
Yb       3.86615828       3.86615828       3.86615828       0.03581776       0.03581776       0.03581776       0.00300000
Yb      -2.09157572       2.09157572       2.09157572       0.03581776      -0.03581776      -0.03581776       0.00300000
Yb       2.09157572      -2.09157572       2.09157572      -0.03581776       0.03581776      -0.03581776       0.00300000
Yb       2.09157572       2.09157572      -2.09157572      -0.03581776      -0.03581776       0.03581776       0.00300000
Rh       5.95773400      -0.00000000       4.55530725      -0.00000000      -0.00000000      -0.08046960       0.00300000
Rh       0.00000000       5.95773400       1.40242675      -0.00000000      -0.00000000       0.08046960       0.00400000
Rh      -0.00000000       4.55530725       5.95773400      -0.00000000      -0.08046960      -0.00000000       0.00300000
Rh       5.95773400       1.40242675       0.00000000      -0.00000000       0.08046960       0.00000000       0.00300000
Rh       4.55530725       5.95773400      -0.00000000      -0.08046960      -0.00000000      -0.00000000       0.00700000
Rh       1.40242675       0.00000000       5.95773400       0.08046960      -0.00000000      -0.00000000       0.00300000
Pb       0.00000000       0.00000000       8.28838763      -0.00000000      -0.00000000       0.17456034       0.00100000
Pb       0.00000000       0.00000000       3.62708037      -0.00000000      -0.00000000      -0.17456034       0.00100000
Pb       0.00000000       8.28838763       0.00000000      -0.00000000       0.17456034      -0.00000000       0.00000000
Pb       0.00000000       3.62708037       0.00000000      -0.00000000      -0.17456034      -0.00000000       0.00100000
Pb       8.28838763       0.00000000       0.00000000       0.17456034      -0.00000000       0.00000000       0.00100000
Pb       3.62708037       0.00000000       0.00000000      -0.17456034      -0.00000000      -0.00000000       0.00100000
Pb       0.00000000       0.00000000       0.00000000      -0.00000000      -0.00000000      -0.00000000       0.00300000
Pb       3.35857722       0.52785523       3.89998034      -0.07462379       0.09127491       0.00780495       0.00100000
Pb       3.35858913      -0.52785523       8.01548766      -0.07462379      -0.09127491      -0.00780495       0.00100000
Pb       2.59915082       6.48558327       2.05775962       0.07462379       0.09127491      -0.00780495       0.00100000
Pb       0.52785523       3.89998034       3.35857722       0.09127491       0.00780495      -0.07462379       0.00100000
Pb       2.59915082       5.42988473      -2.05775962       0.07462379      -0.09127491       0.00780495       0.00100000
Pb      -0.52785523       8.01548766       3.35858913      -0.09127491      -0.00780495      -0.07462379       0.00200000
Pb       6.48558327       2.05775962       2.59915082       0.09127491      -0.00780495       0.07462379       0.00100000
Pb       5.42988473      -2.05775962       2.59915082      -0.09127491       0.00780495       0.07462379       0.00200000
Pb       3.89998034       3.35857722       0.52785523       0.00780495      -0.07462379       0.09127491       0.00100000
Pb       2.05775962       2.59915082       6.48558327      -0.00780495       0.07462379       0.09127491       0.00200000
Pb      -2.05775962       2.59915082       5.42988473       0.00780495       0.07462379      -0.09127491       0.00100000
Pb       8.01548766       3.35858913      -0.52785523      -0.00780495      -0.07462379      -0.09127491       0.00200000

We can find files inside the extxyz zipfile with magmoms stepping through with the debugger but they aren't being read?

cbar_coords=(0.18, 0.85, 0.42, 0.02),
# annotate each element with its number of magmoms in MPtrj
anno_kwds=tile_count_anno,
# anno_kwds=tile_count_anno,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this have a replacement?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tracked in janosh/pymatviz#199

@@ -196,6 +216,7 @@ def tile_count_anno(hist_vals: list[Any]) -> dict[str, Any]:


# %% plot histogram of number of sites per element
# TODO fix the cbar position and weirdness with 6x10e0
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partially addressed in 0d54d68

…t the strange y axis labels on the Cl element tile
…zip (now with same number of frames as original = 1_580_395)

assert len(mp_trj_atoms) == 145_923
assert len(df_mp_trj) == 1_580_395
for atoms_list in tqdm(mp_trj_atoms.values(), total=len(mp_trj_atoms))
for atoms in atoms_list
}
).T.convert_dtypes() # convert object columns to float/int where possible
df_mp_trj.index.name = "frame_id"
assert len(df_mp_trj) == 1_580_312 # number of total frames
assert len(df_mp_trj) == 1_580_395 # number of total frames
if Key.formula not in df_mp_trj:
raise KeyError(f"{Key.formula!s} not in {df_mp_trj.columns=}")

# this is the unrelaxed (but MP2020 corrected) formation energy per atom of the actual
# relaxation step
df_mp_trj = df_mp_trj.rename(columns={"ef_per_atom": MbdKey.e_form_dft})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CompRhys reran the script with the new fixed 2024-09-03-mp-trj.extxyz.zip. all cells pass after 9058aa7 except

fig = pmv.histogram(df_mp_trj[MbdKey.e_form_dft], bins=300)

since the DFT formation energy is no longer recorded in the Atoms.info dict

Copy link
Collaborator Author

@CompRhys CompRhys Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When chunked the script runs fairly quickly, two options exist: i) rerun that script to keep the extra labels I didn't save, I think I didn't do this as some of the formation energies looked wrong to me as they were the same as the energy per atom. ii) just grab the reference energies for the compositions and compute it quickly with https://github.com/janosh/matbench-discovery/blob/4d3d33f63a963f0d54f5538af04dd74866456c8f/matbench_discovery/energy.py#L83C5-L83C24

happy to do either, the only lost information is the bandgap in the current file but stuff does need to be recomputed/referenced for e_form etc

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, leaning towards ii) as it seems slightly less reliant on flawless data provenance

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option ii) implemented in a1f92db and confirmed to yield identical results as before

@janosh janosh marked this pull request as ready for review September 6, 2024 14:49
Copy link
Owner

@janosh janosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CompRhys thanks a lot for fixing this script! 👍

@janosh janosh merged commit 773a6e7 into main Sep 6, 2024
13 checks passed
@janosh janosh deleted the fix-mptrj-eda branch September 6, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix housekeeping Housekeeping reproducibility Issues or improvements to reproducibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants