MineralsCloud / Express.jl

Express: a high-level, extensible workflow framework for accelerating ab initio calculations for the materials science community
https://mineralscloud.github.io/Express.jl/
GNU General Public License v3.0
25 stars 1 forks source link

How can `_makeinput` take variable arguments? #49

Closed singularitti closed 3 years ago

singularitti commented 3 years ago

Phonon.SelfConsistentField depends on the last step results (optimized cells), so it may acquire a variable that takes either a new_structure or output. And Dfpt is even more complicated because it needs input from previous steps. But how to distribute the function on each slice of its arguments? One way is

function f(g, args...; kwargs...)
    map(zip(args...)) do arg
        g(arg...; kwargs...)
    end
end

This is exactly like IterTools.imap.

However, Base.map can do similar things. But it cannot take kwargs, so is IterTools.imap. The most flexible one is the one I wrote above.

singularitti commented 3 years ago

Solved in this code.