Psi4 Takes too Long to Save Computation Results to Python Notebook

I was using psi4 to run vibrational frequency analysis with small molecules (in a jupyter notebook) and it works just fine with molecules like methanol and water but once I move up to ethanol or acetone, I can see the prompt can do the computations just fine but it gets stuck on saving the results file to my notebook (the prompt just says ‘Saving file at x.ipynb’). Has anyone run into this error before? If so, how did you fix it?

This doesn’t sound like a Psi4 problem, but would you be willing to share your Jupyter notebook so that others can try to reproduce it?

1 Like

Yes, thank you!

Here’s my code:

Blockquote

#import psi4 and set memory

import psi4

psi4.set_memory('10 GB')

from rdkit import Chem # main tools
from rdkit.Chem import AllChem # additional tools, including 3D

smiles = 'CCO' # smiles string input
mol = Chem.MolFromSmiles(smiles) # initialize molecule

mol_h = Chem.AddHs(mol) # adding explicit Hs for 3D generation
cid = AllChem.EmbedMolecule(mol_h) # returns the id of the generated conformer,
                                 # and -1 if no conformers were generated

AllChem.MMFFOptimizeMolecule(mol_h) # optimize molecule with MMFF94 forcefield
mol_xyz=Chem.rdmolfiles.MolToXYZBlock(mol_h) # save to xyz string

print(mol_xyz)

#check structure of molecule
mol

#convert xyz file to psi4 geometry file
qmol = psi4.driver.qcdb.Molecule.from_string(mol_xyz, dtype='xyz+')
mol_psi4 = psi4.geometry(qmol.create_psi4_string_from_molecule())

#initialize molecule 
mol_psi4.update_geometry()

#optimize geometry before calculating frequencies
psi4.set_options({'reference': 'rhf'})
psi4.optimize('scf/cc-pvdz', dft_functional = 'b3lyp', molecule=mol_psi4)

#calculate vibrational frequencies
scf_e, scf_wfn = psi4.frequency('scf/cc-pvdz', molecule=mol_psi4, return_wfn=True)
print('done')

#save and print frequencies + intesity
freq=scf_wfn.frequency_analysis['omega'][2]
for i in freq:
    print(i)

print('')
print('Done!!!')

This ran fine for me both directly through Python and in a jupyter notebook. Note that I did have to change the line:

freq=scf_wfn.frequency_analysis['omega'][2]

to

freq=scf_wfn.frequency_analysis['omega'].data
1 Like

Hmm, I think it’s maybe an issue with my setup then, thank you so much for taking the time to run it!