Skip to content

Commit 5b54231

Browse files
committed
Update app for model changes
1 parent 9793988 commit 5b54231

File tree

5 files changed

+31
-11
lines changed

5 files changed

+31
-11
lines changed

ml_peg/app/nebs/li_diffusion/app_li_diffusion.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
struct_from_scatter,
1313
)
1414
from ml_peg.app.utils.load import read_plot
15-
from ml_peg.calcs.models.models import MODELS
15+
from ml_peg.models.get_models import get_model_names
16+
from ml_peg.models.models import current_models
1617

18+
MODELS = get_model_names(current_models)
1719
BENCHMARK_NAME = "Li diffusion"
1820
DOCS_URL = "https://ddmms.github.io/ml-peg/user_guide/benchmarks/nebs.html#li-diffusion"
1921
DATA_PATH = APP_ROOT / "data" / "nebs" / "li_diffusion"

ml_peg/app/run_app.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,31 @@
1212
DATA_PATH = Path(__file__).parent / "data"
1313

1414

15-
def run_app(category: str = "*", port: int = 8050, debug: bool = False) -> None:
15+
def run_app(
16+
models: None | str | list = None,
17+
category: str = "*",
18+
port: int = 8050,
19+
debug: bool = False,
20+
) -> None:
1621
"""
1722
Set port and run Dash application.
1823
1924
Parameters
2025
----------
26+
models
27+
Models to build interactive features for. Default is None, corresponding to all
28+
current models.
2129
category
2230
Category to build app for. Default is `*`, corresponding to all categories.
2331
port
2432
Port to run application on. Default is 8050.
2533
debug
2634
Whether to run with Dash debugging. Default is `True`.
2735
"""
36+
from ml_peg.models import models as ml_peg_models
37+
38+
ml_peg_models.current_models = models
39+
2840
full_app = Dash(__name__, assets_folder=DATA_PATH)
2941
build_full_app(full_app, category=category)
3042

ml_peg/app/surfaces/OC157/app_OC157.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
struct_from_scatter,
1414
)
1515
from ml_peg.app.utils.load import read_plot
16-
from ml_peg.calcs.models.models import MODELS
16+
from ml_peg.models.get_models import get_model_names
17+
from ml_peg.models.models import current_models
1718

19+
MODELS = get_model_names(current_models)
1820
BENCHMARK_NAME = "OC157"
1921
DOCS_URL = "https://ddmms.github.io/ml-peg/user_guide/benchmarks/surfaces.html#oc157"
2022
DATA_PATH = APP_ROOT / "data" / "surfaces" / "OC157"
@@ -29,13 +31,13 @@ def register_callbacks(self) -> None:
2931
DATA_PATH / "figure_rel_energies.json", id=f"{BENCHMARK_NAME}-figure"
3032
)
3133

32-
structs_dir = DATA_PATH / list(MODELS.keys())[0]
34+
structs_dir = DATA_PATH / MODELS[0]
3335

3436
# Assets dir will be parent directory
3537
structs = list(
3638
np.repeat(
3739
[
38-
f"assets/surfaces/OC157/{list(MODELS.keys())[0]}/{i}.xyz"
40+
f"assets/surfaces/OC157/{MODELS[0]}/{i}.xyz"
3941
for i in range(len(list(structs_dir.glob("*.xyz"))))
4042
],
4143
3,

ml_peg/app/surfaces/S24/app_S24.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
struct_from_scatter,
1313
)
1414
from ml_peg.app.utils.load import read_plot
15-
from ml_peg.calcs.models.models import MODELS
15+
from ml_peg.models.get_models import get_model_names
16+
from ml_peg.models.models import current_models
1617

18+
MODELS = get_model_names(current_models)
1719
BENCHMARK_NAME = "S24"
1820
DOCS_URL = "https://ddmms.github.io/ml-peg/user_guide/benchmarks/surfaces.html#s24"
1921
DATA_PATH = APP_ROOT / "data" / "surfaces" / "S24"
@@ -29,11 +31,11 @@ def register_callbacks(self) -> None:
2931
id=f"{BENCHMARK_NAME}-figure",
3032
)
3133

32-
structs_dir = DATA_PATH / list(MODELS.keys())[0]
34+
structs_dir = DATA_PATH / MODELS[0]
3335

3436
# Assets dir will be parent directory
3537
structs = [
36-
f"assets/surfaces/S24/{list(MODELS.keys())[0]}/{struct_file.stem}.xyz"
38+
f"assets/surfaces/S24/{MODELS[0]}/{struct_file.stem}.xyz"
3739
for struct_file in sorted(structs_dir.glob("*.xyz"))
3840
]
3941

ml_peg/app/surfaces/elemental_slab_oxygen_adsorption/app_elemental_slab_oxygen_adsorption.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
struct_from_scatter,
1313
)
1414
from ml_peg.app.utils.load import read_plot
15-
from ml_peg.calcs.models.models import MODELS
15+
from ml_peg.models.get_models import get_model_names
16+
from ml_peg.models.models import current_models
1617

18+
MODELS = get_model_names(current_models)
1719
BENCHMARK_NAME = "Elemental Slab Oxygen Adsorption"
1820
DOCS_URL = "https://ddmms.github.io/ml-peg/user_guide/benchmarks/surfaces.html#elemental-slab-oxygen-adsorption"
1921
DATA_PATH = APP_ROOT / "data" / "surfaces" / "elemental_slab_oxygen_adsorption"
@@ -29,11 +31,11 @@ def register_callbacks(self) -> None:
2931
id=f"{BENCHMARK_NAME}-figure",
3032
)
3133

32-
structs_dir = DATA_PATH / list(MODELS.keys())[0]
34+
structs_dir = DATA_PATH / MODELS[0]
3335

3436
# Assets dir will be parent directory
3537
structs = [
36-
f"assets/surfaces/elemental_slab_oxygen_adsorption/{list(MODELS.keys())[0]}/{struct_file.stem}.xyz"
38+
f"assets/surfaces/elemental_slab_oxygen_adsorption/{MODELS[0]}/{struct_file.stem}.xyz"
3739
for struct_file in sorted(structs_dir.glob("*.xyz"))
3840
]
3941

0 commit comments

Comments
 (0)