RuntimeError: Engine::lmax_exceeded -- angular momentum limit exceeded

I encountered the title error with below code

        mol_input = str(charge) + " " + str(spinmulti)
        for atom in mol.GetAtoms():
            mol_input += "\n" + atom.GetSymbol() \
                + " " + str(conf.GetAtomPosition(atom.GetIdx()).x)\
                + " " + str(conf.GetAtomPosition(atom.GetIdx()).y)\
                + " " + str(conf.GetAtomPosition(atom.Get  Idx()).z)
            geo = psi4.geometry(mol_input)

            #psi4.optimize(level, molecule=geo)
            energy, wf_o = psi4.optimize(level, molecule=geo, return_wfn=True)
            # single poinr energy calc.
            energy, wf_e =, molecule=geo, return_wfn=True)

            print("\t>>>>> frequency calculation will start, here")
            energy, wf_f = psi4.frequency(level, molecule=geo, return_wfn=True)

the output is below

mol_input = 0 1
I 1.9256644496641202 -0.032917443081063716 0.006780758800296458
C -0.18614923907723008 0.003182045137621483 -0.0006554942795642219
H -0.5910009858970279 -0.4559850791342856 0.9063130861999501
H -0.5622325375580698 1.0294328546154472 -0.0526369195110689
H -0.586281687131795 -0.5437123775377177 -0.8598014312096133
	>>>>> frequency calculation will start, here
RuntimeError: Engine::lmax_exceeded -- angular momentum limit exceeded

a .sdf file I used is below

I actually found this answer

The above one is bit old answer, I expect other counter-measures might exist…

The only way is to recompile psi4?
I found the option in CMakeList


option_with_default(MAX_AM_ERI "Maximum angular momentum for integrals. The definition changed with Libint2 but still single integer. Default fine for production." 5)

I actully tried to perform re-installation. But, error happens

$ cmake -S. -DMAX_AM_ERI=7 -DLibint2_DIR=/home/xxxx/xxxx/software/psi4/psi4-1.7/
-- Could NOT find Libint2 (missing: Libint2_DIR)
-- Suitable Libint2 could not be located, Building Libint2 7-7-4-7-7-5 instead.
CMake Warning (dev) at /usr/share/cmake-3.24/Modules/ExternalProject.cmake:3071 (message):
$ sudo make -j6 install
[sudo] password for tomohisa:
[  2%] Installing Psi4-detected BLAS/LAPACK
-- Install configuration: "Release"
[ 60%] Built target libxc_external
[ 60%] Built target libint2_external
[ 60%] Built target pybind11_external
[ 60%] Built target lapack_external
[ 80%] Built target gau2grid_external
[ 82%] Performing configure step for 'psi4-core'
loading initial cache file /home/tomohisa/mywin/mywork/minfo/software/psi4/psi4-1.7/
-- Detecting MathOpenMP -- ?OpenMP=ON, ?MKL=, LANG=CXX, C/CXX/Fortran=GNU/GNU/
-- Using LAPACK: /usr/lib/x86_64-linux-gnu/;...
-- Disabled HDF5
-- Found pybind11: /home/tomohisa/mywin/mywork/minfo/software/psi4/psi4-1.7/ (found version "2.10.1")
-- Using pybind11: /home/tomohisa/mywin/mywork/minfo/software/psi4/psi4-1.7/ (version 2.10.1 for Py3.9.10 and 17)
-- Using Python 3.9: /home/tomohisa/mywin/mywork/minfo/burnish/venv_py39_mol-predict/bin/python3.9
CMake Warning (dev) at /usr/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (libdl) does
  not match the name of the calling package (DL).  This can lead to problems
  in calling code that expects `find_package` result variables (e.g.,
  `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /home/tomohisa/mywin/mywork/minfo/software/psi4/psi4-1.7/cmake/FindLibX.cmake:46 (find_package_handle_standard_args)
  /home/tomohisa/mywin/mywork/minfo/software/psi4/psi4-1.7/cmake/FindDL.cmake:8 (find_lib_x)
  CMakeLists.txt:74 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Disabled ambit
-- Disabled CheMPS2
-- Disabled dkh
-- Disabled ecpint
-- Disabled libefp
-- Disabled erd
-- Using gau2grid: /home/tomohisa/mywin/mywork/minfo/software/psi4/psi4-1.7/ (version 2.0.7)
-- Disabled gdma
-- Libint2Config components requested: CXX_ho;eri_c2_d0_l4;eri_c2_d1_l3;eri_c2_d2_l3;eri_c3_d0_l4;eri_c3_d1_l3;eri_c3_d2_l3;eri_c4_d0_l7;eri_c4_d1_l2;eri_c4_d2_l2;gss;impure_sh;onebody_d0_l4;onebody_d1_l3;onebody_d2_l3
-- Libint2Config components found: CXX_ho;C;eri_c2_d0_l2;eri_c2_d0_l3;eri_c2_d0_l4;eri_c2_d0_l5;eri_c2_d0_l6;eri_c2_d1_l2;eri_c2_d1_l3;eri_c2_d1_l4;eri_c2_d1_l5;eri_c2_d2_l2;eri_c2_d2_l3;eri_c2_d2_l4;eri_c3_d0_l2;eri_c3_d0_l3;eri_c3_d0_l4;eri_c3_d0_l5;eri_c3_d0_l6;eri_c3_d1_l2;eri_c3_d1_l3;eri_c3_d1_l4;eri_c3_d1_l5;eri_c3_d2_l2;eri_c3_d2_l3;eri_c3_d2_l4;eri_c4_d0_l2;eri_c4_d0_l3;eri_c4_d0_l4;eri_c4_d0_l5;eri_c4_d1_l2;eri_c4_d1_l3;eri_c4_d1_l4;eri_c4_d2_l2;eri_c4_d2_l3;g12_d0_l2;g12_d0_l3;g12_d0_l4;g12_d1_l2;g12_d1_l3;g12_d1_l4;gss;impure_sh;onebody_d0_l2;onebody_d0_l3;onebody_d0_l4;onebody_d0_l5;onebody_d0_l6;onebody_d1_l2;onebody_d1_l3;onebody_d1_l4;onebody_d1_l5;onebody_d2_l2;onebody_d2_l3;onebody_d2_l4;shared
CMake Error at CMakeLists.txt:167 (find_package):
  Found package configuration file:


  but it set Libint2_FOUND to FALSE so package "Libint2" is considered to be

-- Configuring incomplete, errors occurred!

I need help…

If you are on linux, there are higher AM packages on conda. You can install with:

conda install psi4/label/dev::psi4 -c psi4/label/testing -c conda-forge

Otherwise, since it seems your optimization is running fine, could try finite-difference hessians for the frequency,

psi4.frequency(..., dertype=1)

Thanks for the advice. I tested the second method, it works.

I did as you suggest and my installation was upgraded, but there was no increase in the max AM in the updated version. Did I somehow get the wrong update? Thanks in advance for any suggestions.

Was the correct version of libint2 installed? Check your conda list libint2, you should get:

# Name                    Version                   Build  Channel
libint2                   2.7.2                h2fe1556_1    psi4/label/testing

What method/basis are you trying to run? Energy/gradient/hessian? IIRC, the high AM libint2 package doesn’t increase the max AM for Hessian integrals by much, but psi4 only uses analytic Hessians for HF and LDA functionals, so that’s not usually a big deal. If you want high AM HF Hessians, I would recommend using finite-differences by using the dertype=1 keyword like above. (depending on basis set you might still need the higher AM libint2 package from psi4/label/testing)

No, I seem to have version 2.7.1. I am doing CCSD(T) single point energies with the 6ZaP and 7ZaP basis sets, which have max AM=6 and 7, respectively. Would the 2.7.2 version of libint2 help with this! Again, thanks for your help.

Yeah, that build goes up to AM=7 for energies, which should have you covered.
Try installing to a fresh conda environment and pinning libint2=2.7.2 in the conda install command. Also, make sure you have python 3.8 or 3.10 (not 3.9 or 3.11).

What worked for me was, as a precaution, to do a fresh reinstall of psi4 1.8 and
then do conda install psi4/label/dev::psi4 -c psi4/label/testing -c conda-forge. Doing
this updated libint2 to version 2.7.2 and a test case with AM=6 ran fine.

I am trying the solution mentioned by jamont to enter “conda install psi4/label/dev[…] conda-forge”. Conda finds that libint2 needs to be newly installed. But conda has failed at Download and Extract of that exact package four separate times now, staying at 0% even while other conda packages are downloading fine.

Now I am trying to change “optimize(‘b3lyp-d3’)” to “optimize(‘b3lyp-d3’,dertype=1)” but the calculation is still crashing with “lmax_exceeded” error after the initial energy calculation but before the gradient calculation.

psi4TestOutput.dat (50.1 KB)
psi4TestInput.dat (448 Bytes) (2.7 KB)

Does conda give any errors at all? Is it trying to install psi4/label/testing/linux-64::libint2-2.7.2-h2fe1556_1?
Note that the high AM build of libint2 is almost 500 MB, it could possibly take a while to download depending on your connection.

As another option, it is possible to manually download and conda install the linux-64/libint2-2.7.2-h2fe1556_1.tar.bz2 file from Files ::

Now I am trying to change “optimize(‘b3lyp-d3’)” to “optimize(‘b3lyp-d3’,dertype=1)” but the calculation is still crashing with “lmax_exceeded” error after the initial energy calculation but before the gradient calculation.

This doesn’t work because optimize already uses analytic gradients, which is what dertype=1 specifies. It’s possible to use dertype=0 (gradients by finite-difference of energies), but I would really recommend trying to get the high AM libint2 package installed, as an optimization with dertype=0 will be very slow.

Thanks Philip! libint2 eventually installed when I tried a bit later. Some combination of it being a large package, or its server not communicating well, was causing hangups in the installation.

After installing the latest libint2, my calculation proceeded fine.