aiida-common-workflows icon indicating copy to clipboard operation
aiida-common-workflows copied to clipboard

New implementation of the input generator does not have inspection methods

Open bosonie opened this issue 3 years ago • 1 comments

The various get_relax_types, get_electronic_types and so on are now missing. Just introspection of protocols have been preserved.

bosonie avatar Oct 17 '21 13:10 bosonie

This was done on purpose. This information can directly be retrieved from the ports in the specification, e.g.:

In [1]: from aiida_common_workflows.workflows.relax.quantum_espresso import QuantumEspressoCommonRelaxInputGenerator

In [2]: QuantumEspressoCommonRelaxInputGenerator.spec().inputs['electronic_type'].choices
Out[2]: (<ElectronicType.METAL: 'metal'>, <ElectronicType.INSULATOR: 'insulator'>)

In this way, not just the arguments for which we decided to add a special method is introspectable, and it is not just the choices, it also provides the valid type and all other information specified in the spec.

The one thing that I considered adding is a single method that essentially returns spec().inputs, so the line becomes:

In [2]: QuantumEspressoCommonRelaxInputGenerator.get_input_spec()['electronic_type'].choices
Out[2]: (<ElectronicType.METAL: 'metal'>, <ElectronicType.INSULATOR: 'insulator'>)

Name to be discussed. If we agree on it, I can add it and close this issue with it.

sphuber avatar Oct 18 '21 06:10 sphuber