Psi.gdma causes python to crash: `Could not open psi4 output for writing.unit = 51`

Hello there,

I’m trying to wrap gdma calculations into a python script, but I’m stuck with a systematic error/crash: when I launch the gdma calculation from within a python interpreter or from a python script through the command line (with this command: python gdma.py), it results in a systematic crash at the gdma step.
I found some temporary files after the crashes, notably a file fort.52 which contains the following, unique line: “Could not open psi4 output for writing.unit = 51”.

So I wonder what is the default psi4 output directory where psi4.gdma is trying to write into and how I could change it.

To be noted, the same calculation using the psi4 executable (psi4 -i gdma.dat) succeded (I don’t know if it produced any temporary files, though) with no error…

I am using psi4 1.2.1 with python 3.6. The dev version didn’t solve this issue.

Any help appreciated,

Florent

The fort.52 file suggests to me that the code at least made it to GDMA…

Was there any kind of error message printed after the crash? If so, that would be useful to have.

No other message error printed at all.
All I got was a .dma file (looks like a regular gdma input file to me) and the aforementioned fort.52 file. The python script produced the same outputs as the psi4 binary for the energy step executed right before the gdma step in my script.

What really suprised me was that the code worked using the psi4 executable but not the python wrapping. To me, the GDMA binary used in background is the same in both cases, or am I wrong?

Thanks for your help

The binary is the same, but something about how information gets passed from Psi to GDMA must depend on the input method. It shouldn’t, so this is definitely a bug.

For future reference, I can reproduce the bug with the following input file:

import psi4

h2o = psi4.geometry("""
    O  0.000000  0.000000  0.117176
    H -0.000000 -0.756950 -0.468706
    H -0.000000  0.756950 -0.468706
""")

psi4.set_options({
    "scf_type": "pk",
    "basis": "cc-pvdz",
    "gdma_switch": 0,
    "gdma_radius": ["H", 0.65],
    "gdma_limit": 2,
    "gdma_origin": [0, 0, 0.117176]
})

energy, wfn = psi4.energy('scf', molecule=h2o, return_wfn=True)

psi4.gdma(wfn)

pdb terminates upon trying to move past the run_gdma call, suggesting the problem is C-side. Ping me here if I don’t respond back by Wednesday.

Thanks for letting me know you were able to reproduce the bug.

Should I open an issue on the GitHub page of the project?

Yes, that would be good. Please link to the forum post so nothing is lost.

Done

For a workaround, please see here