%23%20%2F%2F%2F%20script%0A%23%20requires-python%20%3D%20%22%3E%3D3.12%22%0A%23%20dependencies%20%3D%20%5B%0A%23%20%20%20%20%20%23%20The%20three%20run_button%20demos%20call%20the%20live%20services.%20Without%20these%20three%2C%20--sandbox%0A%23%20%20%20%20%20%23%20builds%20an%20environment%20where%20every%20demo%20raises%20ModuleNotFoundError%20the%20moment%20a%20button%0A%23%20%20%20%20%20%23%20is%20pressed%2C%20and%20the%20deck%20looks%20fine%20until%20you%20are%20standing%20in%20front%20of%20the%20room.%0A%23%20%20%20%20%20%23%20Named%20by%20what%20they%20do%2C%20not%20by%20slide%20number%3A%20slides%20get%20inserted.%0A%23%20%20%20%20%20%22ase%3E%3D3.25%22%2C%20%20%20%20%20%20%20%23%20the%20label%20and%20resume%20demos%20build%20the%20Si%20cell%0A%23%20%20%20%20%20%22httpx%3E%3D0.28%22%2C%20%20%20%20%20%23%20the%20health%20demo%20calls%20%2Fv1%2Fhealth%0A%23%20%20%20%20%20%22marimo%3E%3D0.24%2C%3C0.25%22%2C%0A%23%20%20%20%20%20%22numpy%3E%3D2.0%22%2C%20%20%20%20%20%20%23%20pulled%20in%20by%20ase%20and%20the%20client%0A%23%20%5D%0A%23%20%2F%2F%2F%0A%0Aimport%20marimo%0A%0A__generated_with%20%3D%20%220.24.0%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Aasync%20def%20_()%3A%0A%20%20%20%20import%20sys%0A%0A%20%20%20%20if%20sys.platform%20%3D%3D%20%22emscripten%22%3A%0A%20%20%20%20%20%20%20%20import%20micropip%0A%20%20%20%20%20%20%20%20from%20js%20import%20self%20as%20js_self%0A%20%20%20%20%20%20%20%20from%20pyodide.http%20import%20open_url%0A%0A%20%20%20%20%20%20%20%20_worker_dir%20%3D%20str(js_self.location.href).rsplit(%22%2F%22%2C%201)%5B0%5D%0A%20%20%20%20%20%20%20%20_site_root%20%3D%20_worker_dir.rsplit(%22%2F%22%2C%201)%5B0%5D%20%2B%20%22%2F%22%0A%20%20%20%20%20%20%20%20%23%20The%20wheel's%20filename%20carries%20the%20client%20version.%20Reading%20it%20from%20the%20manifest%20that%0A%20%20%20%20%20%20%20%20%23%20scripts%2Fbuild_client_wheel.py%20writes%20keeps%20that%20version%20out%20of%20every%20notebook%2C%20so%0A%20%20%20%20%20%20%20%20%23%20a%20client%20release%20does%20not%20mean%20editing%20five%20files.%0A%20%20%20%20%20%20%20%20_wheel%20%3D%20open_url(_site_root%20%2B%20%22public%2Fclient-wheel.txt%22).read().strip()%0A%20%20%20%20%20%20%20%20await%20micropip.install(_site_root%20%2B%20%22public%2F%22%20%2B%20_wheel%2C%20deps%3DFalse)%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20from%20pathlib%20import%20Path%0A%0A%20%20%20%20%20%20%20%20_client_src%20%3D%20Path(__file__).resolve().parents%5B2%5D%20%2F%20%22client%22%20%2F%20%22src%22%0A%20%20%20%20%20%20%20%20if%20_client_src.exists()%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20sys.path.insert(0%2C%20str(_client_src))%0A%20%20%20%20client_path_ready%20%3D%20True%0A%20%20%20%20return%20(client_path_ready%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(client_path_ready)%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%0A%20%20%20%20%23%20The%20demo%20cells%20do%20%60from%20mlipschool_client%20import%20...%60%2C%20which%20only%20resolves%20after%20the%0A%20%20%20%20%23%20cell%20above%20has%20micropip-installed%20the%20wheel%20(Pyodide)%20or%20put%20client%2Fsrc%20on%20sys.path%0A%20%20%20%20%23%20(desktop).%20This%20assert%20is%20what%20holds%20that%20ordering%3A%20marimo%20builds%20its%20DAG%20from%20names%0A%20%20%20%20%23%20used%20in%20a%20cell%20*body*%20and%20silently%20drops%20a%20dependency%20that%20appears%20only%20in%20the%0A%20%20%20%20%23%20signature%20%E2%80%94%20it%20did%20exactly%20that%20to%20this%20notebook%20the%20first%20time%20it%20was%20saved%20from%20the%0A%20%20%20%20%23%20editor.%20Do%20not%20%22tidy%22%20it%20away.%0A%20%20%20%20assert%20client_path_ready%0A%0A%20%20%20%20%23%20Everything%20the%20deck%20says%20about%20where%20to%20go%2C%20in%20one%20place%3A%20the%20setup%20slide%20and%20all%0A%20%20%20%20%23%20three%20demos%20follow%20these.%20Production%20by%20default%2C%20because%20that%20is%20what%20runs%20in%20the%0A%20%20%20%20%23%20room%3B%20export%20MLIP_SCHOOL_ORACLE_URL%20and%20MLIP_SCHOOL_ACE_URL%20to%20rehearse%20against%20a%0A%20%20%20%20%23%20local%20stack.%20The%20demos%20are%20passed%20these%20explicitly%20rather%20than%20letting%20the%20client%0A%20%20%20%20%23%20resolve%20its%20own%20defaults%2C%20which%20would%20otherwise%20leave%20the%20health%20slide%20naming%20one%0A%20%20%20%20%23%20endpoint%20while%20the%20calls%20went%20to%20another.%0A%20%20%20%20import%20os%0A%0A%20%20%20%20BASE_URL%20%3D%20os.getenv(%22MLIP_SCHOOL_BASE_URL%22%2C%20%22https%3A%2F%2Fmlipschool.uk%22)%0A%20%20%20%20ORACLE_URL%20%3D%20os.getenv(%22MLIP_SCHOOL_ORACLE_URL%22%2C%20%22https%3A%2F%2Foracle.mlipschool.uk%22)%0A%20%20%20%20ACE_URL%20%3D%20os.getenv(%22MLIP_SCHOOL_ACE_URL%22%2C%20%22https%3A%2F%2Face.mlipschool.uk%22)%0A%0A%20%20%20%20%23%20The%20last%20of%20the%20three%20demos%20resumes%20this%20model.%20Fit%20it%20first%20with%3A%0A%20%20%20%20%23%20%20%20%20%20MLIP_SCHOOL_DEMO_KEY%3D%3Ckey%3E%20scripts%2Fuv%20run%20python%20notebooks%2Ftalks%2Fprepare_intro_demo.py%0A%20%20%20%20%23%0A%20%20%20%20%23%20The%20key%20is%20read%20from%20the%20environment%20and%20deliberately%20never%20written%20here.%20This%20deck%20is%0A%20%20%20%20%23%20published%20at%20BASE_URL%2Fintro.html%20and%20the%20export%20embeds%20the%20notebook%20source%20in%20both%20of%20its%0A%20%20%20%20%23%20carriers%2C%20so%20a%20literal%20key%20in%20this%20cell%20would%20put%20a%20live%20credential%20on%20a%20public%20page%20--%20an%0A%20%20%20%20%23%20instructor%20key%20doubly%20so%2C%20since%20those%20see%20the%20whole%20queue.%20Export%20MLIP_SCHOOL_DEMO_KEY%20in%0A%20%20%20%20%23%20the%20terminal%20you%20present%20from%2C%20and%20give%20the%20prepare%20script%20the%20same%20value%20so%20the%20model%20is%0A%20%20%20%20%23%20fitted%20under%20the%20key%20the%20deck%20resumes%20it%20with.%0A%20%20%20%20DEMO_KEY%20%3D%20os.getenv(%22MLIP_SCHOOL_DEMO_KEY%22%2C%20%22intro-demo%22)%0A%20%20%20%20MODEL_NAME%20%3D%20%22intro-demo%22%0A%0A%20%20%20%20%23%20Figures%20for%20the%20three%20background%20slides%2C%20cropped%20from%20the%20group's%20standard%20intro%0A%20%20%20%20%23%20deck.%20%60mo.image()%60%20turns%20each%20into%20a%20marimo%20virtual%20file%2C%20and%20%60marimo%20export%20html%60%0A%20%20%20%20%23%20inlines%20every%20virtual%20file%20under%2010%20MB%20as%20a%20%60data%3A%60%20URI%20--%20so%20site%2Fintro.html%20carries%0A%20%20%20%20%23%20the%20figures%20itself%20and%20still%20renders%20them%20with%20the%20node%20stopped%20and%20this%20directory%0A%20%20%20%20%23%20nowhere%20in%20sight.%20%60pathlib%60%2C%20not%20%60Path%60%3A%20the%20wheel-bootstrap%20cell%20above%20already%0A%20%20%20%20%23%20defines%20the%20name%20%60Path%60%2C%20and%20two%20cells%20defining%20one%20name%20is%20a%20marimo%20error.%0A%20%20%20%20%23%0A%20%20%20%20%23%20%60__file__%60%2C%20not%20a%20path%20relative%20to%20the%20working%20directory%2C%20because%20build_site.py%0A%20%20%20%20%23%20exports%20a%20throwaway%20*sibling*%20copy%20of%20this%20notebook%20--%20the%20assets%20directory%20has%20to%0A%20%20%20%20%23%20resolve%20the%20same%20way%20from%20either%20file.%0A%20%20%20%20import%20pathlib%0A%0A%20%20%20%20ASSETS%20%3D%20pathlib.Path(__file__).resolve().parent%20%2F%20%22assets%22%0A%20%20%20%20return%20ACE_URL%2C%20ASSETS%2C%20BASE_URL%2C%20DEMO_KEY%2C%20MODEL_NAME%2C%20ORACLE_URL%2C%20mo%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20%23%20Presenter%20control%2C%20first%20slide%20so%20it%20is%20reachable%20before%20the%20talk%20starts%3B%20hide%20it%20in%0A%20%20%20%20%23%20the%20slide%20layout.%20A%20%60mo.ui.run_button%60%20resets%20its%20own%20%60.value%60%20to%20False%20once%20the%20run%20it%0A%20%20%20%20%23%20triggered%20finishes%2C%20but%20the%20cell%20it%20gated%20keeps%20the%20output%20because%20nothing%20re-runs%20it.%0A%20%20%20%20%23%20So%20this%20button%20does%20not%20need%20to%20reach%20into%20the%20three%20demo%20buttons%20at%20all%20--%20the%20demo%0A%20%20%20%20%23%20cells%20merely%20reference%20it%2C%20which%20puts%20them%20downstream%20of%20it%2C%20and%20a%20press%20re-runs%20them%20at%0A%20%20%20%20%23%20a%20moment%20when%20their%20own%20button%20already%20reads%20False.%20Their%20existing%20%60mo.stop%60%20then%20fires%0A%20%20%20%20%23%20and%20each%20returns%20to%20%22press%20it%22.%0A%20%20%20%20reset_button%20%3D%20mo.ui.run_button(label%3D%22Reset%20demos%22)%0A%20%20%20%20mo.hstack(%5Breset_button%5D%2C%20justify%3D%22start%22)%0A%20%20%20%20return%20(reset_button%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Dataset%20craft%20for%20machine-learned%20interatomic%20potentials%20with%20%60ACEpotentials.jl%60%0A%0A%20%20%20%20**MLIP%20School%20and%20Workshop%20%26middot%3B%20Warwick%20%26middot%3B%207%20September%202026**%0A%0A%20%20%20%20**James%20Kermode**%0A%0A%20%20%20%20We%20will%20build%20a%20dataset%2C%20fit%20an%20ACE%20potential%2C%20watch%20it%20fail%2C%20and%20fix%20it.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(BASE_URL%2C%20mo)%3A%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20%23%23%20Getting%20started%20(do%20this%20now!)%0A%0A%20%20%20%20**Everyone%2C%20on%20your%20own%20laptop%3A**%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20uvx%20mograder%20student%20%7BBASE_URL%7D%2Fmograder.toml%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20That%20is%20the%20whole%20install.%20%60uvx%60%20fetches%20what%20it%20needs%20and%20opens%20the%20notebook%0A%20%20%20%20browser.%20**Start%20it%20now!**%0A%0A%20%20%20%20*No%20%60uv%60%3F*%20%26nbsp%3B%20%60curl%20-LsSf%20https%3A%2F%2Fastral.sh%2Fuv%2Finstall.sh%20%7C%20sh%60%20(macOS%2FLinux)%2C%0A%20%20%20%20or%20%60winget%20install%20astral-sh.uv%60%20(Windows).%0A%0A%20%20%20%20**Backup%20with%20nothing%20to%20install%3A**%20open%20%3C%7BBASE_URL%7D%3E%20in%20a%20browser.%20Same%20notebooks%2C%0A%20%20%20%20running%20in%20WebAssembly.%20Slower%20to%20start%2C%20identical%20to%20use.%20If%20%60uvx%60%20fights%20you%2C%0A%20%20%20%20switch%20rather%20than%20spending%20time%20installing.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(ASSETS%2C%20mo)%3A%0A%20%20%20%20mo.vstack(%5B%0A%20%20%20%20%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%20Welcome%20to%20WCPM%20and%20HetSys%0A%0A%20%20%20%20%20%20%20%20*WCPM*%20is%20the%20Warwick%20Centre%20for%20Predictive%20Modelling%2C%20and%20*HetSys*%20is%20our%20EPSRC%20Centre%0A%20%20%20%20%20%20%20%20for%20Doctoral%20Training%20in%20Modelling%20of%20Heterogeneous%20Systems.%0A%20%20%20%20%20%20%20%20%22%22%22)%2C%0A%20%20%20%20%20%20%20%20mo.center(mo.image(%0A%20%20%20%20%20%20%20%20%20%20%20%20ASSETS%20%2F%20%22hetsys-remit.png%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20alt%3D(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22HetSys%20remit%3A%20quantum%2C%20atomistic%20and%20continuum%20modelling%2C%20with%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22uncertainty%20quantification%2C%20robust%20software%20engineering%20and%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22scientific%20machine%20learning%22%0A%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20width%3D640))%2C%0A%20%20%20%20%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%20%20%20%20This%20session%20sits%20in%20the%20atomistic%20tier%20and%20leans%20on%20all%20three%20training%20themes%0A%20%20%20%20%20%20%20%20on%20the%20top%20row.%0A%0A%20%20%20%20%20%20%20%20%3Cwww.warwick.ac.uk%2Fwcpm%3E%20%26nbsp%3B%26middot%3B%26nbsp%3B%20%3Cwww.warwick.ac.uk%2FHetSys%3E%0A%20%20%20%20%20%20%20%20%22%22%22)%2C%0A%20%20%20%20%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(ASSETS%2C%20mo)%3A%0A%20%20%20%20mo.vstack(%5B%0A%20%20%20%20%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%20Why%20machine-learned%20potentials%0A%20%20%20%20%20%20%20%20%22%22%22)%2C%0A%20%20%20%20%20%20%20%20mo.hstack(%0A%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mo.image(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ASSETS%20%2F%20%22multiscale.png%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt%3D(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Accuracy%20and%20cost%20of%20QMC%2C%20DFT%2C%20tight%20binding%2C%20empirical%20MD%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22coarse-grained%20and%20continuum%20models%20against%20number%20of%20atoms%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22and%20time%20scale%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20width%3D470%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mo.image(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ASSETS%20%2F%20%22mlip-recipe.png%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt%3D(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22The%20three%20steps%20of%20building%20an%20MLIP%3A%20reference%20database%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22representation%20of%20atomic%20environments%2C%20and%20regression%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20width%3D540%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20The%20caption%20lands%20verbatim%20inside%20%3Cfigcaption%3E%2C%20so%20it%20is%20HTML%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20markdown%20emphasis%20here%20renders%20as%20literal%20asterisks.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20caption%3D(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Figure%20from%3A%20V.%20L.%20Deringer%20%3Cem%3Eet%20al.%3C%2Fem%3E%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%3Cem%3EChemical%20Reviews%3C%2Fem%3E%20%3Cstrong%3E121%3C%2Fstrong%3E%2C%2010073%20(2021)%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20justify%3D%22center%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20align%3D%22center%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20gap%3D1.5%2C%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%20%20%20%20DFT%20buys%20you%20chemical%20accuracy%20for%20a%20few%20hundred%20atoms%20and%20picoseconds.%20Empirical%20MD%0A%20%20%20%20%20%20%20%20buys%20you%20millions%20of%20atoms%20and%20nanoseconds%2C%20at%20whatever%20accuracy%20its%20fixed%20functional%0A%20%20%20%20%20%20%20%20form%20allows.%20MLIPs%20give%20DFT%20accuracy%2C%20carried%20up%20to%20MD%20scale.%0A%0A%20%20%20%20%20%20%20%20The%20recipe%20has%20three%20steps%3A%20a%20reference%20database%2C%20a%20representation%20of%20atomic%0A%20%20%20%20%20%20%20%20environments%2C%20and%20a%20regression.%20Steps%202%20and%203%20arrive%20in%20a%20library%20and%20are%20largely%0A%20%20%20%20%20%20%20%20solved.%20Step%201%20does%20not%3A%20that%20is%20what%20this%20session%20is%20about.%0A%20%20%20%20%20%20%20%20%22%22%22)%2C%0A%20%20%20%20%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Fitting%20a%20linear%20ACE%20potential%0A%0A%20%20%20%20-%20Site%20energies%20are%20**local**%3A%20an%20atom's%20energy%20depends%20only%20on%20its%20own%20neighbourhood%0A%20%20%20%20%24%5Cmathcal%7BR%7D_i%24.%0A%20%20%20%20-%20Atomic%20Cluster%20Expansion%20(ACE%2C%20R.%20Drautz%2C%20%3Cem%3EPhys.%20Rev.%20B%3C%2Fem%3E%0A%20%20%20%20%3Cstrong%3E99%3C%2Fstrong%3E%2C%20014104%2C%202019)%20expands%20that%20in%20a%20set%20of%20invariant%20basis%20functions%0A%20%20%20%20%24%5Cmathbf%7BB%7D_i%24%2C%20complete%20to%20a%20chosen%20body%20order%0A%20%20%20%20-%20In%20%60ACEpotentials.jl%60%2C%20energy%20is%20*linear*%20in%20the%20coefficients%20%24%5Cmathbf%7Bc%7D%24%3A%0A%0A%20%20%20%20%24%24E%20%3D%20%5Csum_i%20E_i(%5Cmathcal%7BR%7D_i)%2C%20%5Cqquad%0A%20%20%20%20%20%20E_i%20%3D%20%5Cmathbf%7Bc%7D%20%5Ccdot%20%5Cmathbf%7BB%7D_i(%5Cmathcal%7BR%7D_i)%24%24%0A%0A%20%20%20%20-%20Fitting%20is%20least%20squares%2C%20regularised%20with%20smoothness%20prior%20%24%5CGamma%24%20and%0A%20%20%20%20hyperparameter%20%24%5Clambda%24%0A%20%20%20%20-%20Stack%20labels%20into%20%24%5Cmathbf%7By%7D%24%2C%20one%20row%20per%20energy%2C%20one%20per%20force%20component%0A%20%20%20%20-%20Basis%20evaluated%20on%20same%20structures%20into%20the%20design%20matrix%20%24%5CPsi%24.%20Minimise%2C%20and%20solve%20by%20QR%0A%20%20%20%20factorisation%3A%0A%0A%20%20%20%20%24%24L(%5Cmathbf%7Bc%7D)%20%3D%20%5ClVert%20%5CPsi%20%5Cmathbf%7Bc%7D%20-%20%5Cmathbf%7By%7D%20%5CrVert%5E2%20%2B%0A%20%20%20%20%20%20%5Clambda%20%5ClVert%20%5CGamma%20%5Cmathbf%7Bc%7D%20%5CrVert%5E2%24%24%0A%0A%20%20%20%20%24%24%5Cbegin%7Bbmatrix%7D%20%5CPsi%20%5C%5C%20%5Csqrt%7B%5Clambda%7D%5C%2C%5CGamma%20%5Cend%7Bbmatrix%7D%20%3D%20QR%0A%20%20%20%20%20%20%5C%3B%5C%3B%5CLongrightarrow%5C%3B%5C%3B%0A%20%20%20%20%20%20%5Cmathbf%7Bc%7D%20%3D%20R%5E%7B-1%7D%20Q%5E%7B%5Ctop%7D%20%5Cbegin%7Bbmatrix%7D%20%5Cmathbf%7By%7D%20%5C%5C%20%5Cmathbf%7B0%7D%20%5Cend%7Bbmatrix%7D%24%24%0A%0A%20%20%20%20**Convex%20optimisation%3A**%20one%20factorisation%2C%20no%20epochs%2C%20no%20learning%20rate%2C%20no%0A%20%20%20%20random%20seed.%20Simple%20fits%0A%20%20%20%20takes%20seconds%2C%20and%20only%20thing%20left%20to%20design%20is%20which%20rows%20go%20into%20%24%5CPsi%24.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(ASSETS%2C%20mo)%3A%0A%20%20%20%20mo.vstack(%5B%0A%20%20%20%20%20%20%20%20mo.md(%22%22%22-%20Done%20well%2C%20this%20gives%20errors%20of%20only%20a%20few%20per%20cent%20on%20defect%20formation%0A%20%20%20%20%20%20%20%20energies%2C%20elastic%20constants%20and%20surface%20energies%2C%20from%20a%20linear%20model.%0A%20%20%20%20%20%20%20%20-%20E1%2C%20E2%20and%20E3%20chase%20exactly%20these%20quantities%2C%20and%20you%20are%20about%20to%20see%20what%0A%20%20%20%20%20%20%20%20happens%20when%20the%20dataset%20behind%20them%20is%20not%20built%20well.%0A%20%20%20%20%20%20%20%20%22%22%22)%2C%0A%20%20%20%20%20%20%20%20mo.hstack(%0A%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mo.image(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ASSETS%20%2F%20%22si-qoi.png%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alt%3D(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Percentage%20error%20of%20ACE%20and%20GAP%20against%20DFT%20for%20silicon%20point%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22defect%20energies%2C%20elastic%20constants%20and%20surface%20energies%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20width%3D460%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20caption%3D(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22W.%20C.%20Witt%20%3Cem%3Eet%20al.%3C%2Fem%3E%2C%20%3Cem%3EJ.%20Chem.%20Phys.%3C%2Fem%3E%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%3Cstrong%3E159%3C%2Fstrong%3E%2C%20164101%20(2023)%3B%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22A.%20P.%20Bart%C3%B3k%2C%20JRK%2C%20N.%20Bernstein%20and%20G.%20Cs%C3%A1nyi%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%3Cem%3EPhys.%20Rev.%20X%3C%2Fem%3E%20%3Cstrong%3E8%3C%2Fstrong%3E%2C%20041048%20(2018)%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20mo.video%20takes%20a%20str%2C%20not%20a%20Path%20--%20and%20has%20no%20caption%3D%20of%20its%20own%2C%20so%20the%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20label%20below%20it%20is%20a%20separate%20mo.md.%20Muted%20because%20a%20browser%20will%20refuse%20to%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20autoplay%20anything%20else%2C%20and%20looped%20so%20it%20keeps%20running%20while%20it%20is%20talked%20over.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mo.vstack(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mo.video(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20str(ASSETS%20%2F%20%22si-fracture.mp4%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20controls%3DTrue%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20muted%3DTrue%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20autoplay%3DTrue%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20loop%3DTrue%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20width%3D460%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rounded%3DTrue%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Quasi-static%20fracture%20of%20Si(111)%2C%20run%20with%20a%20linear%20ACE%20model%3A%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22requires%20accurate%20elastic%20properties%2C%20surface%20energies%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22and%20bond-breaking.%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20gap%3D0.5%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20justify%3D%22center%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20align%3D%22start%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20widths%3D%5B1%2C%201%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20gap%3D2.0%2C%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Session%20Objectives%0A%0A%20%20%20%20Today%20we%20will%20meet%3A%0A%0A%20%20%20%20-%20**E1.**%20A%20potential%20with%20a%20perfect%20parity%20plot%20that%20gets%20a%20real%20property%20badly%20wrong%3B%0A%20%20%20%20-%20**E2.**%20A%20repair%20that%20fixes%20that%20property%2C%20and%20still%20leaves%20the%20potential%20unstable%3B%0A%20%20%20%20-%20**E3.**%20Alternative%20active%20learning%20strategies%3B%0A%20%20%20%20-%20**C.**%20The%20discovery%20that%20the%20%22ground%20truth%22%20we%20matched%20was%20itself%20a%20choice.%0A%0A%20%20%20%20A%20dataset%20is%20a%20design%20artefact.%20We%20are%20here%20to%20think%20about%20how%20to%20design%20it.%0A%0A%20%20%20%20There%20is%20also%20an%20optional%20extension%2C%20**E1x**%2C%20if%20you%20get%20ahead%3A%20the%20same%20lesson%20as%20**E1**%2C%0A%20%20%20%20reached%20from%20the%20other%20direction%20%26mdash%3B%20a%20model%20complex%20enough%20to%20fit%20its%20training%20data%0A%20%20%20%20almost%20perfectly%2C%20and%20worse%20on%20data%20it%20has%20not%20seen.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20How%20the%20two%20hours%20are%20shaped%0A%0A%20%20%20%20%7C%20%7C%20%7C%20%7C%0A%20%20%20%20%7C---%7C%3A---%7C%3A---%7C%0A%20%20%20%20%7C%20**13%3A45**%20%7C%20Setup%20%7C%20Notebook%20launch%2C%20API%20keys%20%7C%0A%20%20%20%20%7C%20**14%3A00**%20%7C%20**E1**%20Oracle%2C%20first%20fit%2C%20why%20RMSE%20lies%20%7C%20build%2C%20label%2C%20fit%2C%20a%20vacancy%20%7C%0A%20%20%20%20%7C%20%7C%20**E1x**%20Choosing%20a%20basis%20*(optional)*%20%7C%20only%20if%20you%20finish%20E1%20early%20%7C%0A%20%20%20%20%7C%20**14%3A30**%20%7C%20**E2**%20Surfaces%3A%20extrapolation%20%7C%20the%20core%20of%20the%20session%20%7C%0A%20%20%20%20%7C%20**15%3A15**%20%7C%20**E3**%20Sampling%20versus%20selection%20%7C%20same%20budget%2C%20different%20rule%20%7C%0A%20%20%20%20%7C%20**15%3A30**%20%7C%20**C**%20%20Changing%20the%20ground%20truth%20%7C%20demonstrated%2C%20available%20to%20take%20home%20%7C%0A%0A%20%20%20%20E1%2C%20E2%2C%20E3%20and%20C%20run%20in%20order%20on%20the%20same%20key%3A%20each%20resumes%20the%20potential%20the%20last%20one%0A%20%20%20%20fitted%2C%20by%20name.%20**E1x%20is%20the%20exception**%20as%20it%20provides%20its%20own%20labelled%20data%2C%20resumes%0A%20%20%20%20nothing%20and%20spends%20none%20of%20your%20300%20labels%2C%20so%20you%20can%20do%20it%20if%20you%20are%20ahead%20and%20skip%20it%0A%20%20%20%20with%20no%20consequence%20at%20all%20if%20not.%0A%0A%20%20%20%20Model%20solutions%20will%20be%20released%20as%20we%20go%20along%20to%20prevent%20falling%20behind.%20Ask%20for%0A%20%20%20%20help%20rather%20than%20skipping%20ahead.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20health_button%20%3D%20mo.ui.run_button(label%3D%22Ask%20both%20services%20who%20they%20are%22)%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20rf%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%20You%20are%20not%20fitting%20on%20your%20laptop%0A%0A%20%20%20%20%20%20%20%20Two%20services%20do%20the%20heavy%20lifting.%20Your%20notebook%20only%20ever%20holds%20structures.%0A%0A%20%20%20%20%20%20%20%20-%20an%20**oracle**%20%E2%80%94%20the%20MACE-MH1%20foundation%20model%20as%20the%20source%20of%20labels%3B%0A%20%20%20%20%20%20%20%20-%20an%20**ACE%20workbench**%20%E2%80%94%20fits%2C%20evaluates%2C%20compute%20descriptors%2C%20runs%20relaxations%0A%20%20%20%20%20%20%20%20%20%20and%20dynamics%2C%20in%20Julia.%0A%0A%20%20%20%20%20%20%20%20%7Bhealth_button%7D%0A%20%20%20%20%20%20%20%20%22%22%22)%0A%20%20%20%20return%20(health_button%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(ACE_URL%2C%20ORACLE_URL%2C%20health_button%2C%20mo%2C%20reset_button)%3A%0A%20%20%20%20reset_button%20%20%23%20noqa%3A%20B018%20--%20referenced%20so%20Reset%20re-runs%20this%20cell%0A%20%20%20%20mo.stop(not%20health_button.value%2C%20mo.md(%22*%26larr%3B%20press%20it*%22))%0A%0A%20%20%20%20import%20httpx%0A%0A%20%20%20%20_oracle%20%3D%20httpx.get(f%22%7BORACLE_URL%7D%2Fv1%2Fhealth%22%2C%20timeout%3D10).json()%0A%20%20%20%20_ace%20%3D%20httpx.get(f%22%7BACE_URL%7D%2Fv1%2Fhealth%22%2C%20timeout%3D10).json()%0A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20f%22%22%22%0A%20%20%20%20%20%20%20%20**Oracle**%20%26middot%3B%20checkpoint%20%60%7B_oracle.get(%22checkpoint%22)%7D%60%0A%20%20%20%20%20%20%20%20%26middot%3B%20sha256%20%60%7Bstr(_oracle.get(%22sha256%22))%5B%3A16%5D%7D%E2%80%A6%60%0A%20%20%20%20%20%20%20%20%26middot%3B%20heads%20%60%7B%22%2C%20%22.join(_oracle.get(%22heads%22%2C%20%7B%7D))%7D%60%0A%0A%20%20%20%20%20%20%20%20**Workbench**%20%26middot%3B%20backend%20%60%7B_ace.get(%22workbench_backend%22)%7D%60%0A%20%20%20%20%20%20%20%20%26middot%3B%20descriptor%20basis%20%60%7B_ace.get(%22descriptor_basis%22%2C%20%7B%7D).get(%22id%22)%7D%60%0A%0A%20%20%20%20%20%20%20%20The%20checkpoint%20is%20pinned%20and%20checksummed%2C%20and%20the%20descriptor%20basis%20is%20versioned%2C%0A%20%20%20%20%20%20%20%20so%20all%20coverage%20plots%20are%20comparable.%0A%20%20%20%20%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20label_button%20%3D%20mo.ui.run_button(label%3D%22Spend%20two%20labels%22)%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20rf%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%20Labels%20cost%20-%20imagine%20they%20are%20DFT%20calculations!%0A%0A%20%20%20%20%20%20%20%20You%20have%20**300%20labels**.%20Every%20structure%20you%20send%20the%20oracle%20spends%20one.%20%0A%0A%20%20%20%20%20%20%20%20With%20unlimited%20labels%20there%20would%20be%20no%20need%20for%20dataset%20craft.%0A%0A%20%20%20%20%20%20%20%20%7Blabel_button%7D%0A%20%20%20%20%20%20%20%20%22%22%22)%0A%20%20%20%20return%20(label_button%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Aasync%20def%20_(ACE_URL%2C%20DEMO_KEY%2C%20ORACLE_URL%2C%20label_button%2C%20mo%2C%20reset_button)%3A%0A%20%20%20%20reset_button%20%20%23%20noqa%3A%20B018%20--%20referenced%20so%20Reset%20re-runs%20this%20cell%0A%20%20%20%20mo.stop(not%20label_button.value%2C%20mo.md(%22*%26larr%3B%20press%20it*%22))%0A%0A%20%20%20%20from%20ase.build%20import%20bulk%0A%20%20%20%20from%20mlipschool_client%20import%20MLIPSchoolClient%2C%20resolve_config%0A%0A%20%20%20%20%23%20marimo%20runs%20every%20cell%20inside%20its%20own%20event%20loop%2C%20so%20%60asyncio.run%60%20here%20raises%0A%20%20%20%20%23%20%22cannot%20be%20called%20from%20a%20running%20event%20loop%22.%20A%20cell%20awaits%20directly%20instead%3A%0A%20%20%20%20%23%20marimo%20turns%20the%20cell%20into%20a%20coroutine%20as%20soon%20as%20it%20sees%20a%20top-level%20await.%0A%20%20%20%20async%20def%20_spend()%3A%0A%20%20%20%20%20%20%20%20_structures%20%3D%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20bulk(%22Si%22%2C%20%22diamond%22%2C%20a%3D5.43%2C%20cubic%3DTrue)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20bulk(%22Si%22%2C%20%22diamond%22%2C%20a%3D5.50%2C%20cubic%3DTrue)%2C%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20_config%20%3D%20resolve_config(oracle_url%3DORACLE_URL%2C%20ace_url%3DACE_URL%2C%20api_key%3DDEMO_KEY)%0A%20%20%20%20%20%20%20%20async%20with%20MLIPSchoolClient(_config)%20as%20_client%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20await%20_client.oracle_calculate(_structures)%0A%0A%20%20%20%20_labelled%2C%20_budget%20%3D%20await%20_spend()%0A%20%20%20%20_energy%20%3D%20_labelled%5B0%5D.get_potential_energy()%0A%20%20%20%20_fmax%20%3D%20abs(_labelled%5B0%5D.get_forces()).max()%0A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20f%22%22%22%0A%20%20%20%20%20%20%20%20Two%20structures%20in%2C%20energies%20and%20forces%20back%3A%0A%0A%20%20%20%20%20%20%20%20-%20%60E%20%3D%20%7B_energy%3A.4f%7D%20eV%60%20for%20%7Blen(_labelled%5B0%5D)%7D%20atoms%20%26nbsp%3B%0A%20%20%20%20%20%20%20%20%20%20(%60%7B_energy%20%2F%20len(_labelled%5B0%5D)%3A.4f%7D%60%20eV%2Fatom)%0A%20%20%20%20%20%20%20%20-%20largest%20force%20component%20%60%7B_fmax%3A.2e%7D%20eV%2F%C3%85%60%20%E2%80%94%20a%20relaxed%20diamond%20cell%2C%20as%20it%20should%20be%0A%0A%20%20%20%20%20%20%20%20**Budget%3A%20%7B_budget%5B%22used%22%5D%7D%2F%7B_budget%5B%22limit%22%5D%7D%2C%20%7B_budget%5B%22remaining%22%5D%7D%20left.**%0A%0A%20%20%20%20%20%20%20%20Send%20the%20same%20structure%20twice%20and%20it%20is%20free%2C%20since%20labels%20are%20cached.%20Re-running%0A%20%20%20%20%20%20%20%20a%20cell%20never%20costs%20you.%0A%20%20%20%20%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(MODEL_NAME%2C%20mo)%3A%0A%20%20%20%20resume_button%20%3D%20mo.ui.run_button(label%3Df%22Resume%20'%7BMODEL_NAME%7D'%22)%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20rf%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%20Your%20potentials%20outlive%20your%20notebook%0A%0A%20%20%20%20%20%20%20%20Fitted%20potentials%20live%20on%20the%20workbench%20under%20a%20**name**%2C%20tied%20to%20your%20key.%0A%0A%20%20%20%20%20%20%20%20This%20is%20why%20the%20notebooks%20chain%3A%20E2%20does%20not%20have%20to%20re-fit%20E1's%20potential.%0A%20%20%20%20%20%20%20%20Close%20your%20tab%2C%20reopen%20it%2C%20and%20everything%20is%20still%20there.%0A%0A%20%20%20%20%20%20%20%20%7Bresume_button%7D%0A%20%20%20%20%20%20%20%20%22%22%22)%0A%20%20%20%20return%20(resume_button%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Aasync%20def%20_(%0A%20%20%20%20ACE_URL%2C%0A%20%20%20%20DEMO_KEY%2C%0A%20%20%20%20MODEL_NAME%2C%0A%20%20%20%20ORACLE_URL%2C%0A%20%20%20%20mo%2C%0A%20%20%20%20reset_button%2C%0A%20%20%20%20resume_button%2C%0A)%3A%0A%20%20%20%20reset_button%20%20%23%20noqa%3A%20B018%20--%20referenced%20so%20Reset%20re-runs%20this%20cell%0A%20%20%20%20mo.stop(not%20resume_button.value%2C%20mo.md(%22*%26larr%3B%20press%20it*%22))%0A%0A%20%20%20%20from%20ase.build%20import%20bulk%20as%20_bulk%0A%20%20%20%20from%20mlipschool_client%20import%20MLIPSchoolClient%20as%20_Client%0A%20%20%20%20from%20mlipschool_client%20import%20resolve_config%20as%20_resolve%0A%0A%20%20%20%20%23%20marimo%20runs%20every%20cell%20inside%20its%20own%20event%20loop%2C%20so%20%60asyncio.run%60%20here%20raises%0A%20%20%20%20%23%20%22cannot%20be%20called%20from%20a%20running%20event%20loop%22.%20A%20cell%20awaits%20directly%20instead%3A%0A%20%20%20%20%23%20marimo%20turns%20the%20cell%20into%20a%20coroutine%20as%20soon%20as%20it%20sees%20a%20top-level%20await.%0A%20%20%20%20async%20def%20_resume()%3A%0A%20%20%20%20%20%20%20%20_structure%20%3D%20_bulk(%22Si%22%2C%20%22diamond%22%2C%20a%3D5.43%2C%20cubic%3DTrue)%0A%20%20%20%20%20%20%20%20_config%20%3D%20_resolve(oracle_url%3DORACLE_URL%2C%20ace_url%3DACE_URL%2C%20api_key%3DDEMO_KEY)%0A%20%20%20%20%20%20%20%20async%20with%20_Client(_config)%20as%20_client%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20_model%20%3D%20await%20_client.load_model(MODEL_NAME)%0A%20%20%20%20%20%20%20%20%20%20%20%20_evaluated%20%3D%20await%20_model.evaluate(%5B_structure%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20_model%2C%20_evaluated%5B0%5D%0A%0A%20%20%20%20_model%2C%20_atoms%20%3D%20await%20_resume()%0A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20f%22%22%22%0A%20%20%20%20%20%20%20%20%60load_model(%22%7BMODEL_NAME%7D%22)%60%20%26rarr%3B%20%60%7B_model.model_id%5B%3A12%5D%7D%E2%80%A6%60%2C%20fitted%20earlier%2C%20no%20refit.%0A%0A%20%20%20%20%20%20%20%20Evaluating%20one%20Si%20cell%20with%20it%3A%20**%7B_atoms.get_potential_energy()%3A.4f%7D%20eV**.%0A%0A%20%20%20%20%20%20%20%20This%20makes%20handover%20between%20notebooks%20straightforward.%0A%20%20%20%20%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Summary%0A%0A%20%20%20%201.%20**300%20labels.**%20Spend%20them%20carefully.%20Re-runs%20are%20free%3B%20new%20structures%20are%20not.%0A%20%20%20%202.%20**Use%20the%20hints%20and%20checks.**%20Nothing%20here%20is%20assessed.%20Red%20checks%20are%20giving%20you%0A%20%20%20%20%20%20%20information%20about%20your%20dataset.%20Hints%20guide%20you%20to%20the%20answer%2C%0A%20%20%20%20%20%20%20and%20model%20solutions%20will%20be%20revealed%20progressively.%0A%20%20%20%204.%20**Run%20E1%2C%20E2%2C%20E3%20and%20C%20in%20order%2C%20on%20one%20key.**%20Each%20continues%20from%20what%20the%20last%0A%20%20%20%20%20%20%20fitted.%20**E1x%20is%20optional%20and%20standalone**%2C%20and%20costs%20no%20labels%2C%20so%20it%20is%20there%0A%20%20%20%20%20%20%20if%20you%20are%20ahead.%0A%20%20%20%205.%20**Ask%20for%20help!**%0A%0A%20%20%20%20%23%23%23%20Open%20E1%20and%20start.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Credits%0A%0A%20%20%20%20Authored%20by%20James%20Kermode%2C%20with%20feedback%20and%20support%20from%20Facundo%20Costa%2C%0A%20%20%20%20Roman%20Shantsila%20and%20Svenja%20Janke.%0A%0A%20%20%20%20**AI%20declaration.**%20Support%20from%20AI%20coding%20agents%20setting%20up%20the%20infrastructure%2C%20but%20I%0A%20%20%20%20designed%20and%20(with%20help%20from%20Roman%2C%20Facundo%20and%20Svenja)%20fact%20checked%20everything%20and%0A%20%20%20%20take%20responsibility%20for%20scientific%20decisions%20as%20well%20as%20for%20the%20accuracy%20of%20what's%0A%20%20%20%20there.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
8e365c6b50a2b1e79794ffa02b522ec5