Skip to content

Commit efb1ea1

Browse files
committed
s3 download for calc, calc analysis and app fixes
1 parent 894c1ef commit efb1ea1

3 files changed

Lines changed: 23 additions & 5 deletions

File tree

ml_peg/analysis/conformers/Folmsbee/analyse_Folmsbee.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def conformer_energies() -> dict[str, list]:
7575

7676
results[model_name].append(atoms.info["model_rel_energy"] * EV_TO_KCAL)
7777
if not ref_stored:
78-
results["ref"].append(atoms.info["ref_energy"] * EV_TO_KCAL)
78+
results["ref"].append(atoms.info["ref_rel_energy"] * EV_TO_KCAL)
7979

8080
# Write structures for app
8181
structs_dir = OUT_PATH / model_name
@@ -132,3 +132,14 @@ def metrics(get_mae: dict[str, float]) -> dict[str, dict]:
132132
return {
133133
"MAE": get_mae,
134134
}
135+
136+
137+
def test_folmsbee(metrics: dict[str, dict]) -> None:
138+
"""
139+
Run Folmsbee analysis.
140+
141+
Parameters
142+
----------
143+
metrics : dict[str, dict]
144+
Folmsbee metric results provided by fixtures.
145+
"""

ml_peg/app/conformers/Folmsbee/app_Folmsbee.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def register_callbacks(self) -> None:
3737
if model_dir.exists():
3838
labels = sorted([f.stem for f in model_dir.glob("*.xyz")])
3939
structs = [
40-
f"assets/conformers/Folmsbee/{MODELS[0]}/{label}.xyz"
40+
f"/assets/conformers/Folmsbee/{MODELS[0]}/{label}.xyz"
4141
for label in labels
4242
]
4343
else:

ml_peg/calcs/conformers/Folmsbee/calc_Folmsbee.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import pytest
2121
from tqdm import tqdm
2222

23+
from ml_peg.calcs.utils.utils import download_s3_data
2324
from ml_peg.models.get_models import load_models
2425
from ml_peg.models.models import current_models
2526

@@ -66,10 +67,16 @@ def test_folmsbee(mlip: tuple[str, Any]) -> None:
6667
# Add D3 calculator for this test
6768
calc = model.add_d3_calculator(calc)
6869

69-
data_path = Path(__file__).parent / "data" / "folmsbee_dataset.json"
70+
data_path = (
71+
download_s3_data(
72+
key="inputs/conformers/Folmsbee/Folmsbee.zip",
73+
filename="Folmsbee.zip",
74+
)
75+
/ "Folmsbee"
76+
)
7077
out_path = OUT_PATH / model_name
7178

72-
with open(data_path) as f:
79+
with open(data_path / "folmsbee_dataset.json") as f:
7380
data = json.load(f)
7481
progress = tqdm(total=len(data))
7582
for structure_data in data:
@@ -79,7 +86,7 @@ def test_folmsbee(mlip: tuple[str, Any]) -> None:
7986
raw_energies = structure_data["dft_energy_profile"]
8087
ref_min_conformer_idx = raw_energies.index(min(raw_energies))
8188
ref_energies = get_relative_energies(raw_energies, ref_min_conformer_idx)
82-
ref_energies *= KCAL_TO_EV
89+
ref_energies = [e * KCAL_TO_EV for e in ref_energies]
8390

8491
for i, conf_positions in enumerate(structure_data["conformer_coordinates"]):
8592
conf_atoms = Atoms(

0 commit comments

Comments
 (0)