Skip to content

Commit

Permalink
Merge pull request #293 from MineralsCloud:GatherData
Browse files Browse the repository at this point in the history
Add type `GatherData` in src/ConvergenceTestWorkflow/actions.jl
  • Loading branch information
singularitti authored Oct 15, 2023
2 parents 7ea6f24 + e81806b commit 497184a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/ConvergenceTestWorkflow/Recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ using ..ConvergenceTestWorkflow:
WriteInput,
RunCmd,
ExtractData,
GatherData,
SaveData,
TestConvergence

Expand All @@ -34,6 +35,7 @@ function stage(::SelfConsistentField, r::TestCutoffEnergyRecipe)
WriteInput(SelfConsistentField()),
RunCmd(SelfConsistentField()),
ExtractData(SelfConsistentField()),
GatherData(SelfConsistentField()),
SaveData(SelfConsistentField()),
TestConvergence(SelfConsistentField()),
)) do action
Expand All @@ -48,18 +50,20 @@ function stage(::SelfConsistentField, r::TestCutoffEnergyRecipe)
extractdata = map(
thunk -> ConditionalJob(thunk; name="extract energies in SCF"), steps[5]
)
savedata = ArgDependentJob(steps[6]; name="save energies in SCF")
testconv = ArgDependentJob(steps[7]; name="test convergence in SCF")
download .→ makeinputs .→ writeinputs .→ runcmds .→ extractdata .→ testconv
extractdata .→ savedata
gatherdata = ArgDependentJob(steps[6]; name="gather energies in SCF")
savedata = ArgDependentJob(steps[7]; name="save energies in SCF")
testconv = ArgDependentJob(steps[8]; name="test convergence in SCF")
download .→ makeinputs .→ writeinputs .→ runcmds .→ extractdata .→ gatherdata testconv
gatherdata savedata
return steps = (;
download=download,
makeinputs=makeinputs,
writeinputs=writeinputs,
runcmds=runcmds,
extractdata=extractdata,
gatherdata=gatherdata,
testconv=testconv,
savedata=savedata
savedata=savedata,
)
end

Expand Down
5 changes: 5 additions & 0 deletions src/ConvergenceTestWorkflow/actions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ struct ExtractData{T} <: Action{T}
calculation::T
end

struct GatherData{T} <: Action{T}
calculation::T
end
(::GatherData)(iter) = collect(iter)

struct SaveData{T} <: Action{T}
calculation::T
end
Expand Down
1 change: 1 addition & 0 deletions src/ConvergenceTestWorkflow/think.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ think(action::CreateInput, conf::Conf) =
collect(Thunk(action, conf.template, datum) for datum in conf.with)
think(action::ExtractData, conf::Conf) =
collect(Thunk(action, file) for file in last.(conf.io))
think(action::GatherData, ::Conf) = Thunk(action)
think(action::SaveData, conf::Conf) = Thunk(action(conf.data.raw))
think(action::TestConvergence, conf::Conf) = Thunk(action(conf.threshold))
function think(action::Action{T}, config::StaticConfig) where {T}
Expand Down

0 comments on commit 497184a

Please sign in to comment.