diff --git a/pyscf/dft/numint.py b/pyscf/dft/numint.py index 9947ed5c30..0b3cfdc74c 100644 --- a/pyscf/dft/numint.py +++ b/pyscf/dft/numint.py @@ -2802,7 +2802,7 @@ def block_loop(self, mol, grids, nao=None, deriv=0, max_memory=2000, screen_index = non0tab # the xxx_sparse() functions require ngrids 8-byte aligned - allow_sparse = ngrids % ALIGNMENT_UNIT == 0 + allow_sparse = ngrids % ALIGNMENT_UNIT == 0 and nao > SWITCH_SIZE if buf is None: buf = _empty_aligned(comp * blksize * nao)