diff --git a/src/scf_module.F90 b/src/scf_module.F90 index 8ddeb86ea..7098dbb68 100644 --- a/src/scf_module.F90 +++ b/src/scf_module.F90 @@ -336,6 +336,10 @@ subroutine scf(env, mol, wfn, basis, pcem, xtbData, solvation, & ! fill levels if(wfn%nel.ne.0) then + if (wfn%nel > 2*basis%nao) then + call env%error("Not enough basis functions for filling orbitals", source) + return + end if call occu(basis%nao,wfn%nel,wfn%nopen,wfn%ihomoa,wfn%ihomob,wfn%focca,wfn%foccb) wfn%focc = wfn%focca + wfn%foccb wfn%ihomo=wfn%ihomoa