Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 17, 2024
1 parent 24ab624 commit e3eeeea
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 23 deletions.
10 changes: 7 additions & 3 deletions aiida_nanotech_empa/workflows/cp2k/diag_workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,17 @@ def run_diag_scf(self):
input_dict["FORCE_EVAL"]["DFT"]["SCF"].pop("SMEAR")
input_dict["FORCE_EVAL"]["DFT"]["SCF"]["EPS_SCF"] = "1.0E-1"
input_dict["FORCE_EVAL"]["DFT"]["SCF"]["OUTER_SCF"]["EPS_SCF"] = "1.0E-1"

# Printing orbitals.
if "nhomo" in self.ctx.dft_params:
input_dict["FORCE_EVAL"]["DFT"]["PRINT"]["MO_CUBES"]["NHOMO"] = self.ctx.dft_params["nhomo"]
input_dict["FORCE_EVAL"]["DFT"]["PRINT"]["MO_CUBES"]["NHOMO"] = (
self.ctx.dft_params["nhomo"]
)
input_dict["FORCE_EVAL"]["DFT"]["PRINT"]["MO_CUBES"]["STRIDE"] = "2 2 2"
if "nlumo" in self.ctx.dft_params:
input_dict["FORCE_EVAL"]["DFT"]["PRINT"]["MO_CUBES"]["NLUMO"] = self.ctx.dft_params["nlumo"]
input_dict["FORCE_EVAL"]["DFT"]["PRINT"]["MO_CUBES"]["NLUMO"] = (
self.ctx.dft_params["nlumo"]
)
input_dict["FORCE_EVAL"]["DFT"]["PRINT"]["MO_CUBES"]["STRIDE"] = "2 2 2"

# Setup walltime.
Expand Down
27 changes: 16 additions & 11 deletions aiida_nanotech_empa/workflows/cp2k/orbitals_workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,25 +110,28 @@ def run_stm(self):

future = self.submit(StmCalculation, **inputs)
return engine.ToContext(stm=future)

def should_run_cubehandler(self):
return "cubehandler_code" in self.inputs

def run_cubehandler(self):
self.report("Running CubeHandler")
if not common_utils.check_if_calc_ok(self, self.ctx.diag_scf):
return self.exit_codes.ERROR_TERMINATIONx

_, node = launch_shell_job(
self.inputs.cubehandler_code,
arguments = ['shrink', '.', 'out_cubes'],
metadata={
'options': {'prepend_text': 'conda activate cubehandler', 'use_symlinks':True},
'computer': orm.load_computer('daint-gpu'),
'label': 'cube-shrink',
self.inputs.cubehandler_code,
arguments=["shrink", ".", "out_cubes"],
metadata={
"options": {
"prepend_text": "conda activate cubehandler",
"use_symlinks": True,
},
"computer": orm.load_computer("daint-gpu"),
"label": "cube-shrink",
},
nodes={'remote_previous_job': self.ctx.diag_scf.outputs.remote_folder},
outputs=['out_cubes'],
nodes={"remote_previous_job": self.ctx.diag_scf.outputs.remote_folder},
outputs=["out_cubes"],
)
self.ctx.cubehandler_uuid = node.uuid

Expand All @@ -142,5 +145,7 @@ def finalize(self):
self.out("retrieved", self.ctx.diag_scf.outputs.retrieved)
common_utils.add_extras(self.inputs.structure, "surfaces", self.node.uuid)
if "cubehandler_code" in self.inputs:
common_utils.add_extras(self.inputs.structure, "surfaces", self.ctx.cubehandler_uuid)
common_utils.add_extras(
self.inputs.structure, "surfaces", self.ctx.cubehandler_uuid
)
self.report("Work chain is finished")
20 changes: 11 additions & 9 deletions examples/plugins/example_use_aiida_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
from aiida_shell import launch_shell_job



def example_cubehander():
remote_folder = orm.load_node(1216)
results, node = launch_shell_job(
'/users/yaa/miniconda3/envs/cubehandler/bin/cubehandler',
arguments = ['shrink', '.', 'out_cubes'],
"/users/yaa/miniconda3/envs/cubehandler/bin/cubehandler",
arguments=["shrink", ".", "out_cubes"],
metadata={
'options': {'prepend_text': 'conda activate cubehandler', 'use_symlinks':True},
'computer': orm.load_computer('daint-gpu'),
'label': 'cube-shrink',
"options": {
"prepend_text": "conda activate cubehandler",
"use_symlinks": True,
},
nodes={'remote_previous_job': remote_folder},
outputs=['out_cubes'],
)
"computer": orm.load_computer("daint-gpu"),
"label": "cube-shrink",
},
nodes={"remote_previous_job": remote_folder},
outputs=["out_cubes"],
)
print(results)


Expand Down

0 comments on commit e3eeeea

Please sign in to comment.