diff --git a/mp_api/client/routes/materials/grain_boundaries.py b/mp_api/client/routes/materials/grain_boundaries.py index 1c73ac970..1721ccd64 100644 --- a/mp_api/client/routes/materials/grain_boundaries.py +++ b/mp_api/client/routes/materials/grain_boundaries.py @@ -20,7 +20,7 @@ def search( gb_plane: list[str] | None = None, gb_energy: tuple[float, float] | None = None, pretty_formula: str | None = None, - rotation_axis: list[str] | None = None, + rotation_axis: tuple[int, int, int] | tuple[int, int, int, int] | None = None, rotation_angle: tuple[float, float] | None = None, separation_energy: tuple[float, float] | None = None, sigma: int | None = None, @@ -40,8 +40,10 @@ def search( material_ids (List[str]): List of Materials Project IDs to query with. pretty_formula (str): Formula of the material. rotation_angle (Tuple[float,float]): Minimum and maximum rotation angle in degrees to consider. - rotation_axis(List[str]): The Miller index of rotation axis. e.g., [1, 0, 0], [1, 1, 0], and [1, 1, 1] - sigma (int): Sigma value of grain boundary. + rotation_axis (tuple of 3 int or of 4 int): The Miller index of rotation axis. + A 3- or 4-tuple of int or str: e.g., + (0, 0, 0, 1), (1, 0, 0), (1, 1, 0), or (1, 1, 1) + sigma (int): Sigma value of grain boundary. separation_energy (Tuple[float,float]): Minimum and maximum work of separation energy in J/m³ to consider. sigma (int): Sigma value of the boundary. type (GBTypeEnum): Grain boundary type. @@ -84,6 +86,11 @@ def search( ) if rotation_axis: + if len(rotation_axis) not in {3, 4}: + raise ValueError( + "`rotation_axis` should be a tuple of either " + "3 or 4 int values, ex: (0, 0, 0, 1) or (1, 0, 0)" + ) query_params.update( {"rotation_axis": ",".join([str(n) for n in rotation_axis])} )