msiron commited on
Commit
a5a5192
·
1 Parent(s): 512b568

fix to energy corrections

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -72,8 +72,8 @@ for subset, df in elements_df.items():
72
 
73
  map_functional = {
74
  "PBE": "compatible_pbe",
75
- "PBESol": "compatible_pbesol",
76
- "SCAN": "compatible_scan",
77
  }
78
 
79
 
@@ -116,14 +116,16 @@ def create_phase_diagram(
116
 
117
  # Fetch all entries from the Materials Project database
118
  def get_energy_correction(energy_correction, row):
119
- if energy_correction == "Database specific, or MP2020":
120
  return (
121
  row["energy_corrected"] - row["energy"]
122
  if not np.isnan(row["energy_corrected"])
123
  else 0
124
  )
125
- elif energy_correction == "The 110 PBE Method":
126
- return row["energy"] * 1.1
 
 
127
 
128
  entries = [
129
  ComputedStructureEntry(
@@ -194,7 +196,7 @@ energy_correction_dropdown = gr.Dropdown(
194
  label="Energy correction",
195
  )
196
  plot_style_dropdown = gr.Dropdown(choices=["2D", "3D"], label="Plot Style")
197
- functional_dropdown = gr.Dropdown(choices=["PBE", "PBESol", "SCAN"], label="Functional")
198
  finite_temp_toggle = gr.Checkbox(label="Enable Finite Temperature Estimation")
199
 
200
  warning_message = "⚠️ This application uses energy correction schemes directly"
 
72
 
73
  map_functional = {
74
  "PBE": "compatible_pbe",
75
+ "PBESol (No correction scheme)": "compatible_pbesol",
76
+ "SCAN (No correction scheme)": "compatible_scan",
77
  }
78
 
79
 
 
116
 
117
  # Fetch all entries from the Materials Project database
118
  def get_energy_correction(energy_correction, row):
119
+ if energy_correction == "Database specific, or MP2020" and map_functional[functional] == 'pbe':
120
  return (
121
  row["energy_corrected"] - row["energy"]
122
  if not np.isnan(row["energy_corrected"])
123
  else 0
124
  )
125
+ elif energy_correction == "The 110 PBE Method" and map_functional[functional] == 'pbe':
126
+ return row["energy"] * 1.1-row['energy']
127
+ elif map_functional[functional] != 'pbe':
128
+ return 0
129
 
130
  entries = [
131
  ComputedStructureEntry(
 
196
  label="Energy correction",
197
  )
198
  plot_style_dropdown = gr.Dropdown(choices=["2D", "3D"], label="Plot Style")
199
+ functional_dropdown = gr.Dropdown(choices=["PBE", "PBESol (No correction scheme)", "SCAN (No correction scheme)"], label="Functional")
200
  finite_temp_toggle = gr.Checkbox(label="Enable Finite Temperature Estimation")
201
 
202
  warning_message = "⚠️ This application uses energy correction schemes directly"