Dry run for relax workchain

How does one run a dry_run for a workchain and have the input files created in the present folder? I tried setting the dry_run for the subprocesses (see commented lines below) in the builder but none of them worked.

from aiida.orm import load_node, load_code
from aiida.plugins import WorkflowFactory
from aiida.engine import submit

structure = load_node(1316)
code = load_code(370)

PwRelaxWorkChain = WorkflowFactory('quantumespresso.pw.relax')

options = {
    'mpirun_extra_params': ['--mca', 'btl', 'vader,self'],
}

builder = PwRelaxWorkChain.get_builder_from_protocol(
    code=code,
    structure=structure,
    protocol='fast',   # or 'moderate' / 'precise'
    options=options
)

# builder.metadata.dry_run = True
# builder.base.pw.metadata.dry_run = True
# builder.base_final_scf.pw.metadata.dry_run  = True

workchain_node = submit(builder)

Hi @Walser52

To the best of my knowledge, this is not possible: aiida-core/src/aiida/engine/runners.py at 13cb318f1b7e3f31e73a38f720bdc8c47737a52e · aiidateam/aiida-core · GitHub

In case of WorkChains, one would need to explicitly implement this logic as it was done for PdosWorkChain: aiida-quantumespresso/src/aiida_quantumespresso/workflows/pdos.py at main · aiidateam/aiida-quantumespresso · GitHub
However, there it was also only done for testing.

I’d say that there is also a conceptual problem in the sense that you don’t necessarily know a priori the correct inputs of a workflow. While it should in principle be fine for a simple workflow, e.g., the PwBaseWorkChain, complex workflows might change the inputs based on the results of previous steps. Hence, it wouldn’t really work in those cases to do an actual dry run.

If you just want to see the input files a quick-and-dirty option could be:

  • set up a copy of the code with an invalid binary path (e.g. “pw.x.doesnotexist”)
  • attempt to run the workflow; when it fails, go visit the input files using verdi calcjob inputcat (or gotocomputer or inputls)

I can always kill the process as soon as I make it. But what I want to do is to make my files in the present directory.

Have you experimented with inputls and inputcat?

Can do something like

PK=859
for FILENAME in $(verdi calcjob inputls $PK)
do
  if [[ $FILENAME != ".aiida" ]]
  then verdi calcjob inputcat $PK $FILENAME > $FILENAME
  fi
done

(This would need a bit more tweaking to handle subdirectories correctly.)

Awesome. That’s what I need.

As a note, you don’t need to do bash logic: in recent AiiDA versions, you can just run

verdi process dump PK

(even on the top work chain, and it will dump recursively).

On older versions, dumping the repository of the CalcJobNode works (it returns just the files, it’s a bit less rich, but still solves your issue):

verdi node repo dump PK OUTPUT_FOLDER

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.