aiidateam / aiida-quantumespresso

The official AiiDA plugin for Quantum ESPRESSO
https://aiida-quantumespresso.readthedocs.io
Other
55 stars 82 forks source link

Avoid crashing when stress is not implemented #557

Open giovannipizzi opened 4 years ago

giovannipizzi commented 4 years ago

In QE <= 6.5, stress could not computed when using non collinear magnetism (spin-orbit) and GGA functionals. The message in the output would read:

     Message from routine stres:
     noncollinear stress + GGA not implemented

The parser would then completely crash and leave the calculation in an Excepted state, with a traceback like the following:

*** 3 LOG MESSAGES:
+-> WARNING at 2020-09-22 14:50:17.398914+02:00
 | could not parse scheduler output: output parsing is not available for `SlurmScheduler`
+-> WARNING at 2020-09-22 14:50:18.021878+02:00
 | Error while parsing stress tensor: "P=" not found within 15 lines from the start of the stress block
+-> REPORT at 2020-09-22 14:50:18.138142+02:00
 | [4004|PwCalculation|on_except]: Traceback (most recent call last):
 |   File "/home/pizzi/git/plugins_aiida/aiida-quantumespresso/aiida_quantumespresso/utils/validation/trajectory.py", line 84, in verify_convergence_stress
 |     stress = trajectory.get_array('stress')[index]
 |   File "/home/pizzi/git/aiida-core/aiida/orm/nodes/data/array/array.py", line 122, in get_array
 |     return get_array_from_file(self, name)
 |   File "/home/pizzi/git/aiida-core/aiida/orm/nodes/data/array/array.py", line 114, in get_array_from_file
 |     raise KeyError('Array with name `{}` not found in ArrayData<{}>'.format(name, self.pk))
 | KeyError: 'Array with name `stress` not found in ArrayData<None>'
 | 
 | During handling of the above exception, another exception occurred:
 | 
 | Traceback (most recent call last):
 |   File "/home/pizzi/.virtualenvs/aiida-dev/lib/python3.7/site-packages/plumpy/process_states.py", line 225, in execute
 |     result = self.run_fn(*self.args, **self.kwargs)
 |   File "/home/pizzi/git/aiida-core/aiida/engine/processes/calcjobs/calcjob.py", line 313, in parse
 |     exit_code_retrieved = self.parse_retrieved_output(retrieved_temporary_folder)
 |   File "/home/pizzi/git/aiida-core/aiida/engine/processes/calcjobs/calcjob.py", line 387, in parse_retrieved_output
 |     exit_code = parser.parse(**parse_kwargs)
 |   File "/home/pizzi/git/plugins_aiida/aiida-quantumespresso/aiida_quantumespresso/parsers/pw.py", line 128, in parse
 |     exit_code = validator(trajectory, parsed_parameters, logs_stdout)
 |   File "/home/pizzi/git/plugins_aiida/aiida-quantumespresso/aiida_quantumespresso/parsers/pw.py", line 206, in validate_ionic
 |     if not self.is_ionically_converged(trajectory):
 |   File "/home/pizzi/git/plugins_aiida/aiida-quantumespresso/aiida_quantumespresso/parsers/pw.py", line 241, in is_ionically_converged
 |     converged_relax = verify_convergence_trajectory(trajectory, -2, *values)
 |   File "/home/pizzi/git/plugins_aiida/aiida-quantumespresso/aiida_quantumespresso/utils/validation/trajectory.py", line 33, in verify_convergence_trajectory
 |     converged_stress = verify_convergence_stress(trajectory, index, threshold_stress, reference_pressure)
 |   File "/home/pizzi/git/plugins_aiida/aiida-quantumespresso/aiida_quantumespresso/utils/validation/trajectory.py", line 86, in verify_convergence_stress
 |     raise ValueError('the `stress` array does not exist or the given index exceeds the length.')
 | ValueError: the `stress` array does not exist or the given index exceeds the length.

A few notes:

sphuber commented 4 years ago

After discussion, we agree that it should most likely have an 5** exit code, since it's relax/vc-relax related and the PwRelaxWorkChain should add a handler for this that when vc-relax is used as a mode, it is stopped.