Skip to content

Commit

Permalink
Fix bugs in src/EquationOfStateWorkflow/EquationOfStateWorkflow.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Oct 31, 2023
1 parent 66abca6 commit 6dca952
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/EquationOfStateWorkflow/EquationOfStateWorkflow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ using AtomsIO: Atom, periodic_system, save_system
using CrystallographyBase: Lattice, Cell, basisvectors, cellvolume, eachatom
using ExpressBase: Calculation
using QuantumESPRESSO.PWscf:
Preamble, isjobdone, isoptimized, eachcellparameterscard, eachconvergedenergy
Preamble,
isjobdone,
isoptimized,
eachcellparameterscard,
eachatomicpositionscard,
eachconvergedenergy
using Unitful: @u_str
using UnitfulAtomic

Expand All @@ -23,7 +28,7 @@ function (::ExtractData{SelfConsistentField})(file)
preamble = tryparse(Preamble, str)
energies = collect(eachconvergedenergy(str))
if !isnothing(preamble) && !isempty(energies)
return preamble.omega * u"bohr^3" => last(energies) * u"Ry" # volume, energy
return preamble.omega * u"bohr^3" => last(energies).total * u"Ry" # volume, energy
else
throw(DataExtractionFailed("no data found in file $file."))
end
Expand All @@ -39,7 +44,7 @@ function (::ExtractData{VariableCellOptimization})(file)
cards, energies = collect(eachcellparameterscard(str)),
collect(eachconvergedenergy(str))
if !isempty(cards) && !isempty(energies)
lastcell, lastenergy = last(cards), last(energies)
lastcell, lastenergy = last(cards), last(energies).total
return cellvolume(lastcell) * u"bohr^3" => lastenergy * u"Ry" # volume, energy
else
throw(DataExtractionFailed("no data found in file $file."))
Expand Down

0 comments on commit 6dca952

Please sign in to comment.