Skip to content

Commit

Permalink
Integer overflow due to the type casting issue in numpy-2.0 (fix pysc…
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Nov 4, 2024
1 parent e66bb81 commit 3a72148
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyscf/ao2mo/_ao2mo.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def nr_e1fill(intor, sh_range, atm, bas, env,
natm = ctypes.c_int(c_atm.shape[0])
nbas = ctypes.c_int(c_bas.shape[0])
ao_loc = make_loc(bas, intor)
nao = ao_loc[-1]
nao = int(ao_loc[-1])

klsh0, klsh1, nkl = sh_range

Expand Down
2 changes: 1 addition & 1 deletion pyscf/df/incore.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def cholesky_eri(mol, auxbasis='weigend+etb', auxmol=None,
atm, bas, env = gto.mole.conc_env(mol._atm, mol._bas, mol._env,
auxmol._atm, auxmol._bas, auxmol._env)
ao_loc = gto.moleintor.make_loc(bas, int3c)
nao = ao_loc[mol.nbas]
nao = int(ao_loc[mol.nbas])

if aosym == 's1':
nao_pair = nao * nao
Expand Down
4 changes: 2 additions & 2 deletions pyscf/df/outcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ def cholesky_eri_b(mol, erifile, auxbasis='weigend+etb', dataname='j3c',
atm, bas, env = gto.mole.conc_env(mol._atm, mol._bas, mol._env,
auxmol._atm, auxmol._bas, auxmol._env)
ao_loc = gto.moleintor.make_loc(bas, int3c)
nao = ao_loc[mol.nbas]
naoaux = ao_loc[-1] - nao
nao = int(ao_loc[mol.nbas])
naoaux = int(ao_loc[-1] - nao)
if aosym == 's1':
nao_pair = nao * nao
buflen = min(max(int(max_memory*.24e6/8/naoaux/comp), 1), nao_pair)
Expand Down
2 changes: 1 addition & 1 deletion pyscf/gto/moleintor.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def getints4c(intor_name, atm, bas, env, shls_slice=None, comp=1,
if aosym == 's8':
assert (shls_slice is None)
from pyscf.scf import _vhf
nao = ao_loc[-1]
nao = int(ao_loc[-1])
nao_pair = nao*(nao+1)//2
out = numpy.ndarray((nao_pair*(nao_pair+1)//2), buffer=out)
if nao_pair == 0:
Expand Down

0 comments on commit 3a72148

Please sign in to comment.