From 783931aef2fc70b717353281e1dcba12db8476e9 Mon Sep 17 00:00:00 2001 From: singularitti Date: Tue, 24 Oct 2023 02:38:15 -0400 Subject: [PATCH] Fix bugs for `SaveCell` --- src/EquationOfStateWorkflow/Recipes.jl | 4 ++-- src/EquationOfStateWorkflow/actions.jl | 1 + src/EquationOfStateWorkflow/think.jl | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/EquationOfStateWorkflow/Recipes.jl b/src/EquationOfStateWorkflow/Recipes.jl index bf2fed0f..1b8fa54e 100644 --- a/src/EquationOfStateWorkflow/Recipes.jl +++ b/src/EquationOfStateWorkflow/Recipes.jl @@ -63,7 +63,7 @@ function stage(::SelfConsistentField, r::ParallelEosFittingRecipe) # thunk -> ConditionalJob(thunk; name="extract cell in SCF"), first(iterate(steps)) # ) # savecells = map( - # thunk -> ConditionalJob(thunk; name="save cell in SCF"), first(iterate(steps)) + # thunk -> ArgDependentJob(thunk; name="save cell in SCF"), first(iterate(steps)) # ) extractdata = map( thunk -> ConditionalJob(thunk; name="extract E(V) data in SCF"), @@ -130,7 +130,7 @@ function stage(::VariableCellOptimization, r::ParallelEosFittingRecipe) thunk -> ConditionalJob(thunk; name="extract cell in SCF"), first(iterate(steps)) ) savecells = map( - thunk -> ConditionalJob(thunk; name="save cell in SCF"), first(iterate(steps)) + thunk -> ArgDependentJob(thunk; name="save cell in SCF"), first(iterate(steps)) ) extractdata = map( thunk -> ConditionalJob(thunk; name="extract E(V) data in vc-relax"), diff --git a/src/EquationOfStateWorkflow/actions.jl b/src/EquationOfStateWorkflow/actions.jl index f6f43875..9f11066d 100644 --- a/src/EquationOfStateWorkflow/actions.jl +++ b/src/EquationOfStateWorkflow/actions.jl @@ -78,6 +78,7 @@ end struct SaveCell{T} <: Action{T} calculation::T end +(action::SaveCell)(path) = Base.Fix1(action, path) struct FitEquationOfState{T} <: Action{T} calculation::T diff --git a/src/EquationOfStateWorkflow/think.jl b/src/EquationOfStateWorkflow/think.jl index 7cc106f4..d40d4be9 100644 --- a/src/EquationOfStateWorkflow/think.jl +++ b/src/EquationOfStateWorkflow/think.jl @@ -25,8 +25,13 @@ think(action::ExtractData, conf::Conf) = collect(Thunk(action, file) for file in last.(conf.io)) think(action::ExtractCell, conf::Conf) = collect(Thunk(action, file) for file in last.(conf.io)) -think(action::SaveCell, conf::Conf) = - collect(Thunk(action, file) for file in last.(conf.io)) +think(action::SaveCell, conf::Conf) = collect( + Thunk( + action( + joinpath(dirname(file), string(nameof(typeof(Calculation(action))))) * ".cif", + ), + ) for file in last.(conf.io) +) think(action::GatherData, ::Conf) = Thunk(action) think(action::SaveData, conf::Conf) = Thunk(action(conf.data.raw)) think(action::SaveParameters, conf::Conf) = Thunk(action(conf.data.eos_params))