Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,3 @@
|
|
| 1 |
-
import subprocess
|
| 2 |
-
import sys
|
| 3 |
-
from pathlib import Path
|
| 4 |
-
|
| 5 |
-
# Instalar dependencias npm primero
|
| 6 |
-
print("Installing npm dependencies...")
|
| 7 |
-
frontend_path = Path(__file__).parent / "gradio_molecule3d" / "frontend"
|
| 8 |
-
subprocess.run(["npm", "install"], cwd=frontend_path, check=True)
|
| 9 |
-
|
| 10 |
-
# Ahora compilar
|
| 11 |
-
print("Building gradio_molecule3d...")
|
| 12 |
-
subprocess.run(["gradio", "cc", "build"], cwd=Path(__file__).parent / "gradio_molecule3d/", check=True)
|
| 13 |
-
|
| 14 |
-
print("Installing wheel...")
|
| 15 |
-
whl_files = list((Path(__file__).parent / "gradio_molecule3d" / "dist").glob("*.whl"))
|
| 16 |
-
if whl_files:
|
| 17 |
-
subprocess.run([sys.executable, "-m", "pip", "install", str(whl_files[0])], check=True)
|
| 18 |
-
|
| 19 |
-
# Ahora sí, imports
|
| 20 |
import os
|
| 21 |
os.environ["TORCH_DYNAMO_DISABLE"] = "1"
|
| 22 |
import tempfile
|
|
@@ -178,64 +159,7 @@ def relax_wrapper(structure_file, task_name, steps, fmax, charge, spin, relax_ce
|
|
| 178 |
# ==== UI ====
|
| 179 |
with gr.Blocks(theme=gr.themes.Ocean(), title="OrbMol Demo") as demo:
|
| 180 |
with gr.Tabs():
|
| 181 |
-
# --------
|
| 182 |
-
with gr.Tab("Home"):
|
| 183 |
-
with gr.Row():
|
| 184 |
-
with gr.Column(scale=1):
|
| 185 |
-
gr.Markdown("## Learn more about OrbMol")
|
| 186 |
-
|
| 187 |
-
with gr.Accordion("What is OrbMol?", open=False):
|
| 188 |
-
gr.Markdown("""
|
| 189 |
-
OrbMol is a suite of quantum-accurate machine learning models for molecular predictions. Built on the **Orb-v3 architecture**, OrbMol provides fast and accurate calculations of energies, forces, and molecular properties at the level of advanced quantum chemistry methods.
|
| 190 |
-
""")
|
| 191 |
-
|
| 192 |
-
with gr.Accordion("Available Models", open=False):
|
| 193 |
-
gr.Markdown("""
|
| 194 |
-
**OMol** and **OMol-Direct**
|
| 195 |
-
- **Training dataset**: OMol25 (>100M calculations on small molecules, biomolecules, metal complexes, and electrolytes)
|
| 196 |
-
- **Level of theory**: ωB97M-V/def2-TZVPD with non-local dispersion; solvation treated explicitly
|
| 197 |
-
- **Inputs**: total charge & spin multiplicity
|
| 198 |
-
- **Applications**: biology, organic chemistry, protein folding, small-molecule drugs, organic liquids, homogeneous catalysis
|
| 199 |
-
- **Caveats**: trained only on aperiodic systems → periodic/inorganic cases may not work well
|
| 200 |
-
- **Difference**: OMol enforces energy–force consistency; OMol-Direct relaxes this for efficiency
|
| 201 |
-
|
| 202 |
-
**OMat**
|
| 203 |
-
- **Training dataset**: OMat24 (>100M inorganic calculations, from Materials Project, Alexandria, and far-from-equilibrium samples)
|
| 204 |
-
- **Level of theory**: PBE/PBE+U with Materials Project settings; VASP 54 pseudopotentials; no dispersion
|
| 205 |
-
- **Inputs**: No support for spin and charge
|
| 206 |
-
- **Applications**: inorganic discovery, photovoltaics, alloys, superconductors, electronic/optical materials
|
| 207 |
-
""")
|
| 208 |
-
|
| 209 |
-
with gr.Accordion("Supported File Formats", open=False):
|
| 210 |
-
gr.Markdown("""
|
| 211 |
-
OrbMol supports: `.xyz`, `.pdb`, `.cif`, `.traj`, `.mol`, `.sdf`
|
| 212 |
-
""")
|
| 213 |
-
|
| 214 |
-
with gr.Accordion("Resources & Support", open=False):
|
| 215 |
-
gr.Markdown("""
|
| 216 |
-
- [Orb-v3 paper](https://arxiv.org/abs/2504.06231)
|
| 217 |
-
- [Orb-Models GitHub repository](https://github.com/orbital-materials/orb-models)
|
| 218 |
-
""")
|
| 219 |
-
|
| 220 |
-
with gr.Column(scale=2):
|
| 221 |
-
gr.Image("logo_color_text.png",
|
| 222 |
-
show_share_button=False,
|
| 223 |
-
show_download_button=False,
|
| 224 |
-
show_label=False,
|
| 225 |
-
show_fullscreen_button=False)
|
| 226 |
-
|
| 227 |
-
gr.Markdown("# OrbMol — Quantum-Accurate Molecular Predictions")
|
| 228 |
-
gr.Markdown("""
|
| 229 |
-
Welcome to the OrbMol demo! Use the tabs above to access different functionalities:
|
| 230 |
-
|
| 231 |
-
1. **Single Point Energy**: Calculate energies and forces
|
| 232 |
-
2. **Molecular Dynamics**: Run MD simulations
|
| 233 |
-
3. **Relaxation / Optimization**: Optimize structures
|
| 234 |
-
|
| 235 |
-
Supported formats: `.xyz`, `.pdb`, `.cif`, `.traj`, `.mol`, `.sdf`
|
| 236 |
-
""")
|
| 237 |
-
|
| 238 |
-
# -------- SPE (IDÉNTICA A LA QUE FUNCIONABA) --------
|
| 239 |
with gr.Tab("Single Point Energy"):
|
| 240 |
with gr.Row():
|
| 241 |
with gr.Column(scale=2):
|
|
@@ -283,7 +207,7 @@ Supported formats: `.xyz`, `.pdb`, `.cif`, `.traj`, `.mol`, `.sdf`
|
|
| 283 |
[spe_out, spe_status, spe_viewer]
|
| 284 |
)
|
| 285 |
|
| 286 |
-
# -------- MD
|
| 287 |
with gr.Tab("Molecular Dynamics"):
|
| 288 |
with gr.Row():
|
| 289 |
with gr.Column(scale=2):
|
|
@@ -339,7 +263,7 @@ Supported formats: `.xyz`, `.pdb`, `.cif`, `.traj`, `.mol`, `.sdf`
|
|
| 339 |
[md_status, md_traj, md_log, md_script, md_explain, md_viewer]
|
| 340 |
)
|
| 341 |
|
| 342 |
-
# -------- Relax
|
| 343 |
with gr.Tab("Relaxation / Optimization"):
|
| 344 |
with gr.Row():
|
| 345 |
with gr.Column(scale=2):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
os.environ["TORCH_DYNAMO_DISABLE"] = "1"
|
| 3 |
import tempfile
|
|
|
|
| 159 |
# ==== UI ====
|
| 160 |
with gr.Blocks(theme=gr.themes.Ocean(), title="OrbMol Demo") as demo:
|
| 161 |
with gr.Tabs():
|
| 162 |
+
# -------- SPE --------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
with gr.Tab("Single Point Energy"):
|
| 164 |
with gr.Row():
|
| 165 |
with gr.Column(scale=2):
|
|
|
|
| 207 |
[spe_out, spe_status, spe_viewer]
|
| 208 |
)
|
| 209 |
|
| 210 |
+
# -------- MD --------
|
| 211 |
with gr.Tab("Molecular Dynamics"):
|
| 212 |
with gr.Row():
|
| 213 |
with gr.Column(scale=2):
|
|
|
|
| 263 |
[md_status, md_traj, md_log, md_script, md_explain, md_viewer]
|
| 264 |
)
|
| 265 |
|
| 266 |
+
# -------- Relax --------
|
| 267 |
with gr.Tab("Relaxation / Optimization"):
|
| 268 |
with gr.Row():
|
| 269 |
with gr.Column(scale=2):
|