Skip to content

Commit a1b3c25

Browse files
committed
Remove unnecessary DataFactory calls
The workchain has implemented automatic convertion to AiiDA data types already.
1 parent 597e627 commit a1b3c25

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/aiida_common_workflows/workflows/relax/vasp/generator.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
8888
builder.structure = structure
8989

9090
# Set options
91-
builder.vasp.calc.options = plugins.DataFactory('core.dict')(dict=engines['relax']['options'])
91+
builder.vasp.calc.options = engines['relax']['options']
9292

9393
# Set workchain related inputs, in this case, give more explicit output to report
94-
builder.verbose = plugins.DataFactory('core.bool')(True)
94+
builder.verbose = True
9595

9696
# Fetch initial parameters from the protocol file.
9797
# Here we set the protocols fast, moderate and precise. These currently have no formal meaning.
@@ -139,7 +139,7 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
139139
}
140140
}
141141
)
142-
builder.vasp.settings = plugins.DataFactory('core.dict')(dict=settings)
142+
builder.vasp.settings = settings
143143

144144
# Configure the handlers
145145
handler_overrides = {
@@ -150,17 +150,15 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
150150
'handler_unfinished_calc_generic': {'enabled': False},
151151
'handler_electronic_conv': {'enabled': False},
152152
}
153-
builder.vasp.handler_overrides = plugins.DataFactory('core.dict')(dict=handler_overrides)
153+
builder.vasp.handler_overrides = handler_overrides
154154

155155
# Set the parameters on the builder, put it in the code namespace to pass through
156156
# to the code inputs
157-
builder.vasp.parameters = plugins.DataFactory('core.dict')(dict={'incar': parameters_dict})
157+
builder.vasp.parameters = parameters_dict
158158

159159
# Set potentials and their mapping
160-
builder.vasp.potential_family = plugins.DataFactory('str')(protocol['potential_family'])
161-
builder.vasp.potential_mapping = plugins.DataFactory('core.dict')(
162-
dict=self._potential_mapping[protocol['potential_mapping']]
163-
)
160+
builder.vasp.potential_family = protocol['potential_family']
161+
builder.vasp.potential_mapping = self._potential_mapping[protocol['potential_mapping']]
164162

165163
# Set the kpoint grid from the density in the protocol
166164
kpoints = plugins.DataFactory('core.array.kpoints')()
@@ -212,7 +210,7 @@ def _construct_builder(self, **kwargs) -> engine.ProcessBuilder: # noqa: PLR091
212210
threshold = threshold_forces
213211
else:
214212
threshold = protocol['relax']['threshold_forces']
215-
relax_settings.force_cutoff = plugins.DataFactory('float')(threshold)
213+
relax_settings.force_cutoff = threshold
216214

217215
if threshold_stress is not None:
218216
raise ValueError('Using a stress threshold is not directly available in VASP during relaxation.')

0 commit comments

Comments
 (0)