@@ -19,11 +19,10 @@ class PhononRester(BaseRester):
1919 suffix = "materials/phonon"
2020 document_model = PhononBSDOSDoc # type: ignore
2121 primary_key = "identifier"
22- delta_backed = False
2322
2423 def search (
2524 self ,
26- phonon_ids : str | list [str ] | None = None ,
25+ identifiers : str | list [str ] | None = None ,
2726 phonon_method : str | None = None ,
2827 num_chunks : int | None = None ,
2928 chunk_size : int = 1000 ,
@@ -34,7 +33,7 @@ def search(
3433 """Query phonon docs using a variety of search criteria.
3534
3635 Arguments:
37- phonon_ids (str, List[str]): A single Phonon Task ID string or list of strings
36+ identifiers (str, List[str]): A single Phonon Task ID string or list of strings
3837 (e.g., mp-149, [mp-149, mp-13]).
3938 phonon_method (str): phonon method to search (dfpt, phonopy, pheasy)
4039 num_chunks (int): Maximum number of chunks of data to yield. None will yield all possible.
@@ -50,24 +49,24 @@ def search(
5049 query_params : dict = defaultdict (dict )
5150
5251 if "material_ids" in kwargs :
53- if phonon_ids :
52+ if identifiers :
5453 raise MPRestError (
55- "You have specified both `phonon_ids ` and the deprecated `material_ids` tag. "
56- "Please specify only `phonon_ids `."
54+ "You have specified both `identifiers ` and the deprecated `material_ids` tag. "
55+ "Please specify only `identifiers `."
5756 )
58- phonon_ids = kwargs .pop ("material_ids" )
57+ identifiers = kwargs .pop ("material_ids" )
5958 warnings .warn (
6059 "`material_id` has been replaced by `identifier` in the phonon endpoint. "
61- "Please migrate to using the newer field name and the more generic `phonon_ids ` kwarg "
60+ "Please migrate to using the newer field name and the more generic `identifiers ` kwarg "
6261 "for searching." ,
6362 stacklevel = 2 ,
6463 category = MPRestWarning ,
6564 )
6665
67- if phonon_ids :
68- query_params ["phonon_ids " ] = "," .join (
66+ if identifiers :
67+ query_params ["identifiers " ] = "," .join (
6968 validate_ids (
70- [phonon_ids ] if isinstance (phonon_ids , str ) else phonon_ids
69+ [identifiers ] if isinstance (identifiers , str ) else identifiers
7170 )
7271 )
7372
@@ -89,20 +88,20 @@ def search(
8988 )
9089
9190 def get_bandstructure_from_phonon_id (
92- self , phonon_id : str , phonon_method : str
91+ self , identifier : str , phonon_method : str
9392 ) -> PhononBS | dict [str , Any ]:
9493 """Get the phonon band structure pymatgen object associated with a given phonon ID and phonon method.
9594
9695 Arguments:
97- phonon_id (str): Phonon ID for the phonon band structure calculation
96+ identifier (str): Phonon ID for the phonon band structure calculation
9897 phonon_method (str): phonon method, i.e. pheasy or dfpt
9998
10099 Returns:
101100 bandstructure (PhononBS): PhononBS object
102101 """
103102 result = self ._query_open_data (
104103 bucket = "materialsproject-parsed" ,
105- key = f"ph-bandstructures/{ phonon_method } /{ phonon_id } .json.gz" ,
104+ key = f"ph-bandstructures/{ phonon_method } /{ identifier } .json.gz" ,
106105 )[0 ][0 ]
107106
108107 return (
@@ -117,27 +116,27 @@ def get_bandstructure_from_material_id(
117116 """Deprecated: use `get_bandstructure_from_phonon_id` instead."""
118117 warnings .warn (
119118 "`material_id` has been replaced by `identifier` in the phonon endpoint. "
120- "Please migrate to using `get_bandstructure_from_phonon_id` with the `phonon_id ` kwarg." ,
119+ "Please migrate to using `get_bandstructure_from_phonon_id` with the `identifier ` kwarg." ,
121120 stacklevel = 2 ,
122121 category = MPRestWarning ,
123122 )
124123 return self .get_bandstructure_from_phonon_id (material_id , phonon_method )
125124
126125 def get_dos_from_phonon_id (
127- self , phonon_id : str , phonon_method : str
126+ self , identifier : str , phonon_method : str
128127 ) -> PhononDOS | dict [str , Any ]:
129128 """Get the phonon dos pymatgen object associated with a given phonon ID and phonon method.
130129
131130 Arguments:
132- phonon_id (str): Phonon ID for the phonon dos calculation
131+ identifier (str): Phonon ID for the phonon dos calculation
133132 phonon_method (str): phonon method, i.e. pheasy or dfpt
134133
135134 Returns:
136135 dos (PhononDOS): PhononDOS object
137136 """
138137 result = self ._query_open_data (
139138 bucket = "materialsproject-parsed" ,
140- key = f"ph-dos/{ phonon_method } /{ phonon_id } .json.gz" ,
139+ key = f"ph-dos/{ phonon_method } /{ identifier } .json.gz" ,
141140 )[0 ][0 ]
142141
143142 return (
@@ -152,24 +151,26 @@ def get_dos_from_material_id(
152151 """Deprecated: use `get_dos_from_phonon_id` instead."""
153152 warnings .warn (
154153 "`material_id` has been replaced by `identifier` in the phonon endpoint. "
155- "Please migrate to using `get_dos_from_phonon_id` with the `phonon_id ` kwarg." ,
154+ "Please migrate to using `get_dos_from_phonon_id` with the `identifier ` kwarg." ,
156155 stacklevel = 2 ,
157156 category = MPRestWarning ,
158157 )
159158 return self .get_dos_from_phonon_id (material_id , phonon_method )
160159
161- def get_forceconstants_from_phonon_id (self , phonon_id : str ) -> list [list [Matrix3D ]]:
160+ def get_forceconstants_from_phonon_id (
161+ self , identifier : str
162+ ) -> list [list [Matrix3D ]]:
162163 """Get the force constants associated with a given phonon ID.
163164
164165 Arguments:
165- phonon_id (str): Phonon ID for the force constants calculation
166+ identifier (str): Phonon ID for the force constants calculation
166167
167168 Returns:
168169 force constants (list[list[Matrix3D]]): force constants
169170 """
170171 return self ._query_open_data ( # type: ignore[return-value]
171172 bucket = "materialsproject-parsed" ,
172- key = f"ph-force-constants/{ phonon_id } .json.gz" ,
173+ key = f"ph-force-constants/{ identifier } .json.gz" ,
173174 )[0 ][0 ]
174175
175176 def get_forceconstants_from_material_id (
@@ -178,54 +179,54 @@ def get_forceconstants_from_material_id(
178179 """Deprecated: use `get_forceconstants_from_phonon_id` instead."""
179180 warnings .warn (
180181 "`material_id` has been replaced by `identifier` in the phonon endpoint. "
181- "Please migrate to using `get_forceconstants_from_phonon_id` with the `phonon_id ` kwarg." ,
182+ "Please migrate to using `get_forceconstants_from_phonon_id` with the `identifier ` kwarg." ,
182183 stacklevel = 2 ,
183184 category = MPRestWarning ,
184185 )
185186 return self .get_forceconstants_from_phonon_id (material_id )
186187
187188 def compute_thermo_quantities (
188189 self ,
189- phonon_id : str | None = None ,
190+ identifier : str | None = None ,
190191 phonon_method : str | None = None ,
191192 ** kwargs ,
192193 ):
193194 """Compute thermodynamical quantities for given phonon ID and phonon_method.
194195
195196 Arguments:
196- phonon_id (str): Phonon ID to calculate quantities for
197+ identifier (str): Phonon ID to calculate quantities for
197198 phonon_method (str): phonon method, i.e. pheasy or dfpt
198199 **kwargs : used for handling deprecated kwargs
199200
200201 Returns:
201202 quantities (dict): thermodynamical quantities
202203 """
203204 if "material_id" in kwargs :
204- if phonon_id :
205+ if identifier :
205206 raise MPRestError (
206- "You have specified both `phonon_id ` and the deprecated `material_id` tag. "
207- "Please specify only `phonon_id `."
207+ "You have specified both `identifier ` and the deprecated `material_id` tag. "
208+ "Please specify only `identifier `."
208209 )
209- phonon_id = kwargs .pop ("material_id" )
210+ identifier = kwargs .pop ("material_id" )
210211 warnings .warn (
211212 "`material_id` has been replaced by `identifier` in the phonon endpoint. "
212- "Please migrate to using the newer field name and the more generic `phonon_id ` kwarg." ,
213+ "Please migrate to using the newer field name and the more generic `identifier ` kwarg." ,
213214 stacklevel = 2 ,
214215 category = MPRestWarning ,
215216 )
216217
217- if phonon_id is None :
218- raise MPRestError ("`phonon_id ` must be specified." )
218+ if identifier is None :
219+ raise MPRestError ("`identifier ` must be specified." )
219220
220221 use_document_model = self .use_document_model
221222 self .use_document_model = False
222- docs = self .search (phonon_ids = phonon_id , phonon_method = phonon_method )
223+ docs = self .search (identifiers = identifier , phonon_method = phonon_method )
223224 if not docs or not docs [0 ]:
224225 raise MPRestError ("No phonon document found" )
225226
226227 self .use_document_model = True
227228 docs [0 ]["phonon_dos" ] = self .get_dos_from_phonon_id ( # type: ignore[index]
228- phonon_id , phonon_method # type: ignore[arg-type]
229+ identifier , phonon_method # type: ignore[arg-type]
229230 )
230231 doc = PhononBSDOSDoc (** docs [0 ]) # type: ignore[arg-type]
231232 self .use_document_model = use_document_model
0 commit comments