Skip to content

Commit

Permalink
Merge pull request #19 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Checking more thoroughly for errors when running Psi4.
  • Loading branch information
seamm authored Feb 17, 2023
2 parents eeeabfd + 12ca096 commit c6068fb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
History
=======

2023.2.17 -- Checking more thoroughly for errors in Psi4
* Check and throw errors for various issues when running Psi4, including whenever it
does not complete successfully according to the output.

2023.2.16.1 -- OptKing will not die!!!
* Yet another part needed to be removed.

Expand Down
2 changes: 2 additions & 0 deletions psi4_step/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,7 @@ def analyze(self, indent="", data={}, out=[]):
"\nThere are no results from Psi4. Perhaps it "
f"failed? Looking for {tmp}."
)
printer.normal(__(text, **data, indent=self.indent + 4 * " "))
raise RuntimeError(text)

printer.normal(__(text, **data, indent=self.indent + 4 * " "))
2 changes: 2 additions & 0 deletions psi4_step/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,7 @@ def analyze(self, indent="", data={}, out=[]):
f"failed? Looking for {str(json_file)}."
),
)
printer.normal(__(text, **data, indent=self.indent + 4 * " "))
raise RuntimeError(text)

printer.normal(__(text, **data, indent=self.indent + 4 * " "))
2 changes: 2 additions & 0 deletions psi4_step/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,7 @@ def analyze(self, indent="", data={}, out=[]):
"\nThere are no results from Psi4. Perhaps it "
f"failed? Looking for {str(json_file)}."
)
printer.normal(__(text, **data, indent=self.indent + 4 * " "))
raise RuntimeError(text)

printer.normal(__(text, **data, indent=self.indent + 4 * " "))
12 changes: 11 additions & 1 deletion psi4_step/psi4.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,13 +481,23 @@ def run(self):

if result is None:
self.logger.error("There was an error running Psi4")
return None
raise RuntimeError("There was an error running Psi4")

self.logger.debug("\n" + pprint.pformat(result))

failed = False
if "output.dat" in result["files"]:
if result["output.dat"]["data"] is not None:
if "*** Psi4 exiting successfully." not in result["output.dat"]["data"]:
self.logger.warning("Psi4 did not complete successfully.")
failed = True

# Analyze the results
self.analyze()

if failed:
raise RuntimeError("Psi4 did not complete successfully.")

return next_node

def analyze(self, indent="", **kwargs):
Expand Down

0 comments on commit c6068fb

Please sign in to comment.