Skip to content

Commit

Permalink
Merge branch 'find'
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Apr 24, 2020
2 parents ca24c34 + 4359dfd commit 38a11b7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Find.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ Find a volume which leads to the given pressure, energy, or bulk modulus based o
an array or a tuple, of which only the maximum and minimum values will be used in the
root-finding process.
"""
findvolume(f, y, x0, method) = find_zero(v -> f(v) - y, x0, method)
function findvolume(f, y, x0, method)
v0 = find_zero(v -> f(v) - y, x0, method)
if v0 < zero(v0)
error("the volume found is negative!")
else
return v0
end
end # function findvolume
function findvolume(f, y, x0)
for T in [subtypes(AbstractBisection); subtypes(AbstractAlefeldPotraShi)]
@info("Using method \"$T\"...")
Expand Down

0 comments on commit 38a11b7

Please sign in to comment.