Segmentation faults + symmetry issues

Hi,

I am not sure if the build category is the right place to post this, or if I should post it on GitHub or here. Apologies if this is the wrong place. I am using psi4 1.1add49b9 on a Linux Redhat system, and have installed psi4 within a conda environment. I have two different issues I wanted to ask about:

  1. I get a segmentation fault for the following input:

    import psi4
    import numpy as np

    molecule h_lat {
    A = 2.0000
    #atom x y z
    #left top
    H -A A 0.000
    #middle top
    H 0.000 A 0.000
    #right top
    H A A 0.000
    #left middle
    H -A 0.000 0.000
    #origin
    H 0.000 0.000 0.000
    #right middle
    H A 0.000 0.000
    #left bottom
    H -A -A 0.000
    #middle bottom
    H 0.000 -A 0.000
    #right bottom
    #H A -A 0.000
    symmetry c1
    }

    psi4.set_options({‘reference’: ‘rhf’, ‘scf_type’: ‘df’, ‘maxiter’: 500, ‘stability_analysis’: ‘follow’})

    scf_e, scf_wfn = psi4.energy(‘scf/sto-3g’, molecule=h_lat, return_wfn=True)

Why does this happen? I know the geometry is unusual, but the segmentation fault occurs for a variety of values of A.

  1. Given any input molecule, when I specify symmetry in the molecule geometry, scf_wfn.H() returns the actual Hamiltonian. But when I don’t specify the symmetry, I get the memory location of the Hamiltonian.
import psi4
import numpy as np

molecule h2 {
H 0.0 0.0 0.0
H 0.0 0.0 0.7
}

psi4.set_options({'reference': 'rhf', 'scf_type': 'df'})

scf_e, scf_wfn = psi4.energy('scf/sto-3g', molecule=h2, return_wfn=True)
mints = psi4.core.MintsHelper(scf_wfn.basisset())

h=np.asarray(scf_wfn.H())
print(h)

gives output: <psi4.core.Matrix object at 0x2b67243bc470>. But when I add symmetry c1 in the geometry, I get:

[[-1.14765024 -1.00692423] [-1.00692423 -1.14765024]]
as my output. Is this intentional?

Thank you, and please let me know if I should post this question elsewhere.

  1. can you post the geometry?

  2. Wavefunctions with symmetry cannot be represented by a single numpy array. So when using the NumPy casting technology nothing happens due its default pass through. Please see the Irrep section here: http://www.psicode.org/psi4manual/master/numpy.html

  1. I have posted the geometry for both issues. Is there some other geometry you want that I’m missing?
  2. So for wfns with symmetry, I should create numpy matrix/vector objects first, and then pass them to psi4 and then run scf on them? Am I understanding this correctly? Is this also why in the instances I don’t get a segmentation error, I’m getting a divide-by-zero error originating from vecutil.py?

Thanks!

For 1) what does Psi4 show as the XYZ? Im not at a computer at the moment to try this myself.

For 2) what you should do is write scf_wfn.H().to_array() to get back out the H matrix with irreps (a list of NumPy arrays). Which operations are you doing when you get seg faults?

  1. Here is the psi4 geometry, sorry for the delay in sending this:
Molecular point group: c1
    Full point group: Cs

    Geometry (in Angstrom), charge = 0, multiplicity = 1:

       Center              X                  Y                   Z               Mass
    ------------   -----------------  -----------------  -----------------  -----------------
           H          0.000000000000     2.474873734153     0.000000000000     1.007825032070
           H         -1.414213562373     1.060660171780     0.000000000000     1.007825032070
           H          0.000000000000    -0.353553390593     0.000000000000     1.007825032070
           H          0.000000000000     1.060660171780     0.000000000000     1.007825032070
           H          0.000000000000    -0.353553390593     0.000000000000     1.007825032070
           H          0.000000000000    -1.767766952966     0.000000000000     1.007825032070
           H          0.000000000000    -0.353553390593     0.000000000000     1.007825032070
           H          1.414213562373    -1.767766952966     0.000000000000     1.007825032070

  Running in c1 symmetry.
  1. The segmentation fault occurs for energy(‘scf’) with a few different reference/basis set/scf_type options.

Are your atoms 3, 5, 7 at the same point in space? I’m surprised that molecule got through.

Small consolation, but it looks like my new mol parser fares better:

    units Angstrom
    0 1
    --
    0 1
    H                            -A                  A     2.474873734153
    H                1.414213562373                  A     1.060660171780
    H                             A                  A    -0.353553390593
    H                            -A     0.000000000000     1.060660171780
    H                0.000000000000     0.000000000000    -0.353553390593
    H                             A     0.000000000000    -1.767766952966
    H                            -A                 -A    -0.353553390593
    H               -1.414213562373                 -A    -1.767766952966

    A         =   -0.0000000000


    Molecular point group: c1
    Full point group: C2v

    Geometry (in Angstrom), charge = 0, multiplicity = 1:

       Center              X                  Y                   Z       
    ------------   -----------------  -----------------  -----------------
           H          0.000000000000     0.000000000000     2.474873734153
           H          1.414213562373     0.000000000000     1.060660171780
           H          2.828427124746     0.000000000000    -0.353553390593
           H         -1.414213562373     0.000000000000     1.060660171780
           H          0.000000000000     0.000000000000    -0.353553390593
           H          1.414213562373     0.000000000000    -1.767766952966
           H         -2.828427124746     0.000000000000    -0.353553390593
           H         -1.414213562373     0.000000000000    -1.767766952966

So given that in my initial input geometry atoms 3, 5, and 7 don’t have the same coordinates (given that A != 0), why does the molecule parser make them the same? And how can I fix this?

Also, just in general, I am curious to know how the geometry is parsed. Is the user-input geometry not used as given?

It gets parsed here. But given that I just removed that fn from the dev psi a couple days ago, I wouldn’t examine it too closely.

Whether geom is used as given depends on Cartesian (yes; subject to com/orientation) vs. ZMat/variables (gets complicated). As a stopgap, feed psi non-variable Cartesians. Sorry about that, but I’m not inclined to debug code that’s soon to be gone. Certainly you’re in the right and psi is in the wrong molecule-parsing-wise.