Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
4162533
1
Parent(s):
86da990
swap
Browse files
app.py
CHANGED
@@ -124,447 +124,6 @@ def main():
|
|
124 |
)
|
125 |
|
126 |
with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
127 |
-
|
128 |
-
with gr.Sidebar(open=True):
|
129 |
-
|
130 |
-
with gr.Accordion("1. Your first UMA simulation", open=True):
|
131 |
-
|
132 |
-
with gr.Row():
|
133 |
-
gr.Examples(
|
134 |
-
examples=[
|
135 |
-
[
|
136 |
-
str(
|
137 |
-
Path(__file__).parent
|
138 |
-
/ "./examples/metal_cplx.pdb"
|
139 |
-
),
|
140 |
-
100,
|
141 |
-
20,
|
142 |
-
1.0,
|
143 |
-
300.0,
|
144 |
-
"NVE",
|
145 |
-
"OMol",
|
146 |
-
1,
|
147 |
-
6,
|
148 |
-
"Congratulations, you just ran your first UMA simulation! This is a molecular dynamics simulation of a transition metal complex that shows the atoms vibrating from thermal motion. Now try running some of the examples in the next tab to more thoroughly explore how UMA can be applied to different domains and types of structures.",
|
149 |
-
],
|
150 |
-
[
|
151 |
-
str(
|
152 |
-
Path(__file__).parent
|
153 |
-
/ "./examples/inorganic_crystal.cif"
|
154 |
-
),
|
155 |
-
200,
|
156 |
-
20,
|
157 |
-
1.0,
|
158 |
-
300.0,
|
159 |
-
"NVE",
|
160 |
-
"OMat",
|
161 |
-
0,
|
162 |
-
1,
|
163 |
-
"Congratulations, you just ran your first UMA simulation! This is a molecular dynamics simulation of a transition metal complex that shows the atoms vibrating from thermal motion. Now try running some of the examples in the next tab to more thoroughly explore how UMA can be applied to different domains and types of structures.",
|
164 |
-
],
|
165 |
-
],
|
166 |
-
example_labels=[
|
167 |
-
"A transition metal complex",
|
168 |
-
"An inorganic crystal",
|
169 |
-
],
|
170 |
-
inputs=[
|
171 |
-
input_structure,
|
172 |
-
md_steps,
|
173 |
-
prerelax_steps,
|
174 |
-
md_timestep,
|
175 |
-
temperature_k,
|
176 |
-
md_ensemble,
|
177 |
-
task_name,
|
178 |
-
total_charge,
|
179 |
-
spin_multiplicity,
|
180 |
-
explanation_buffer,
|
181 |
-
],
|
182 |
-
outputs=[
|
183 |
-
output_traj,
|
184 |
-
output_text,
|
185 |
-
reproduction_script,
|
186 |
-
explanation,
|
187 |
-
],
|
188 |
-
fn=run_md_simulation,
|
189 |
-
run_on_click=True,
|
190 |
-
cache_examples=True,
|
191 |
-
label="Molecular Dynamics Examples",
|
192 |
-
)
|
193 |
-
|
194 |
-
gr.Markdown(
|
195 |
-
"""
|
196 |
-
Start by clicking one of the above examples to see how the demo works and what the inputs and outputs will look like.
|
197 |
-
* Every example is a specific molecular structure or material that can be simulated using the UMA model.
|
198 |
-
* Each simulation you see would take days or weeks using a traditional quantum chemistry simulation, but UMA can do it in seconds or minutes!
|
199 |
-
* Examples in the demo are cached ahead of time so they should load right away, but if you run a custom simulation you'll see a progress bar while the simulation runs.
|
200 |
-
|
201 |
-
When you've run your first simulation, click on the next tab above to explore the UMA model in more detail and see how it works across many different domains/examples!
|
202 |
-
"""
|
203 |
-
)
|
204 |
-
|
205 |
-
with gr.Accordion("2. Explore UMA's capabilities", open=False):
|
206 |
-
gr.Markdown(
|
207 |
-
"""
|
208 |
-
These next examples are designed to show how the UMA model can be applied to different domains and types of structures, and how different model inputs can impact the results!
|
209 |
-
* As you try each one, look at how the inputs change below, and the simulation outputs change on the right
|
210 |
-
* Each UMA task corresponds to a different domain of chemistry, and a different Density Functional Theory (DFT) code and level of theory that was used for the training data.
|
211 |
-
* Feel free to try changing some of the settings below and re-run the simulations to see how the results can vary!
|
212 |
-
"""
|
213 |
-
)
|
214 |
-
gr.Examples(
|
215 |
-
examples=[
|
216 |
-
[
|
217 |
-
str(
|
218 |
-
Path(__file__).parent
|
219 |
-
/ "./examples/metal_cplx.pdb"
|
220 |
-
),
|
221 |
-
100,
|
222 |
-
20,
|
223 |
-
1.0,
|
224 |
-
300.0,
|
225 |
-
"NVE",
|
226 |
-
"OMol",
|
227 |
-
1,
|
228 |
-
6,
|
229 |
-
"This metal complex showcases the UMA's ability to handle complicated transition metal complexes with ligands, spin, and charge.",
|
230 |
-
],
|
231 |
-
[
|
232 |
-
str(
|
233 |
-
Path(__file__).parent
|
234 |
-
/ "./examples/organic_molecular_crystal.cif"
|
235 |
-
),
|
236 |
-
200,
|
237 |
-
20,
|
238 |
-
1.0,
|
239 |
-
300.0,
|
240 |
-
"NVE",
|
241 |
-
"OMC",
|
242 |
-
0,
|
243 |
-
1,
|
244 |
-
"This organic crystal showcases the UMA's ability to handle organic molecular crystals using the OMC task, using a random packing of a molecule from OE62. You could also try using the OMol or OMat tasks and see how the simulations differ!",
|
245 |
-
],
|
246 |
-
[
|
247 |
-
str(
|
248 |
-
Path(__file__).parent
|
249 |
-
/ "./examples/inorganic_crystal.cif"
|
250 |
-
),
|
251 |
-
200,
|
252 |
-
20,
|
253 |
-
1.0,
|
254 |
-
300.0,
|
255 |
-
"NVE",
|
256 |
-
"OMat",
|
257 |
-
0,
|
258 |
-
1,
|
259 |
-
"This inorganic crystal from the Materials Project showcases the UMA's ability to handle inorganic materials using the OMat task. You should be careful with the output energies since the analysis might require careful application of the Materials Project GGA/GGA+U correction schemes.",
|
260 |
-
],
|
261 |
-
[
|
262 |
-
str(Path(__file__).parent / "./examples/HEA.cif"),
|
263 |
-
200,
|
264 |
-
20,
|
265 |
-
1.0,
|
266 |
-
300.0,
|
267 |
-
"NVE",
|
268 |
-
"OMat",
|
269 |
-
0,
|
270 |
-
1,
|
271 |
-
"High-entropy alloys are materials with 4 or more elements, and this example shows the OMat model can also be applied to HEAs. This particular HEA is equimolar Cr/Fe/Ni/Sn, but could exist in other lattice configurations. ",
|
272 |
-
],
|
273 |
-
[
|
274 |
-
str(
|
275 |
-
Path(__file__).parent
|
276 |
-
/ "./examples/catalyst.traj"
|
277 |
-
),
|
278 |
-
200,
|
279 |
-
20,
|
280 |
-
1.0,
|
281 |
-
300.0,
|
282 |
-
"NVE",
|
283 |
-
"OC20",
|
284 |
-
0,
|
285 |
-
1,
|
286 |
-
"This example shows the OC20 model can be applied to small molecules on a catalyst surface, and that OC20 has recently been extended with datasets for multi-adsorbate interactions. Notice some of the adsorbates wrap around the periodic boundary conditions. Some of the adsorbates are weakly bound and desorbing from the surface based on this starting configuration.",
|
287 |
-
],
|
288 |
-
[
|
289 |
-
str(
|
290 |
-
Path(__file__).parent
|
291 |
-
/ "./examples/gold_nanoparticle_crystal.cif"
|
292 |
-
),
|
293 |
-
200,
|
294 |
-
20,
|
295 |
-
1.0,
|
296 |
-
300.0,
|
297 |
-
"NVE",
|
298 |
-
"OMat",
|
299 |
-
0,
|
300 |
-
1,
|
301 |
-
"This example is an experimentally solved crystal structure for a thiolate protected gold nanocluster from an[open-access academic paper](https://pubs.rsc.org/en/content/articlelanding/2016/sc/c5sc02134k) and [available in the COD](https://www.crystallography.net/cod/1540567.html). This is a fun example because it combines small molecules, inorganic materials, and surface chemistry, so it's not so clear which task to use. Try the OMat, OMol, and OC20 tasks to see how the results differ! Further, the experimental paper reported different crystal structures based on the charge and spin multiplicity, so try changing the charge and spin multiplicity to see how the results differ.",
|
302 |
-
],
|
303 |
-
[
|
304 |
-
str(
|
305 |
-
Path(__file__).parent
|
306 |
-
/ "./examples/ethylene_carbonate.xyz"
|
307 |
-
),
|
308 |
-
500,
|
309 |
-
20,
|
310 |
-
1.0,
|
311 |
-
1000.0,
|
312 |
-
"NVE",
|
313 |
-
"OMol",
|
314 |
-
0,
|
315 |
-
1,
|
316 |
-
"Ethylene carbonate is a common electrolyte in batteries, and an important precursor to the solid/electrolyte interface (SEI) formation. This example is the neutral version of ethylene carbonate and it is quite stable even at high temperatures! Try the radical anion version of ethylene carbonate in the next example.",
|
317 |
-
],
|
318 |
-
[
|
319 |
-
str(
|
320 |
-
Path(__file__).parent
|
321 |
-
/ "./examples/ethylene_carbonate.xyz"
|
322 |
-
),
|
323 |
-
500,
|
324 |
-
20,
|
325 |
-
1.0,
|
326 |
-
1000.0,
|
327 |
-
"NVE",
|
328 |
-
"OMol",
|
329 |
-
-1,
|
330 |
-
2,
|
331 |
-
"With charge of -1 and spin multiplicity of 2, this radical anion version of ethylene carbonate is much less stable than the neutral version and can undergo spontaneous ring-opening at high temperatures, which initiates the formation of a battery's solid/electrolyte interface (SEI). If the simulation doesn't show a ring opening reaction, try clicking the molecular dynamic buttons again to see another short simulation. Only OMol currently supports arbitrary charge/spin multiplicity.",
|
332 |
-
],
|
333 |
-
[
|
334 |
-
str(
|
335 |
-
Path(__file__).parent / "./examples/protein.pdb"
|
336 |
-
),
|
337 |
-
200,
|
338 |
-
20,
|
339 |
-
1.0,
|
340 |
-
300.0,
|
341 |
-
"NVE",
|
342 |
-
"OMol",
|
343 |
-
0,
|
344 |
-
1,
|
345 |
-
"This is a solvated structure of a small protein fragment using the OMol task. Very little is likely happen in a very short MD simulations. Try increasing the number of MD steps to see how the protein moves. You can also try using the OMat task, but be careful with the results since the OMat task is not trained on solvated systems.",
|
346 |
-
],
|
347 |
-
[
|
348 |
-
str(
|
349 |
-
Path(__file__).parent
|
350 |
-
/ "./examples/MOF_CO2.traj"
|
351 |
-
),
|
352 |
-
200,
|
353 |
-
20,
|
354 |
-
1.0,
|
355 |
-
300.0,
|
356 |
-
"NVE",
|
357 |
-
"ODAC",
|
358 |
-
0,
|
359 |
-
1,
|
360 |
-
"This is a metal organic framework (MOF) structure using the ODac task. You might study structures like if designing MOFs for direct air capture calculations. Look carefully for the red/gray CO2 molecule in the pores of the MOF! You can also try the OMol and OMat tasks to see if the results differ.",
|
361 |
-
],
|
362 |
-
],
|
363 |
-
example_labels=[
|
364 |
-
"Simulate a transition metal complex",
|
365 |
-
"Simulate an organic molecular crystal",
|
366 |
-
"Simulate an inorganic crystal",
|
367 |
-
"Simulate a high-entropy alloy",
|
368 |
-
"Simulate a catalyst surface/adsorbate",
|
369 |
-
"Simulate a ligated gold nanoparticle crystal",
|
370 |
-
"Simulate a neutral ethylene carbonate",
|
371 |
-
"Simulate a radical anion ethylene carbonate",
|
372 |
-
"Simulate a solvated protein",
|
373 |
-
"Simulate CO2 in a metal organic framework",
|
374 |
-
],
|
375 |
-
inputs=[
|
376 |
-
input_structure,
|
377 |
-
md_steps,
|
378 |
-
prerelax_steps,
|
379 |
-
md_timestep,
|
380 |
-
temperature_k,
|
381 |
-
md_ensemble,
|
382 |
-
task_name,
|
383 |
-
total_charge,
|
384 |
-
spin_multiplicity,
|
385 |
-
explanation_buffer,
|
386 |
-
],
|
387 |
-
outputs=[
|
388 |
-
output_traj,
|
389 |
-
output_text,
|
390 |
-
reproduction_script,
|
391 |
-
explanation,
|
392 |
-
],
|
393 |
-
fn=run_md_simulation,
|
394 |
-
run_on_click=True,
|
395 |
-
cache_examples=True,
|
396 |
-
label="Molecular Dynamics Examples",
|
397 |
-
)
|
398 |
-
|
399 |
-
gr.Examples(
|
400 |
-
examples=[
|
401 |
-
[
|
402 |
-
str(
|
403 |
-
Path(__file__).parent
|
404 |
-
/ "./examples/bis(EDA)Cu.xyz"
|
405 |
-
),
|
406 |
-
300,
|
407 |
-
0.05,
|
408 |
-
"OMol",
|
409 |
-
1,
|
410 |
-
1,
|
411 |
-
False,
|
412 |
-
"This is a super fun example of a transition metal complex that changes its geometry based on the assumed charge/spin multiplicity and actually has different local minima. It highlights the ability of the OMol task to handle these additional inputs. In this first example it forms a tetragonal geometry - try clicking on the next example (with charge=+2 and spin multiplicity 2) to see the other local minima!",
|
413 |
-
],
|
414 |
-
[
|
415 |
-
str(
|
416 |
-
Path(__file__).parent
|
417 |
-
/ "./examples/bis(EDA)Cu.xyz"
|
418 |
-
),
|
419 |
-
300,
|
420 |
-
0.05,
|
421 |
-
"OMol",
|
422 |
-
2,
|
423 |
-
2,
|
424 |
-
False,
|
425 |
-
"This is a super fun example of a transition metal complex that changes its geometry based on the assumed charge/spin multiplicity and actually has different local minima. In contrast to the previous example (charge=+1 and spin multiplicity 1), this one forms a square planar geometry.",
|
426 |
-
],
|
427 |
-
[
|
428 |
-
str(
|
429 |
-
Path(__file__).parent
|
430 |
-
/ "./examples/metal_cplx.pdb"
|
431 |
-
),
|
432 |
-
300,
|
433 |
-
0.05,
|
434 |
-
"OMol",
|
435 |
-
1,
|
436 |
-
6,
|
437 |
-
False,
|
438 |
-
"This metal complex showcases the UMA's ability to handle complicated transition metal complexes with ligands, spin, and charge.",
|
439 |
-
],
|
440 |
-
[
|
441 |
-
str(
|
442 |
-
Path(__file__).parent
|
443 |
-
/ "./examples/organic_molecular_crystal.cif"
|
444 |
-
),
|
445 |
-
300,
|
446 |
-
0.05,
|
447 |
-
"OMC",
|
448 |
-
0,
|
449 |
-
1,
|
450 |
-
True,
|
451 |
-
"This organic crystal showcases the UMA's ability to handle organic molecular crystals using the OMC task, using a random packing of a molecule from OE62. You could also try using the OMol or OMat tasks and see how the simulations differ!",
|
452 |
-
],
|
453 |
-
[
|
454 |
-
str(
|
455 |
-
Path(__file__).parent
|
456 |
-
/ "./examples/inorganic_crystal.cif"
|
457 |
-
),
|
458 |
-
300,
|
459 |
-
0.05,
|
460 |
-
"OMat",
|
461 |
-
0,
|
462 |
-
1,
|
463 |
-
True,
|
464 |
-
"This inorganic crystal from the Materials Project showcases the UMA's ability to handle inorganic materials using the OMat task. You should be careful with the output energies since the analysis might require careful application of the Materials Project GGA/GGA+U correction schemes.",
|
465 |
-
],
|
466 |
-
[
|
467 |
-
str(Path(__file__).parent / "./examples/HEA.cif"),
|
468 |
-
300,
|
469 |
-
0.05,
|
470 |
-
"OMat",
|
471 |
-
0,
|
472 |
-
1,
|
473 |
-
True,
|
474 |
-
"High-entropy alloys are materials with 4 or more elements, and this example shows the OMat model can also be applied to HEAs. This particular HEA is equimolar Cr/Fe/Ni/Sn, but could exist in other lattice configurations. ",
|
475 |
-
],
|
476 |
-
[
|
477 |
-
str(
|
478 |
-
Path(__file__).parent
|
479 |
-
/ "./examples/catalyst.traj"
|
480 |
-
),
|
481 |
-
300,
|
482 |
-
0.05,
|
483 |
-
"OC20",
|
484 |
-
0,
|
485 |
-
1,
|
486 |
-
False,
|
487 |
-
"This example shows the OC20 model can be applied to small molecules on a catalyst surface, and that OC20 has recently been extended with datasets for multi-adsorbate interactions. Notice some of the adsorbates wrap around the periodic boundary conditions. Some of the adsorbates are weakly bound and desorbing from the surface based on this starting configuration.",
|
488 |
-
],
|
489 |
-
[
|
490 |
-
str(
|
491 |
-
Path(__file__).parent / "./examples/protein.pdb"
|
492 |
-
),
|
493 |
-
300,
|
494 |
-
0.05,
|
495 |
-
"OMol",
|
496 |
-
0,
|
497 |
-
1,
|
498 |
-
True,
|
499 |
-
"This is a solvated structure of a small protein fragment using the OMol task. Very little is likely happen in a very short MD simulations. Try increasing the number of MD steps to see how the protein moves. You can also try using the OMat task, but be careful with the results since the OMat task is not trained on solvated systems.",
|
500 |
-
],
|
501 |
-
[
|
502 |
-
str(
|
503 |
-
Path(__file__).parent
|
504 |
-
/ "./examples/MOF_CO2_2H2O.traj"
|
505 |
-
),
|
506 |
-
300,
|
507 |
-
0.05,
|
508 |
-
"ODAC",
|
509 |
-
0,
|
510 |
-
1,
|
511 |
-
False,
|
512 |
-
"This is a metal organic framework (MOF) structure using the ODac task. You might study structures like if designing MOFs for direct air capture (DAC) calculations. Look carefully for the co-adsorption between CO2 and two water molecules in the pore, which you might study if you were interested in the effect of humidity on DAC performance! You can also try the OMol and OMat tasks to see if the results differ.",
|
513 |
-
],
|
514 |
-
],
|
515 |
-
example_labels=[
|
516 |
-
"Relax bis(EDA)Cu TM complex with charge=1, spin=1",
|
517 |
-
"Relax bis(EDA)Cu TM complex with charge=2, spin=2",
|
518 |
-
"Relax a transition metal complex w ligands",
|
519 |
-
"Relax an organic molecular crystal",
|
520 |
-
"Relax an inorganic crystal",
|
521 |
-
"Relax a high-entropy alloy",
|
522 |
-
"Relax a catalyst surface/adsorbate",
|
523 |
-
"Relax a solvated protein",
|
524 |
-
"Relax co-adsorbed H2O/CO2 in a metal organic framework",
|
525 |
-
],
|
526 |
-
inputs=[
|
527 |
-
input_structure,
|
528 |
-
optimization_steps,
|
529 |
-
fmax,
|
530 |
-
task_name,
|
531 |
-
total_charge,
|
532 |
-
spin_multiplicity,
|
533 |
-
relax_unit_cell,
|
534 |
-
explanation_buffer,
|
535 |
-
],
|
536 |
-
outputs=[
|
537 |
-
output_traj,
|
538 |
-
output_text,
|
539 |
-
reproduction_script,
|
540 |
-
explanation,
|
541 |
-
],
|
542 |
-
fn=run_relaxation_simulation,
|
543 |
-
run_on_click=True,
|
544 |
-
cache_examples=True,
|
545 |
-
label="Relaxation Examples",
|
546 |
-
)
|
547 |
-
|
548 |
-
gr.Markdown(
|
549 |
-
"Once you understand how the UMA model can be applied to different types of molecules and materials, the final tab above will help you try it out with your own structures! "
|
550 |
-
)
|
551 |
-
|
552 |
-
with gr.Accordion("3. Try UMA with your own structures!", open=False):
|
553 |
-
gr.Markdown(
|
554 |
-
"""
|
555 |
-
As the final step of the demo, try running your own structure through the UMA model!
|
556 |
-
|
557 |
-
To use a custom input structure with this demo:
|
558 |
-
1. [Request gated model access.](https://huggingface.co/facebook/UMA) Requests for model access are typically processed within a matter of minutes.
|
559 |
-
2. Login to Hugging Face using the "Sign in with Hugging Face button" in the .
|
560 |
-
3. Then upload a structure file below and click run!
|
561 |
-
|
562 |
-
* Note that uploaded structure will be stored by this demo to analyze model usage and identify domains where model accuracy can be improved.
|
563 |
-
* If you get a redirect error when logging in, please try visiting the direct demo url (https://facebook-fairchem-uma-demo.hf.space/) and try again
|
564 |
-
* Your structure should be in a format supported by ASE 3.25, including .xyz, .cif, .pdb, ASE .traj, INCAR, or POSCAR.
|
565 |
-
* Your structure should either have periodic boundary conditions (PBC) all True, or all False. Support for mixed PBC may be added in the future.
|
566 |
-
"""
|
567 |
-
)
|
568 |
with gr.Row():
|
569 |
with gr.Column(scale=2):
|
570 |
|
@@ -573,8 +132,446 @@ These next examples are designed to show how the UMA model can be applied to dif
|
|
573 |
"# Meta's Universal Model for Atoms (UMA) Educational Demo"
|
574 |
)
|
575 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
with gr.Row():
|
128 |
with gr.Column(scale=2):
|
129 |
|
|
|
132 |
"# Meta's Universal Model for Atoms (UMA) Educational Demo"
|
133 |
)
|
134 |
|
135 |
+
with gr.Tab("1. Your first UMA simulation"):
|
136 |
+
|
137 |
+
with gr.Row():
|
138 |
+
gr.Examples(
|
139 |
+
examples=[
|
140 |
+
[
|
141 |
+
str(
|
142 |
+
Path(__file__).parent
|
143 |
+
/ "./examples/metal_cplx.pdb"
|
144 |
+
),
|
145 |
+
100,
|
146 |
+
20,
|
147 |
+
1.0,
|
148 |
+
300.0,
|
149 |
+
"NVE",
|
150 |
+
"OMol",
|
151 |
+
1,
|
152 |
+
6,
|
153 |
+
"Congratulations, you just ran your first UMA simulation! This is a molecular dynamics simulation of a transition metal complex that shows the atoms vibrating from thermal motion. Now try running some of the examples in the next tab to more thoroughly explore how UMA can be applied to different domains and types of structures.",
|
154 |
+
],
|
155 |
+
[
|
156 |
+
str(
|
157 |
+
Path(__file__).parent
|
158 |
+
/ "./examples/inorganic_crystal.cif"
|
159 |
+
),
|
160 |
+
200,
|
161 |
+
20,
|
162 |
+
1.0,
|
163 |
+
300.0,
|
164 |
+
"NVE",
|
165 |
+
"OMat",
|
166 |
+
0,
|
167 |
+
1,
|
168 |
+
"Congratulations, you just ran your first UMA simulation! This is a molecular dynamics simulation of a transition metal complex that shows the atoms vibrating from thermal motion. Now try running some of the examples in the next tab to more thoroughly explore how UMA can be applied to different domains and types of structures.",
|
169 |
+
],
|
170 |
+
],
|
171 |
+
example_labels=[
|
172 |
+
"A transition metal complex",
|
173 |
+
"An inorganic crystal",
|
174 |
+
],
|
175 |
+
inputs=[
|
176 |
+
input_structure,
|
177 |
+
md_steps,
|
178 |
+
prerelax_steps,
|
179 |
+
md_timestep,
|
180 |
+
temperature_k,
|
181 |
+
md_ensemble,
|
182 |
+
task_name,
|
183 |
+
total_charge,
|
184 |
+
spin_multiplicity,
|
185 |
+
explanation_buffer,
|
186 |
+
],
|
187 |
+
outputs=[
|
188 |
+
output_traj,
|
189 |
+
output_text,
|
190 |
+
reproduction_script,
|
191 |
+
explanation,
|
192 |
+
],
|
193 |
+
fn=run_md_simulation,
|
194 |
+
run_on_click=True,
|
195 |
+
cache_examples=True,
|
196 |
+
label="Molecular Dynamics Examples",
|
197 |
+
)
|
198 |
|
199 |
+
gr.Markdown(
|
200 |
+
"""
|
201 |
+
Start by clicking one of the above examples to see how the demo works and what the inputs and outputs will look like.
|
202 |
+
* Every example is a specific molecular structure or material that can be simulated using the UMA model.
|
203 |
+
* Each simulation you see would take days or weeks using a traditional quantum chemistry simulation, but UMA can do it in seconds or minutes!
|
204 |
+
* Examples in the demo are cached ahead of time so they should load right away, but if you run a custom simulation you'll see a progress bar while the simulation runs.
|
205 |
+
|
206 |
+
When you've run your first simulation, click on the next tab above to explore the UMA model in more detail and see how it works across many different domains/examples!
|
207 |
+
"""
|
208 |
+
)
|
209 |
+
|
210 |
+
with gr.Tab("2. Explore UMA's capabilities"):
|
211 |
+
gr.Markdown(
|
212 |
+
"""
|
213 |
+
These next examples are designed to show how the UMA model can be applied to different domains and types of structures, and how different model inputs can impact the results!
|
214 |
+
* As you try each one, look at how the inputs change below, and the simulation outputs change on the right
|
215 |
+
* Each UMA task corresponds to a different domain of chemistry, and a different Density Functional Theory (DFT) code and level of theory that was used for the training data.
|
216 |
+
* Feel free to try changing some of the settings below and re-run the simulations to see how the results can vary!
|
217 |
+
"""
|
218 |
+
)
|
219 |
+
gr.Examples(
|
220 |
+
examples=[
|
221 |
+
[
|
222 |
+
str(
|
223 |
+
Path(__file__).parent
|
224 |
+
/ "./examples/metal_cplx.pdb"
|
225 |
+
),
|
226 |
+
100,
|
227 |
+
20,
|
228 |
+
1.0,
|
229 |
+
300.0,
|
230 |
+
"NVE",
|
231 |
+
"OMol",
|
232 |
+
1,
|
233 |
+
6,
|
234 |
+
"This metal complex showcases the UMA's ability to handle complicated transition metal complexes with ligands, spin, and charge.",
|
235 |
+
],
|
236 |
+
[
|
237 |
+
str(
|
238 |
+
Path(__file__).parent
|
239 |
+
/ "./examples/organic_molecular_crystal.cif"
|
240 |
+
),
|
241 |
+
200,
|
242 |
+
20,
|
243 |
+
1.0,
|
244 |
+
300.0,
|
245 |
+
"NVE",
|
246 |
+
"OMC",
|
247 |
+
0,
|
248 |
+
1,
|
249 |
+
"This organic crystal showcases the UMA's ability to handle organic molecular crystals using the OMC task, using a random packing of a molecule from OE62. You could also try using the OMol or OMat tasks and see how the simulations differ!",
|
250 |
+
],
|
251 |
+
[
|
252 |
+
str(
|
253 |
+
Path(__file__).parent
|
254 |
+
/ "./examples/inorganic_crystal.cif"
|
255 |
+
),
|
256 |
+
200,
|
257 |
+
20,
|
258 |
+
1.0,
|
259 |
+
300.0,
|
260 |
+
"NVE",
|
261 |
+
"OMat",
|
262 |
+
0,
|
263 |
+
1,
|
264 |
+
"This inorganic crystal from the Materials Project showcases the UMA's ability to handle inorganic materials using the OMat task. You should be careful with the output energies since the analysis might require careful application of the Materials Project GGA/GGA+U correction schemes.",
|
265 |
+
],
|
266 |
+
[
|
267 |
+
str(Path(__file__).parent / "./examples/HEA.cif"),
|
268 |
+
200,
|
269 |
+
20,
|
270 |
+
1.0,
|
271 |
+
300.0,
|
272 |
+
"NVE",
|
273 |
+
"OMat",
|
274 |
+
0,
|
275 |
+
1,
|
276 |
+
"High-entropy alloys are materials with 4 or more elements, and this example shows the OMat model can also be applied to HEAs. This particular HEA is equimolar Cr/Fe/Ni/Sn, but could exist in other lattice configurations. ",
|
277 |
+
],
|
278 |
+
[
|
279 |
+
str(
|
280 |
+
Path(__file__).parent
|
281 |
+
/ "./examples/catalyst.traj"
|
282 |
+
),
|
283 |
+
200,
|
284 |
+
20,
|
285 |
+
1.0,
|
286 |
+
300.0,
|
287 |
+
"NVE",
|
288 |
+
"OC20",
|
289 |
+
0,
|
290 |
+
1,
|
291 |
+
"This example shows the OC20 model can be applied to small molecules on a catalyst surface, and that OC20 has recently been extended with datasets for multi-adsorbate interactions. Notice some of the adsorbates wrap around the periodic boundary conditions. Some of the adsorbates are weakly bound and desorbing from the surface based on this starting configuration.",
|
292 |
+
],
|
293 |
+
[
|
294 |
+
str(
|
295 |
+
Path(__file__).parent
|
296 |
+
/ "./examples/gold_nanoparticle_crystal.cif"
|
297 |
+
),
|
298 |
+
200,
|
299 |
+
20,
|
300 |
+
1.0,
|
301 |
+
300.0,
|
302 |
+
"NVE",
|
303 |
+
"OMat",
|
304 |
+
0,
|
305 |
+
1,
|
306 |
+
"This example is an experimentally solved crystal structure for a thiolate protected gold nanocluster from an[open-access academic paper](https://pubs.rsc.org/en/content/articlelanding/2016/sc/c5sc02134k) and [available in the COD](https://www.crystallography.net/cod/1540567.html). This is a fun example because it combines small molecules, inorganic materials, and surface chemistry, so it's not so clear which task to use. Try the OMat, OMol, and OC20 tasks to see how the results differ! Further, the experimental paper reported different crystal structures based on the charge and spin multiplicity, so try changing the charge and spin multiplicity to see how the results differ.",
|
307 |
+
],
|
308 |
+
[
|
309 |
+
str(
|
310 |
+
Path(__file__).parent
|
311 |
+
/ "./examples/ethylene_carbonate.xyz"
|
312 |
+
),
|
313 |
+
500,
|
314 |
+
20,
|
315 |
+
1.0,
|
316 |
+
1000.0,
|
317 |
+
"NVE",
|
318 |
+
"OMol",
|
319 |
+
0,
|
320 |
+
1,
|
321 |
+
"Ethylene carbonate is a common electrolyte in batteries, and an important precursor to the solid/electrolyte interface (SEI) formation. This example is the neutral version of ethylene carbonate and it is quite stable even at high temperatures! Try the radical anion version of ethylene carbonate in the next example.",
|
322 |
+
],
|
323 |
+
[
|
324 |
+
str(
|
325 |
+
Path(__file__).parent
|
326 |
+
/ "./examples/ethylene_carbonate.xyz"
|
327 |
+
),
|
328 |
+
500,
|
329 |
+
20,
|
330 |
+
1.0,
|
331 |
+
1000.0,
|
332 |
+
"NVE",
|
333 |
+
"OMol",
|
334 |
+
-1,
|
335 |
+
2,
|
336 |
+
"With charge of -1 and spin multiplicity of 2, this radical anion version of ethylene carbonate is much less stable than the neutral version and can undergo spontaneous ring-opening at high temperatures, which initiates the formation of a battery's solid/electrolyte interface (SEI). If the simulation doesn't show a ring opening reaction, try clicking the molecular dynamic buttons again to see another short simulation. Only OMol currently supports arbitrary charge/spin multiplicity.",
|
337 |
+
],
|
338 |
+
[
|
339 |
+
str(
|
340 |
+
Path(__file__).parent / "./examples/protein.pdb"
|
341 |
+
),
|
342 |
+
200,
|
343 |
+
20,
|
344 |
+
1.0,
|
345 |
+
300.0,
|
346 |
+
"NVE",
|
347 |
+
"OMol",
|
348 |
+
0,
|
349 |
+
1,
|
350 |
+
"This is a solvated structure of a small protein fragment using the OMol task. Very little is likely happen in a very short MD simulations. Try increasing the number of MD steps to see how the protein moves. You can also try using the OMat task, but be careful with the results since the OMat task is not trained on solvated systems.",
|
351 |
+
],
|
352 |
+
[
|
353 |
+
str(
|
354 |
+
Path(__file__).parent
|
355 |
+
/ "./examples/MOF_CO2.traj"
|
356 |
+
),
|
357 |
+
200,
|
358 |
+
20,
|
359 |
+
1.0,
|
360 |
+
300.0,
|
361 |
+
"NVE",
|
362 |
+
"ODAC",
|
363 |
+
0,
|
364 |
+
1,
|
365 |
+
"This is a metal organic framework (MOF) structure using the ODac task. You might study structures like if designing MOFs for direct air capture calculations. Look carefully for the red/gray CO2 molecule in the pores of the MOF! You can also try the OMol and OMat tasks to see if the results differ.",
|
366 |
+
],
|
367 |
+
],
|
368 |
+
example_labels=[
|
369 |
+
"Simulate a transition metal complex",
|
370 |
+
"Simulate an organic molecular crystal",
|
371 |
+
"Simulate an inorganic crystal",
|
372 |
+
"Simulate a high-entropy alloy",
|
373 |
+
"Simulate a catalyst surface/adsorbate",
|
374 |
+
"Simulate a ligated gold nanoparticle crystal",
|
375 |
+
"Simulate a neutral ethylene carbonate",
|
376 |
+
"Simulate a radical anion ethylene carbonate",
|
377 |
+
"Simulate a solvated protein",
|
378 |
+
"Simulate CO2 in a metal organic framework",
|
379 |
+
],
|
380 |
+
inputs=[
|
381 |
+
input_structure,
|
382 |
+
md_steps,
|
383 |
+
prerelax_steps,
|
384 |
+
md_timestep,
|
385 |
+
temperature_k,
|
386 |
+
md_ensemble,
|
387 |
+
task_name,
|
388 |
+
total_charge,
|
389 |
+
spin_multiplicity,
|
390 |
+
explanation_buffer,
|
391 |
+
],
|
392 |
+
outputs=[
|
393 |
+
output_traj,
|
394 |
+
output_text,
|
395 |
+
reproduction_script,
|
396 |
+
explanation,
|
397 |
+
],
|
398 |
+
fn=run_md_simulation,
|
399 |
+
run_on_click=True,
|
400 |
+
cache_examples=True,
|
401 |
+
label="Molecular Dynamics Examples",
|
402 |
+
)
|
403 |
+
|
404 |
+
gr.Examples(
|
405 |
+
examples=[
|
406 |
+
[
|
407 |
+
str(
|
408 |
+
Path(__file__).parent
|
409 |
+
/ "./examples/bis(EDA)Cu.xyz"
|
410 |
+
),
|
411 |
+
300,
|
412 |
+
0.05,
|
413 |
+
"OMol",
|
414 |
+
1,
|
415 |
+
1,
|
416 |
+
False,
|
417 |
+
"This is a super fun example of a transition metal complex that changes its geometry based on the assumed charge/spin multiplicity and actually has different local minima. It highlights the ability of the OMol task to handle these additional inputs. In this first example it forms a tetragonal geometry - try clicking on the next example (with charge=+2 and spin multiplicity 2) to see the other local minima!",
|
418 |
+
],
|
419 |
+
[
|
420 |
+
str(
|
421 |
+
Path(__file__).parent
|
422 |
+
/ "./examples/bis(EDA)Cu.xyz"
|
423 |
+
),
|
424 |
+
300,
|
425 |
+
0.05,
|
426 |
+
"OMol",
|
427 |
+
2,
|
428 |
+
2,
|
429 |
+
False,
|
430 |
+
"This is a super fun example of a transition metal complex that changes its geometry based on the assumed charge/spin multiplicity and actually has different local minima. In contrast to the previous example (charge=+1 and spin multiplicity 1), this one forms a square planar geometry.",
|
431 |
+
],
|
432 |
+
[
|
433 |
+
str(
|
434 |
+
Path(__file__).parent
|
435 |
+
/ "./examples/metal_cplx.pdb"
|
436 |
+
),
|
437 |
+
300,
|
438 |
+
0.05,
|
439 |
+
"OMol",
|
440 |
+
1,
|
441 |
+
6,
|
442 |
+
False,
|
443 |
+
"This metal complex showcases the UMA's ability to handle complicated transition metal complexes with ligands, spin, and charge.",
|
444 |
+
],
|
445 |
+
[
|
446 |
+
str(
|
447 |
+
Path(__file__).parent
|
448 |
+
/ "./examples/organic_molecular_crystal.cif"
|
449 |
+
),
|
450 |
+
300,
|
451 |
+
0.05,
|
452 |
+
"OMC",
|
453 |
+
0,
|
454 |
+
1,
|
455 |
+
True,
|
456 |
+
"This organic crystal showcases the UMA's ability to handle organic molecular crystals using the OMC task, using a random packing of a molecule from OE62. You could also try using the OMol or OMat tasks and see how the simulations differ!",
|
457 |
+
],
|
458 |
+
[
|
459 |
+
str(
|
460 |
+
Path(__file__).parent
|
461 |
+
/ "./examples/inorganic_crystal.cif"
|
462 |
+
),
|
463 |
+
300,
|
464 |
+
0.05,
|
465 |
+
"OMat",
|
466 |
+
0,
|
467 |
+
1,
|
468 |
+
True,
|
469 |
+
"This inorganic crystal from the Materials Project showcases the UMA's ability to handle inorganic materials using the OMat task. You should be careful with the output energies since the analysis might require careful application of the Materials Project GGA/GGA+U correction schemes.",
|
470 |
+
],
|
471 |
+
[
|
472 |
+
str(Path(__file__).parent / "./examples/HEA.cif"),
|
473 |
+
300,
|
474 |
+
0.05,
|
475 |
+
"OMat",
|
476 |
+
0,
|
477 |
+
1,
|
478 |
+
True,
|
479 |
+
"High-entropy alloys are materials with 4 or more elements, and this example shows the OMat model can also be applied to HEAs. This particular HEA is equimolar Cr/Fe/Ni/Sn, but could exist in other lattice configurations. ",
|
480 |
+
],
|
481 |
+
[
|
482 |
+
str(
|
483 |
+
Path(__file__).parent
|
484 |
+
/ "./examples/catalyst.traj"
|
485 |
+
),
|
486 |
+
300,
|
487 |
+
0.05,
|
488 |
+
"OC20",
|
489 |
+
0,
|
490 |
+
1,
|
491 |
+
False,
|
492 |
+
"This example shows the OC20 model can be applied to small molecules on a catalyst surface, and that OC20 has recently been extended with datasets for multi-adsorbate interactions. Notice some of the adsorbates wrap around the periodic boundary conditions. Some of the adsorbates are weakly bound and desorbing from the surface based on this starting configuration.",
|
493 |
+
],
|
494 |
+
[
|
495 |
+
str(
|
496 |
+
Path(__file__).parent / "./examples/protein.pdb"
|
497 |
+
),
|
498 |
+
300,
|
499 |
+
0.05,
|
500 |
+
"OMol",
|
501 |
+
0,
|
502 |
+
1,
|
503 |
+
True,
|
504 |
+
"This is a solvated structure of a small protein fragment using the OMol task. Very little is likely happen in a very short MD simulations. Try increasing the number of MD steps to see how the protein moves. You can also try using the OMat task, but be careful with the results since the OMat task is not trained on solvated systems.",
|
505 |
+
],
|
506 |
+
[
|
507 |
+
str(
|
508 |
+
Path(__file__).parent
|
509 |
+
/ "./examples/MOF_CO2_2H2O.traj"
|
510 |
+
),
|
511 |
+
300,
|
512 |
+
0.05,
|
513 |
+
"ODAC",
|
514 |
+
0,
|
515 |
+
1,
|
516 |
+
False,
|
517 |
+
"This is a metal organic framework (MOF) structure using the ODac task. You might study structures like if designing MOFs for direct air capture (DAC) calculations. Look carefully for the co-adsorption between CO2 and two water molecules in the pore, which you might study if you were interested in the effect of humidity on DAC performance! You can also try the OMol and OMat tasks to see if the results differ.",
|
518 |
+
],
|
519 |
+
],
|
520 |
+
example_labels=[
|
521 |
+
"Relax bis(EDA)Cu TM complex with charge=1, spin=1",
|
522 |
+
"Relax bis(EDA)Cu TM complex with charge=2, spin=2",
|
523 |
+
"Relax a transition metal complex w ligands",
|
524 |
+
"Relax an organic molecular crystal",
|
525 |
+
"Relax an inorganic crystal",
|
526 |
+
"Relax a high-entropy alloy",
|
527 |
+
"Relax a catalyst surface/adsorbate",
|
528 |
+
"Relax a solvated protein",
|
529 |
+
"Relax co-adsorbed H2O/CO2 in a metal organic framework",
|
530 |
+
],
|
531 |
+
inputs=[
|
532 |
+
input_structure,
|
533 |
+
optimization_steps,
|
534 |
+
fmax,
|
535 |
+
task_name,
|
536 |
+
total_charge,
|
537 |
+
spin_multiplicity,
|
538 |
+
relax_unit_cell,
|
539 |
+
explanation_buffer,
|
540 |
+
],
|
541 |
+
outputs=[
|
542 |
+
output_traj,
|
543 |
+
output_text,
|
544 |
+
reproduction_script,
|
545 |
+
explanation,
|
546 |
+
],
|
547 |
+
fn=run_relaxation_simulation,
|
548 |
+
run_on_click=True,
|
549 |
+
cache_examples=True,
|
550 |
+
label="Relaxation Examples",
|
551 |
+
)
|
552 |
+
|
553 |
+
gr.Markdown(
|
554 |
+
"Once you understand how the UMA model can be applied to different types of molecules and materials, the final tab above will help you try it out with your own structures! "
|
555 |
+
)
|
556 |
+
|
557 |
+
with gr.Tab("3. Try UMA with your own structures!"):
|
558 |
+
gr.Markdown(
|
559 |
+
"""
|
560 |
+
As the final step of the demo, try running your own structure through the UMA model!
|
561 |
+
|
562 |
+
To use a custom input structure with this demo:
|
563 |
+
1. [Request gated model access.](https://huggingface.co/facebook/UMA) Requests for model access are typically processed within a matter of minutes.
|
564 |
+
2. Login to Hugging Face using the "Sign in with Hugging Face button" in the .
|
565 |
+
3. Then upload a structure file below and click run!
|
566 |
+
|
567 |
+
* Note that uploaded structure will be stored by this demo to analyze model usage and identify domains where model accuracy can be improved.
|
568 |
+
* If you get a redirect error when logging in, please try visiting the direct demo url (https://facebook-fairchem-uma-demo.hf.space/) and try again
|
569 |
+
* Your structure should be in a format supported by ASE 3.25, including .xyz, .cif, .pdb, ASE .traj, INCAR, or POSCAR.
|
570 |
+
* Your structure should either have periodic boundary conditions (PBC) all True, or all False. Support for mixed PBC may be added in the future.
|
571 |
+
"""
|
572 |
+
)
|
573 |
+
|
574 |
+
with gr.Sidebar(open=True, width=500):
|
575 |
gr.Markdown(
|
576 |
"## Learn more about the Universal Model for Atoms (UMA)"
|
577 |
)
|