User-defined basis in two-component calculations leads to "'NoneType' object has no attribute 'lower' "

I tried to use user-defined basis set for two-component calculations. For example,

molecule h2 {
  0 1
 H
 H 1  r

  r = 0.7414
}

set {
  reference   rhf
  relativistic dkh
  dkh_order 2
  scf_type pk
}

basis {
   assign H aug-cc-pVDZ-DK-def

[aug-cc-pVDZ-DK-def]
spherical
****
H     0
S    4   1.00
     13.0100000              0.0196977
      1.9620000              0.1379911
      0.4446000              0.4781418
      0.1220000              0.5012326
S    1   1.00
      0.1220000              1.0000000
S    1   1.00
      0.0297400              1.0000000
P    1   1.00
      0.7270000              1.0000000
P    1   1.00
      0.1410000              1.0000000
****
}



basis_relativistic  {
   assign H aug-cc-pVDZ-DK-def-d

[aug-cc-pVDZ-DK-def-d]
spherical
****
H     0
S    1   1.00
     13.0100000              1.0000000
S    1   1.00
      1.9620000              1.0000000
S   1  1.00
      0.4446000              1.0000000
S   1 1.00
      0.1220000              1.0000000
S    1   1.00
      0.1220000              1.0000000
S    1   1.00
      0.0297400              1.0000000
P    1   1.00
      0.7270000              1.0000000
P    1   1.00
      0.1410000              1.0000000
****
}

energy('hf')

I got


AttributeError: 'NoneType' object has no attribute 'lower'

Printing out the relevant lines from the Psithon --> Python processed input file:
    ****
    """
        return basstrings
    qcdb.libmintsbasisset.basishorde['_RELATIVISTIC'] = basisspec_psi4_yo___relativistic
    core.set_global_option("BASIS", "_relativistic")
--> energy('hf')


!---------------------------------------------!
!                                             !
!  'NoneType' object has no attribute 'lower' !
!                                             !
!---------------------------------------------!

with PSI4 1.6.1

This question suggests basis_relativistic keyword, which I have used. So how to fix this input file?

I tried another input

molecule h2 {
  0 1
 H
 H 1  r

  r = 0.7414
}


basis mb {
[aug-cc-pVDZ-DK-def]
spherical
****
H     0
S    4   1.00
     13.0100000              0.0196977
      1.9620000              0.1379911
      0.4446000              0.4781418
      0.1220000              0.5012326
S    1   1.00
      0.1220000              1.0000000
S    1   1.00
      0.0297400              1.0000000
P    1   1.00
      0.7270000              1.0000000
P    1   1.00
      0.1410000              1.0000000
****

assign H aug-cc-pVDZ-DK-def
}



basis mb2 {
[aug-cc-pVDZ-DK-def-d]
spherical
****
H     0
S    1   1.00
     13.0100000              1.0000000
S   1 1.00
      1.9620000              1.0000000
S 1 1.00
      0.4446000              1.0000000
S 1 1.00
      0.1220000              1.00000
S    1   1.00
      0.1220000              1.0000000
S    1   1.00
      0.0297400              1.0000000
P    1   1.00
      0.7270000              1.0000000
P    1   1.00
      0.1410000              1.0000000
****

assign H aug-cc-pVDZ-DK-def-d
}


set {
  reference   rhf
  relativistic dkh
  dkh_order 2
  scf_type pk
  basis mb
  basis_relativistic  mb2 
}

energy('hf')

I got

----------------------------------------------------------------------------------!
!                                                                                  !
!  ADIIS minimization failed. File a bug, and include your entire input and output !
!     files.                                                                       !
!                                                                                  !
!----------------------------------------------------------------------------------!

There are multiple issues in this topic. I’d like to look at them, but I’m busy with improving some other code in Psi, so it may be a few days before I can look at this in more detail (along with your other topic).

As a quick workaround, use set scf scf_initial_accelerator none to disable ADIIS optimization and allow your second input to proceed. I’m troubled that this is necessary, but I can’t diagnose why without more time than I currently have.

Thanks. Please take your time. By adding scf scf_initial_accelerator none , the input became

molecule h2 {
  0 1
 H
 H 1  r

  r = 0.7414
}


basis mb {
[aug-cc-pVDZ-DK-def]
spherical
****
H     0
S    4   1.00
     13.0100000              0.0196977
      1.9620000              0.1379911
      0.4446000              0.4781418
      0.1220000              0.5012326
S    1   1.00
      0.1220000              1.0000000
S    1   1.00
      0.0297400              1.0000000
P    1   1.00
      0.7270000              1.0000000
P    1   1.00
      0.1410000              1.0000000
****

assign H aug-cc-pVDZ-DK-def
}



basis mb2 {
[aug-cc-pVDZ-DK-def-d]
spherical
****
H     0
S    1   1.00
     13.0100000              1.0000000
S   1 1.00
      1.9620000              1.0000000
S 1 1.00
      0.4446000              1.0000000
S 1 1.00
      0.1220000              1.00000
S    1   1.00
      0.1220000              1.0000000
S    1   1.00
      0.0297400              1.0000000
P    1   1.00
      0.7270000              1.0000000
P    1   1.00
      0.1410000              1.0000000
****

assign H aug-cc-pVDZ-DK-def-d
}


set {
  reference   rhf
  relativistic dkh
  dkh_order 2
  scf_type pk
  basis mb
  basis_relativistic  mb2 
}


set scf scf_initial_accelerator none

energy('hf')

and I got the error message :frowning:


  ==> Iterations <==

                        Total Energy        Delta E     RMS |[F,P]|

   @RHF iter SAD:                  nan            nan   0.00000e+00

Traceback (most recent call last):
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/bin/psi4", line 338, in <module>
    exec(content)
  File "<string>", line 85, in <module>
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/lib//python3.8/site-packages/psi4/driver/driver.py", line 501, in energy
    wfn = procedures['energy'][lowername](lowername, molecule=molecule, **kwargs)
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/lib//python3.8/site-packages/psi4/driver/procrouting/proc.py", line 2455, in run_scf
    scf_wfn = scf_helper(name, post_scf=False, **kwargs)
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/lib//python3.8/site-packages/psi4/driver/procrouting/proc.py", line 1670, in scf_helper
    e_scf = scf_wfn.compute_energy()
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/lib//python3.8/site-packages/psi4/driver/procrouting/scf_proc/scf_iterator.py", line 86, in scf_compute_energy
    self.iterations()
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/lib//python3.8/site-packages/psi4/driver/procrouting/scf_proc/scf_iterator.py", line 412, in scf_iterate
    for engine_used in self.diis(Dnorm):
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/lib//python3.8/site-packages/psi4/driver/procrouting/scf_proc/subclass_methods.py", line 111, in _RHF_diis
    return self.diis_manager_.extrapolate(self.Fa(), Dnorm=Dnorm)
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/lib//python3.8/site-packages/psi4/driver/procrouting/diis.py", line 375, in extrapolate
    coeffs = self.diis_coefficients()
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/lib//python3.8/site-packages/psi4/driver/procrouting/diis.py", line 271, in diis_coefficients
    return np.linalg.lstsq(B, rhs, rcond=None)[0][:-1]
  File "<__array_function__ internals>", line 180, in lstsq
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/lib//python3.8/site-packages/numpy/linalg/linalg.py", line 2300, in lstsq
    x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj)
  File "/mnt/home/user/psi4conda/envs/psi4-test-2/lib//python3.8/site-packages/numpy/linalg/linalg.py", line 101, in _raise_linalgerror_lstsq
    raise LinAlgError("SVD did not converge in Linear Least Squares")

numpy.linalg.LinAlgError: SVD did not converge in Linear Least Squares


Printing out the relevant lines from the Psithon --> Python processed input file:
    core.set_global_option("DKH_ORDER", 2)
    core.set_global_option("SCF_TYPE", "pk")
    core.set_global_option("BASIS", "mb")
    core.set_global_option("BASIS_RELATIVISTIC", "mb2")
    core.set_local_option("SCF", "SCF_INITIAL_ACCELERATOR", "none")
--> energy('hf')

!-----------------------------------------------!
!                                               !
!  SVD did not converge in Linear Least Squares !
!                                               !
!-----------------------------------------------!

    Psi4 stopped on: Wednesday, 26 October 2022 11:40AM
    Psi4 wall time for execution: 0:00:00.26

*** Psi4 encountered an error. Buy a developer more coffee!
*** Resources and help at github.com/psi4/psi4.

I bet at least some of your problems are caused by the duplicated functions in the relativistic basis

1 Like

I figured out the first problem – the input parser hadn’t been taught about that basis role. You can switch out the line below; it’s python so no re-build required.

diff --git a/psi4/driver/inputparser.py b/psi4/driver/inputparser.py
index 826814fb8..ad77e37f1 100644
--- a/psi4/driver/inputparser.py
+++ b/psi4/driver/inputparser.py
@@ -706,7 +706,7 @@ def process_input(raw_input: str, print_level: int = 1) -> str:
 
     # Process "basis name? { ... }"
     basis_block = re.compile(
-        r'^(\s*?)(basis|df_basis_scf|df_basis_mp2|df_basis_cc|df_basis_sapt|df_basis_sad|df_basis_dct)[=\s]*(\w*?)\s*\{(.*?)\}',
+        r'^(\s*?)(basis_relativistic|df_basis_scf|df_basis_mp2|df_basis_cc|df_basis_sapt|df_basis_sad|df_basis_dct|basis)[=\s]*(\w*?)\s*\{(.*?)\}',
         re.MULTILINE | re.DOTALL | re.IGNORECASE)
     temp = re.sub(basis_block, process_basis_block, temp)
 

And Susi was right about the duplicated functions. The below runs. (This isn’t necessarily the minimum input changes.)

molecule h2 {
  0 1
 H
 H 1  r

  r = 0.7414
}

set {
  reference   rhf
  relativistic dkh
  dkh_order 2
  scf_type pk
  df_scf_guess false
  guess core
}
set scf scf_initial_accelerator none

basis myprimary {
   assign H aug-cc-pVDZ-DK-def

[aug-cc-pVDZ-DK-def]
spherical
****
H     0
S    4   1.00
     13.0100000              0.0196977
      1.9620000              0.1379911
      0.4446000              0.4781418
      0.1220000              0.5012326
S    1   1.00
      0.1220000              1.0000000
S    1   1.00
      0.0297400              1.0000000
P    1   1.00
      0.7270000              1.0000000
P    1   1.00
      0.1410000              1.0000000
****
}



basis_relativistic mydecon {
   assign H aug-cc-pVDZ-DK-def-d

[aug-cc-pVDZ-DK-def-d]
spherical
****
H     0
S    1   1.00
     13.0100000              1.0000000
S    1   1.00
      1.9620000              1.0000000
S   1  1.00
      0.4446000              1.0000000
S   1 1.00
      0.1220000              1.0000000
#S    1   1.00
#      0.1220000              1.0000000
S    1   1.00
      0.0297400              1.0000000
P    1   1.00
      0.7270000              1.0000000
P    1   1.00
      0.1410000              1.0000000
****
}

#set basis myprimary
#set basis_relativistic mydecon

energy('hf')
1 Like

Thank you so much! Haven’t tried the first one. At least the second approach works now :slight_smile: I should have been more careful about decontraction the basis set manually. Though I can use the default setting in PSI4,

https://psicode.org/psi4manual/master/relativistic.html

By default, if the input file specifies only BASIS, then the X2C module will solve the modified Dirac equation in an uncontracted basis

but later I need some customization, so I think I have to specified

1 Like