From 90fa1d12b6d9a1c22111319c99660311aa47c6ea Mon Sep 17 00:00:00 2001 From: orionarcher Date: Sun, 13 Apr 2025 15:30:27 -0700 Subject: [PATCH 1/4] don't download MBD in CI --- .../scripts/5_Workflow/5.3_Hot_Swap_WBM.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py b/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py index b0a49db7..5e382453 100644 --- a/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py +++ b/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py @@ -12,7 +12,6 @@ import torch from mace.calculators.foundations_models import mace_mp -from matbench_discovery.data import DataFiles, ase_atoms_from_zip import torch_sim as ts @@ -40,11 +39,20 @@ max_atoms_in_batch = 50 if os.getenv("CI") else 8_000 # --- Data Loading --- -n_structures_to_relax = 2 if os.getenv("CI") else 100 -print(f"Loading {n_structures_to_relax:,} structures...") -ase_atoms_list = ase_atoms_from_zip( - DataFiles.wbm_initial_atoms.path, limit=n_structures_to_relax -) +if not os.getenv("CI"): + n_structures_to_relax = 100 + print(f"Loading {n_structures_to_relax:,} structures...") + from matbench_discovery.data import DataFiles, ase_atoms_from_zip + ase_atoms_list = ase_atoms_from_zip( + DataFiles.wbm_initial_atoms.path, limit=n_structures_to_relax + ) +else: + n_structures_to_relax = 2 + print(f"Loading {n_structures_to_relax:,} structures...") + from ase.build import bulk + al_atoms = bulk("Al", "hcp", a=4.05) + fe_atoms = bulk("Fe", "bcc", a=2.86) + ase_atoms_list = [al_atoms, fe_atoms] # --- Optimization Setup --- # Statistics tracking From 07761dac06332dc6f60602abfc9382b69956f44a Mon Sep 17 00:00:00 2001 From: orionarcher Date: Sun, 13 Apr 2025 15:36:04 -0700 Subject: [PATCH 2/4] lint --- examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py b/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py index 5e382453..8569c129 100644 --- a/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py +++ b/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py @@ -43,6 +43,7 @@ n_structures_to_relax = 100 print(f"Loading {n_structures_to_relax:,} structures...") from matbench_discovery.data import DataFiles, ase_atoms_from_zip + ase_atoms_list = ase_atoms_from_zip( DataFiles.wbm_initial_atoms.path, limit=n_structures_to_relax ) @@ -50,6 +51,7 @@ n_structures_to_relax = 2 print(f"Loading {n_structures_to_relax:,} structures...") from ase.build import bulk + al_atoms = bulk("Al", "hcp", a=4.05) fe_atoms = bulk("Fe", "bcc", a=2.86) ase_atoms_list = [al_atoms, fe_atoms] From c62286bd1ee7a7834a8998e2a07702ffd9954daa Mon Sep 17 00:00:00 2001 From: orionarcher Date: Sun, 13 Apr 2025 15:47:03 -0700 Subject: [PATCH 3/4] rattle atoms --- examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py b/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py index 8569c129..ceec6155 100644 --- a/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py +++ b/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py @@ -10,6 +10,7 @@ import os import time +import numpy as np import torch from mace.calculators.foundations_models import mace_mp @@ -53,7 +54,9 @@ from ase.build import bulk al_atoms = bulk("Al", "hcp", a=4.05) - fe_atoms = bulk("Fe", "bcc", a=2.86) + al_atoms.positions += 0.1 * np.random.randn(*al_atoms.positions.shape) + fe_atoms = bulk("Fe", "bcc", a=2.86).repeat((2, 2, 2)) + fe_atoms.positions += 0.1 * np.random.randn(*fe_atoms.positions.shape) ase_atoms_list = [al_atoms, fe_atoms] # --- Optimization Setup --- @@ -93,4 +96,4 @@ # --- Final Statistics --- end_time = time.perf_counter() total_time = end_time - start_time -print(f"Total time taken: {total_time:.2f} seconds") +print(f"Total time taken: {total_time:.2f} seconds") \ No newline at end of file From 1d3988185a9307e4e1a4624d2f6972176209039d Mon Sep 17 00:00:00 2001 From: orionarcher Date: Sun, 13 Apr 2025 16:02:51 -0700 Subject: [PATCH 4/4] lint --- examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py b/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py index ceec6155..79f458fd 100644 --- a/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py +++ b/examples/scripts/5_Workflow/5.3_Hot_Swap_WBM.py @@ -54,9 +54,9 @@ from ase.build import bulk al_atoms = bulk("Al", "hcp", a=4.05) - al_atoms.positions += 0.1 * np.random.randn(*al_atoms.positions.shape) + al_atoms.positions += 0.1 * np.random.randn(*al_atoms.positions.shape) # noqa: NPY002 fe_atoms = bulk("Fe", "bcc", a=2.86).repeat((2, 2, 2)) - fe_atoms.positions += 0.1 * np.random.randn(*fe_atoms.positions.shape) + fe_atoms.positions += 0.1 * np.random.randn(*fe_atoms.positions.shape) # noqa: NPY002 ase_atoms_list = [al_atoms, fe_atoms] # --- Optimization Setup --- @@ -96,4 +96,4 @@ # --- Final Statistics --- end_time = time.perf_counter() total_time = end_time - start_time -print(f"Total time taken: {total_time:.2f} seconds") \ No newline at end of file +print(f"Total time taken: {total_time:.2f} seconds")