aiidateam / aiida-cp2k

The CP2K plugin for the AiiDA workflow and provenance engine.
https://aiida-cp2k.readthedocs.io/en/latest/
MIT License
22 stars 28 forks source link

Detect when SCF does not converge? #2

Closed RKBK closed 7 years ago

RKBK commented 7 years ago

I ran a super simple calculation that did not converge. However, aiida apparently takes no notice of this, and just logs the energy without any complaints. Is whether or not the calculation finishes properly not logged in some way? Can it be?

verdi calculation outputcat 223 | grep -e converge
 *** WARNING in qs_scf.F:479 :: SCF run NOT converged ***

verdi calculation logshow 223
*** 223 [A very simple test run of cp2k through aiida]: FINISHED
*** (empty scheduler output file)
*** (empty scheduler errors file)
*** 0 LOG MESSAGES

verdi calculation res 223
{
  "energy": -8.17577814412711, 
  "energy_units": "a.u."
}
oschuett commented 7 years ago

Hi,

sorry for the late reply.

Your question actually touches on a very fundamental issue. A CP2K calculations can fail in numerous ways (non-convergence being just one). I don't think it is possible to write a praser that can reliably detect all failure modes.

Hence, the way I see it, we have only two options:

  1. Parse the output but make no guarantees about correctness.
  2. Don't parse the output.

I would actually prefer the second option. This would leave the parsing responsibility up to the plugin user. And whoever writes the higher-level AiiDA workflow will know much better which problems to look out for.

After having said that, for the sake of backwards compatibility I'm reluctant to remove the parser entirely.

-Ole

RKBK commented 7 years ago

The PWSCF Aiida plugin has a very extensive set of checks to handle this, but that of course requires work both to write and to keep updated over time. Personally, I think the DB aspect of AiiDA is one of the more interesting parts, so for that reason I'd have a lot of use for some rudimentary error checking. Everything is more simple of there is a very specific keyword that gets printed by CP2K only when calculations succeed according to their input script (In that case data could be logged to the db only if that keyword is found), but I don't know CP2K well enough to say if that's the case.