Conversation
cdf16c0 to
8ff8f77
Compare
- Since they are never intendet to be used as examples we move them to the tests folder
efb92a5 to
d1c9b7a
Compare
timmyte
left a comment
There was a problem hiding this comment.
This is nice improvement in the right direction. This will allow users to all add fallbacks to there OPI scripts.
But please cross-check the release notes and description again and removed sections, that are not served in this PR.
Also remove the three dots in the "Closes Issues" section.
| d3a2: float | None = None | ||
|
|
||
| # > Number of CPSCF iterations | ||
| z_maxiter: int | None = None |
There was a problem hiding this comment.
I don't see this change listed in the PR description. Please cross-check.
| class ErrorPattern: | ||
| """ | ||
| Represents an error pattern in the ORCA output file. | ||
| More complex error patterns derive from this class and override the extractor |
There was a problem hiding this comment.
| More complex error patterns derive from this class and override the extractor | |
| More complex error patterns derive from this class and override the `extractor`. |
|
|
||
| def __init__( | ||
| self, | ||
| grep_string: str | None = None, |
There was a problem hiding this comment.
Why not just go with empty strings as default? I don't see the value of using None here.
Applies to grep_string as well as message.
| critical: bool = False, | ||
| extractor: Callable[[Grepper], str] | None = None, | ||
| ) -> None: | ||
| if grep_string is not None: |
There was a problem hiding this comment.
I would check as follows: if not grep_string (also applies to if message ...)
E.g. why would one want grep for an empty string?
| self.grep_string = grep_string | ||
| if message is not None: | ||
| self.message = message | ||
| if critical is not None: |
There was a problem hiding this comment.
Above it says critical is always boolean. So I don't get why you check for None here.
| print(output.error_message()) | ||
| assert not output.terminated_normally() | ||
| assert ( | ||
| "Not enough memory available for SCF. Available: 1.0 MB" in output.error_message() |
There was a problem hiding this comment.
I would be careful with using a fixed number of multiple consecutive blanks in a string literal if it's not meant only for printing. This where regex should be used.
|  | ||
|  | ||
| [](https://doi.org/10.1021/acs.jctc.5c02141) | ||
| [](https://doi.org/10.1021/acs.jctc.5c02141) |
There was a problem hiding this comment.
Is this change listed in the PR description?
| # > Error patterns in order of priority. | ||
| # > Critical errors will stop scanning when matched. | ||
| # > Non-critical errors will just be added and reported. | ||
| ERROR_PATTERNS: list[ErrorPattern] = [ |
There was a problem hiding this comment.
Please add kind of line in the form of a comment, at which point in the list we go from critical to non-critical.
| return hits if hits else None | ||
|
|
||
|
|
||
| def get_error_message(file_name: Path) -> str | None: |
There was a problem hiding this comment.
I would make the function name more specific: e.g. get_first_error_message()
| @@ -0,0 +1,80 @@ | |||
| from opi.output.grepper.error_pattern import ( | |||
There was a problem hiding this comment.
Please add module level docstring, describing what this file holds.
Closes Issues
Closes #215
Description
output.error_messagethat goes through a list of knownErrorPatternsand checks if they are found in the output file. The pattern with the highest priority given by the position in the list will be returned. Tests for the errors can be found intests/failure_examples. Initial errors include input errors, convergence errors for SCF, CC, geometry, and CP-SCF convergence, memory errors for SCF, MP2, and CC.Release Notes
(Project adheres to Keep a Changelog; Every entry should start in upper-case and end with
(#<pr-id>); Remove sections that don't apply)Added
output.error_message()which retrieves the most important error message from the ORCA output file.output.error_messages()which retrieves all error messages from known strings from the ORCA output file.output.cc_convergedandoutput.casscf_convergedto check cc and casscf convergence.Changed
Deprecated
Removed
Fixed