Skip to content

Commit

Permalink
Fix steps = Iterators.Stateful(steps) in #296
Browse files Browse the repository at this point in the history
  • Loading branch information
singularitti committed Oct 24, 2023
1 parent 70e0282 commit c332bb2
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 95 deletions.
23 changes: 11 additions & 12 deletions src/ConvergenceTestWorkflow/Recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,19 @@ end

function stage(::SelfConsistentField, r::TestCutoffEnergyRecipe)
conf = expand(r.config, SelfConsistentField())
steps = map(
Iterators.Stateful((
DownloadPotentials(SelfConsistentField()),
CreateInput(SelfConsistentField()),
WriteInput(SelfConsistentField()),
RunCmd(SelfConsistentField()),
ExtractData(SelfConsistentField()),
GatherData(SelfConsistentField()),
SaveData(SelfConsistentField()),
TestConvergence(SelfConsistentField()),
)),
) do action
steps = map((
DownloadPotentials(SelfConsistentField()),
CreateInput(SelfConsistentField()),
WriteInput(SelfConsistentField()),
RunCmd(SelfConsistentField()),
ExtractData(SelfConsistentField()),
GatherData(SelfConsistentField()),
SaveData(SelfConsistentField()),
TestConvergence(SelfConsistentField()),
)) do action
think(action, conf)
end
steps = Iterators.Stateful(steps)
download = Job(first(iterate(steps)); name="download potentials")
makeinputs = map(thunk -> Job(thunk; name="update input in SCF"), first(iterate(steps)))
writeinputs = map(
Expand Down
64 changes: 31 additions & 33 deletions src/EquationOfStateWorkflow/Recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,23 @@ end

function stage(::SelfConsistentField, r::ParallelEosFittingRecipe)
conf = expand(r.config, SelfConsistentField())
steps = map(
Iterators.Stateful((
DownloadPotentials(SelfConsistentField()),
ComputeVolume(SelfConsistentField()),
CreateInput(SelfConsistentField()),
WriteInput(SelfConsistentField()),
RunCmd(SelfConsistentField()),
ExtractCell(SelfConsistentField()),
SaveCell(SelfConsistentField()),
ExtractData(SelfConsistentField()),
GatherData(SelfConsistentField()),
SaveData(SelfConsistentField()),
FitEquationOfState(SelfConsistentField()),
SaveParameters(SelfConsistentField()),
)),
) do action
steps = map((
DownloadPotentials(SelfConsistentField()),
ComputeVolume(SelfConsistentField()),
CreateInput(SelfConsistentField()),
WriteInput(SelfConsistentField()),
RunCmd(SelfConsistentField()),
ExtractCell(SelfConsistentField()),
SaveCell(SelfConsistentField()),
ExtractData(SelfConsistentField()),
GatherData(SelfConsistentField()),
SaveData(SelfConsistentField()),
FitEquationOfState(SelfConsistentField()),
SaveParameters(SelfConsistentField()),
)) do action
think(action, conf)
end
steps = Iterators.Stateful(steps)
download = Job(first(iterate(steps)); name="download potentials")
compute = map(thunk -> Job(thunk; name="compute volume in SCF"), first(iterate(steps)))
makeinputs = map(
Expand Down Expand Up @@ -91,28 +90,27 @@ function stage(::SelfConsistentField, r::ParallelEosFittingRecipe)
gatherdata=gatherdata,
savedata=savedata,
fiteos=fiteos,
saveparams=saveparams,
saveparams=saveparams
)
end
function stage(::VariableCellOptimization, r::ParallelEosFittingRecipe)
conf = expand(r.config, VariableCellOptimization())
steps = map(
Iterators.Stateful((
ComputeVolume(VariableCellOptimization()),
CreateInput(VariableCellOptimization()),
WriteInput(VariableCellOptimization()),
RunCmd(VariableCellOptimization()),
ExtractCell(VariableCellOptimization()),
SaveCell(VariableCellOptimization()),
ExtractData(VariableCellOptimization()),
GatherData(VariableCellOptimization()),
SaveData(VariableCellOptimization()),
FitEquationOfState(VariableCellOptimization()),
SaveParameters(VariableCellOptimization()),
)),
) do action
steps = map((
ComputeVolume(VariableCellOptimization()),
CreateInput(VariableCellOptimization()),
WriteInput(VariableCellOptimization()),
RunCmd(VariableCellOptimization()),
ExtractCell(VariableCellOptimization()),
SaveCell(VariableCellOptimization()),
ExtractData(VariableCellOptimization()),
GatherData(VariableCellOptimization()),
SaveData(VariableCellOptimization()),
FitEquationOfState(VariableCellOptimization()),
SaveParameters(VariableCellOptimization()),
)) do action
think(action, conf)
end
steps = Iterators.Stateful(steps)
compute = map(
thunk -> Job(thunk; name="compute volume in vc-relax"), first(iterate(steps))
)
Expand Down Expand Up @@ -159,7 +157,7 @@ function stage(::VariableCellOptimization, r::ParallelEosFittingRecipe)
gatherdata=gatherdata,
savedata=savedata,
fiteos=fiteos,
saveparams=saveparams,
saveparams=saveparams
)
end

Expand Down
95 changes: 45 additions & 50 deletions src/PhononWorkflow/Recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,18 @@ end

function stage(::SelfConsistentField, r::Recipe)
conf = expand(r.config, SelfConsistentField())
steps = map(
Iterators.Stateful((
DownloadPotentials(SelfConsistentField()),
CreateInput(SelfConsistentField()),
WriteInput(SelfConsistentField()),
RunCmd(SelfConsistentField()),
# ExtractData(SelfConsistentField()),
# GatherData(SelfConsistentField()),
# SaveData(SelfConsistentField()),
)),
) do action
steps = map((
DownloadPotentials(SelfConsistentField()),
CreateInput(SelfConsistentField()),
WriteInput(SelfConsistentField()),
RunCmd(SelfConsistentField()),
# ExtractData(SelfConsistentField()),
# GatherData(SelfConsistentField()),
# SaveData(SelfConsistentField()),
)) do action
think(action, conf)
end
steps = Iterators.Stateful(steps)
download = Job(first(iterate(steps)); name="download potentials")
makeinputs = map(thunk -> Job(thunk; name="update input in SCF"), first(iterate(steps)))
writeinputs = map(
Expand Down Expand Up @@ -67,18 +66,17 @@ function stage(::SelfConsistentField, r::Recipe)
end
function stage(::DensityFunctionalPerturbationTheory, r::Recipe)
conf = expand(r.config, DensityFunctionalPerturbationTheory())
steps = map(
Iterators.Stateful((
CreateInput(DensityFunctionalPerturbationTheory()),
WriteInput(DensityFunctionalPerturbationTheory()),
RunCmd(DensityFunctionalPerturbationTheory()),
# ExtractData(DensityFunctionalPerturbationTheory()),
# GatherData(DensityFunctionalPerturbationTheory()),
# SaveData(DensityFunctionalPerturbationTheory()),
)),
) do action
steps = map((
CreateInput(DensityFunctionalPerturbationTheory()),
WriteInput(DensityFunctionalPerturbationTheory()),
RunCmd(DensityFunctionalPerturbationTheory()),
# ExtractData(DensityFunctionalPerturbationTheory()),
# GatherData(DensityFunctionalPerturbationTheory()),
# SaveData(DensityFunctionalPerturbationTheory()),
)) do action
think(action, conf)
end
steps = Iterators.Stateful(steps)
makeinputs = map(
thunk -> ArgDependentJob(thunk; name="update input in DFPT"), first(iterate(steps))
)
Expand Down Expand Up @@ -106,18 +104,17 @@ function stage(::DensityFunctionalPerturbationTheory, r::Recipe)
end
function stage(::RealSpaceForceConstants, r::Recipe)
conf = expand(r.config, RealSpaceForceConstants())
steps = map(
Iterators.Stateful((
CreateInput(RealSpaceForceConstants()),
WriteInput(RealSpaceForceConstants()),
RunCmd(RealSpaceForceConstants()),
# ExtractData(RealSpaceForceConstants()),
# GatherData(RealSpaceForceConstants()),
# SaveData(RealSpaceForceConstants()),
)),
) do action
steps = map((
CreateInput(RealSpaceForceConstants()),
WriteInput(RealSpaceForceConstants()),
RunCmd(RealSpaceForceConstants()),
# ExtractData(RealSpaceForceConstants()),
# GatherData(RealSpaceForceConstants()),
# SaveData(RealSpaceForceConstants()),
)) do action
think(action, conf)
end
steps = Iterators.Stateful(steps)
makeinputs = map(
thunk -> ArgDependentJob(thunk; name="update input in IFC"), first(iterate(steps))
)
Expand Down Expand Up @@ -145,17 +142,16 @@ function stage(::RealSpaceForceConstants, r::Recipe)
end
function stage(::PhononDispersion, r::PhononDispersionRecipe)
conf = expand(r.config, PhononDispersion())
steps = map(
Iterators.Stateful((
WriteInput(PhononDispersion()),
RunCmd(PhononDispersion()),
# ExtractData(PhononDispersion()),
# GatherData(PhononDispersion()),
# SaveData(PhononDispersion()),
))
) do action
steps = map((
WriteInput(PhononDispersion()),
RunCmd(PhononDispersion()),
# ExtractData(PhononDispersion()),
# GatherData(PhononDispersion()),
# SaveData(PhononDispersion()),
)) do action
think(action, conf)
end
steps = Iterators.Stateful(steps)
makeinputs = map(
ArgDependentJob(
Thunk(CreateInput(PhononDispersion())(conf.template));
Expand Down Expand Up @@ -196,18 +192,17 @@ function stage(::PhononDispersion, r::PhononDispersionRecipe)
end
function stage(::PhononDensityOfStates, r::PhononDispersionRecipe)
conf = expand(r.config, PhononDensityOfStates())
steps = map(
Iterators.Stateful(
CreateInput(PhononDensityOfStates()),
WriteInput(PhononDensityOfStates()),
RunCmd(PhononDensityOfStates()),
# ExtractData(PhononDensityOfStates()),
# GatherData(PhononDensityOfStates()),
# SaveData(PhononDensityOfStates()),
),
) do action
steps = map((
CreateInput(PhononDensityOfStates()),
WriteInput(PhononDensityOfStates()),
RunCmd(PhononDensityOfStates()),
# ExtractData(PhononDensityOfStates()),
# GatherData(PhononDensityOfStates()),
# SaveData(PhononDensityOfStates()),
)) do action
think(action, conf)
end
steps = Iterators.Stateful(steps)
makeinputs = map(
thunk -> ArgDependentJob(thunk; name="update input in phonon dispersion"),
first(iterate(steps)),
Expand Down

0 comments on commit c332bb2

Please sign in to comment.