Skip to content

Commit

Permalink
partially address #130 (comment), just the color bars overlapping, no…
Browse files Browse the repository at this point in the history
…t the strange y axis labels on the Cl element tile
  • Loading branch information
janosh committed Sep 5, 2024
1 parent 594db5f commit 0d54d68
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions data/mp/eda_mp_trj.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import ase
import ase.io.extxyz
import matplotlib.colorbar
import matplotlib.colors
import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -60,8 +61,7 @@
raise ValueError(f"expected zip file to be at {zip_path}")


# %%
# extract extXYZ files from zipped directory without unpacking the whole archive
# %% extract extXYZ files from zipped directory without unpacking the whole archive
# takes ~8 mins on M2 Max
# takes ~5 mins on M3 Max
atoms_list = ase_atoms_from_zip(
Expand Down Expand Up @@ -216,7 +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
# TODO fix weirdness with 6x10^e0 y axis label on Cl tile
ptable_n_sites_hist_path = f"{MP_DIR}/2022-09-16-mp-trj-elem-n-sites.json.bz2"
srs_mp_trj_elem_n_sites = locals().get("srs_mp_trj_elem_n_sites")

Expand Down Expand Up @@ -265,7 +265,7 @@ def tile_count_anno(hist_vals: list[Any]) -> dict[str, Any]:
# turn off y axis for helium (why is it even there?)
fig_ptable_sites.axes[17].get_yaxis().set_visible(b=False)

cbar_ax = fig_ptable_sites.figure.add_axes([0.23, 0.8, 0.31, 0.025])
cbar_ax = fig_ptable_sites.figure.add_axes([0.23, 0.73, 0.31, 0.025])
cbar = matplotlib.colorbar.ColorbarBase(
cbar_ax,
cmap=cmap,
Expand All @@ -288,8 +288,7 @@ def tile_count_anno(hist_vals: list[Any]) -> dict[str, Any]:
trj_elem_counts.to_json(f"{data_page}/{filename}.json")


# %%
# TODO https://github.com/janosh/pymatviz/issues/188 font sizes and box sizes
# %% TODO https://github.com/janosh/pymatviz/issues/188 font sizes and box sizes
count_mode = "composition"
trj_elem_counts = pd.read_json(
f"{data_page}/mp-trj-element-counts-by-{count_mode}.json", typ="series"
Expand Down
2 changes: 1 addition & 1 deletion matbench_discovery/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def ase_atoms_from_zip(
content = io.TextIOWrapper(file, encoding="utf-8").read()
atoms = ase.io.read(
io.StringIO(content), format="extxyz", index=slice(None)
)
) # reads multiple Atoms objects as frames if file contains trajectory
if isinstance(atoms, Atoms):
atoms = [atoms] # Wrap single Atoms object in a list
if filename_to_info:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"H":3022802,"He":394,"Li":1256745,"Be":71473,"B":673705,"C":1062189,"N":1270141,"O":18231355,"F":1852970,"Ne":7,"Na":565195,"Mg":1236354,"Al":607198,"Si":1044992,"P":1286729,"S":1671089,"Cl":941874,"Ar":19,"K":465558,"Ca":432583,"Sc":92095,"Ti":379620,"V":483822,"Cr":261206,"Mn":666675,"Fe":747611,"Co":462502,"Ni":349059,"Cu":442935,"Zn":369534,"Ga":266789,"Ge":280575,"As":274292,"Se":735063,"Br":378868,"Kr":1118,"Rb":234312,"Sr":340053,"Y":169707,"Zr":170165,"Nb":242834,"Mo":302815,"Tc":16446,"Ru":90811,"Rh":102437,"Pd":119125,"Ag":205205,"Cd":159110,"In":153819,"Sn":280298,"Sb":325241,"Te":356260,"I":378474,"Xe":12681,"Cs":187902,"Ba":377213,"La":249585,"Ce":138867,"Pr":124559,"Nd":144399,"Pm":6100,"Sm":109566,"Eu":65963,"Gd":57981,"Tb":92275,"Dy":85813,"Ho":84289,"Er":91595,"Tm":58947,"Yb":103610,"Lu":56557,"Hf":77575,"Ta":152462,"W":199171,"Re":79734,"Os":42936,"Ir":69722,"Pt":93165,"Au":88273,"Hg":131481,"Tl":131612,"Pb":178207,"Bi":289706,"Po":0,"At":0,"Rn":0,"Fr":0,"Ra":0,"Ac":3210,"Th":35895,"Pa":3024,"U":110566,"Np":11502,"Pu":15847,"Am":0,"Cm":0,"Bk":0,"Cf":0,"Es":0,"Fm":0,"Md":0,"No":0,"Lr":0,"Rf":0,"Db":0,"Sg":0,"Bh":0,"Hs":0,"Mt":0,"Ds":0,"Rg":0,"Cn":0,"Nh":0,"Fl":0,"Mc":0,"Lv":0,"Ts":0,"Og":0}
{"H":3022802.0,"He":394.0,"Li":1256745.0,"Be":71473.0,"B":673705.0,"C":1062189.0,"N":1270141.0,"O":18231355.0,"F":1852970.0,"Ne":7.0,"Na":565195.0,"Mg":1236354.0,"Al":607198.0,"Si":1044992.0,"P":1286729.0,"S":1671089.0,"Cl":941874.0,"Ar":19.0,"K":465558.0,"Ca":432583.0,"Sc":92095.0,"Ti":379620.0,"V":483822.0,"Cr":261206.0,"Mn":666675.0,"Fe":747611.0,"Co":462502.0,"Ni":349059.0,"Cu":442935.0,"Zn":369534.0,"Ga":266789.0,"Ge":280575.0,"As":274292.0,"Se":735063.0,"Br":378868.0,"Kr":1118.0,"Rb":234312.0,"Sr":340053.0,"Y":169707.0,"Zr":170165.0,"Nb":242834.0,"Mo":302815.0,"Tc":16446.0,"Ru":90811.0,"Rh":102437.0,"Pd":119125.0,"Ag":205205.0,"Cd":159110.0,"In":153819.0,"Sn":280298.0,"Sb":325241.0,"Te":356260.0,"I":378474.0,"Xe":12681.0,"Cs":187902.0,"Ba":377213.0,"La":249585.0,"Ce":138867.0,"Pr":124559.0,"Nd":144399.0,"Pm":6100.0,"Sm":109566.0,"Eu":65963.0,"Gd":57981.0,"Tb":92275.0,"Dy":85813.0,"Ho":84289.0,"Er":91595.0,"Tm":58947.0,"Yb":103610.0,"Lu":56557.0,"Hf":77575.0,"Ta":152462.0,"W":199171.0,"Re":79734.0,"Os":42936.0,"Ir":69722.0,"Pt":93165.0,"Au":88273.0,"Hg":131481.0,"Tl":131612.0,"Pb":178207.0,"Bi":289706.0,"Po":null,"At":null,"Rn":null,"Fr":null,"Ra":null,"Ac":3210.0,"Th":35895.0,"Pa":3024.0,"U":110566.0,"Np":11502.0,"Pu":15847.0,"Am":null,"Cm":null,"Bk":null,"Cf":null,"Es":null,"Fm":null,"Md":null,"No":null,"Lr":null,"Rf":null,"Db":null,"Sg":null,"Bh":null,"Hs":null,"Mt":null,"Ds":null,"Rg":null,"Cn":null,"Nh":null,"Fl":null,"Mc":null,"Lv":null,"Ts":null,"Og":null}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"H":141813,"He":80,"Li":221969,"Be":11617,"B":70668,"C":110482,"N":133419,"O":865310,"F":126711,"Ne":7,"Na":97846,"Mg":165156,"Al":85808,"Si":130390,"P":173342,"S":152409,"Cl":84369,"Ar":13,"K":92751,"Ca":90181,"Sc":20586,"Ti":73892,"V":95069,"Cr":62270,"Mn":138452,"Fe":130470,"Co":99444,"Ni":64911,"Cu":102577,"Zn":63384,"Ga":43862,"Ge":47999,"As":44561,"Se":75359,"Br":37662,"Kr":193,"Rb":52213,"Sr":70790,"Y":43457,"Zr":34452,"Nb":48428,"Mo":53121,"Tc":5805,"Ru":21775,"Rh":21110,"Pd":26473,"Ag":41294,"Cd":32153,"In":32972,"Sn":57153,"Sb":60064,"Te":55721,"I":38242,"Xe":2100,"Cs":46105,"Ba":80808,"La":52544,"Ce":34253,"Pr":26100,"Nd":30510,"Pm":2554,"Sm":25545,"Eu":20175,"Gd":15642,"Tb":19282,"Dy":19158,"Ho":18354,"Er":19165,"Tm":13751,"Yb":21528,"Lu":13049,"Hf":20429,"Ta":29753,"W":48784,"Re":15609,"Os":10340,"Ir":17642,"Pt":22537,"Au":22604,"Hg":23197,"Tl":30588,"Pb":33582,"Bi":51054,"Po":0,"At":0,"Rn":0,"Fr":0,"Ra":0,"Ac":1371,"Th":10280,"Pa":1641,"U":28332,"Np":3775,"Pu":4496,"Am":0,"Cm":0,"Bk":0,"Cf":0,"Es":0,"Fm":0,"Md":0,"No":0,"Lr":0,"Rf":0,"Db":0,"Sg":0,"Bh":0,"Hs":0,"Mt":0,"Ds":0,"Rg":0,"Cn":0,"Nh":0,"Fl":0,"Mc":0,"Lv":0,"Ts":0,"Og":0}
{"H":141813.0,"He":80.0,"Li":221969.0,"Be":11617.0,"B":70668.0,"C":110482.0,"N":133419.0,"O":865310.0,"F":126711.0,"Ne":7.0,"Na":97846.0,"Mg":165156.0,"Al":85808.0,"Si":130390.0,"P":173342.0,"S":152409.0,"Cl":84369.0,"Ar":13.0,"K":92751.0,"Ca":90181.0,"Sc":20586.0,"Ti":73892.0,"V":95069.0,"Cr":62270.0,"Mn":138452.0,"Fe":130470.0,"Co":99444.0,"Ni":64911.0,"Cu":102577.0,"Zn":63384.0,"Ga":43862.0,"Ge":47999.0,"As":44561.0,"Se":75359.0,"Br":37662.0,"Kr":193.0,"Rb":52213.0,"Sr":70790.0,"Y":43457.0,"Zr":34452.0,"Nb":48428.0,"Mo":53121.0,"Tc":5805.0,"Ru":21775.0,"Rh":21110.0,"Pd":26473.0,"Ag":41294.0,"Cd":32153.0,"In":32972.0,"Sn":57153.0,"Sb":60064.0,"Te":55721.0,"I":38242.0,"Xe":2100.0,"Cs":46105.0,"Ba":80808.0,"La":52544.0,"Ce":34253.0,"Pr":26100.0,"Nd":30510.0,"Pm":2554.0,"Sm":25545.0,"Eu":20175.0,"Gd":15642.0,"Tb":19282.0,"Dy":19158.0,"Ho":18354.0,"Er":19165.0,"Tm":13751.0,"Yb":21528.0,"Lu":13049.0,"Hf":20429.0,"Ta":29753.0,"W":48784.0,"Re":15609.0,"Os":10340.0,"Ir":17642.0,"Pt":22537.0,"Au":22604.0,"Hg":23197.0,"Tl":30588.0,"Pb":33582.0,"Bi":51054.0,"Po":null,"At":null,"Rn":null,"Fr":null,"Ra":null,"Ac":1371.0,"Th":10280.0,"Pa":1641.0,"U":28332.0,"Np":3775.0,"Pu":4496.0,"Am":null,"Cm":null,"Bk":null,"Cf":null,"Es":null,"Fm":null,"Md":null,"No":null,"Lr":null,"Rf":null,"Db":null,"Sg":null,"Bh":null,"Hs":null,"Mt":null,"Ds":null,"Rg":null,"Cn":null,"Nh":null,"Fl":null,"Mc":null,"Lv":null,"Ts":null,"Og":null}

0 comments on commit 0d54d68

Please sign in to comment.