Spaces:
Running
Running
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +14 -9
src/streamlit_app.py
CHANGED
@@ -1099,6 +1099,9 @@ if atoms is not None:
|
|
1099 |
run_calculation = st.button("Run Calculation", type="primary")
|
1100 |
|
1101 |
if run_calculation:
|
|
|
|
|
|
|
1102 |
results = {}
|
1103 |
#global table_placeholder # Ensure they are accessible
|
1104 |
opt_log = [] # Reset log for each run
|
@@ -1382,8 +1385,8 @@ if atoms is not None:
|
|
1382 |
except Exception as e:
|
1383 |
st.error(f"Error reading trajectory: {e}")
|
1384 |
return
|
1385 |
-
finally:
|
1386 |
-
|
1387 |
else:
|
1388 |
st.warning("Trajectory file not found.")
|
1389 |
return
|
@@ -1423,14 +1426,16 @@ if atoms is not None:
|
|
1423 |
xyz_str += f"{atom.symbol} {atom.position[0]:.6f} {atom.position[1]:.6f} {atom.position[2]:.6f}\n"
|
1424 |
return xyz_str
|
1425 |
|
1426 |
-
xyz_str = atoms_to_xyz_string(current_atoms, st.session_state.traj_index)
|
1427 |
|
1428 |
-
view = py3Dmol.view(width=400, height=400)
|
1429 |
-
view.addModel(xyz_str, "xyz")
|
1430 |
-
view.setStyle({'stick': {}})
|
1431 |
-
view.zoomTo()
|
1432 |
-
view.setBackgroundColor("white")
|
1433 |
-
st.components.v1.html(view._make_html(), height=400, width=400)
|
|
|
|
|
1434 |
|
1435 |
# Download button for entire trajectory
|
1436 |
trajectory_xyz = ""
|
|
|
1099 |
run_calculation = st.button("Run Calculation", type="primary")
|
1100 |
|
1101 |
if run_calculation:
|
1102 |
+
# Delete all the items in Session state
|
1103 |
+
for key in st.session_state.keys():
|
1104 |
+
del st.session_state[key]
|
1105 |
results = {}
|
1106 |
#global table_placeholder # Ensure they are accessible
|
1107 |
opt_log = [] # Reset log for each run
|
|
|
1385 |
except Exception as e:
|
1386 |
st.error(f"Error reading trajectory: {e}")
|
1387 |
return
|
1388 |
+
# finally:
|
1389 |
+
# os.unlink(traj_filename)
|
1390 |
else:
|
1391 |
st.warning("Trajectory file not found.")
|
1392 |
return
|
|
|
1426 |
xyz_str += f"{atom.symbol} {atom.position[0]:.6f} {atom.position[1]:.6f} {atom.position[2]:.6f}\n"
|
1427 |
return xyz_str
|
1428 |
|
1429 |
+
# xyz_str = atoms_to_xyz_string(current_atoms, st.session_state.traj_index)
|
1430 |
|
1431 |
+
# view = py3Dmol.view(width=400, height=400)
|
1432 |
+
# view.addModel(xyz_str, "xyz")
|
1433 |
+
# view.setStyle({'stick': {}})
|
1434 |
+
# view.zoomTo()
|
1435 |
+
# view.setBackgroundColor("white")
|
1436 |
+
# st.components.v1.html(view._make_html(), height=400, width=400)
|
1437 |
+
traj_view = get_structure_viz2(current_atoms, style=viz_style, show_unit_cell=True, width=400, height=400)
|
1438 |
+
st.components.v1.html(traj_view._make_html(), width=400, height=400)
|
1439 |
|
1440 |
# Download button for entire trajectory
|
1441 |
trajectory_xyz = ""
|