ManasSharma07 commited on
Commit
8afc436
·
verified ·
1 Parent(s): 0037cab

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +7 -3
src/streamlit_app.py CHANGED
@@ -626,7 +626,7 @@ def get_structure_viz2(atoms_obj, style='stick', show_unit_cell=True, width=400,
626
  view = py3Dmol.view(width=width, height=height)
627
  view.addModel(xyz_str, "xyz")
628
 
629
- if style.lower() == 'ball_stick':
630
  view.setStyle({'stick': {'radius': 0.1}, 'sphere': {'scale': 0.3}})
631
  elif style.lower() == 'stick':
632
  view.setStyle({'stick': {}})
@@ -865,7 +865,11 @@ if atoms is not None:
865
 
866
  with col1:
867
  st.markdown('### Structure Visualization', unsafe_allow_html=True)
868
- view_3d = get_structure_viz2(atoms, style='stick', show_unit_cell=True, width=400, height=400)
 
 
 
 
869
  st.components.v1.html(view_3d._make_html(), width=400, height=400)
870
 
871
  st.markdown("### Structure Information")
@@ -1070,7 +1074,7 @@ if atoms is not None:
1070
  view_viz.setBackgroundColor('white')
1071
  return view_viz
1072
 
1073
- opt_view = get_structure_viz2(calc_atoms, style='stick', show_unit_cell=True, width=400, height=400)
1074
  st.components.v1.html(opt_view._make_html(), width=400, height=400)
1075
 
1076
  with tempfile.NamedTemporaryFile(delete=False, suffix=".xyz", mode="w+") as tmp_file_opt:
 
626
  view = py3Dmol.view(width=width, height=height)
627
  view.addModel(xyz_str, "xyz")
628
 
629
+ if style.lower() == 'ball-stick':
630
  view.setStyle({'stick': {'radius': 0.1}, 'sphere': {'scale': 0.3}})
631
  elif style.lower() == 'stick':
632
  view.setStyle({'stick': {}})
 
865
 
866
  with col1:
867
  st.markdown('### Structure Visualization', unsafe_allow_html=True)
868
+ viz_style = st.selectbox("Select Visualization Style:",
869
+ ["ball-stick",
870
+ "stick",
871
+ "ball"])
872
+ view_3d = get_structure_viz2(atoms, style=viz_style, show_unit_cell=True, width=400, height=400)
873
  st.components.v1.html(view_3d._make_html(), width=400, height=400)
874
 
875
  st.markdown("### Structure Information")
 
1074
  view_viz.setBackgroundColor('white')
1075
  return view_viz
1076
 
1077
+ opt_view = get_structure_viz2(calc_atoms, style=viz_style, show_unit_cell=True, width=400, height=400)
1078
  st.components.v1.html(opt_view._make_html(), width=400, height=400)
1079
 
1080
  with tempfile.NamedTemporaryFile(delete=False, suffix=".xyz", mode="w+") as tmp_file_opt: