msiron commited on
Commit
ce5365e
1 Parent(s): b85ce7d

rounding and unit fixes, changing DB and hiding not yet released fields, visualize magmoms

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -19,7 +19,7 @@ top_k = 500
19
 
20
  # Load only the train split of the dataset
21
  dataset = load_dataset(
22
- "LeMaterial/leMat1",
23
  token=HF_TOKEN,
24
  split="train",
25
  columns=[
@@ -27,17 +27,17 @@ dataset = load_dataset(
27
  "species_at_sites",
28
  "cartesian_site_positions",
29
  "energy",
30
- "energy_corrected",
31
  "immutable_id",
32
  "elements",
33
  "functional",
34
  "stress_tensor",
35
  "magnetic_moments",
36
  "forces",
37
- "band_gap_direct",
38
- "band_gap_indirect",
39
  "dos_ef",
40
- "charges",
41
  "functional",
42
  "chemical_formula_reduced",
43
  "chemical_formula_descriptive",
@@ -367,6 +367,8 @@ def display_material(active_cell, selected_rows):
367
  row["cartesian_site_positions"],
368
  coords_are_cartesian=True,
369
  )
 
 
370
 
371
  sga = SpacegroupAnalyzer(structure)
372
 
@@ -377,17 +379,17 @@ def display_material(active_cell, selected_rows):
377
  properties = {
378
  "Material ID": row["immutable_id"],
379
  "Formula": row["chemical_formula_descriptive"],
380
- "Energy per atom (eV/atom)": row["energy"] / len(row["species_at_sites"]),
381
- "Band Gap (eV)": row["band_gap_direct"] or row["band_gap_indirect"],
382
- "Total Magnetization (μB/f.u.)": row["total_magnetization"],
383
- "Density (g/cm^3)": structure.density,
384
  "Fermi energy level (eV)": row["dos_ef"],
385
  "Crystal system": sga.get_crystal_system(),
386
  "International Spacegroup": sga.get_symmetry_dataset().international,
387
- "Magnetic moments (μB/f.u.)": row["magnetic_moments"],
388
- # "Stress tensor (kB)": row["stress_tensor"], # not available in LeMat1
389
- "Forces on atoms (eV/A)": row["forces"],
390
- "Bader charges (e-)": row["charges"],
391
  "DFT Functional": row["functional"],
392
  }
393
 
 
19
 
20
  # Load only the train split of the dataset
21
  dataset = load_dataset(
22
+ "LeMaterial/leMat-Bulk",
23
  token=HF_TOKEN,
24
  split="train",
25
  columns=[
 
27
  "species_at_sites",
28
  "cartesian_site_positions",
29
  "energy",
30
+ # "energy_corrected", # not yet available in LeMat-Bulk
31
  "immutable_id",
32
  "elements",
33
  "functional",
34
  "stress_tensor",
35
  "magnetic_moments",
36
  "forces",
37
+ # "band_gap_direct", #future release
38
+ # "band_gap_indirect", #future release
39
  "dos_ef",
40
+ # "charges", #future release
41
  "functional",
42
  "chemical_formula_reduced",
43
  "chemical_formula_descriptive",
 
367
  row["cartesian_site_positions"],
368
  coords_are_cartesian=True,
369
  )
370
+ if row['magnetic_moments']:
371
+ structure.add_site_property('magmom',row['magnetic_moments'])
372
 
373
  sga = SpacegroupAnalyzer(structure)
374
 
 
379
  properties = {
380
  "Material ID": row["immutable_id"],
381
  "Formula": row["chemical_formula_descriptive"],
382
+ "Energy per atom (eV/atom)": round(row["energy"] / len(row["species_at_sites"]), 3),
383
+ # "Band Gap (eV)": row["band_gap_direct"] or row["band_gap_indirect"], #future release
384
+ "Total Magnetization (μB)": row["total_magnetization"],
385
+ "Density (g/cm^3)": round(structure.density, 3),
386
  "Fermi energy level (eV)": row["dos_ef"],
387
  "Crystal system": sga.get_crystal_system(),
388
  "International Spacegroup": sga.get_symmetry_dataset().international,
389
+ "Magnetic moments (μB/f.u.)": np.round(row["magnetic_moments"], 3),
390
+ "Stress tensor (kB)": row["stress_tensor"],
391
+ "Forces on atoms (eV/A)": np.round(row["forces"], 3),
392
+ # "Bader charges (e-)": np.round(row["charges"], 3), # future release
393
  "DFT Functional": row["functional"],
394
  }
395