ManasSharma07 commited on
Commit
fde6971
·
verified ·
1 Parent(s): 8447c3d

some more updates to keep consistency with local version

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +14 -11
src/streamlit_app.py CHANGED
@@ -946,7 +946,7 @@ def get_mace_model(model_path, dispersion, device, selected_default_dtype):
946
  @st.cache_resource
947
  def get_fairchem_model(selected_model_name, model_path_or_name, device, selected_task_type_fc): # Renamed args to avoid conflict
948
  predictor = pretrained_mlip.get_predict_unit(model_path_or_name, device=device)
949
- if selected_model_name == "UMA Small":
950
  calc = FAIRChemCalculator(predictor, task_name=selected_task_type_fc)
951
  else:
952
  calc = FAIRChemCalculator(predictor, task_name="omol")
@@ -1033,7 +1033,7 @@ if model_type == "MACE":
1033
  if model_type == "FairChem":
1034
  selected_model = st.sidebar.selectbox("Select FairChem Model:", list(FAIRCHEM_MODELS.keys()))
1035
  model_path = FAIRCHEM_MODELS[selected_model]
1036
- if selected_model == "UMA Small":
1037
  st.sidebar.warning("Meta FAIR Acceptable Use Policy applies.")
1038
  selected_task_type = st.sidebar.selectbox("Select UMA Model Task Type:", ["omol", "omat", "omc", "odac", "oc20"])
1039
  if selected_task_type == "omol" and atoms is not None:
@@ -1041,6 +1041,10 @@ if model_type == "FairChem":
1041
  spin_multiplicity = st.sidebar.number_input("Spin Multiplicity (2S + 1)", min_value=1, max_value=11, step=1, value=int(atoms.info.get("spin",0) if atoms.info.get("spin",0) is not None else 1)) # Assuming spin in atoms.info is S
1042
  atoms.info["charge"] = charge
1043
  atoms.info["spin"] = spin_multiplicity # FairChem expects multiplicity
 
 
 
 
1044
  if model_type == "ORB":
1045
  selected_model = st.sidebar.selectbox("Select ORB Model:", list(ORB_MODELS.keys()))
1046
  model_path = ORB_MODELS[selected_model]
@@ -1086,6 +1090,10 @@ if "Optimization" in task:
1086
  optimizer_type = st.sidebar.selectbox("Optimizer:", ["BFGS", "LBFGS", "FIRE"], index=1) # Renamed to optimizer_type
1087
 
1088
 
 
 
 
 
1089
  if atoms is not None:
1090
  col1, col2 = st.columns(2)
1091
 
@@ -1114,7 +1122,7 @@ if atoms is not None:
1114
  st.markdown("### Selected Model")
1115
  st.write(f"**Model Type:** {model_type}")
1116
  st.write(f"**Model:** {selected_model}")
1117
- if model_type == "FairChem" and selected_model == "UMA Small":
1118
  st.write(f"**UMA Task Type:** {selected_task_type}")
1119
  if model_type == "MACE":
1120
  st.write(f"**Dispersion:** {dispersion}")
@@ -1204,7 +1212,7 @@ if atoms is not None:
1204
  st.write("Fetching FairChem reference energies for isolated atoms...")
1205
  ref_key_suffix = "_elem_refs"
1206
  chosen_ref_list_name = None
1207
- if selected_model == "UMA Small":
1208
  if selected_task_type:
1209
  chosen_ref_list_name = selected_task_type + ref_key_suffix
1210
  elif "ESEN" in selected_model:
@@ -1396,15 +1404,10 @@ if atoms is not None:
1396
  show_trajectory_and_controls()
1397
  elif task == "Vibrational Mode Analysis":
1398
  # Conversion factors
1399
-
1400
  from ase.units import kB as kB_eVK, _Nav, J # ASE's constants
1401
-
1402
  from scipy.constants import physical_constants
1403
-
1404
  kB_JK = physical_constants["Boltzmann constant"][0] # J/K
1405
-
1406
  is_periodic = any(calc_atoms.pbc)
1407
-
1408
  st.write("Running vibrational mode analysis using finite differences...")
1409
 
1410
  natoms = len(calc_atoms)
@@ -1592,8 +1595,8 @@ with st.expander('ℹ️ About This App & Foundational MLIPs'):
1592
  4. **Run**: Click "Run Calculation" and view the results.
1593
 
1594
  **Atomization/Cohesive Energy Notes:**
1595
- - **Atomization Energy** ($E_{\text{atomization}} = \sum E_{\text{isolated atoms}} - E_{\text{molecule}}$) is typically for non-periodic systems (molecules).
1596
- - **Cohesive Energy** ($E_{\text{cohesive}} = (\sum E_{\text{isolated atoms}} - E_{\text{bulk system}}) / N_{\text{atoms}}$) is for periodic systems.
1597
  - For **MACE models**, isolated atom energies are computed on-the-fly.
1598
  - For **FairChem models**, isolated atom energies are based on pre-tabulated reference values (provided in a YAML-like structure within the app). Ensure the selected FairChem task type (`omol`, `omat`, etc. for UMA models) or model type (ESEN models use `omol` references) aligns with the system and has the necessary elemental references.
1599
  """)
 
946
  @st.cache_resource
947
  def get_fairchem_model(selected_model_name, model_path_or_name, device, selected_task_type_fc): # Renamed args to avoid conflict
948
  predictor = pretrained_mlip.get_predict_unit(model_path_or_name, device=device)
949
+ if "UMA Small" in selected_model_name:
950
  calc = FAIRChemCalculator(predictor, task_name=selected_task_type_fc)
951
  else:
952
  calc = FAIRChemCalculator(predictor, task_name="omol")
 
1033
  if model_type == "FairChem":
1034
  selected_model = st.sidebar.selectbox("Select FairChem Model:", list(FAIRCHEM_MODELS.keys()))
1035
  model_path = FAIRCHEM_MODELS[selected_model]
1036
+ if "UMA Small" in selected_model:
1037
  st.sidebar.warning("Meta FAIR Acceptable Use Policy applies.")
1038
  selected_task_type = st.sidebar.selectbox("Select UMA Model Task Type:", ["omol", "omat", "omc", "odac", "oc20"])
1039
  if selected_task_type == "omol" and atoms is not None:
 
1041
  spin_multiplicity = st.sidebar.number_input("Spin Multiplicity (2S + 1)", min_value=1, max_value=11, step=1, value=int(atoms.info.get("spin",0) if atoms.info.get("spin",0) is not None else 1)) # Assuming spin in atoms.info is S
1042
  atoms.info["charge"] = charge
1043
  atoms.info["spin"] = spin_multiplicity # FairChem expects multiplicity
1044
+ else:
1045
+ atoms.info["charge"] = 0
1046
+ atoms.info["spin"] = 1 # FairChem expects multiplicity
1047
+
1048
  if model_type == "ORB":
1049
  selected_model = st.sidebar.selectbox("Select ORB Model:", list(ORB_MODELS.keys()))
1050
  model_path = ORB_MODELS[selected_model]
 
1090
  optimizer_type = st.sidebar.selectbox("Optimizer:", ["BFGS", "LBFGS", "FIRE"], index=1) # Renamed to optimizer_type
1091
 
1092
 
1093
+ if "Vibration" in task:
1094
+ st.write("### Thermodynamic Quantities (Molecule Only)")
1095
+ T = st.sidebar.number_input("Temperature (K)", value=298.15)
1096
+
1097
  if atoms is not None:
1098
  col1, col2 = st.columns(2)
1099
 
 
1122
  st.markdown("### Selected Model")
1123
  st.write(f"**Model Type:** {model_type}")
1124
  st.write(f"**Model:** {selected_model}")
1125
+ if model_type == "FairChem" and "UMA Small" in selected_model:
1126
  st.write(f"**UMA Task Type:** {selected_task_type}")
1127
  if model_type == "MACE":
1128
  st.write(f"**Dispersion:** {dispersion}")
 
1212
  st.write("Fetching FairChem reference energies for isolated atoms...")
1213
  ref_key_suffix = "_elem_refs"
1214
  chosen_ref_list_name = None
1215
+ if "UMA Small" in selected_model:
1216
  if selected_task_type:
1217
  chosen_ref_list_name = selected_task_type + ref_key_suffix
1218
  elif "ESEN" in selected_model:
 
1404
  show_trajectory_and_controls()
1405
  elif task == "Vibrational Mode Analysis":
1406
  # Conversion factors
 
1407
  from ase.units import kB as kB_eVK, _Nav, J # ASE's constants
 
1408
  from scipy.constants import physical_constants
 
1409
  kB_JK = physical_constants["Boltzmann constant"][0] # J/K
 
1410
  is_periodic = any(calc_atoms.pbc)
 
1411
  st.write("Running vibrational mode analysis using finite differences...")
1412
 
1413
  natoms = len(calc_atoms)
 
1595
  4. **Run**: Click "Run Calculation" and view the results.
1596
 
1597
  **Atomization/Cohesive Energy Notes:**
1598
+ - **Atomization Energy** ($E_{\\text{atomization}} = \sum E_{\\text{isolated atoms}} - E_{\\text{molecule}}$) is typically for non-periodic systems (molecules).
1599
+ - **Cohesive Energy** ($E_{\\text{cohesive}} = (\sum E_{\\text{isolated atoms}} - E_{\\text{bulk system}}) / N_{\\text{atoms}}$) is for periodic systems.
1600
  - For **MACE models**, isolated atom energies are computed on-the-fly.
1601
  - For **FairChem models**, isolated atom energies are based on pre-tabulated reference values (provided in a YAML-like structure within the app). Ensure the selected FairChem task type (`omol`, `omat`, etc. for UMA models) or model type (ESEN models use `omol` references) aligns with the system and has the necessary elemental references.
1602
  """)