Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import numpy as np
3from ase.eos import birchmurnaghan
6def delta(v1: float, B1: float, Bp1: float,
7 v2: float, B2: float, Bp2: float,
8 symmetric=True) -> float:
9 """Calculate Delta-value between two equation of states.
11 .. seealso:: https://github.com/molmod/DeltaCodesDFT
13 Parameters
14 ----------
15 v1,v2: float
16 Volume per atom.
17 B1,B2: float
18 Bulk-modulus (in eV/Ang^3).
19 Bp1,Bp2: float
20 Pressure derivative of bulk-modulus.
21 symmetric: bool
22 Default is to calculate a symmetric delta.
24 Returns
25 -------
26 delta: float
27 Delta value in eV/atom.
28 """
29 if symmetric:
30 va = 0.94 * (v1 + v2) / 2
31 vb = 1.06 * (v1 + v2) / 2
32 else:
33 va = 0.94 * v2
34 vb = 1.06 * v2
35 npoints = 100
36 dv = (vb - va) / npoints
37 v = np.linspace(va + dv / 2, vb - dv / 2, npoints)
38 e1 = birchmurnaghan(v, 0.0, B1, Bp1, v1)
39 e2 = birchmurnaghan(v, 0.0, B2, Bp2, v2)
40 return (((e1 - e2)**2).sum() * dv / (vb - va))**0.5