Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to produce a full output file when using PsiAPI #2893

Closed
mskblackbelt opened this issue Mar 8, 2023 · 4 comments · Fixed by #2932
Closed

Add a way to produce a full output file when using PsiAPI #2893

mskblackbelt opened this issue Mar 8, 2023 · 4 comments · Fixed by #2932
Milestone

Comments

@mskblackbelt
Copy link

I'd like to be able to use Psi4 in a Jupyter notebook, but part of my workflow involves feeding the output into cclib for conversion to CJSON. Unfortunately, the truncated output from PsiAPI can't be parsed by the cclib parsers. Is there (or can there be) a way to toggle a "full" output using psi4.set_output_file()?

@loriab
Copy link
Member

loriab commented Mar 8, 2023

Is it the header info (psi name, version, authors text) that's tripping cclib up? If so you can run the fn that prints that stuff and concatenate. Fn is in header.py iirc

@mskblackbelt
Copy link
Author

The initial issue was that cclib looks for the first line of the header ("Psi4: An Open-Source Ab Initio Electronic Structure Package") to decide which parser to use. I pasted this into one of the outputs and tried parsing it, but still threw an error. I just ran the same molecule with psithon and tried to parse the output, found the same error. Looks like adding the header text to the start of my output file would fix the issue. Would it be reasonable to add a header=True option to the set_output_file() function, such that the contents of header.py are automatically included?

As for the cclib issue, it looks like the structure of the Convergence Check section has changed since their code was written. I'll file an issue over there to fix that matter.

@loriab
Copy link
Member

loriab commented Mar 9, 2023

Yes, adding a header=true is possible. What conv crit changed so you know? Geom opt, scf, cc, other? I suspect geom opt since we switched that out in Dec.

So in your Jupiter notebook, you're importing psi4, setting an output file (soon to incl header), running a single job(cclib consumable) closing that output file, processing or storing it, setting another output file, running another single job?

I ask b/c the Jupiter route usually amalgamates lots of outputs (that cclib won't like). Another route would be to have a node that prints the header at each energy/gradient/Hess/opt/freq call.

@mskblackbelt
Copy link
Author

I was doing a geometry optimization, and only the header changed. The cclib parser skips the header lines by content and the recent psi4 output has a different sequence of blank lines and info.

As for my application, I'm trying to teach chemistry students a bit of computational chemistry. The specific goal is to calculate geometry, vibrational modes and perform a PES scan on H3O+ using two levels of theory. So once the geometry is defined, I'm setting the output file, calling psi4.print_header(), then running the optimize() and frequency() routines. After fixing the (outdated) cclib parser, all the data seems to come through correctly.

Cclib just needs to see that initial line ("Psi4: An Open-Source Ab Initio Electronic Structure Package") when it starts reading to assign the correct parsing file. I couldn't find any way to manually specify a parser.

@loriab loriab added this to the Psi4 1.8 milestone Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants