picometer 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: picometer
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Precisely define and calculate measurements across multiple crystal structures
5
5
  License: MIT
6
6
  Author: Daniel Tchoń
@@ -185,6 +185,21 @@ class AtomSet(Shape):
185
185
  data.loc[mask, 'U23'] = uij_rot[:, 1, 2]
186
186
  return self.__class__(self.base, data)
187
187
 
188
+ @property
189
+ def u_cartesian_eigenvalues(self):
190
+ u_columns = ['U11', 'U12', 'U13', 'U22', 'U23', 'U33']
191
+ eigenvalues = np.full((len(self), 3), np.nan)
192
+ if not set(u_columns).issubset(self.table.keys()):
193
+ return eigenvalues
194
+ u_fract = self.fract_uij # Nx3n3 stack of abc-normalized U_cif tensors
195
+ a_mat = self.base.A_d.T # fractional to orthogonal cartesian metric
196
+ n_mat = np.diag([self.base.a_r, self.base.b_r, self.base.c_r])
197
+ u_star = (n_mat @ u_fract) @ n_mat # eq. 4b @ S0021889802008580
198
+ u_cart = (a_mat @ u_star) @ a_mat.T # eq. 3a @ S0021889802008580
199
+ mask = ~self.table[u_columns].isna().any(axis=1)
200
+ eigenvalues[mask, :] = np.linalg.eigh(u_cart[mask, :, :])[0]
201
+ return eigenvalues
202
+
188
203
  @property
189
204
  def centroid(self) -> np.ndarray:
190
205
  """A 3-vector with average atom position."""
@@ -225,7 +225,8 @@ class LoadInstructionHandler(BaseInstructionHandler):
225
225
  if 'Uiso' not in atoms.table.columns:
226
226
  atoms.table['Uiso'] = pd.NA
227
227
  u_equiv = atoms.table[['U11', 'U22', 'U33']].mean(axis=1)
228
- atoms.table['Uiso'].fillna(u_equiv, inplace=True)
228
+ mask = atoms.table['Uiso'].isna()
229
+ atoms.table.loc[mask, 'Uiso'] = u_equiv[mask]
229
230
 
230
231
  if self.processor.settings['complete_umatrix_from_uiso']:
231
232
  u_columns = ['U11', 'U12', 'U13', 'U22', 'U23', 'U33']
@@ -359,6 +360,11 @@ class DisplacementInstructionHandler(SerialInstructionHandler):
359
360
  value = getattr(displacements, suffix, None)
360
361
  if value is not None:
361
362
  self.processor.evaluation_table.loc[ms_key, label_] = value
363
+ if self.processor.settings['displacement_get_cartesian_eigenvalues']:
364
+ for label, es in zip(focus.table.index, focus.u_cartesian_eigenvalues):
365
+ for e, suffix in zip(es, ['Uce1', 'Uce2', 'Uce3']):
366
+ label_ = label + '_' + suffix
367
+ self.processor.evaluation_table.loc[ms_key, label_] = e
362
368
  logger.info(f'Noted displacement for current selection in model state {ms_key}')
363
369
 
364
370
 
@@ -19,6 +19,7 @@ class DefaultSettings:
19
19
  """Store default values of all settings. Use `AnyValue` if no default."""
20
20
  auto_write_unit_cell: bool = True
21
21
  clear_selection_after_use: bool = True
22
+ displacement_get_cartesian_eigenvalues: bool = False
22
23
  complete_uiso_from_umatrix: bool = False
23
24
  complete_umatrix_from_uiso: bool = False
24
25
 
@@ -1,5 +1,6 @@
1
1
  settings:
2
2
  auto_write_unit_cell: True
3
3
  clear_selection_after_use: True
4
+ displacement_get_cartesian_eigenvalues: False
4
5
  complete_uiso_from_umatrix: False
5
6
  complete_umatrix_from_uiso: False
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "picometer"
3
- version = "0.4.0"
3
+ version = "0.5.0"
4
4
  description = "Precisely define and calculate measurements across multiple crystal structures"
5
5
  authors = ["Daniel Tchoń"]
6
6
  license = "MIT"
File without changes
File without changes
File without changes
File without changes