@@ -213,29 +213,61 @@ def get_cartesian_coordinates(self):
213213 cartn_coords = numpy .array ([a .xyz_cartn for a in self ])
214214 return cartn_coords
215215
216- def get_anisotropic_displacement_parameters (self ):
217- """Return array of anisotropic displacement parameters of all
218- `Atoms` in this structure.
216+ def get_anisotropic_displacement_parameters (self , return_array = False ):
217+ """Return a dictionary of anisotropic displacement parameters
218+ for all atoms.
219+
220+ Parameters
221+ ----------
222+ return_array : bool, optional
223+ If True, return anisotropic displacement parameters as a numpy array instead of a dictionary.
219224
220225 Returns
221226 -------
222- numpy.ndarray
223- The array of anisotropic displacement parameters of all `Atoms` in this structure.
227+ dict
228+ The dictionary of anisotropic displacement parameters for all atoms in this structure.
229+ Keys are of the form 'Element_i_Ujk', e.g. 'C_0_11', 'C_0_12'.
224230 """
225- aniso_adps = numpy .array ([a .U for a in self ])
226- return aniso_adps
231+ if return_array :
232+ aniso_adps = numpy .array ([a .U for a in self ])
233+ return aniso_adps
234+ else :
235+ adp_dict = {}
236+ for i , atom in enumerate (self ):
237+ element = atomBareSymbol (atom .element )
238+ adp_dict [f"{ element } _{ i } _11" ] = self .U11 [i ]
239+ adp_dict [f"{ element } _{ i } _22" ] = self .U22 [i ]
240+ adp_dict [f"{ element } _{ i } _33" ] = self .U33 [i ]
241+ adp_dict [f"{ element } _{ i } _12" ] = self .U12 [i ]
242+ adp_dict [f"{ element } _{ i } _13" ] = self .U13 [i ]
243+ adp_dict [f"{ element } _{ i } _23" ] = self .U23 [i ]
244+ return adp_dict
245+
246+ def get_isotropic_displacement_parameters (self , return_array = False ):
247+ """Return a dictionary of isotropic displacement parameters for
248+ all atoms.
227249
228- def get_isotropic_displacement_parameters (self ):
229- """Return array of isotropic displacement parameters of all
230- `Atoms` in this structure.
250+ Parameters
251+ ----------
252+ return_array : bool, optional
253+ If True, return isotropic displacement parameters as a numpy array instead of a dictionary.
254+ Default is False.
231255
232256 Returns
233257 -------
234- numpy.ndarray
235- The array of isotropic displacement parameters of all `Atoms` in this structure.
258+ dict
259+ The dictionary of isotropic displacement parameters for all atoms in this structure.
260+ Keys are of the form 'Element_i_Uiso', e.g. 'C_0_Uiso'.
236261 """
237- iso_adps = numpy .array ([a .Uisoequiv for a in self ])
238- return iso_adps
262+ if return_array :
263+ iso_adps = numpy .array ([a .Uisoequiv for a in self ])
264+ return iso_adps
265+ else :
266+ iso_dict = {}
267+ for i , atom in enumerate (self ):
268+ element = atomBareSymbol (atom .element )
269+ iso_dict [f"{ element } _{ i + 1 } _Uiso" ] = self .Uisoequiv [i ]
270+ return iso_dict
239271
240272 def get_occupancies (self ):
241273 """Return array of occupancies of all `Atoms` in this structure.
0 commit comments