Skip to content

Commit 6fb1984

Browse files
committed
Fix inverse using Order2, deprecate Order16
1 parent 2d922c3 commit 6fb1984

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/Inverse.jl

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Inverse
22

33
using PolynomialRoots: roots
4-
using Roots: find_zero, Order16
4+
using Roots: find_zero, Order2
55
using StaticArrays: MVector
66
using UnPack: @unpack
77

@@ -144,25 +144,15 @@ function (eos⁻¹::Inverted{<:EnergyEquation{<:PoirierTarantola2nd}})(e)
144144
@assert false "Δ == (e - e0) / v0 / b0 == . this should never happen!"
145145
end
146146
end
147-
function (eos⁻¹::Inverted{<:EquationOfStateOfSolids})(
148-
y;
149-
search_interval = (eps(), 2),
150-
maxiter = 40,
151-
verbose = false,
152-
)
153-
v0 = sum(extrema(search_interval)) / 2 * getparam(eos⁻¹.eos).v0 # v0 can be negative
154-
@assert _ispositive(minimum(v0)) # No negative volume
147+
function (eos⁻¹::Inverted{<:EquationOfStateOfSolids})(y, x0; maxiter = 40, verbose = false)
155148
v = find_zero(
156149
guess -> eos⁻¹.eos(guess) - y,
157-
v0,
158-
Order16();
150+
x0,
151+
Order2();
159152
maxevals = maxiter,
160153
verbose = verbose,
161154
)
162-
if !_ispositive(v)
163-
@warn "the volume found is negative!"
164-
end
165-
return v
155+
return MVector(v...)
166156
end
167157

168158
function _strain2volume(

0 commit comments

Comments
 (0)