Segmentation fault error on O2 dimer energy calculation

Dear friends,

I’m trying to calculate the energy of an O2 dimer in two situations.

In the first of them (input dimer_1.dat and output dimer_1.txt) the calculation occurs without problems.

In the second of them (input dimer_2.dat and output dimer_2.txt), I am getting the following error:

forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
libgdma.so 00007F3715F000DC for__signal_handl Unknown Unknown
libpthread-2.31.s 00007F372540D420 Unknown Unknown Unknown
core.cpython-39-x 00007F3722B5F74E Unknown Unknown Unknown
core.cpython-39-x 00007F3722BE44E4 Unknown Unknown Unknown
core.cpython-39-x 00007F3722BE45AB Unknown Unknown Unknown
core.cpython-39-x 00007F37227F0372 Unknown Unknown Unknown
python3.9 0000000000507457 Unknown Unknown Unknown
python3.9 00000000004F068C _PyObject_MakeTpC Unknown Unknown
python3.9 00000000004EC9FB _PyEval_EvalFrame Unknown Unknown
python3.9 00000000004E689A Unknown Unknown Unknown
python3.9 00000000004E6527 _PyEval_EvalCodeW Unknown Unknown
python3.9 00000000004E64D9 PyEval_EvalCodeEx Unknown Unknown
python3.9 000000000059329B PyEval_EvalCode Unknown Unknown
python3.9 00000000005C0AD7 Unknown Unknown Unknown
python3.9 00000000005BCB00 Unknown Unknown Unknown
python3.9 00000000004566F4 Unknown Unknown Unknown
python3.9 00000000005B67E2 PyRun_SimpleFileE Unknown Unknown
python3.9 00000000005B3D5E Py_RunMain Unknown Unknown
python3.9 0000000000587349 Py_BytesMain Unknown Unknown
libc-2.31.so 00007F37250D1083 __libc_start_main Unknown Unknown
python3.9 00000000005871FE Unknown Unknown Unknown

The difference between these scripts is only the distance between the O2 monomers. I have generated multiple O2 conformers, some calculations run and others give this previously mentioned problem.

These outputs were run on version 1.7 of Psi4 on my personal computer. I also did a test running version 1.9.1 on a cluster I use and I’m getting the same type of “segmentation fault” problem. On my computer I installed Psi4 through psi4conda https://psicode.org/categories/releases/

Does anyone have experience with this type of error and could help me? This error appears to be associated with python. I didn’t find anything related.

Thanks in advance.

Best,

dimer_1.dat (423 Bytes)
dimer_2.dat (423 Bytes)
dimer_1.txt (73.6 KB)
dimer_2.txt (47.8 KB)

Update:

I tried running the O2 dimer energy calculation using psi4 v. 1.9.1 installed with Python 3.10.12 instead of 3.9.X (by Linux “Installer” Install v1.9.1+ | Installs) and the error I got of “Segmentation Fault” still persists.

Attached I send the .log files. of a script without problems (dimer_1_log.txt) and one with problems. (dimer_2_log.txt).

Visually, the difference is that in the script without errors, the log file returns this “c2v”

[psi4.driver.task_base:172] <<< JSON launch … c2v

and the no with errors “cs”

psi4.driver.task_base:172] <<< JSON launch … cs

The c2v point group specifically indicates a molecule with: (i) a principal rotation axis of C2 (rotation by 180 degrees), (ii) a perpendicular C2 rotation axis, and (iii) vertical mirror plane (σv). The “cs” point group is characterized by a single mirror plane.

I ran a third calculation just by varying the distance between the centers of mass of the O2 molecules in the second configuration and I got no errors (dimer_3_log.txt)

Can anyone tell me why this error occurred? Let me know if I need to provide more information.

dimer_1_log.txt (2.9 KB)
dimer_2_log.txt (2.1 KB)
dimer_2_output.txt (47.1 KB)
dimer_3_log.txt (2.9 KB)
dimer_3_output.txt (72.8 KB)

I started looking at this last week but had my attention pulled away by other things before I could finish.

There are two issues here. One is that the O2 dimer computation is not converging at SCF. It gets close to converging but never makes it the last final bit. The second is that the mechanism that should print that information to file is not working.

The second part is an actual Psi4 bug, but what you need fixed is the first part. For this system, I think you can afford SOSCF? That would be the simplest solution.

Thanks for reply @jmisiewicz!

I have a doubt. To change for SOSCF, I need to change the line of my input:

set basis aug-cc-pVTZ

for:

set {
basis aug-cc-pVTZ
guess sad
soscf true
scf_type df
}

or would it be something else? I’m basing this example: https://github.com/psi4/psi4/blob/master/samples/soscf-ref/input.dat.

Thanks in advance.

The important part there is soscf true. The other two keywords are good practices, but those are on by default anyways.

For some reason the SOSCF isn’t managing to converge either… I’ll need to look at this more carefully, but I’m not going to have the time to do that for a few days.

I asked because I had tried to run it here and it hadn’t converged to SOSCF either. Then I thought I might be doing something wrong in the script.

I’ll need to look at this more carefully, but I’m not going to have the time to do that for a few days.

No problem @jmisiewicz, thank you for taking the time to respond.

I’m doing some tests and interestingly, when I change the precision of the number of significant figures to describe the positions of the atoms, sometimes the calculation has converged. As I said, if I maintain the configuration of the conformers and change the distances between the centers of mass of the molecules, the calculation converges.

This issue of not converging only occurred with the oxygen triplet. I’ve already tested it with several other molecules and everything was ok.

Update.

I don’t have very detailed knowledge in theoretical chemistry, but I thought of a possible solution.

Researching a little further, in the triplet state, O2 has two unpaired electrons, each with the same spin. In computational chemistry, there are different methods to treat molecules with unpaired electrons. One common approach is the “restricted open shell” formalism.

I changed my script for O2 triplet in:

set basis aug-cc-pvtz

for:

set {
basis aug-cc-pvtz
reference rohf
}

Implementing this change seems to have resolved the segmentation fault issue when running psi4 calculations.

Could someone with more experience tell me if what I thought makes sense?

Briefly, a UHF wavefunction is a single determinant with different alpha and beta orbitals that does not have the spin symmetry of the exact wavefunction. An ROHF wavefunction is a linear combination of determinants with the same alpha and beta orbitals, which does have the spin symmetry of the exact wavefunction. If one has to work with open shell systems, UHF is normally simpler but can give poor results if the expectation value of <S^2> deviates sharply from an allowed value. This problem is called spin contamination.

So, this is perfectly plausible. I’d need to look at the <S^2> expectation values to see if I’d expect the UHF computation to have trouble. Unfortunately, I have a lot of help issues at the moment, so I don’t have time to look at this one much further.

EDIT: UHF can also resolve some so-called “static correlation effects,” see standard reference, courtesy of one of the authors.

Many thanks for reply @jmisiewicz, I appreciate your time,
I know you must be very busy!

Just one “final” question related:

If I want to exchange an O2 for another molecule (e.g., N2) in my base script below, is it possible to assign “reference rohf” only for the O2 in the input?

psi4.set_memory(‘8GB’)
psi4.core.set_num_threads(8)
molecule o2n2_dimer {
0 3
O 0.439751 0.000000 0.439751
O -0.439751 0.000000 -0.439751

0 1
N -0.000000 0.621902 2.550000
N 0.000000 -0.621902 2.550000
}
set {
basis aug-cc-pvtz
reference rohf
}
E = energy(‘MP2’,molecule=oxygen_dimer, bsse_type=‘cp’)
Efinal = E* psi_hartree2kcalmol
psi4.print_out(“MP2/aug-cc-pVTZ = “)
psi4.print_out(”%10.6f” % (Efinal))

Thanks is advance for your time!

That isn’t possible, any more that it’s possible to compute the interaction between O2 and N2 using O2 with B3LYP and N2 with PBE. You can do that for the individual systems, but not the interacting system.

Many thanks @jmisiewicz

I thought it would be possible to do something similar to what was described in “Mixing Basis Sets” with command “assign” for a two-molecule system.