3838MARKER_SHAPE = "x"
3939MAX_MAGNITUDE = 500
4040MIN_MAGNITUDE = 0
41+ MAX_SUPERCELL_SITES = 500
4142
4243DEFAULTS : dict [str , str | bool ] = {
4344 "color_scheme" : "VESTA" ,
@@ -68,6 +69,7 @@ def __init__(
6869 default_data = {
6970 "mpid" : mpid ,
7071 "bandstructure_symm_line" : bandstructure_symm_line ,
72+ "num_sites" : density_of_states .structure .num_sites ,
7173 "density_of_states" : density_of_states ,
7274 },
7375 ** kwargs ,
@@ -102,6 +104,17 @@ def _sub_layouts(self) -> dict[str, Component]:
102104 # on-the-fly only supported for bandstructures retrieved from MP
103105 show_path_options = bool (self .initial_data ["default" ]["mpid" ])
104106
107+ # set maximum scale for supercell to limit size
108+ max_sc_scale = max (
109+ 1 ,
110+ int (
111+ np .floor (
112+ (MAX_SUPERCELL_SITES / self .initial_data ["default" ]["num_sites" ])
113+ ** (1 / 3 )
114+ )
115+ ),
116+ )
117+
105118 options = [
106119 {"label" : "Latimer-Munro" , "value" : "lm" },
107120 {"label" : "Hinuma et al." , "value" : "hin" },
@@ -223,6 +236,7 @@ def _sub_layouts(self) -> dict[str, Component]:
223236 is_int = True ,
224237 label = "x" ,
225238 min = 1 ,
239+ max = max_sc_scale ,
226240 style = {"height" : "15px" },
227241 label_style = {"textAlign" : "center" },
228242 ),
@@ -233,6 +247,7 @@ def _sub_layouts(self) -> dict[str, Component]:
233247 is_int = True ,
234248 label = "y" ,
235249 min = 1 ,
250+ max = max_sc_scale ,
236251 style = {"height" : "15px" },
237252 label_style = {"textAlign" : "center" },
238253 ),
@@ -243,6 +258,7 @@ def _sub_layouts(self) -> dict[str, Component]:
243258 is_int = True ,
244259 label = "z" ,
245260 min = 1 ,
261+ max = max_sc_scale ,
246262 style = {"height" : "15px" },
247263 label_style = {"textAlign" : "center" },
248264 ),
0 commit comments