Frequency Calculation Stalls in JupyterNotebook / Python interpreter

Hi Everyone,

I’m using psi4 1.3.2+ecbda83 and psi4-rt 1.3.2 in a jupyter notebook (docker-stacks/base-notebook 1.0). It uses python 3.7.3.

I’m able to run a frequency calculation from the docker shell by typing:
python fluoro.py

fluro.py:

import psi4
psi4.set_memory('1000 MB')
fluoropropane = psi4.geometry("pubchem:fluoropropane")
psi4.optimize('scf/6-31G*')
psi4.frequencies('scf/6-31G*')

But when I input the commands one at a time in the notebook the kernel hangs during the frequency calculation (see below).

Interestingly, if I type the commands one at a time into the interpreter from the shell (or from my local computer) it also hangs at this part. I only have one conda environment (base).

Is there something I’m missing that’s making this script work by calling python fluoro.py, but not work by typing the commands into the interpreter one by one?

Thanks,
Mark

     ------------------------------------------------------------
                               SCF HESS                          
                      Rob Parrish, Justin Turney,                
                   Andy Simmonett, and Alex Sokolov              
     ------------------------------------------------------------

==> Geometry <==

Molecular point group: c1
Full point group: C1

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

   Center              X                  Y                   Z               Mass       
------------   -----------------  -----------------  -----------------  -----------------
     F            1.305114476556     0.562863558848     0.150412763906    18.998403162730
     C           -0.713066809587    -0.665499709868     0.271801362393    12.000000000000
     C            0.687761997026    -0.579871276191    -0.298229189268    12.000000000000
     C           -1.596364976296     0.509971038742    -0.142875453327    12.000000000000
     H           -0.643838592793    -0.713858631781     1.354709243169     1.007825032230
     H           -1.154099616661    -1.603043881699    -0.059256441026     1.007825032230
     H            1.293901552939    -1.422148542234     0.011541920525     1.007825032230
     H            0.672679719352    -0.539013461466    -1.381030071263     1.007825032230
     H           -2.587585323109     0.421144015990     0.289293849995     1.007825032230
     H           -1.167142239992     1.448234170011     0.187998117523     1.007825032230
     H           -1.707546201726     0.554486059258    -1.222806581132     1.007825032230

Nuclear repulsion = 131.168102975851838

==> Basis Set <==

Basis Set: 6-31G*
Blend: 6-31G*
Number of shells: 38
Number of basis function: 74
Number of Cartesian functions: 74
Spherical Harmonics?: false
Max angular momentum: 2

==> DFJKGrad: Density-Fitted SCF Gradients <==

Gradient:                    2
J tasked:                  Yes
K tasked:                  Yes
wK tasked:                  No
OpenMP threads:              1
Integrals threads:           1
Memory [MiB]:              715
Schwarz Cutoff:          0E+00
Fitting Condition:       1E-10

=> Auxiliary Basis Set <=

Basis Set: (6-31G* AUX)
Blend: CC-PVDZ-JKFIT
Number of shells: 159
Number of basis function: 499
Number of Cartesian functions: 499
Spherical Harmonics?: false
Max angular momentum: 3

<at this part it just hangs at 100% cpu usage>

I’m reminded of this report. @loriab, can you check if there’s an error message when you run this input with DDD? I’m not sure if the DDD branch in the PR is up-to-date or not.

It might be related, I tried a couple more things: python 3.6 vs 3.7 doesn’t make a difference.

if I specify dertype=1 those commands run fine in the python shell interpreter, but not in the Jupyter Notebook (instead of hanging I get this error):

psi4.frequencies(‘scf/6-31G*’,dertype=1)

SystemError Traceback (most recent call last)
in
----> 1 psi4.frequencies(‘scf/6-31G*’,dertype=1)

/opt/conda/lib/python3.7/site-packages/psi4/driver/driver.py in frequency(name, **kwargs)
1462
1463 # Compute the hessian
-> 1464 H, wfn = hessian(name, return_wfn=True, molecule=molecule, **kwargs)
1465
1466 # Project final frequencies?

/opt/conda/lib/python3.7/site-packages/psi4/driver/driver.py in hessian(name, **kwargs)
1204 # Check if this is a CBS extrapolation
1205 elif gradient_type == “cbs_gufunc”:
-> 1206 return driver_cbs._cbs_gufunc(hessian, name.lower(), **kwargs, ptype=“hessian”)
1207 elif gradient_type == “cbs_wrapper”:
1208 return driver_cbs.cbs(hessian, “cbs”, **kwargs, ptype=“hessian”)

/opt/conda/lib/python3.7/site-packages/psi4/driver/driver_cbs.py in _cbs_gufunc(func, total_method_name, **kwargs)
1947 optstash = p4util.OptionsState([‘BASIS’])
1948 core.set_global_option(‘BASIS’, basis)
-> 1949 ptype_value, wfn = func(method_name, return_wfn=True, molecule=molecule, **kwargs)
1950 core.clean()
1951

/opt/conda/lib/python3.7/site-packages/psi4/driver/driver.py in hessian(name, **kwargs)
1283
1284 # Obtain list of displacements
-> 1285 findif_meta_dict = driver_findif.hessian_from_gradient_geometries(molecule, irrep)
1286
1287 # Record undisplaced symmetry for projection of displaced point groups

/opt/conda/lib/python3.7/site-packages/psi4/driver/driver_findif.py in hessian_from_gradient_geometries(molecule, irrep)
889 Dictionary of finite difference data, specified in _geom_generator docstring.
890 “”"
–> 891 return _geom_generator(molecule, irrep, “2_1”)
892
893

/opt/conda/lib/python3.7/site-packages/psi4/driver/driver_findif.py in _geom_generator(mol, freq_irrep_only, mode)
338 mol = core.Molecule.from_dict(mol.to_dict())
339
–> 340 data = _initialize_findif(mol, freq_irrep_only, mode, init_string, 1)
341
342 # We can finally start generating displacements.

/opt/conda/lib/python3.7/site-packages/psi4/driver/driver_findif.py in _initialize_findif(mol, freq_irrep_only, mode, initialize_string, verbose)
168
169 # Populate salc_indices_pi for all irreps.
–> 170 for i, salc in enumerate(salc_list):
171 salc_indices_pi[salc.irrep_index()].append(i)
172

SystemError: <built-in method next of PyCapsule object at 0x7f715a0e23c0> returned NULL without setting an error

I just built psi4 from master (65c092) and frequency calculations are working if I use dertype=1
psi4.frequencies(‘scf/6-31G*’, dertype=1) but still stalling if I don’t include that option. (when run from a jupyter notebook in a docker container).

Thanks for the update! This is a known issue, and I’ve notified the other developers that we still need to deal with this.

I’m currently battling some other bugs, so I won’t be able to assist in fixing this.

Update: We’ve found the problem, and this will be fixed in v1.4.

Great, thanks. I’ll keep an eye out for it.