Spaces:
Running
on
Zero
Running
on
Zero
everything seems to work committing until I have more GPU credits
Browse files- app.py +3 -3
- molecules.json +1 -1
- visualization.py +7 -1
app.py
CHANGED
@@ -215,7 +215,7 @@ def create_interface():
|
|
215 |
# Molecule selection controls
|
216 |
molecule_choice = gr.Dropdown(
|
217 |
choices=list(molecules.keys()),
|
218 |
-
value=
|
219 |
label="Select Molecule",
|
220 |
interactive=True,
|
221 |
allow_custom_value=False
|
@@ -236,11 +236,11 @@ def create_interface():
|
|
236 |
# Molecule parameters display
|
237 |
params_display = gr.HTML(
|
238 |
label="Molecule Parameters",
|
239 |
-
value=
|
240 |
)
|
241 |
|
242 |
with gr.Column(scale=1):
|
243 |
-
# 3D Molecule Viewer
|
244 |
molecule_viz = MolGallery3D(
|
245 |
columns=1,
|
246 |
height=400, # Reduced height to match other elements
|
|
|
215 |
# Molecule selection controls
|
216 |
molecule_choice = gr.Dropdown(
|
217 |
choices=list(molecules.keys()),
|
218 |
+
value=None, # Start with no selection
|
219 |
label="Select Molecule",
|
220 |
interactive=True,
|
221 |
allow_custom_value=False
|
|
|
236 |
# Molecule parameters display
|
237 |
params_display = gr.HTML(
|
238 |
label="Molecule Parameters",
|
239 |
+
value="<div>Select a molecule to view its parameters</div>"
|
240 |
)
|
241 |
|
242 |
with gr.Column(scale=1):
|
243 |
+
# 3D Molecule Viewer (starts empty)
|
244 |
molecule_viz = MolGallery3D(
|
245 |
columns=1,
|
246 |
height=400, # Reduced height to match other elements
|
molecules.json
CHANGED
@@ -50,7 +50,7 @@
|
|
50 |
},
|
51 |
"CH4": {
|
52 |
"name": "Methane",
|
53 |
-
"enabled":
|
54 |
"formula": "CH₄",
|
55 |
"smiles": "C",
|
56 |
"basis": "sto-3g",
|
|
|
50 |
},
|
51 |
"CH4": {
|
52 |
"name": "Methane",
|
53 |
+
"enabled": 0,
|
54 |
"formula": "CH₄",
|
55 |
"smiles": "C",
|
56 |
"basis": "sto-3g",
|
visualization.py
CHANGED
@@ -147,6 +147,7 @@ def create_molecule_viewer(molecule_id: str, scale_factor: float) -> MolGallery3
|
|
147 |
Create a 3D visualization of the molecule using MolGallery3D and RDKit.
|
148 |
For better visualization, hydrogen atoms are replaced with nitrogen atoms in the display only.
|
149 |
The actual quantum calculations still use the real molecule structure.
|
|
|
150 |
|
151 |
Args:
|
152 |
molecule_id: Molecule identifier (e.g., "H2")
|
@@ -294,7 +295,12 @@ def create_molecule_viewer(molecule_id: str, scale_factor: float) -> MolGallery3
|
|
294 |
# Final sanitization check
|
295 |
Chem.SanitizeMol(mol)
|
296 |
|
297 |
-
|
|
|
|
|
|
|
|
|
|
|
298 |
|
299 |
except Exception as e:
|
300 |
logger.error(f"Failed to generate 3D coordinates: {e}", exc_info=True)
|
|
|
147 |
Create a 3D visualization of the molecule using MolGallery3D and RDKit.
|
148 |
For better visualization, hydrogen atoms are replaced with nitrogen atoms in the display only.
|
149 |
The actual quantum calculations still use the real molecule structure.
|
150 |
+
Atoms are displayed as spheres with explicit bonds between them.
|
151 |
|
152 |
Args:
|
153 |
molecule_id: Molecule identifier (e.g., "H2")
|
|
|
295 |
# Final sanitization check
|
296 |
Chem.SanitizeMol(mol)
|
297 |
|
298 |
+
# Set RDKit display properties for ball-and-stick appearance
|
299 |
+
for atom in mol.GetAtoms():
|
300 |
+
atom.SetProp('molAtomMapNumber', str(atom.GetIdx())) # This helps with atom visibility
|
301 |
+
|
302 |
+
# Return the molecule as a list as expected by MolGallery3D
|
303 |
+
return [mol]
|
304 |
|
305 |
except Exception as e:
|
306 |
logger.error(f"Failed to generate 3D coordinates: {e}", exc_info=True)
|