Custom defined basis set


#1

Hello PSI4-users,

I was following a tutorial to use psi4 api in python (https://github.com/psi4/psi4numpy/blob/master/Tutorials/01_Psi4NumPy-Basics/1g_basis-sets.ipynb). The example works fine, and I when I try to do similar thing with He-He(+) system I am hitting a roadblock. Here is my code:

import psi4
import numpy as np
psi4.core.set_output_file('output.dat', False)
hehe_plus = psi4.geometry("""
  1 2
  He 0.0 0.0  2.0
  He 0.0 0.0 -2.0
""")
psi4.core.IO.set_default_namespace("hehe_plus")

def basisspec_psi4_yo__anonymous775(mol, role):
    basstrings = {}
    mol.set_basis_by_symbol("He", "HEonlyS", role=role)
    basstrings['HEonlyS'] = """
cartesian
****
He  0
S    4  1.0
11.042785        -0.0577090
2.784478         -0.1869975
0.777509         -0.3561658
0.222223         -0.2708717
S     4  1.0
11.042785       -0.1051864
2.784478        -0.3909365
0.777509        -0.8380637
0.222223         1.4428743
****
"""
    return basstrings

psi4.qcdb.libmintsbasisset.basishorde['USERDEFINED'] = basisspec_psi4_yo__anonymous775
psi4.set_options({'basis': 'userdefined',
                  'scf_type': 'pk',
                  'e_convergence': 11,
                  'd_convergence': 11})

eb, wfn = psi4.energy('scf', return_wfn=True)
mints = psi4.core.MintsHelper(wfn.basisset())
S = np.asarray(mints.ao_overlap())
T = np.asarray(mints.ao_kinetic())
V = np.asarray(mints.ao_potential())
H = T + V
print(S)
print(H)

The error I am getting is “QcdbException BasisSetNotFound”. I am not able to find where I was going wrong with the basis set definition. Any help is appreciated. Thank you very much.

Best Regards.


#2

Can you edit your post so that the input is enclosed by triple backticks (```)? The basis set parser is notoriously picky about syntax, so those tiny details which the forum thinks are formatting are likely important. The only way to see them is to use those backticks.


#3

Yeah, changed the formatting, thank you for the tip.


#4

All keys to basstring need to be in lowercase. On changing HeOnlyS to heonlys on line 14, the basis set parsing is successful.

You do need to set the reference to UHF or ROHF, though, since this is an open-shell species.


#5

Thanks a lot, that solved my problem. I changed the reference to UHF too.