@@ -47,6 +47,7 @@ def get_site_scene(
4747 visualize_bond_orders : bool = False ,
4848 magmom_scale : float = 1.0 ,
4949 legend : Legend | None = None ,
50+ retain_atom_idx : bool = False ,
5051) -> Scene :
5152 """Get a Scene object for a Site.
5253
@@ -70,6 +71,7 @@ def get_site_scene(
7071 visualize_bond_orders (bool, optional): Defaults to False.
7172 magmom_scale (float, optional): Defaults to 1.0.
7273 legend (Legend | None, optional): Defaults to None.
74+ retain_atom_idx (bool, optional): Defaults to False.
7375
7476 Returns:
7577 Scene: The scene object containing atoms, bonds, polyhedra, magmoms.
@@ -135,6 +137,7 @@ def get_site_scene(
135137 phiEnd = phiEnd ,
136138 clickable = True ,
137139 tooltip = name ,
140+ _meta = [site_idx ] if retain_atom_idx else None ,
138141 )
139142 atoms .append (sphere )
140143
@@ -207,6 +210,9 @@ def get_site_scene(
207210 radius = bond_radius / 2 ,
208211 clickable = True ,
209212 tooltip = name_cyl ,
213+ _meta = [site_idx , connected_site .index ]
214+ if retain_atom_idx
215+ else None ,
210216 )
211217 )
212218 trans_vector = trans_vector + 0.25 * max_radius
@@ -218,6 +224,9 @@ def get_site_scene(
218224 radius = bond_radius ,
219225 clickable = True ,
220226 tooltip = name_cyl ,
227+ _meta = [site_idx , connected_site .index ]
228+ if retain_atom_idx
229+ else None ,
221230 )
222231 bonds .append (cylinder )
223232
@@ -228,6 +237,7 @@ def get_site_scene(
228237 radius = bond_radius ,
229238 clickable = True ,
230239 tooltip = name_cyl ,
240+ _meta = [site_idx , connected_site .index ] if retain_atom_idx else None ,
231241 )
232242 bonds .append (cylinder )
233243 all_positions .append (connected_position .tolist ())
@@ -251,6 +261,7 @@ def get_site_scene(
251261 positionPairs = [[position , bond_midpoint .tolist ()]],
252262 color = color ,
253263 radius = bond_radius ,
264+ _meta = [site_idx , connected_site .index ] if retain_atom_idx else None ,
254265 )
255266 bonds .append (cylinder )
256267 all_positions .append (connected_position .tolist ())
0 commit comments