Segmentation fault when using a wavefunction from file

Hi,

psi4 version: 1.3.2

Thanks to your previous help, I managed to save my wavefunction object into a separate file and to read it from an external script. But when I try a (for instance) CASCI calculation, a segmentation fault appears:

INPUT: (Note that I work without symmetry)

some code...
old_wfn.to_file("wfn")
new_wfn = psi4.core.Wavefunction.from_file("wfn")
psi4.compare_wavefunctions(scf_wfn, avas_wfn, label='Serialization Check 1')
N_active  = 11
N_frozen  = 4
N_virtual = 30
psi4.set_options({'ACTIVE'      : [ N_active ],\
                   'FROZEN_DOCC' : [ N_frozen ],\
                   'FROZEN_UOCC' : [ N_virtual],\
                   'DIAG_METHOD' : 'DAVIDSON',\
                   'CI_MAXITER'  : 200\
                 })
PSI4_CASCI_energy = psi4.energy('fci', molecule=mol, ref_wfn=new_wfn,  return_wfn=False)

OUTPUT:

	compare Ca........................................................PASSED
	compare Cb........................................................PASSED
	compare Da........................................................PASSED
	compare Db........................................................PASSED
	compare Fa........................................................PASSED
	compare Fb........................................................PASSED
	compare H.........................................................PASSED
	compare S.........................................................PASSED
	compare X.........................................................PASSED
	compare aotoso....................................................PASSED
	compare epsilon_a.................................................PASSED
	compare epsilon_b.................................................PASSED
	compare nalpha....................................................PASSED
	compare nbeta.....................................................PASSED
	compare nfrzc.....................................................PASSED
	compare nirrep....................................................PASSED
	compare nmo.......................................................PASSED
	compare nso.......................................................PASSED
	compare name......................................................PASSED
	compare energy....................................................PASSED
	compare frozen core energy........................................PASSED
	compare dipole field strength x...................................PASSED
	compare dipole field strength y...................................PASSED
	compare dipole field strength z...................................PASSED
	compare basis set name............................................PASSED
	compare number of basis functions in set..........................PASSED
	compare total number of primitives in basis set...................PASSED
	compare molecule name.............................................PASSED
	compare molecule point group......................................PASSED
	compare molecule geometry.........................................PASSED
	Serialization Check 1.............................................PASSED
Segmentation fault: 11

This error does however not appear if I just use the old_wfn object and do:

old_wfn.to_file("wfn")
old_wfn.from_file("wfn")

followed by the active space calculation on old_wfn.

I found this in Github : https://github.com/psi4/psi4/issues/1851 and I guess this is my problem but I would like to be absolutely sure, and also ask if there is a way to bypass it for now or not ?

Thank you very much for your advices !

Yes, it is.

What modules/methods do you want to read wavefunctions into? 1851 needs to be fixed on a module-by-module basis. For some modules, it’s very easy. For others, it’s going to be a nightmare. Fixing it for the CASSCF code looks like it can be done in one line of code. If so, I can get that done on the developer version.

Can you build the developer version of Psi yourself given conda instructions, or do you need to use a release version? I may be able to cook up a workaround entirely in-input file, but I’m not hopeful.

I would like to use CASCI and CASSCF methods. I have no restriction on the version to use so yes, I can work with the developer version !

Thank you

I got the same error too. I changed number of core, my problem was solved:

psi4 -i boron.in -o boron.out -n 40

I got “segmentation fault” error but when I changed it as 38:

psi4 -i boron.in -o boron.out -n 38

Everything turned normal.
Another thing, when I run “virtual box” under the windows system, I got this error until I closed vbox or I changed vbox settings for number of cores. I don’t know what does “number of cores” have to do with “this error” but it worked for me and I wanted to share.

I’m not convinced the two of you are even talking about the same error. When you post about an error, you ALWAYS need to either give an input file or make it clear which input file you’re talking about. For all I know, “boron.in” is an input file which doesn’t even use wavefunction serialization.

I indeed don’t think that this is the same as I’m not even working on a cluster but on my laptop without any -n settings/options.

@jmisiewicz, keep me in touch when you’ve done this “one line of code” in the developer version. I’ll install it then. Thanks a lot.

PS: will the problem be solved for both CASCI and CASSCF with this simple fix ?

Yes, this will fix anything that runs through the detci module. That includes both CASSCF and CASCI.

It turned out to be three lines of code, but either way, it’s submitted as a pull request. That’ll be on the developer version once it gets accepted, which should be within a day or two. I’ll leave checking when that’s in to you, because I have enough to do. Once that’s in, build from source per here, and it should work. I ran an fci reading in a wavefunction, and once I added this code, it worked.

1 Like

Hi,

I will do the checks and do an update here. Unfortunately I have problems to install psi4 from source. I have a mac but I don’t know why my clang compiler is not well working so I usually use gcc/g++ (8.3.0). So I just disabled the option -stdlib=libc++ by doing:

cmake -H. -Bobjdir -DCMAKE_CXX_FLAGS="-march=native"

At first I got several issues with OpenMP it seems but I think I managed to fix that.
I don’t see any warnings or errors in the configuration, but when compiling I get at the end:

[ 98%] Linking CXX shared library core.cpython-37m-darwin.so
duplicate symbol _lsame_ in:
    /usr/local/lib/liblapack.a(lsame.o)
    /usr/local/lib/librefblas.a(lsame.o)
duplicate symbol _xerbla_ in:
    /usr/local/lib/liblapack.a(xerbla.o)
    /usr/local/lib/librefblas.a(xerbla.o)
duplicate symbol _xerbla_array_ in:
    /usr/local/lib/liblapack.a(xerbla_array.o)
    /usr/local/lib/librefblas.a(xerbla_array.o)
ld: 3 duplicate symbols for architecture x86_64

I admit I don’t have so much experience with such errors, I tried to dig on the internet and do some trial & error with my path to librairies in bash_profile, but couldn’t find the issue. Any hint maybe ?

Thanks a lot

I refer any and all build questions to @loriab