-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended way of providing overrides #238
Comments
To revitalize the discussion I would like to stress that my concerns expressed in #230 also applies here :-) |
More general overridesHere some discussions originating from a meeting held today with @sphuber @bosonie and me. There are 2 goals we want to achieve:
Possible implementationOverride functionsHere some practical comments on how these goals could be achieved (just from brainstorming, not necessarily the final solution we want to implement), but mostly to explain the concept. For now, we define common workflows via python entrypoints, e.g.: aiida.workflows:
- "common_workflows.relax.quantum_espresso = aiida_common_workflows.workflows.relax.quantum_espresso.workchain:QuantumEspressoCommonRelaxWorkChain"
- "common_workflows.relax.siesta = aiida_common_workflows.workflows.relax.siesta.workchain:SiestaCommonRelaxWorkChain" etc. In the same way, each implementation could provide a list of overrides, i.e. functions that perform a given action, e.g. as follows: aiida.workflows.common_workflow_overrides:
- "quantum_espresso.relax.common.kpoints = qe_kpt_override"
- "quantum_espresso.relax.pools = ..."
- "siesta.relax.common.kpoints = ..."
- "siesta.relax.basis_set = ..." Notes:
Use of overrides in common workflows (like EOS)The question now is how to pass the list of overrides, and their inputs. First of all, we want to specify an ordered list of overrides (and their inputs) to be applied (e.g. first change the pools, then change the k-points, then the smearing, ...). There are various way to do it, depending on whether we are just OK with a single node with the full spec of what to do, or we want to expose some of this as AiiDA node with links. overrides:
- override: common.kpoints
kwargs:
kpoints_distance: 0.1
kpoints_offset: [0, 0, 0]
- override: pools
kwargs:
num_pools: 4 (Note that we can skip the first part If we want to pass nodes instead, one could e.g. have an input of the EOS workchain with label Storing ovveride and generator inputs of the common WorkChainCurrently the Note that this is better than the current status, even if it might be limiting in the future (so some discussion might be required, but we can decide to implement it anyway as it's an improvement over the current status). Custom overridesHow to enable users to implement custom override functions? This is unfortunately very tricky, because the function needs to be known to the AiiDA deamon. So, we can't allow to pass any generic function implemented in the submission script. One way is that a user can define a small python package adding a new entrypoint, if really needed; this works, but is a bit cumbersome for the average user. Example (if we focus on def merge_dict_override(builder, dict_input_link, merge_dict):
new_dict = copy.deepcopy(getattr(builder, dict_input_link).get_dict())
new_dict.update(merge_dict)
setattr(builder, dict_input_link, Dict(dict=new_dict))
return builder (Note: this is actually changing the TBD: what if we want to allow nodes? E.g. pass a new pseudopotential to replace one that was automatically picked? Is this a relevant usecase, or maybe in this case we pass the group name and let the override function select the right nodes and set them in the builder? (In any case, cutoffs might need to be changed in this case) Defining a common workflow for relaxation as a wrapper for the common workflow interfaceIn the discussion, we realised that we could implement all the logic above not only for the common workflows like the EOS, but actually also for the relaxation that now only provides a common-workflow interface for each code: i.e., implement a common workflow for relaxation. The code should be the same and even easier than the EOS (just remove the scale-factor inputs, and use expose_inputs for the input generator specs now that it is possible, ...). This makes the logic on using the overrides implemented only once in the common relax workflow, and the common EOS becomes even simpler: it just forwards inputs and overrides to the common relax workflow. Therefore, the plan is to see if we can implement this or if there are technical challenges associated to it. Next meetingWe'll meet Fri 12th Nov afternoon - interested people can contact us to participate. |
(BTW this should be ok with @d-wortmann's concern - as this will prevent extending the number of common inputs; this remains to a minimum, and if a code wants to provide additional "flags" (change kpoint, enable DFT+U, ...), these can just be implemented as overrides. |
Continuing from #206, I think we need to discuss a more general way of how to specify overrides for the codes.
This could be combined with the option to define code-agnostic overrides: e.g. if we want to change the smearing and k-points, should we do it via overrides (and define a common interface for such an override?).
E.g. the overrides could be a list of functions, and each implementation returns a generator of override functions, e.g.:
(and we decide that the interface of
get_override_kpoints
and similar functions is the same for all plugins).(And override function would be a function that gets a builder and returns a modified builder).
Just an initial idea to start discussion!
The text was updated successfully, but these errors were encountered: