Collections
The current EquationOfState
s contain
EquationOfState
├─ AntonSchmidt
├─ BreenanStacey
├─ FiniteStrainEquationOfState
│ ├─ BirchMurnaghan2nd
│ ├─ BirchMurnaghan3rd
│ ├─ BirchMurnaghan4th
│ ├─ PoirierTarantola2nd
│ ├─ PoirierTarantola3rd
│ └─ PoirierTarantola4th
├─ Murnaghan
└─ Vinet
Usage
Construct an EquationOfState
We will use BirchMurnaghan3rd
as an example.
A BirchMurnaghan3rd
can be constructed from scratch, as shown above. It can also be constructed from an existing BirchMurnaghan3rd
, with Setfield.jl
@set!
macro:
julia> using Setfield
julia> eos = Murnaghan(1, 2, 3.0)
Murnaghan{Float64}(1.0, 2.0, 3.0, 0.0)
julia> @set! eos.v0 = 4
Murnaghan{Float64}(4.0, 2.0, 3.0, 0.0)
julia> eos
Murnaghan{Float64}(4.0, 2.0, 3.0, 0.0)
To modify multiple fields (say, :v0
, :b′0
, :b′′0
, :e0
) at a time, use @batchlens
from Kaleido.jl
:
julia> using Setfield, Kaleido
julia> lens = @batchlens(begin
_.v0
_.b′0
_.b′′0
_.e0
end)
IndexBatchLens(:v0, :b′0, :b′′0, :e0)
julia> eos = BirchMurnaghan4th(1, 2.0, 3, 4)
BirchMurnaghan4th{Float64}(1.0, 2.0, 3.0, 4.0, 0.0)
julia> set(eos, lens, (5, 6, 7, 8))
BirchMurnaghan4th{Float64}(5.0, 2.0, 6.0, 7.0, 8.0)
Users can access BirchMurnaghan3rd
's elements by "dot notation":
julia> eos = BirchMurnaghan3rd(1, 2, 3, 4.0)
4-element BirchMurnaghan3rd{Float64}:
1.0
2.0
3.0
4.0
julia> eos.v0
1.0
Calculate energy on an EquationOfState
The $E(V)$ relation of equations of state are listed as below:
Murnaghan
:\[E(V) = E_{0}+K_{0} V_{0}\left[\frac{1}{K_{0}^{\prime}\left(K_{0}^{\prime}-1\right)}\left(\frac{V}{V_{0}}\right)^{1-K_{0}^{\prime}}+\frac{1}{K_{0}^{\prime}} \frac{V}{V_{0}}-\frac{1}{K_{0}^{\prime}-1}\right].\]BirchMurnaghan2nd
:\[E(V) = E_{0} + \frac{9}{8} B_{0} V_{0} \left(\left( V / V_0 \right)^{-2 / 3}-1\right)^{2}.\]BirchMurnaghan3rd
:\[E(V) = E_{0}+\frac{9}{16} V_{0} B_{0} \frac{\left(x^{2 / 3}-1\right)^{2}}{x^{7 / 3}}\left\{x^{1 / 3}\left(B_{0}^{\prime}-4\right)-x\left(B_{0}^{\prime}-6\right)\right\}.\]where $x = V / V_0$, and $f = \frac{ 1 }{ 2 } \bigg[ \bigg( \frac{ V_0 }{ V } \bigg)^{2/3} - 1 \bigg]$.
BirchMurnaghan4th
:\[E(V) = E_{0}+\frac{3}{8} V_{0} B_{0} f^{2}\left[\left(9 H-63 B_{0}^{\prime}+143\right) f^{2}+12\left(B_{0}^{\prime}-4\right) f+12\right].\]where $H = B_0 B_0'' + (B_0')^2$.
PoirierTarantola2nd
:\[E(V) = E_{0}+\frac{1}{2} B_{0} V_{0} \ln ^{2} x.\]PoirierTarantola3rd
:\[E(V) = E_{0}+\frac{1}{6} B_{0} V_{0} \ln ^{2} x\left[\left(B_{0}^{\prime}+2\right) \ln x+3\right].\]PoirierTarantola4th
:\[E(V) = E_{0}+\frac{1}{24} B_{0} V_{0} \ln ^{2} x\left\{\left(H+3 B_{0}^{\prime}+3\right) \ln ^{2} x\right. \left.+4\left(B_{0}^{\prime}+2\right) \ln x+12\right\}.\]where $H = B_0 B_0'' + (B_0')^2$.
Vinet
:\[E(V) = E_{0}+\frac{9}{16} V_{0} B_{0} \frac{\left(x^{2 / 3}-1\right)^{2}}{x^{7 / 3}}\left\{x^{1 / 3}\left(B_{0}^{\prime}-4\right)-x\left(B_{0}^{\prime}-6\right)\right\}.\]AntonSchmidt
:\[E(V)=\frac{\beta V_{0}}{n+1}\left(\frac{V}{V_{0}}\right)^{n+1}\left[\ln \left(\frac{V}{V_{0}}\right)-\frac{1}{n+1}\right]+E_{\infty}.\]
Calculate pressure on an EquationOfState
The $P(V)$ relation of equations of state are listed as below:
Murnaghan
:\[P(V) = \frac{B_{0}}{B_{0}^{\prime}}\left[\left(\frac{V_{0}}{V}\right)^{B_{0}^{\prime}}-1\right].\]BirchMurnaghan2nd
:\[P(V) = \frac{3}{2} B_{0}\left(x^{-7 / 3}-x^{-5 / 3}\right).\]BirchMurnaghan3rd
:\[P(V) = \frac{3}{8} B_{0} \frac{x^{2 / 3}-1}{x^{10 / 3}}\left\{3 B_{0}^{\prime} x-16 x-3 x^{1 / 3}\left(B_{0}^{\prime}-4\right)\right\}.\]BirchMurnaghan4th
:\[P(V) = \frac{1}{2} B_{0}(2 f+1)^{5 / 2}\left\{\left(9 H-63 B_{0}^{\prime}+143\right) f^{2}\right.\left.+9\left(B_{0}^{\prime}-4\right) f+6\right\}.\]PoirierTarantola2nd
:\[P(V) = -\frac{B_{0}}{x} \ln x.\]PoirierTarantola3rd
:\[P(V) = -\frac{B_{0} \ln x}{2 x}\left[\left(B_{0}^{\prime}+2\right) \ln x+2\right].\]PoirierTarantola4th
:\[P(V) = -\frac{B_{0} \ln x}{6 x}\left\{\left(H+3 B_{0}^{\prime}+3\right) \ln ^{2} x+3\left(B_{0}^{\prime}+6\right) \ln x+6\right\}.\]Vinet
:\[P(V) = 3 B_{0} \frac{1-\eta}{\eta^{2}} \exp \left\{-\frac{3}{2}\left(B_{0}^{\prime}-1\right)(\eta-1)\right\}.\]AntonSchmidt
:\[P(V) = -\beta\left(\frac{V}{V_{0}}\right)^{n} \ln \left(\frac{V}{V_{0}}\right).\]
Calculate bulk modulus on an EquationOfState
The $B(V)$ relation of equations of state are listed as below:
BirchMurnaghan2nd
:\[B(V) = B_{0}(7 f+1)(2 f+1)^{5 / 2}.\]BirchMurnaghan3rd
:\[B(V) = \frac{B_{0}}{8 x^{10 / 3}}\left\{x^{5 / 3}\left(15 B_{0}^{\prime}-80\right)-x\left(42 B_{0}^{\prime}-196\right)\right.\left.+27 x^{1 / 3}\left(B_{0}^{\prime}-4\right)\right\}.\]BirchMurnaghan4th
:\[B(V) = \frac{1}{6} B_{0}(2 f+1)^{5 / 2}\left\{\left(99 H-693 B_{0}^{\prime}+1573\right) f^{3}\right.\left.+\left(27 H-108 B_{0}^{\prime}+105\right) f^{2}+6\left(3 B_{0}^{\prime}-5\right) f+6\right\}.\]PoirierTarantola2nd
:\[B(V) = \frac{B_{0}}{x}(1-\ln x).\]PoirierTarantola3rd
:\[B(V) = -\frac{B_{0}}{2 x}\left[\left(B_{0}^{\prime}+2\right) \ln x(\ln x-1)-2\right].\]PoirierTarantola4th
:\[B(V) = -\frac{B_{0}}{6 x}\left\{\left(H+3 B_{0}^{\prime}+3\right) \ln ^{3} x-3\left(H+2 B_{0}^{\prime}+1\right) \ln ^{2} x\right.\left.-6\left(B_{0}^{\prime}+1\right) \ln x-6\right\}.\]Vinet
:\[B(V) = -\frac{B_{0}}{2 \eta^{2}}\left[3 \eta(\eta-1)\left(B_{0}^{\prime}-1\right)+2(\eta-2)\right]\times \exp \left\{-\frac{3}{2}\left(B_{0}^{\prime}-1\right)(\eta-1)\right\}.\]AntonSchmidt
:\[B(V) = \beta\left(\frac{V}{V_{0}}\right)^{n}\left[1+n \ln \frac{V}{V_{0}}\right].\]
Public interfaces
EquationsOfState.Collections.Energy
— TypeEnergy()
(::EquationOfState)(::Energy)(v)
(::EquationOfState)(::Energy)
Return the energy of an EquationOfState
on volume v
. If eos
has units, v
must also has.
Return a function-like object that takes a volume as a variable, suitable for mapping onto an array.
Examples
julia> f = Vinet(1, 2, 3)(Energy());
julia> map(f, 1:1:10)
10-element Array{Float64,1}:
0.0
0.367905230584308
0.7652477289745814
1.0516459435179233
1.2560420090256408
1.405149833626178
1.5165867441792136
1.6017034530570884
1.6679539823686644
1.7203642945516917
However, these methods are preserved for special cases (see #52). In most cases, the Julia do
block syntax is preferred:
julia> map(1:1:10) do v
Vinet(1, 2, 3)(Energy())(v)
end
10-element Array{Float64,1}:
0.0
0.367905230584308
0.7652477289745814
1.0516459435179235
1.2560420090256412
1.405149833626178
1.5165867441792138
1.6017034530570884
1.6679539823686644
1.7203642945516917
EquationsOfState.Collections.Pressure
— TypePressure()
(::EquationOfState)(::Pressure)(v)
(::EquationOfState)(::Pressure)
Return the pressure of an EquationOfState
on volume v
. If eos
has units, v
must also has.
Examples
julia> f = Vinet(1, 2, 3)(Pressure());
julia> map(f, 1:1:10)
10-element Array{Float64,1}:
0.0
-0.45046308428750254
-0.3384840350043251
-0.24010297221667418
-0.17314062272722755
-0.12795492664586872
-0.09677154467733216
-0.07468060255179591
-0.05864401631176751
-0.04674768462396211
EquationsOfState.Collections.BulkModulus
— TypeBulkModulus()
(::EquationOfState)(::BulkModulus)(v)
(::EquationOfState)(::BulkModulus)
Return the bulk modulus of an EquationOfState
on volume v
. If eos
has units, v
must also has.
Examples
julia> f = BirchMurnaghan3rd(1, 2, 3)(BulkModulus());
julia> map(f, 1:1:10)
10-element Array{Float64,1}:
2.0
0.9216086833346415
0.444903691617472
0.2540009203153288
0.16193296566524193
0.11130584492987289
0.08076305569984538
0.06103515625
0.047609811583958425
0.03808959181078831
EquationsOfState.Collections.EquationOfState
— TypeEquationOfState{T}
An abstraction of equations of state, where T
specifies the elements' common type.
EquationsOfState.Collections.FiniteStrainEquationOfState
— TypeFiniteStrainEquationOfState{T} <: EquationOfState{T}
An abstraction of finite strain equations of state, where T
specifies the elements' common type.
EquationsOfState.Collections.Murnaghan
— TypeMurnaghan(v0, b0, b′0, e0)
Create a Murnaghan equation of state. The elements' type will be handled automatically.
This equation of state can have units. The units are specified in Unitful.jl
's @u_str
style.
Arguments
v0
: the volume of solid at zero pressure.b0
: the bulk modulus of solid at zero pressure.b′0
: the first-order pressure-derivative bulk modulus of solid at zero pressure.e0
: the energy of solid at zero pressure. Its default value is0u"eV"
(0
), if other parameters have (no) units.
Examples
julia> Murnaghan(1, 2, 3.0)
Murnaghan{Float64}(1.0, 2.0, 3.0, 0.0)
julia> Murnaghan(Int8(1), 2//1, 3.0, 4)
Murnaghan{Float64}(1.0, 2.0, 3.0, 4.0)
julia> Murnaghan(1u"nm^3", 2u"GPa", 3, 3.0u"eV")
Murnaghan{Quantity{Float64,D,U} where U where D}(1.0 nm³, 2.0 GPa, 3.0, 3.0 eV)
EquationsOfState.Collections.BirchMurnaghan2nd
— TypeBirchMurnaghan2nd(v0, b0, e0)
Create a Birch–Murnaghan 2nd order equation of state. The elements' type will be handled automatically.
Arguments
v0
: the volume of solid at zero pressure.b0
: the bulk modulus of solid at zero pressure.e0
: the energy of solid at zero pressure. Its default value is0u"eV"
(0
), if other parameters have (no) units.
See also: BirchMurnaghan3rd
, BirchMurnaghan4th
Examples
julia> BirchMurnaghan2nd(1, 2.0)
BirchMurnaghan2nd{Float64}(1.0, 2.0, 0.0)
julia> BirchMurnaghan2nd(Int8(1), 2//1, 0.0)
BirchMurnaghan2nd{Float64}(1.0, 2.0, 0.0)
julia> BirchMurnaghan2nd(1u"nm^3", 2u"GPa", 3.0u"eV")
BirchMurnaghan2nd{Quantity{Float64,D,U} where U where D}(1.0 nm³, 2.0 GPa, 3.0 eV)
EquationsOfState.Collections.BirchMurnaghan3rd
— TypeBirchMurnaghan3rd(v0, b0, b′0, e0)
Create a Birch–Murnaghan 3rd order equation of state. The elements' type will be handled automatically.
Arguments
v0
: the volume of solid at zero pressure.b0
: the bulk modulus of solid at zero pressure.b′0
: the first-order pressure-derivative bulk modulus of solid at zero pressure.e0
: the energy of solid at zero pressure. Its default value is0u"eV"
(0
), if other parameters have (no) units.
See also: BirchMurnaghan2nd
, BirchMurnaghan4th
Examples
julia> BirchMurnaghan3rd(1, 2.0, 3)
BirchMurnaghan3rd{Float64}(1.0, 2.0, 3.0, 0.0)
julia> BirchMurnaghan3rd(Int8(1), 2//1, 4, 0.0)
BirchMurnaghan3rd{Float64}(1.0, 2.0, 4.0, 0.0)
julia> BirchMurnaghan3rd(1u"nm^3", 2u"GPa", 4.0, 3u"eV")
BirchMurnaghan3rd{Quantity{Float64,D,U} where U where D}(1.0 nm³, 2.0 GPa, 4.0, 3.0 eV)
EquationsOfState.Collections.BirchMurnaghan4th
— TypeBirchMurnaghan4th(v0, b0, b′0, b′′0, e0)
Create a Birch–Murnaghan 4th order equation of state. The elements' type will be handled automatically.
Arguments
v0
: the volume of solid at zero pressure.b0
: the bulk modulus of solid at zero pressure.b′0
: the first-order pressure-derivative bulk modulus of solid at zero pressure.b′′0
: the second-order pressure-derivative bulk modulus of solid at zero pressure.e0
: the energy of solid at zero pressure. Its default value is0u"eV"
(0
), if other parameters have (no) units.
See also: BirchMurnaghan2nd
, BirchMurnaghan4th
Examples
julia> BirchMurnaghan4th(1, 2.0, 3, 4)
BirchMurnaghan4th{Float64}(1.0, 2.0, 3.0, 4.0, 0.0)
julia> BirchMurnaghan4th(Int8(1), 2//1, 4, 5.0, Float16(6))
BirchMurnaghan4th{Float64}(1.0, 2.0, 4.0, 5.0, 6.0)
julia> BirchMurnaghan4th(1u"nm^3", 2u"GPa", 3.0, 4u"1/GPa", 5u"eV")
BirchMurnaghan4th{Quantity{Float64,D,U} where U where D}(1.0 nm³, 2.0 GPa, 3.0, 4.0 GPa⁻¹, 5.0 eV)
EquationsOfState.Collections.PoirierTarantola2nd
— TypePoirierTarantola2nd(v0, b0, e0)
Create a Poirier–Tarantola order equation of state. The elements' type will be handled automatically.
Arguments
v0
: the volume of solid at zero pressure.b0
: the bulk modulus of solid at zero pressure.e0
: the energy of solid at zero pressure. Its default value is0u"eV"
(0
), if other parameters have (no) units.
See also: PoirierTarantola3rd
, PoirierTarantola4th
Examples
julia> PoirierTarantola2nd(1, 2.0)
PoirierTarantola2nd{Float64}(1.0, 2.0, 0.0)
julia> PoirierTarantola2nd(Int8(1), 2//1, 3.0)
PoirierTarantola2nd{Float64}(1.0, 2.0, 3.0)
julia> PoirierTarantola2nd(1u"nm^3", 2u"GPa", 3.0u"eV")
PoirierTarantola2nd{Quantity{Float64,D,U} where U where D}(1.0 nm³, 2.0 GPa, 3.0 eV)
EquationsOfState.Collections.PoirierTarantola3rd
— TypePoirierTarantola3rd(v0, b0, b′0, e0)
Create a Poirier–Tarantola 3rd order equation of state. The elements' type will be handled automatically.
Arguments
v0
: the volume of solid at zero pressure.b0
: the bulk modulus of solid at zero pressure.b′0
: the first-order pressure-derivative bulk modulus of solid at zero pressure.e0
: the energy of solid at zero pressure. Its default value is0u"eV"
(0
), if other parameters have (no) units.
See also: PoirierTarantola2nd
, PoirierTarantola4th
Examples
julia> PoirierTarantola3rd(1, 2.0, 3)
PoirierTarantola3rd{Float64}(1.0, 2.0, 3.0, 0.0)
julia> PoirierTarantola3rd(Int8(1), 2//1, 3.0, Float16(4))
PoirierTarantola3rd{Float64}(1.0, 2.0, 3.0, 4.0)
julia> PoirierTarantola3rd(1u"nm^3", 2u"GPa", 3, 4.0u"eV")
PoirierTarantola3rd{Quantity{Float64,D,U} where U where D}(1.0 nm³, 2.0 GPa, 3.0, 4.0 eV)
EquationsOfState.Collections.PoirierTarantola4th
— TypePoirierTarantola4th(v0, b0, b′0, b′′0, e0)
Create a Birch–Murnaghan 4th order equation of state. The elements' type will be handled automatically.
Arguments
v0
: the volume of solid at zero pressure.b0
: the bulk modulus of solid at zero pressure.b′0
: the first-order pressure-derivative bulk modulus of solid at zero pressure.b′′0
: the second-order pressure-derivative bulk modulus of solid at zero pressure.e0
: the energy of solid at zero pressure. Its default value is0u"eV"
(0
), if other parameters have (no) units.
See also: PoirierTarantola2nd
, PoirierTarantola3rd
Examples
julia> PoirierTarantola4th(1, 2.0, 3, 4)
PoirierTarantola4th{Float64}(1.0, 2.0, 3.0, 4.0, 0.0)
julia> PoirierTarantola4th(Int8(1), 2//1, 3.0, Float16(4), 5)
PoirierTarantola4th{Float64}(1.0, 2.0, 3.0, 4.0, 5.0)
julia> PoirierTarantola4th(1u"nm^3", 2u"GPa", 3, 4u"1/GPa", 5.0u"eV")
PoirierTarantola4th{Quantity{Float64,D,U} where U where D}(1.0 nm³, 2.0 GPa, 3.0, 4.0 GPa⁻¹, 5.0 eV)
EquationsOfState.Collections.Vinet
— TypeVinet(v0, b0, b′0, e0)
Create a Vinet equation of state. The elements' type will be handled automatically.
Arguments
v0
: the volume of solid at zero pressure.b0
: the bulk modulus of solid at zero pressure.b′0
: the first-order pressure-derivative bulk modulus of solid at zero pressure.e0
: the energy of solid at zero pressure. Its default value is0u"eV"
(0
), if other parameters have (no) units.
Examples
julia> Vinet(1, 2.0, 3)
Vinet{Float64}(1.0, 2.0, 3.0, 0.0)
julia> Vinet(Int8(1), 2//1, 3.0, Float16(4))
Vinet{Float64}(1.0, 2.0, 3.0, 4.0)
julia> Vinet(1u"nm^3", 2u"GPa", 3, 4.0u"eV")
Vinet{Quantity{Float64,D,U} where U where D}(1.0 nm³, 2.0 GPa, 3.0, 4.0 eV)