@@ -274,8 +274,8 @@ def pack(
274274 b : float | None = None ,
275275 c : float | None = None ,
276276 clashing_tolerance : float = 0.0 ,
277- angles : numpy .ndarray | list [float ] | None = None ,
278- translations : numpy .ndarray | list [float ] | None = None ,
277+ angles : numpy .ndarray | list [float ] = [ 0.0 ] ,
278+ translations : numpy .ndarray | list [float ] = [ 0.0 ] ,
279279 optsave : bool = False ,
280280 optdir : str | None = None ,
281281 verbose : bool = False ,
@@ -299,12 +299,16 @@ def pack(
299299 clashing_tolerance : float, optional
300300 Minimum allowed distance (Å) between cluster and cage atoms.
301301 Default is 0.0.
302- angles : numpy.ndarray | list[float] | None, optional
303- Rotation angles for cluster optimization. If None, uses [-75, -50,
304- -25, 0, 25, 50, 75].
305- translations : numpy.ndarray | list[float] | None, optional
306- Translation values for cluster optimization. If None, uses
307- [-0.2, 0.0, 0.2].
302+ angles : numpy.ndarray | list[float], optional
303+ Rotation angles for cluster optimization. If not specified, no optimization
304+ is performed. Default is [0.0].
305+ If specified, angles should be a list or numpy array of angles in degrees.
306+ Example: [-75, -50, -25, 0, 25, 50, 75].
307+ translations : numpy.ndarray | list[float], optional
308+ Translation values for cluster optimization. If not specified, no optimization
309+ is performed. Default is [0.0].
310+ If specified, translations should be a list or numpy array of translation
311+ values in Angstroms. Example: [-0.2, 0.0, 0.2].
308312 optsave : bool, optional
309313 If True, saves each optimization step as a PDB file. Default is
310314 False.
@@ -556,8 +560,8 @@ def _build_cluster(
556560 lattice_constants : tuple [float , float ] | tuple [float ] | None ,
557561 center : numpy .ndarray ,
558562 clashing_tolerance : float = 0.0 ,
559- angles : numpy .ndarray | list [float ] | None = None ,
560- translations : numpy .ndarray | list [float ] | None = None ,
563+ angles : numpy .ndarray | list [float ] = [ 0.0 ] ,
564+ translations : numpy .ndarray | list [float ] = [ 0.0 ] ,
561565 optsave : bool = False ,
562566 optdir : str | None = None ,
563567 verbose : bool = False ,
@@ -582,12 +586,16 @@ def _build_cluster(
582586 clashing_tolerance : float, optional
583587 Minimum allowed distance (Å) between cluster and cage atoms.
584588 Default is 0.0.
585- angles : numpy.ndarray | list[float] | None, optional
586- Rotation angles for cluster optimization. If None, uses [-75, -50,
587- -25, 0, 25, 50, 75].
588- translations : numpy.ndarray | list[float] | None, optional
589- Translation values for cluster optimization. If None, uses
590- [-0.2, 0.0, 0.2].
589+ angles : numpy.ndarray | list[float], optional
590+ Rotation angles for cluster optimization. If not specified, no optimization
591+ is performed. Default is [0.0].
592+ If specified, angles should be a list or numpy array of angles in degrees.
593+ Example: [-75, -50, -25, 0, 25, 50, 75].
594+ translations : numpy.ndarray | list[float], optional
595+ Translation values for cluster optimization. If not specified, no optimization
596+ is performed. Default is [0.0].
597+ If specified, translations should be a list or numpy array of translation
598+ values in Angstroms. Example: [-0.2, 0.0, 0.2].
591599 optsave : bool, optional
592600 If True, saves each optimization step as a PDB file. Default is
593601 False.
@@ -670,13 +678,6 @@ def _build_cluster(
670678 # Get lattice constants for nanocluster
671679 cluster .info .update ({"lattice_constants" : lattice_constants })
672680
673- # Create rotation angles and translations for the cluster
674- if angles is None :
675- angles = numpy .arange (start = - 75 , stop = 90 , step = 25 )
676-
677- if translations is None :
678- translations = numpy .arange (start = - 0.2 , stop = 0.21 , step = 0.2 )
679-
680681 # Iterate over all possible combinations of angles and translations
681682 log = []
682683 combinations = list (
@@ -747,8 +748,8 @@ def _build_cluster(
747748 # Convert optimization to DataFrame
748749 log = pandas .DataFrame (log )
749750
750- # Get the best cluster based on the maximum diameter
751- idx = log ["Maximum diameter (Å)" ].idxmax ()
751+ # Get the best cluster based on the volume diameter
752+ idx = log ["Volume diameter (Å)" ].idxmax ()
752753 x , y , z , phi , theta , psi = log .loc [idx , ["x" , "y" , "z" , "phi" , "theta" , "psi" ]]
753754
754755 # Rotate and translate the cluster
0 commit comments