From ccaf23403f12a9a8fa3f7715ec30b5560a458e73 Mon Sep 17 00:00:00 2001 From: singularitti Date: Mon, 30 Oct 2023 04:19:47 -0400 Subject: [PATCH] Fix `last` does not work on `EachParsed` --- src/ConvergenceTestWorkflow/actions.jl | 2 +- src/EquationOfStateWorkflow/EquationOfStateWorkflow.jl | 9 +++++---- src/PhononWorkflow/actions.jl | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ConvergenceTestWorkflow/actions.jl b/src/ConvergenceTestWorkflow/actions.jl index 827c12e..2b38fa2 100644 --- a/src/ConvergenceTestWorkflow/actions.jl +++ b/src/ConvergenceTestWorkflow/actions.jl @@ -17,7 +17,7 @@ end function (::ExtractData)(file) str = read(file, String) preamble = tryparse(Preamble, str) - energies = eachconvergedenergy(str) + energies = collect(eachconvergedenergy(str)) if !isnothing(preamble) && !isempty(energies) return preamble.ecutwfc * u"Ry" => last(energies) * u"Ry" # volume, energy else diff --git a/src/EquationOfStateWorkflow/EquationOfStateWorkflow.jl b/src/EquationOfStateWorkflow/EquationOfStateWorkflow.jl index d70762d..44132e1 100644 --- a/src/EquationOfStateWorkflow/EquationOfStateWorkflow.jl +++ b/src/EquationOfStateWorkflow/EquationOfStateWorkflow.jl @@ -21,7 +21,7 @@ end function (::ExtractData{SelfConsistentField})(file) str = read(file, String) preamble = tryparse(Preamble, str) - energies = eachconvergedenergy(str) + energies = collect(eachconvergedenergy(str)) if !isnothing(preamble) && !isempty(energies) return preamble.omega * u"bohr^3" => last(energies) * u"Ry" # volume, energy else @@ -36,7 +36,8 @@ function (::ExtractData{VariableCellOptimization})(file) if !isoptimized(str) @warn "Cell is not completely optimized!" end - cards, energies = eachcellparameterscard(str), eachconvergedenergy(str) + cards, energies = collect(eachcellparameterscard(str)), + collect(eachconvergedenergy(str)) if !isempty(cards) && !isempty(energies) lastcell, lastenergy = last(cards), last(energies) return cellvolume(lastcell) * u"bohr^3" => lastenergy * u"Ry" # volume, energy @@ -47,8 +48,8 @@ end function (::ExtractCell)(file) str = read(file, String) - cell_parameters = last(eachcellparameterscard(str)) - atomic_positions = last(eachatomicpositionscard(str)) + cell_parameters = last(collect(eachcellparameterscard(str))) + atomic_positions = last(collect(eachatomicpositionscard(str))) return Cell(cell_parameters, atomic_positions) end diff --git a/src/PhononWorkflow/actions.jl b/src/PhononWorkflow/actions.jl index abdcf6c..ad908b5 100644 --- a/src/PhononWorkflow/actions.jl +++ b/src/PhononWorkflow/actions.jl @@ -22,8 +22,8 @@ using UnifiedPseudopotentialFormat # To work with `download_potential` import Express.PhononWorkflow: CreateInput, RunCmd, parsecell function parsecell(str) - cell_parameters = last(eachcellparameterscard(str)) - atomic_positions = last(eachatomicpositionscard(str)) + cell_parameters = last(collect(eachcellparameterscard(str))) + atomic_positions = last(collect(eachatomicpositionscard(str))) return atomic_positions, cell_parameters end