@@ -1864,7 +1864,11 @@ def particles_in_range(
18641864 return particle_array [idxs ]
18651865
18661866 def visualize (
1867- self , show_ports = False , backend = "py3dmol" , color_scheme = {}
1867+ self ,
1868+ show_ports = False ,
1869+ backend = "py3dmol" ,
1870+ color_scheme = {},
1871+ bead_size = 0.3 ,
18681872 ): # pragma: no cover
18691873 """Visualize the Compound using py3dmol (default) or nglview.
18701874
@@ -1882,6 +1886,8 @@ def visualize(
18821886 keys are strings of the particle names
18831887 values are strings of the colors
18841888 i.e. {'_CGBEAD': 'blue'}
1889+ bead_size : float, Optional, default=0.3
1890+ Size of beads in visualization
18851891 """
18861892 viz_pkg = {
18871893 "nglview" : self ._visualize_nglview ,
@@ -1890,7 +1896,9 @@ def visualize(
18901896 if run_from_ipython ():
18911897 if backend .lower () in viz_pkg :
18921898 return viz_pkg [backend .lower ()](
1893- show_ports = show_ports , color_scheme = color_scheme
1899+ show_ports = show_ports ,
1900+ color_scheme = color_scheme ,
1901+ bead_size = bead_size ,
18941902 )
18951903 else :
18961904 raise RuntimeError (
@@ -1903,7 +1911,9 @@ def visualize(
19031911 "Visualization is only supported in Jupyter Notebooks."
19041912 )
19051913
1906- def _visualize_py3dmol (self , show_ports = False , color_scheme = {}):
1914+ def _visualize_py3dmol (
1915+ self , show_ports = False , color_scheme = {}, bead_size = 0.3
1916+ ):
19071917 """Visualize the Compound using py3Dmol.
19081918
19091919 Allows for visualization of a Compound within a Jupyter Notebook.
@@ -1917,6 +1927,8 @@ def _visualize_py3dmol(self, show_ports=False, color_scheme={}):
19171927 keys are strings of the particle names
19181928 values are strings of the colors
19191929 i.e. {'_CGBEAD': 'blue'}
1930+ bead_size : float, Optional, default=0.3
1931+ Size of beads in visualization
19201932
19211933 Returns
19221934 -------
@@ -1951,15 +1963,20 @@ def _visualize_py3dmol(self, show_ports=False, color_scheme={}):
19511963
19521964 view .setStyle (
19531965 {
1954- "stick" : {"radius" : 0.2 , "color" : "grey" },
1955- "sphere" : {"scale" : 0.3 , "colorscheme" : modified_color_scheme },
1966+ "stick" : {"radius" : bead_size * 0.6 , "color" : "grey" },
1967+ "sphere" : {
1968+ "scale" : bead_size ,
1969+ "colorscheme" : modified_color_scheme ,
1970+ },
19561971 }
19571972 )
19581973 view .zoomTo ()
19591974
19601975 return view
19611976
1962- def _visualize_nglview (self , show_ports = False , color_scheme = {}):
1977+ def _visualize_nglview (
1978+ self , show_ports = False , color_scheme = {}, bead_size = 0.3
1979+ ):
19631980 """Visualize the Compound using nglview.
19641981
19651982 Allows for visualization of a Compound within a Jupyter Notebook.
0 commit comments