21
21
from pymatgen .analysis .elasticity .stress import Stress
22
22
from pymatgen .core .tensors import DEFAULT_QUAD , SquareTensor , Tensor , TensorCollection , get_uvec
23
23
from pymatgen .core .units import Unit
24
+ from pymatgen .util .due import Doi , due
24
25
25
26
if TYPE_CHECKING :
26
27
from collections .abc import Sequence
27
28
29
+ from numpy .typing import ArrayLike
30
+
28
31
from pymatgen .core import Structure
29
32
30
33
@@ -198,7 +201,7 @@ def y_mod(self) -> float:
198
201
"""
199
202
return 9.0e9 * self .k_vrh * self .g_vrh / (3 * self .k_vrh + self .g_vrh )
200
203
201
- def directional_poisson_ratio (self , n , m , tol : float = 1e-8 ):
204
+ def directional_poisson_ratio (self , n : ArrayLike , m : ArrayLike , tol : float = 1e-8 ) -> float :
202
205
"""
203
206
Calculates the poisson ratio for a specific direction
204
207
relative to a second, orthogonal direction.
@@ -215,15 +218,15 @@ def directional_poisson_ratio(self, n, m, tol: float = 1e-8):
215
218
v *= - 1 / self .compliance_tensor .einsum_sequence ([n ] * 4 )
216
219
return v
217
220
218
- def directional_elastic_mod (self , n ):
221
+ def directional_elastic_mod (self , n ) -> float :
219
222
"""Calculates directional elastic modulus for a specific vector."""
220
223
n = get_uvec (n )
221
224
return self .einsum_sequence ([n ] * 4 )
222
225
223
226
@raise_if_unphysical
224
- def trans_v (self , structure : Structure ):
227
+ def trans_v (self , structure : Structure ) -> float :
225
228
"""
226
- Calculates transverse sound velocity (in SI units) using the
229
+ Calculates transverse sound velocity using the
227
230
Voigt-Reuss-Hill average bulk modulus.
228
231
229
232
Args:
@@ -233,19 +236,17 @@ def trans_v(self, structure: Structure):
233
236
float: transverse sound velocity (in SI units)
234
237
"""
235
238
n_sites = len (structure )
236
- volume = structure .volume
237
239
n_atoms = structure .composition .num_atoms
238
240
weight = float (structure .composition .weight )
239
- mass_density = 1.6605e3 * n_sites * weight / (n_atoms * volume )
241
+ mass_density = 1.6605e3 * n_sites * weight / (n_atoms * structure . volume )
240
242
if self .g_vrh < 0 :
241
243
raise ValueError ("k_vrh or g_vrh is negative, sound velocity is undefined" )
242
244
return (1e9 * self .g_vrh / mass_density ) ** 0.5
243
245
244
246
@raise_if_unphysical
245
- def long_v (self , structure : Structure ):
247
+ def long_v (self , structure : Structure ) -> float :
246
248
"""
247
- Calculates longitudinal sound velocity (in SI units)
248
- using the Voigt-Reuss-Hill average bulk modulus.
249
+ Calculates longitudinal sound velocity using the Voigt-Reuss-Hill average bulk modulus.
249
250
250
251
Args:
251
252
structure: pymatgen structure object
@@ -254,18 +255,16 @@ def long_v(self, structure: Structure):
254
255
float: longitudinal sound velocity (in SI units)
255
256
"""
256
257
n_sites = len (structure )
257
- volume = structure .volume
258
258
n_atoms = structure .composition .num_atoms
259
259
weight = float (structure .composition .weight )
260
- mass_density = 1.6605e3 * n_sites * weight / (n_atoms * volume )
260
+ mass_density = 1.6605e3 * n_sites * weight / (n_atoms * structure . volume )
261
261
if self .g_vrh < 0 :
262
262
raise ValueError ("k_vrh or g_vrh is negative, sound velocity is undefined" )
263
263
return (1e9 * (self .k_vrh + 4 / 3 * self .g_vrh ) / mass_density ) ** 0.5
264
264
265
265
@raise_if_unphysical
266
- def snyder_ac (self , structure : Structure ):
267
- """
268
- Calculates Snyder's acoustic sound velocity (in SI units).
266
+ def snyder_ac (self , structure : Structure ) -> float :
267
+ """Calculates Snyder's acoustic sound velocity.
269
268
270
269
Args:
271
270
structure: pymatgen structure object
@@ -274,20 +273,19 @@ def snyder_ac(self, structure: Structure):
274
273
float: Snyder's acoustic sound velocity (in SI units)
275
274
"""
276
275
n_sites = len (structure )
277
- volume = structure .volume
278
276
n_atoms = structure .composition .num_atoms
279
- num_density = 1e30 * n_sites / volume
277
+ site_density = 1e30 * n_sites / structure . volume
280
278
tot_mass = sum (e .atomic_mass for e in structure .species )
281
279
avg_mass = 1.6605e-27 * tot_mass / n_atoms
282
280
return (
283
281
0.38483
284
282
* avg_mass
285
283
* ((self .long_v (structure ) + 2 * self .trans_v (structure )) / 3 ) ** 3.0
286
- / (300 * num_density ** (- 2 / 3 ) * n_sites ** (1 / 3 ))
284
+ / (300 * site_density ** (- 2 / 3 ) * n_sites ** (1 / 3 ))
287
285
)
288
286
289
287
@raise_if_unphysical
290
- def snyder_opt (self , structure : Structure ):
288
+ def snyder_opt (self , structure : Structure ) -> float :
291
289
"""
292
290
Calculates Snyder's optical sound velocity (in SI units).
293
291
@@ -298,18 +296,17 @@ def snyder_opt(self, structure: Structure):
298
296
float: Snyder's optical sound velocity (in SI units)
299
297
"""
300
298
n_sites = len (structure )
301
- volume = structure .volume
302
- num_density = 1e30 * n_sites / volume
299
+ site_density = 1e30 * n_sites / structure .volume
303
300
return (
304
301
1.66914e-23
305
302
* (self .long_v (structure ) + 2 * self .trans_v (structure ))
306
303
/ 3.0
307
- / num_density ** (- 2 / 3 )
304
+ / site_density ** (- 2 / 3 )
308
305
* (1 - n_sites ** (- 1 / 3 ))
309
306
)
310
307
311
308
@raise_if_unphysical
312
- def snyder_total (self , structure : Structure ):
309
+ def snyder_total (self , structure : Structure ) -> float :
313
310
"""
314
311
Calculates Snyder's total sound velocity (in SI units).
315
312
@@ -322,7 +319,7 @@ def snyder_total(self, structure: Structure):
322
319
return self .snyder_ac (structure ) + self .snyder_opt (structure )
323
320
324
321
@raise_if_unphysical
325
- def clarke_thermalcond (self , structure : Structure ):
322
+ def clarke_thermalcond (self , structure : Structure ) -> float :
326
323
"""
327
324
Calculates Clarke's thermal conductivity (in SI units).
328
325
@@ -333,16 +330,15 @@ def clarke_thermalcond(self, structure: Structure):
333
330
float: Clarke's thermal conductivity (in SI units)
334
331
"""
335
332
n_sites = len (structure )
336
- volume = structure .volume
337
333
tot_mass = sum (e .atomic_mass for e in structure .species )
338
334
n_atoms = structure .composition .num_atoms
339
335
weight = float (structure .composition .weight )
340
336
avg_mass = 1.6605e-27 * tot_mass / n_atoms
341
- mass_density = 1.6605e3 * n_sites * weight / (n_atoms * volume )
337
+ mass_density = 1.6605e3 * n_sites * weight / (n_atoms * structure . volume )
342
338
return 0.87 * 1.3806e-23 * avg_mass ** (- 2 / 3 ) * mass_density ** (1 / 6 ) * self .y_mod ** 0.5
343
339
344
340
@raise_if_unphysical
345
- def cahill_thermalcond (self , structure : Structure ):
341
+ def cahill_thermalcond (self , structure : Structure ) -> float :
346
342
"""
347
343
Calculates Cahill's thermal conductivity (in SI units).
348
344
@@ -353,21 +349,47 @@ def cahill_thermalcond(self, structure: Structure):
353
349
float: Cahill's thermal conductivity (in SI units)
354
350
"""
355
351
n_sites = len (structure )
356
- volume = structure .volume
357
- num_density = 1e30 * n_sites / volume
358
- return 1.3806e-23 / 2.48 * num_density ** (2 / 3 ) * (self .long_v (structure ) + 2 * self .trans_v (structure ))
352
+ site_density = 1e30 * n_sites / structure .volume
353
+ return 1.3806e-23 / 2.48 * site_density ** (2 / 3 ) * (self .long_v (structure ) + 2 * self .trans_v (structure ))
354
+
355
+ @due .dcite (
356
+ Doi ("10.1039/C7EE03256K" ),
357
+ description = "Minimum thermal conductivity in the context of diffuson-mediated thermal transport" ,
358
+ )
359
+ @raise_if_unphysical
360
+ def agne_diffusive_thermalcond (self , structure : Structure ) -> float :
361
+ """
362
+ Calculates Agne's diffusive thermal conductivity (in SI units).
363
+
364
+ Please cite the original authors if using this method
365
+ M. T. Agne, R. Hanus, G. J. Snyder, Energy Environ. Sci. 2018, 11, 609-616.
366
+ DOI: https://doi.org/10.1039/C7EE03256K
367
+
368
+ Args:
369
+ structure: pymatgen structure object
370
+
371
+ Returns:
372
+ float: Agne's diffusive thermal conductivity (in SI units)
373
+ """
374
+ n_sites = len (structure )
375
+ site_density = 1e30 * n_sites / structure .volume
376
+ return (
377
+ 0.76
378
+ * (site_density ** (2 / 3 ))
379
+ * 1.3806e-23
380
+ * ((1 / 3 ) * (2 * self .trans_v (structure ) + self .long_v (structure )))
381
+ )
359
382
360
383
@raise_if_unphysical
361
- def debye_temperature (self , structure : Structure ):
384
+ def debye_temperature (self , structure : Structure ) -> float :
362
385
"""
363
- Estimates the Debye temperature from longitudinal and
364
- transverse sound velocities.
386
+ Estimates the Debye temperature from longitudinal and transverse sound velocities.
365
387
366
388
Args:
367
389
structure: pymatgen structure object
368
390
369
391
Returns:
370
- float: debye temperature (in SI units)
392
+ float: Debye temperature (in SI units)
371
393
"""
372
394
v0 = structure .volume * 1e-30 / len (structure )
373
395
vl , vt = self .long_v (structure ), self .trans_v (structure )
0 commit comments