Skip to content
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

Fix: Set common inputs to non_db #339

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/aiida_common_workflows/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def convert(self, value, param, ctx):

duplicate = (
QueryBuilder()
.append(StructureData, filters={'extras._aiida_hash': structure.base.caching._get_hash()})
.append(StructureData, filters={'extras._aiida_hash': structure.base.caching._compute_hash()})
.first()
)

Expand Down
1 change: 1 addition & 0 deletions src/aiida_common_workflows/workflows/bands/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def define(cls, spec):
spec.input(
'engines.bands.options',
valid_type=dict,
non_db=True,
required=False,
help='Options for the bands calculation jobs.',
)
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ def define(cls, spec):
The ports defined on the specification are the inputs that will be accepted by the ``get_builder`` method.
"""
super().define(spec)
spec.input(
'protocol',
valid_type=ChoiceType(('fast', 'moderate', 'precise', 'verification-PBE-v1', 'verification-PBE-v1-a0')),
default='moderate',
help='The protocol to use for the automated input generation. This value indicates the level of precision '
'of the results and computational cost that the input parameters will be selected for.',
spec.inputs['protocol'].valid_type = ChoiceType(
('fast', 'moderate', 'precise', 'verification-PBE-v1', 'verification-PBE-v1-a0')
)
spec.inputs['spin_type'].valid_type = ChoiceType((SpinType.NONE, SpinType.COLLINEAR, SpinType.NON_COLLINEAR))
spec.inputs['relax_type'].valid_type = ChoiceType(tuple(RelaxType))
Expand Down
8 changes: 2 additions & 6 deletions src/aiida_common_workflows/workflows/relax/cp2k/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,8 @@ def define(cls, spec):
The ports defined on the specification are the inputs that will be accepted by the ``get_builder`` method.
"""
super().define(spec)
spec.input(
'protocol',
valid_type=ChoiceType(('fast', 'moderate', 'precise', 'verification-PBE-v1', 'verification-PBE-v1-sirius')),
default='moderate',
help='The protocol to use for the automated input generation. This value indicates the level of precision '
'of the results and computational cost that the input parameters will be selected for.',
spec.inputs['protocol'].valid_type = ChoiceType(
('fast', 'moderate', 'precise', 'verification-PBE-v1', 'verification-PBE-v1-sirius')
)
spec.inputs['spin_type'].valid_type = ChoiceType((SpinType.NONE, SpinType.COLLINEAR))
spec.inputs['relax_type'].valid_type = ChoiceType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def define(cls, spec):
('fast', 'moderate', 'precise', 'oxides_validation', 'verification-PBE-v1')
)
spec.input('engines.inpgen.code', valid_type=orm.Code, serializer=orm.load_code)
spec.input('engines.inpgen.options', valid_type=dict, required=False)
spec.input('engines.inpgen.options', non_db=True, valid_type=dict, required=False)
spec.inputs['engines']['relax']['code'].valid_type = CodeType('fleur.fleur')
spec.inputs['engines']['inpgen']['code'].valid_type = CodeType('fleur.inpgen')

Expand Down
6 changes: 6 additions & 0 deletions src/aiida_common_workflows/workflows/relax/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def define(cls, spec):
'protocol',
valid_type=ChoiceType(('fast', 'moderate', 'precise')),
default='moderate',
non_db=True,
help='The protocol to use for the automated input generation. This value indicates the level of precision '
'of the results and computational cost that the input parameters will be selected for.',
)
Expand Down Expand Up @@ -61,6 +62,7 @@ def define(cls, spec):
'magnetization_per_site',
valid_type=list,
required=False,
non_db=True,
help='The initial magnetization of the system. Should be a list of floats, where each float represents the '
'spin polarization in units of electrons, meaning the difference between spin up and spin down '
'electrons, for the site. This also corresponds to the magnetization of the site in Bohr magnetons '
Expand All @@ -70,19 +72,22 @@ def define(cls, spec):
'threshold_forces',
valid_type=float,
required=False,
non_db=True,
help='A real positive number indicating the target threshold for the forces in eV/Å. If not specified, '
'the protocol specification will select an appropriate value.',
)
spec.input(
'threshold_stress',
valid_type=float,
required=False,
non_db=True,
help='A real positive number indicating the target threshold for the stress in eV/Å^3. If not specified, '
'the protocol specification will select an appropriate value.',
)
spec.input(
'reference_workchain',
valid_type=orm.WorkChainNode,
non_db=True,
required=False,
help='The node of a previously completed process of the same type whose inputs should be taken into '
'account when generating inputs. This is important for particular workflows where certain inputs have '
Expand All @@ -106,5 +111,6 @@ def define(cls, spec):
'engines.relax.options',
valid_type=dict,
required=False,
non_db=True,
help='Options for the geometry optimization calculation jobs.',
)
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def define(cls, spec):

if inputs_dict is not None:
for k, val in inputs_dict.items():
spec.input(k, valid_type=val)
spec.input(k, valid_type=val, non_db=True)

def _construct_builder(self, **kwargs) -> engine.ProcessBuilder:
builder = self.process_class.get_builder()
Expand Down
Loading