Repository: pyscf/pyscf — pull request #1891 (python)
Title: Assume 46 and 78 core configurations to be f-in-valence

This is a reasonable default and should fix  #1889. I added a test with `mf.get_init_guess()` to catch the error.

What should be the way to introduce another core configuration to the same element and number of electrons? 
An `f_in_core`  attribute should be added somewhere.

Resolved issues:
title: Using ECP gives an error for Actinide elements
body: I am trying to do a HF/DFT calculation on a system involving a U atom and trying to invoke the effective core potential (ECP) 'crenbl' but that gives a numpy error:   LinAlgError('Last 2 dimensions of the array must be square'). The error goes away if ECP is turned off. The same thing happens when using other ECPs (eg. 'stuttgart') listed in the pyscf User Guide or on Basis set exchange for U and other Actinide elements. I am using pyscf v2.3.0 with numpy v1.26.0, scipy v1.11.3, h5py v3.9.0 and python v3.10.13 on Mac ARM architechture. The code is as follows:

```python
from pyscf import gto, scf, dft                                             

mol = gto.Mole()
mol.atom='''
U    -0.00000    0.00000    0.00000
H     -1.70048   -1.32378   -0.00000
H      1.70048   -1.32378   -0.00000
'''
mol.basis={'U':'crenbl','H':'6-31++g**'}                                      
mol.ecp={'U':'crenbl'}                                                        
mol.symmetry = True          
mol.build()

mf = dft.ROKS(mol)
mf.xc='b3lyp,b3lyp'
mf.max_cycle = 60
mf.conv_tol = 1e-9
mf.kernel()
``` 

Hints:

Fix patch:
diff --git a/pyscf/gto/ecp.py b/pyscf/gto/ecp.py
index e686b88f26..d6a264318e 100644
--- a/pyscf/gto/ecp.py
+++ b/pyscf/gto/ecp.py
@@ -145,10 +145,12 @@ def core_configuration(nelec_core, atom_symbol=None):
     elements_4f = ELEMENTS[57:71]
     elements_5f = ELEMENTS[89:103]
     if atom_symbol in elements_4f:
-        for i in range(46, 60):
+        # TODO: fix La3+ and Ce4+ ECP46MWB f-in-core ECPs
+        for i in range(47, 59):
             conf_dic[i] = '4s3p2d1f'
     if atom_symbol in elements_5f:
-        for i in range(78, 92):
+        # TODO: fix Ac3+, Th4+, Pa5+ and U6+ ECP78MWB f-in-core ECPs
+        for i in range(79, 91):
             conf_dic[i] = '5s4p3d2f'
     if nelec_core not in conf_dic:
         raise RuntimeError('Core configuration for %d core electrons is not available.' % nelec_core)


Test patch:
diff --git a/pyscf/gto/test/test_ecp.py b/pyscf/gto/test/test_ecp.py
index f35d0e1f9e..d2341396f3 100644
--- a/pyscf/gto/test/test_ecp.py
+++ b/pyscf/gto/test/test_ecp.py
@@ -376,9 +376,19 @@ def test_ecp_f_in_core(self):
 2      5.3988000000      -63.6010500000
                     ''')}, charge=2, verbose=0)
         mf = scf.RHF(mol)
+        mf.get_init_guess()
         self.assertEqual(mol.ao_labels()[0], '0 Eu1 5s    ')
         self.assertAlmostEqual(lib.fp(mf.get_hcore()), 22.59028455662168)
 
+    def test_ecp_f_in_valence(self):
+        mol = gto.M(atom='U, 0.00, 0.00, 0.00',
+                    basis={'U': 'crenbl'}, ecp={'U': 'crenbl'},
+                    charge=3, spin=3, verbose=0)
+        mf = scf.ROHF(mol)
+        mf.get_init_guess()
+        self.assertEqual(mol.ao_labels()[40], '0 U 5f-3  ')
+        self.assertAlmostEqual(lib.fp(mf.get_hcore()), -55.38627201912257)
+
 
 if __name__ == '__main__':
     print("Full Tests for ECP")