diff --git a/src/auto_basis.F b/src/auto_basis.F index 9ebe8b0697..d0125334da 100644 --- a/src/auto_basis.F +++ b/src/auto_basis.F @@ -91,6 +91,15 @@ CONTAINS CALL get_qs_kind(qs_kind, basis_set=orb_basis_set, basis_type=basis_type) END IF IF (ASSOCIATED(orb_basis_set)) THEN + ! BASIS_SET ORB NONE associates the pointer orb_basis_set, but does not contain + ! any actual basis functions. Therefore, we catch it here to avoid spurious autogenerated + ! RI_AUX basis sets. + IF (SUM(orb_basis_set%nsgf_set) == 0) THEN + CALL cp_abort(__LOCATION__, & + "Cannot autocreate RI_AUX basis set for at least one of the given "// & + "primary basis sets due to missing exponents. If you have invoked BASIS_SET NONE, "// & + "you should state BASIS_SET RI_AUX NONE explicitly in the input.") + END IF CALL get_basis_keyfigures(orb_basis_set, lmax, zmin, zmax, zeff) !Note: RI basis coud require lmax up to 2*orb_lmax. This ensures that all orbital pointers ! are properly initialized before building the basis diff --git a/src/gw_utils.F b/src/gw_utils.F index 1a1c5828ba..a112cec082 100644 --- a/src/gw_utils.F +++ b/src/gw_utils.F @@ -1285,6 +1285,20 @@ CONTAINS bs_env%Sigma_x_exists = bs_env%Sigma_x_exists .AND. Sigma_x_spin_exists END DO + ! If any restart files are read, check if the SCF converged in 1 step. + ! This is important because a re-iterated SCF can lead to spurious GW results + IF (ANY(bs_env%read_chi(:)) & + .OR. ANY(bs_env%Sigma_c_exists) & + .OR. bs_env%all_W_exist & + .OR. bs_env%Sigma_x_exists & + ) THEN + + IF (qs_env%scf_env%iter_count /= 1) THEN + CALL cp_warn(__LOCATION__, "SCF needed more than 1 step, "// & + "which might lead to spurious GW results when using GW restart files. ") + END IF + END IF + CALL timestop(handle) END SUBROUTINE check_for_restart_files diff --git a/src/mp2_eri.F b/src/mp2_eri.F index 7932ea9263..42c5d31641 100644 --- a/src/mp2_eri.F +++ b/src/mp2_eri.F @@ -741,9 +741,11 @@ CONTAINS END IF basis_set_a => basis_set_list_a(ikind)%gto_basis_set - IF (.NOT. ASSOCIATED(basis_set_a)) CYCLE + ! When RI_AUX NONE is invoked, the pointers to basis_set_a and basis_set_b are created, + ! but not filled. Therefore, we check for the association and the number of entries. + IF (.NOT. ASSOCIATED(basis_set_a) .OR. SUM(basis_set_a%nsgf_set) <= 0) CYCLE basis_set_b => basis_set_list_b(jkind)%gto_basis_set - IF (.NOT. ASSOCIATED(basis_set_b)) CYCLE + IF (.NOT. ASSOCIATED(basis_set_b) .OR. SUM(basis_set_b%nsgf_set) <= 0) CYCLE atom_a = atom_of_kind(iatom) atom_b = atom_of_kind(jatom)