From 9cf845759d6bc6c510be9dda7a95ea5f1bfe9890 Mon Sep 17 00:00:00 2001 From: Dynamics of Condensed Matter <30792324+DCM-Uni-Paderborn@users.noreply.github.com> Date: Mon, 4 May 2026 11:09:36 +0200 Subject: [PATCH] Add k-point symmetry backends and guards (#5124) Co-authored-by: Thomas D. Kuehne --- src/cryssym.F | 304 ++++++++++++++++-- src/input_cp2k_kpoints.F | 34 +- src/kpoint_methods.F | 45 +-- src/kpoint_types.F | 66 +++- src/qs_active_space_methods.F | 76 ++++- src/qs_basis_rotation_methods.F | 56 +++- src/qs_environment.F | 257 +++++++++++++-- tests/DFTB/regtest-nonscc/TEST_FILES.toml | 5 +- .../regtest-nonscc/si_kp1_spglib_backend.inp | 63 ++++ tests/DFTB/regtest-scc/TEST_FILES.toml | 3 +- tests/QS/regtest-as-1/TEST_FILES.toml | 3 + .../h2o_gpw_pade_gamma_kpoints.inp | 67 ++++ tests/QS/regtest-kp-1/TEST_FILES.toml | 12 + .../QS/regtest-kp-1/c_gapw_spglib_backend.inp | 77 +++++ .../regtest-kp-1/c_gapwxc_spglib_backend.inp | 77 +++++ .../c_spglib_backend_gamma_real_wfn.inp | 74 +++++ .../h_fcc_macdonald_spglib_backend.inp | 69 ++++ .../QS/regtest-kp-1/h_fcc_spglib_backend.inp | 70 ++++ .../regtest-kp-1/h_fcc_spglib_backend_4.inp | 69 ++++ tests/QS/regtest-kp-1/h_hex_c3_sym_red.inp | 1 + .../RPA_kpoints_H2O_kpsym.inp | 89 +++++ .../regtest-rpa-cubic-scaling/TEST_FILES.toml | 1 + tests/xTB/regtest-3/TEST_FILES.toml | 4 + tests/xTB/regtest-3/si_kp_kpsym.inp | 72 +++++ tests/xTB/regtest-3/si_kp_spglib_backend.inp | 73 +++++ 25 files changed, 1563 insertions(+), 104 deletions(-) create mode 100644 tests/DFTB/regtest-nonscc/si_kp1_spglib_backend.inp create mode 100644 tests/QS/regtest-as-1/h2o_gpw_pade_gamma_kpoints.inp create mode 100644 tests/QS/regtest-kp-1/c_gapw_spglib_backend.inp create mode 100644 tests/QS/regtest-kp-1/c_gapwxc_spglib_backend.inp create mode 100644 tests/QS/regtest-kp-1/c_spglib_backend_gamma_real_wfn.inp create mode 100644 tests/QS/regtest-kp-1/h_fcc_macdonald_spglib_backend.inp create mode 100644 tests/QS/regtest-kp-1/h_fcc_spglib_backend.inp create mode 100644 tests/QS/regtest-kp-1/h_fcc_spglib_backend_4.inp create mode 100644 tests/QS/regtest-rpa-cubic-scaling/RPA_kpoints_H2O_kpsym.inp create mode 100644 tests/xTB/regtest-3/si_kp_kpsym.inp create mode 100644 tests/xTB/regtest-3/si_kp_spglib_backend.inp diff --git a/src/cryssym.F b/src/cryssym.F index 7b73788018..814895072a 100644 --- a/src/cryssym.F +++ b/src/cryssym.F @@ -46,6 +46,7 @@ MODULE cryssym LOGICAL :: fullgrid = .FALSE. LOGICAL :: inversion_only = .FALSE. LOGICAL :: spglib_reduction = .FALSE. + LOGICAL :: spglib_backend = .FALSE. INTEGER :: plevel = 0 INTEGER :: punit = -1 INTEGER :: istriz = -1 @@ -71,11 +72,11 @@ MODULE cryssym INTEGER, DIMENSION(:, :, :), ALLOCATABLE :: rotations REAL(KIND=dp), DIMENSION(:, :), ALLOCATABLE :: translations !K290 - REAL(KIND=dp), DIMENSION(3, 3, 48) :: rt = 0.0_dp - REAL(KIND=dp), DIMENSION(3, 48) :: vt = 0.0_dp + REAL(KIND=dp), DIMENSION(:, :, :), ALLOCATABLE :: rt + REAL(KIND=dp), DIMENSION(:, :), ALLOCATABLE :: vt INTEGER, ALLOCATABLE, DIMENSION(:, :) :: f0 INTEGER :: nrtot = 0 - INTEGER, DIMENSION(48) :: ibrot = 1 + INTEGER, DIMENSION(:), ALLOCATABLE :: ibrot END TYPE csym_type CONTAINS @@ -114,9 +115,18 @@ CONTAINS IF (ALLOCATED(csym%kpop)) THEN DEALLOCATE (csym%kpop) END IF + IF (ALLOCATED(csym%rt)) THEN + DEALLOCATE (csym%rt) + END IF + IF (ALLOCATED(csym%vt)) THEN + DEALLOCATE (csym%vt) + END IF IF (ALLOCATED(csym%f0)) THEN DEALLOCATE (csym%f0) END IF + IF (ALLOCATED(csym%ibrot)) THEN + DEALLOCATE (csym%ibrot) + END IF END SUBROUTINE release_csym_type @@ -225,22 +235,24 @@ CONTAINS !> \param full_grid ... !> \param inversion_symmetry_only ... !> \param use_spglib_reduction ... +!> \param use_spglib_backend ... ! ************************************************************************************************** SUBROUTINE kpoint_gen(csym, nk, symm, shift, full_grid, inversion_symmetry_only, & - use_spglib_reduction) + use_spglib_reduction, use_spglib_backend) TYPE(csym_type) :: csym INTEGER, INTENT(IN) :: nk(3) LOGICAL, INTENT(IN), OPTIONAL :: symm REAL(KIND=dp), INTENT(IN), OPTIONAL :: shift(3) LOGICAL, INTENT(IN), OPTIONAL :: full_grid, inversion_symmetry_only, & - use_spglib_reduction + use_spglib_reduction, & + use_spglib_backend CHARACTER(LEN=*), PARAMETER :: routineN = 'kpoint_gen' INTEGER :: handle, i, ik, j, nkp, nkpts INTEGER, ALLOCATABLE, DIMENSION(:) :: kpop, xptr LOGICAL :: fullmesh, inversion_only, & - spglib_reduction + spglib_backend, spglib_reduction REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: wkp REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: xkp @@ -278,8 +290,26 @@ CONTAINS END IF csym%spglib_reduction = spglib_reduction + IF (PRESENT(use_spglib_backend)) THEN + spglib_backend = use_spglib_backend + ELSE + spglib_backend = .FALSE. + END IF + csym%spglib_backend = spglib_backend + + IF (spglib_backend .AND. .NOT. spglib_reduction) THEN + CALL cp_abort(__LOCATION__, & + "SYMMETRY_BACKEND SPGLIB requires SYMMETRY_REDUCTION_METHOD SPGLIB") + END IF + csym%nkpoint = 0 csym%mesh(1:3) = nk(1:3) + csym%nrtot = 0 + IF (ALLOCATED(csym%rt)) DEALLOCATE (csym%rt) + IF (ALLOCATED(csym%vt)) DEALLOCATE (csym%vt) + IF (ALLOCATED(csym%ibrot)) DEALLOCATE (csym%ibrot) + IF (ALLOCATED(csym%f0)) DEALLOCATE (csym%f0) + ALLOCATE (csym%rt(3, 3, 0), csym%vt(3, 0), csym%ibrot(0), csym%f0(csym%nat, 0)) nkpts = nk(1)*nk(2)*nk(3) ALLOCATE (xkp(3, nkpts), wkp(nkpts), kpop(nkpts)) @@ -311,10 +341,10 @@ CONTAINS END IF CALL full_grid_gen(nk, xkp, wkp, shift) - IF (spglib_reduction) THEN + IF (spglib_backend) THEN CALL kp_symmetry_spglib(csym, xkp, wkp, kpop) ELSE - CALL kp_symmetry(csym, xkp, wkp, kpop) + CALL kp_symmetry(csym, xkp, wkp, kpop, use_spglib_reduction=spglib_reduction) END IF END IF @@ -399,19 +429,23 @@ CONTAINS !> \param xkp ... !> \param wkp ... !> \param kpop ... +!> \param use_spglib_reduction ... ! ************************************************************************************************** - SUBROUTINE kp_symmetry(csym, xkp, wkp, kpop) + SUBROUTINE kp_symmetry(csym, xkp, wkp, kpop, use_spglib_reduction) TYPE(csym_type) :: csym REAL(KIND=dp), DIMENSION(:, :) :: xkp REAL(KIND=dp), DIMENSION(:) :: wkp INTEGER, DIMENSION(:) :: kpop + LOGICAL, INTENT(IN), OPTIONAL :: use_spglib_reduction INTEGER :: i, ihc, ihg, indpg, iou, iq1, iq2, iq3, & istriz, isy, li, nat, nc, nhash, & - nkpoint, nsp, ntvec + nkpoint, nrot, nsp, ntvec INTEGER, ALLOCATABLE, DIMENSION(:) :: includ, isc, list, lwght, ty INTEGER, ALLOCATABLE, DIMENSION(:, :) :: f0, lrot + INTEGER, ALLOCATABLE, DIMENSION(:, :, :) :: srot INTEGER, DIMENSION(48) :: ib + LOGICAL :: spglib_reduction REAL(KIND=dp) :: alat REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: rlist, rx, tvec, wvkl, xkapa REAL(KIND=dp), DIMENSION(3) :: a1, a2, a3, b1, b2, b3, origin, wvk0 @@ -428,6 +462,11 @@ CONTAINS nkpoint = 10*iq1*iq2*iq3 wvk0 = csym%wvk0 istriz = csym%istriz + IF (PRESENT(use_spglib_reduction)) THEN + spglib_reduction = use_spglib_reduction + ELSE + spglib_reduction = .FALSE. + END IF a1(1:3) = hmat(1:3, 1) a2(1:3) = hmat(1:3, 2) a3(1:3) = hmat(1:3, 3) @@ -450,6 +489,7 @@ CONTAINS "*******************************************************************************" END IF CALL cite_reference(Worlton1972) + IF (spglib_reduction) CALL cite_reference(Togo2018) CALL K290s(iou, nat, nkpoint, nsp, iq1, iq2, iq3, istriz, & a1, a2, a3, alat, strain, xkapa, rx, tvec, & @@ -467,17 +507,29 @@ CONTAINS "*******************************************************************************" END IF - csym%rt = r - csym%vt = vt csym%nrtot = nc + IF (ALLOCATED(csym%rt)) DEALLOCATE (csym%rt) + IF (ALLOCATED(csym%vt)) DEALLOCATE (csym%vt) + IF (ALLOCATED(csym%ibrot)) DEALLOCATE (csym%ibrot) + IF (ALLOCATED(csym%f0)) DEALLOCATE (csym%f0) + ALLOCATE (csym%rt(3, 3, nc), csym%vt(3, nc), csym%ibrot(nc)) + csym%vt(1:3, 1:nc) = vt(1:3, 1:nc) ALLOCATE (csym%f0(nat, nc)) DO i = 1, nc + csym%rt(1:3, 1:3, i) = r(1:3, 1:3, ib(i)) csym%f0(1:nat, i) = f0(i, 1:nat) END DO - csym%ibrot = 0 csym%ibrot(1:nc) = ib(1:nc) - CALL reduce_kpoint_mesh(csym, xkp, wkp, kpop, nc, ib, r, a1, a2, a3, b1, b2, b3, alat) + IF (spglib_reduction) THEN + ALLOCATE (srot(3, 3, csym%n_operations)) + CALL setup_spglib_reduction_rotations(csym, srot, nrot) + CALL reduce_spglib_kpoint_mesh_k290(csym, xkp, wkp, kpop, srot, nrot, & + a1, a2, a3, b1, b2, b3, alat) + DEALLOCATE (srot) + ELSE + CALL reduce_kpoint_mesh(csym, xkp, wkp, kpop, nc, ib, r, a1, a2, a3, b1, b2, b3, alat) + END IF DEALLOCATE (xkapa, rx, tvec, ty, isc, f0) DEALLOCATE (wvkl, rlist, includ, list) DEALLOCATE (lrot, lwght) @@ -498,7 +550,7 @@ CONTAINS INTEGER, DIMENSION(:) :: kpop INTEGER :: iou, nrot - INTEGER, DIMENSION(3, 3, 48) :: srot + INTEGER, ALLOCATABLE, DIMENSION(:, :, :) :: srot iou = csym%punit IF (iou > 0) THEN @@ -509,8 +561,10 @@ CONTAINS END IF CALL cite_reference(Togo2018) + ALLOCATE (srot(3, 3, csym%n_operations)) CALL setup_spglib_operations(csym, srot, nrot) CALL reduce_spglib_kpoint_mesh(csym, xkp, wkp, kpop, srot, nrot) + DEALLOCATE (srot) IF (iou > 0) THEN WRITE (iou, '((T2,A79))') & @@ -522,14 +576,14 @@ CONTAINS END SUBROUTINE kp_symmetry_spglib ! ************************************************************************************************** -!> \brief Store unique SPGLIB point operations in the K290-compatible symmetry fields +!> \brief Store usable SPGLIB space-group operations for k-point symmetry !> \param csym ... !> \param srot integer rotations in fractional coordinates !> \param nrot number of stored rotations ! ************************************************************************************************** SUBROUTINE setup_spglib_operations(csym, srot, nrot) TYPE(csym_type) :: csym - INTEGER, DIMENSION(3, 3, 48), INTENT(OUT) :: srot + INTEGER, DIMENSION(:, :, :), INTENT(OUT) :: srot INTEGER, INTENT(OUT) :: nrot INTEGER :: iop, jop, pass @@ -543,12 +597,16 @@ CONTAINS CPASSERT(csym%symlib) srot = 0 + csym%nrtot = 0 + IF (ALLOCATED(csym%rt)) DEALLOCATE (csym%rt) + IF (ALLOCATED(csym%vt)) DEALLOCATE (csym%vt) + IF (ALLOCATED(csym%ibrot)) DEALLOCATE (csym%ibrot) + IF (ALLOCATED(csym%f0)) DEALLOCATE (csym%f0) + ALLOCATE (csym%rt(3, 3, csym%n_operations), csym%vt(3, csym%n_operations)) + ALLOCATE (csym%ibrot(csym%n_operations), csym%f0(csym%nat, csym%n_operations)) csym%rt = 0.0_dp csym%vt = 0.0_dp csym%ibrot = 0 - csym%nrtot = 0 - IF (ALLOCATED(csym%f0)) DEALLOCATE (csym%f0) - ALLOCATE (csym%f0(csym%nat, 48)) csym%f0 = 0 eps = MAX(1.e-12_dp, 10.0_dp*csym%delta) @@ -576,7 +634,9 @@ CONTAINS duplicate = .FALSE. DO jop = 1, nrot - IF (ALL(irot == srot(:, :, jop))) THEN + IF (ALL(irot == srot(:, :, jop)) .AND. & + ALL(ABS(csym%translations(1:3, iop) - csym%vt(1:3, jop) - & + ANINT(csym%translations(1:3, iop) - csym%vt(1:3, jop))) <= eps)) THEN duplicate = .TRUE. EXIT END IF @@ -587,7 +647,6 @@ CONTAINS IF (.NOT. valid) CYCLE nrot = nrot + 1 - IF (nrot > 48) CALL cp_abort(__LOCATION__, "Too many SPGLIB point-group operations") srot(1:3, 1:3, nrot) = irot(1:3, 1:3) rfrac(1:3, 1:3) = REAL(irot(1:3, 1:3), KIND=dp) @@ -604,6 +663,56 @@ CONTAINS END SUBROUTINE setup_spglib_operations +! ************************************************************************************************** +!> \brief Store unique SPGLIB rotations for K290-backend diagnostic reduction +!> \param csym ... +!> \param srot integer rotations in fractional coordinates +!> \param nrot number of stored rotations +! ************************************************************************************************** + SUBROUTINE setup_spglib_reduction_rotations(csym, srot, nrot) + TYPE(csym_type) :: csym + INTEGER, DIMENSION(:, :, :), INTENT(OUT) :: srot + INTEGER, INTENT(OUT) :: nrot + + INTEGER :: iop, jop, pass + INTEGER, DIMENSION(3, 3) :: eye, irot + LOGICAL :: duplicate, identity + + CPASSERT(csym%symlib) + + srot = 0 + eye = 0 + eye(1, 1) = 1 + eye(2, 2) = 1 + eye(3, 3) = 1 + + nrot = 0 + ! Keep the identity first, matching the representative k-point operation. + DO pass = 1, 2 + DO iop = 1, csym%n_operations + irot(1:3, 1:3) = csym%rotations(1:3, 1:3, iop) + identity = ALL(irot == eye) + IF (pass == 1 .AND. .NOT. identity) CYCLE + IF (pass == 2 .AND. identity) CYCLE + + duplicate = .FALSE. + DO jop = 1, nrot + IF (ALL(irot == srot(:, :, jop))) THEN + duplicate = .TRUE. + EXIT + END IF + END DO + IF (duplicate) CYCLE + + nrot = nrot + 1 + srot(1:3, 1:3, nrot) = irot(1:3, 1:3) + END DO + END DO + + IF (nrot == 0) CALL cp_abort(__LOCATION__, "SPGLIB did not return usable symmetry rotations") + + END SUBROUTINE setup_spglib_reduction_rotations + ! ************************************************************************************************** !> \brief Determine the atom permutation generated by a SPGLIB space-group operation !> \param csym ... @@ -673,7 +782,7 @@ CONTAINS REAL(KIND=dp), DIMENSION(:, :), INTENT(IN) :: xkp REAL(KIND=dp), DIMENSION(:) :: wkp INTEGER, DIMENSION(:) :: kpop - INTEGER, DIMENSION(3, 3, 48), INTENT(IN) :: srot + INTEGER, DIMENSION(:, :, :), INTENT(IN) :: srot INTEGER, INTENT(IN) :: nrot INTEGER :: i, iop, isign, j, kr, nkpts, score @@ -744,6 +853,151 @@ CONTAINS END SUBROUTINE reduce_spglib_kpoint_mesh +! ************************************************************************************************** +!> \brief Reduce a k-point mesh with SPGLIB rotations and K290 operations +!> \param csym ... +!> \param xkp full k-point mesh in reciprocal lattice coordinates +!> \param wkp reduced k-point weights +!> \param kpop K290 operation mapping the representative k-point to a mesh point +!> \param srot SPGLIB integer rotations in fractional coordinates +!> \param nrot number of stored rotations +!> \param a1 first lattice vector +!> \param a2 second lattice vector +!> \param a3 third lattice vector +!> \param b1 first reciprocal lattice vector +!> \param b2 second reciprocal lattice vector +!> \param b3 third reciprocal lattice vector +!> \param alat lattice scaling used by K290 +! ************************************************************************************************** + SUBROUTINE reduce_spglib_kpoint_mesh_k290(csym, xkp, wkp, kpop, srot, nrot, & + a1, a2, a3, b1, b2, b3, alat) + TYPE(csym_type) :: csym + REAL(KIND=dp), DIMENSION(:, :), INTENT(IN) :: xkp + REAL(KIND=dp), DIMENSION(:) :: wkp + INTEGER, DIMENSION(:) :: kpop + INTEGER, DIMENSION(:, :, :), INTENT(IN) :: srot + INTEGER, INTENT(IN) :: nrot + REAL(KIND=dp), DIMENSION(3), INTENT(IN) :: a1, a2, a3, b1, b2, b3 + REAL(KIND=dp), INTENT(IN) :: alat + + INTEGER :: i, iop, isign, j, k290_op, nkpts + INTEGER, DIMENSION(3, 3) :: krot + LOGICAL :: valid + REAL(KIND=dp) :: eps + REAL(KIND=dp), DIMENSION(3) :: diff, rr + + nkpts = SIZE(wkp) + eps = MAX(1.e-12_dp, 10.0_dp*csym%delta) + + wkp = 0.0_dp + kpop = 0 + csym%kplink(1, :) = 0 + + DO i = 1, nkpts + IF (csym%kplink(1, i) /= 0) CYCLE + + csym%kplink(1, i) = i + wkp(i) = 1.0_dp + kpop(i) = 1 + + DO iop = 1, nrot + krot = reciprocal_rotation(srot(:, :, iop)) + DO isign = 1, 2 + rr(1:3) = MATMUL(REAL(krot(1:3, 1:3), KIND=dp), xkp(1:3, i)) + IF (isign == 2) rr(1:3) = -rr(1:3) + + DO j = 1, nkpts + diff(1:3) = xkp(1:3, j) - rr(1:3) + diff(1:3) = diff(1:3) - ANINT(diff(1:3)) + IF (ALL(ABS(diff(1:3)) < eps)) THEN + IF (j == i) EXIT + IF (csym%kplink(1, j) /= 0) THEN + CPASSERT(csym%kplink(1, j) == i) + EXIT + END IF + + CALL find_k290_kpoint_operation(csym, xkp(1:3, i), xkp(1:3, j), & + a1, a2, a3, b1, b2, b3, alat, & + k290_op, valid) + IF (.NOT. valid) THEN + CALL cp_abort(__LOCATION__, & + "SPGLIB k-point mapping is not represented by K290 backend") + END IF + csym%kplink(1, j) = i + wkp(i) = wkp(i) + 1.0_dp + kpop(j) = k290_op + EXIT + END IF + END DO + IF (j > nkpts) CYCLE + END DO + END DO + END DO + + DO i = 1, nkpts + CPASSERT(csym%kplink(1, i) /= 0) + CPASSERT(kpop(i) /= 0) + END DO + + END SUBROUTINE reduce_spglib_kpoint_mesh_k290 + +! ************************************************************************************************** +!> \brief Find a K290 operation that maps one fractional k-point to another +!> \param csym ... +!> \param xref representative k-point +!> \param xtarget target k-point +!> \param a1 first lattice vector +!> \param a2 second lattice vector +!> \param a3 third lattice vector +!> \param b1 first reciprocal lattice vector +!> \param b2 second reciprocal lattice vector +!> \param b3 third reciprocal lattice vector +!> \param alat lattice scaling used by K290 +!> \param k290_op K290 operation identifier +!> \param valid whether a matching K290 operation was found +! ************************************************************************************************** + SUBROUTINE find_k290_kpoint_operation(csym, xref, xtarget, a1, a2, a3, b1, b2, b3, alat, & + k290_op, valid) + TYPE(csym_type) :: csym + REAL(KIND=dp), DIMENSION(3), INTENT(IN) :: xref, xtarget, a1, a2, a3, b1, b2, b3 + REAL(KIND=dp), INTENT(IN) :: alat + INTEGER, INTENT(OUT) :: k290_op + LOGICAL, INTENT(OUT) :: valid + + INTEGER :: ibsign, iop, kr + REAL(KIND=dp) :: eps + REAL(KIND=dp), DIMENSION(3) :: diff, rr, wcart + + eps = MAX(1.e-12_dp, 10.0_dp*csym%delta) + k290_op = 0 + valid = .FALSE. + + DO iop = 1, csym%nrtot + kr = csym%ibrot(iop) + IF (kr < 1 .OR. kr > SIZE(csym%rt, 3)) CYCLE + DO ibsign = 1, 2 + wcart(1:3) = alat*(xref(1)*b1(1:3) + xref(2)*b2(1:3) + xref(3)*b3(1:3)) + wcart(1:3) = kp_apply_operation(wcart(1:3), csym%rt(1:3, 1:3, kr)) + IF (ibsign == 2) THEN + wcart(1:3) = -wcart(1:3) + kr = -kr + END IF + rr(1) = DOT_PRODUCT(a1(1:3), wcart(1:3))/alat + rr(2) = DOT_PRODUCT(a2(1:3), wcart(1:3))/alat + rr(3) = DOT_PRODUCT(a3(1:3), wcart(1:3))/alat + + diff(1:3) = xtarget(1:3) - rr(1:3) + diff(1:3) = diff(1:3) - ANINT(diff(1:3)) + IF (ALL(ABS(diff(1:3)) < eps)) THEN + k290_op = kr + valid = .TRUE. + RETURN + END IF + END DO + END DO + + END SUBROUTINE find_k290_kpoint_operation + ! ************************************************************************************************** !> \brief Score SPGLIB operations to choose stable atom transformations !> \param csym ... @@ -767,7 +1021,7 @@ CONTAINS DO i = 1, nat IF (csym%f0(i, iop) /= i) score = score + 100 END DO - IF (ANY(ABS(csym%vt(1:3, iop) - ANINT(csym%vt(1:3, iop))) > eps)) score = score + 100000000 + IF (ANY(ABS(csym%vt(1:3, iop) - ANINT(csym%vt(1:3, iop))) > eps)) score = score + 10 eye = 0 eye(1, 1) = 1 @@ -1026,7 +1280,7 @@ CONTAINS WRITE (iunit, '(/,A)') " Atom Transformation Table" nat = SIZE(csym%f0, 1) DO i = 1, csym%nrtot - WRITE (iunit, '(T10,A,I3,(T21,12I5))') " Rot=", csym%ibrot(i), csym%f0(1:nat, i) + WRITE (iunit, '(T10,A,I5,(T21,12I5))') " Rot=", csym%ibrot(i), csym%f0(1:nat, i) END DO END IF END IF diff --git a/src/input_cp2k_kpoints.F b/src/input_cp2k_kpoints.F index 4852e1842a..be9f88563a 100644 --- a/src/input_cp2k_kpoints.F +++ b/src/input_cp2k_kpoints.F @@ -37,12 +37,15 @@ MODULE input_cp2k_kpoints INTEGER, PARAMETER :: use_real_wfn = 101, & use_complex_wfn = 100, & use_k290_kpoint_symmetry = 200, & - use_spglib_kpoint_symmetry = 201 + use_spglib_kpoint_symmetry = 201, & + use_k290_kpoint_backend = 300, & + use_spglib_kpoint_backend = 301 PUBLIC :: create_kpoints_section PUBLIC :: create_kpoint_set_section PUBLIC :: use_real_wfn, use_complex_wfn PUBLIC :: use_k290_kpoint_symmetry, use_spglib_kpoint_symmetry + PUBLIC :: use_k290_kpoint_backend, use_spglib_kpoint_backend CONTAINS @@ -57,6 +60,7 @@ CONTAINS !> WAVEFUNCTION [real, complex] !> FULL_GRID [on, off] !> INVERSION_SYMMETRY_ONLY [on, off] +!> SYMMETRY_BACKEND [K290, SPGLIB] !> SYMMETRY_REDUCTION_METHOD [K290, SPGLIB] !> VERBOSE [on, off] !> EPS_SYMMETRY value @@ -86,7 +90,9 @@ CONTAINS newline// & "For `MONKHORST-PACK` the number of k points in all 3 dimensions has to"// & " be supplied along with the keyword. For `MACDONALD` also the list of shifts."// & - " E.g. `MONKHORST-PACK 12 12 8`, `MACDONALD 4 4 4 0.25 0.25 0.25`", & + " E.g. `MONKHORST-PACK 12 12 8`, `MACDONALD 4 4 4 0.25 0.25 0.25`."// & + " `GENERAL` uses the explicitly listed k-points as supplied and does not apply"// & + " SYMMETRY_BACKEND or SYMMETRY_REDUCTION_METHOD.", & usage="SCHEME {KPMETHOD} {integer} {integer} ..", & citations=[Monkhorst1976, MacDonald1978], & n_var=-1, type_of_var=char_t) @@ -132,11 +138,29 @@ CONTAINS CALL section_add_keyword(section, keyword) CALL keyword_release(keyword) + CALL keyword_create(keyword, __LOCATION__, name="SYMMETRY_BACKEND", & + description="Select the backend used to provide and apply atomic "// & + "k-point symmetry operations. K290 is the established default. "// & + "SPGLIB uses the symmetry operations returned by SPGLIB, including "// & + "their fractional translations. This applies to Monkhorst-Pack and MacDonald "// & + "meshes. For GENERAL, the explicit k-point list is used as supplied. If "// & + "SYMMETRY_REDUCTION_METHOD is not specified, it follows the selected backend.", & + usage="SYMMETRY_BACKEND K290", type_of_var=enum_t, & + enum_c_vals=s2a("K290", "SPGLIB"), & + enum_i_vals=[use_k290_kpoint_backend, use_spglib_kpoint_backend], & + enum_desc=s2a("Use the existing K290 k-point symmetry backend.", & + "Use SPGLIB symmetry operations as k-point symmetry backend."), & + default_i_val=use_k290_kpoint_backend) + CALL section_add_keyword(section, keyword) + CALL keyword_release(keyword) + CALL keyword_create(keyword, __LOCATION__, name="SYMMETRY_REDUCTION_METHOD", & description="Select the method used to reduce Monkhorst-Pack and MacDonald "// & "k-point meshes when atomic symmetry is enabled. K290 is the established "// & "default. SPGLIB uses the symmetry operations returned by SPGLIB for the "// & - "k-point reduction.", & + "k-point reduction. GENERAL k-point lists are not reduced. With "// & + "SYMMETRY_BACKEND K290 this can be used as a comparison mode using K290 "// & + "operations for SPGLIB-generated mappings.", & usage="SYMMETRY_REDUCTION_METHOD K290", type_of_var=enum_t, & enum_c_vals=s2a("K290", "SPGLIB"), & enum_i_vals=[use_k290_kpoint_symmetry, use_spglib_kpoint_symmetry], & @@ -175,7 +199,9 @@ CONTAINS CALL keyword_create(keyword, __LOCATION__, name="WAVEFUNCTIONS", & description="Select whether real or complex wavefunctions should be used "// & - "when allowed by the k-point set.", & + "when allowed by the k-point set. REAL wavefunctions can only represent "// & + "Gamma or special k-points and symmetry operations with real Bloch phases. "// & + "Use COMPLEX for general atomic k-point symmetries with nontrivial phases.", & usage="WAVEFUNCTIONS REAL", & default_i_val=use_complex_wfn, & enum_c_vals=s2a("REAL", "COMPLEX"), & diff --git a/src/kpoint_methods.F b/src/kpoint_methods.F index 0e473b56a1..2b0deae44d 100644 --- a/src/kpoint_methods.F +++ b/src/kpoint_methods.F @@ -54,7 +54,10 @@ MODULE kpoint_methods smear_gaussian,& smear_mp,& smear_mv - USE input_cp2k_kpoints, ONLY: use_spglib_kpoint_symmetry + USE input_cp2k_kpoints, ONLY: use_k290_kpoint_backend,& + use_k290_kpoint_symmetry,& + use_spglib_kpoint_backend,& + use_spglib_kpoint_symmetry USE kinds, ONLY: dp USE kpoint_types, ONLY: get_kpoint_info,& kind_rotmat_type,& @@ -189,7 +192,8 @@ CONTAINS full_grid=kpoint%full_grid, & inversion_symmetry_only=kpoint%inversion_symmetry_only, & use_spglib_reduction= & - kpoint%symmetry_reduction_method == use_spglib_kpoint_symmetry) + kpoint%symmetry_reduction_method == use_spglib_kpoint_symmetry, & + use_spglib_backend=kpoint%symmetry_backend == use_spglib_kpoint_backend) kpoint%nkp = crys_sym%nkpoint ALLOCATE (kpoint%xkp(3, kpoint%nkp), kpoint%wkp(kpoint%nkp)) wsum = SUM(crys_sym%wkpoint) @@ -228,13 +232,13 @@ CONTAINS nr = nr + 1 ir = crys_sym%kpop(is) ira = ABS(ir) - kpsym%rotp(nr) = ir - kpsym%rot(1:3, 1:3, nr) = crys_sym%rt(1:3, 1:3, ira) - srotmat = MATMUL(cell%h_inv, MATMUL(crys_sym%rt(1:3, 1:3, ira), cell%hmat)) - frot(1:3, 1:3) = NINT(srotmat(1:3, 1:3)) - kpsym%xkp(1:3, nr) = crys_sym%kpmesh(1:3, is) DO ic = 1, crys_sym%nrtot IF (crys_sym%ibrot(ic) == ira) THEN + kpsym%rotp(nr) = ir + kpsym%rot(1:3, 1:3, nr) = crys_sym%rt(1:3, 1:3, ic) + srotmat = MATMUL(cell%h_inv, MATMUL(crys_sym%rt(1:3, 1:3, ic), cell%hmat)) + frot(1:3, 1:3) = NINT(srotmat(1:3, 1:3)) + kpsym%xkp(1:3, nr) = crys_sym%kpmesh(1:3, is) kpsym%f0(1:natom, nr) = crys_sym%f0(1:natom, ic) DO j = 1, natom srot(1:3) = MATMUL(srotmat, scoord(1:3, j)) + crys_sym%vt(1:3, ic) @@ -246,6 +250,7 @@ CONTAINS EXIT END IF END DO + CPASSERT(ic <= crys_sym%nrtot) END IF END DO ! Reduce inversion? @@ -271,6 +276,17 @@ CONTAINS DEALLOCATE (agauge) CASE ("GENERAL") + IF (kpoint%symmetry) THEN + CALL cp_abort(__LOCATION__, & + "KPOINTS%SYMMETRY is not supported with SCHEME GENERAL; "// & + "explicit k-points are used as supplied.") + END IF + IF (kpoint%symmetry_backend /= use_k290_kpoint_backend .OR. & + kpoint%symmetry_reduction_method /= use_k290_kpoint_symmetry) THEN + CALL cp_warn(__LOCATION__, & + "KPOINTS%SYMMETRY_BACKEND and SYMMETRY_REDUCTION_METHOD are ignored with "// & + "SCHEME GENERAL; explicit k-points are used as supplied.") + END IF ! default: no symmetry settings ALLOCATE (kpoint%kp_sym(kpoint%nkp)) DO i = 1, kpoint%nkp @@ -1747,9 +1763,8 @@ CONTAINS numnodes, owner INTEGER, DIMENSION(3) :: shift LOGICAL :: dorot, found, has_phase, perm, trans - REAL(KIND=dp) :: arg, coskl, dr, phase_sign, sinkl + REAL(KIND=dp) :: arg, coskl, dr, sinkl REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: cwork, rwork, twork - REAL(KIND=dp), DIMENSION(3, 3) :: eye, rot2 REAL(KIND=dp), DIMENSION(:, :), POINTER :: cblock, kroti, krotj, rblock, scblock, & srblock TYPE(dbcsr_distribution_type) :: dist @@ -1769,15 +1784,6 @@ CONTAINS IF (ABS(SUM(ABS(rot)) - 3.0_dp) > 1.e-12_dp) dorot = .TRUE. dr = ABS(rot(1, 1) - 1.0_dp) + ABS(rot(2, 2) - 1.0_dp) + ABS(rot(3, 3) - 1.0_dp) IF (ABS(dr) > 1.e-12_dp) dorot = .TRUE. - eye = 0.0_dp - eye(1, 1) = 1.0_dp - eye(2, 2) = 1.0_dp - eye(3, 3) = 1.0_dp - rot2(1:3, 1:3) = MATMUL(rot(1:3, 1:3), rot(1:3, 1:3)) - phase_sign = 1.0_dp - ! Non-self-inverse rotations need the inverse Bloch phase convention used by K290. - IF (ANY(ABS(rot2(1:3, 1:3) - eye(1:3, 1:3)) > 1.e-8_dp)) phase_sign = -1.0_dp - has_phase = ANY(fcell /= 0) .OR. time_reversal IF (.NOT. (dorot .OR. perm .OR. has_phase)) THEN @@ -1822,8 +1828,9 @@ CONTAINS shift = fcell(1:3, icol) - fcell(1:3, irow) arg = REAL(shift(1), dp)*xkp(1) + REAL(shift(2), dp)*xkp(2) + REAL(shift(3), dp)*xkp(3) + ! The Bloch phase depends only on the mapped atom-cell shifts and the target k-point. coskl = COS(twopi*arg) - sinkl = phase_sign*SIN(twopi*arg) + sinkl = SIN(twopi*arg) IF (real_only) THEN IF (ABS(sinkl) > 1.e-12_dp) THEN CALL cp_abort(__LOCATION__, "Real k-point wavefunctions cannot represent symmetry phases") diff --git a/src/kpoint_types.F b/src/kpoint_types.F index 50a6b887ec..7a5e9e14e2 100644 --- a/src/kpoint_types.F +++ b/src/kpoint_types.F @@ -25,8 +25,10 @@ MODULE kpoint_types USE cp_output_handling, ONLY: cp_print_key_finished_output,& cp_print_key_unit_nr USE input_cp2k_kpoints, ONLY: use_complex_wfn,& + use_k290_kpoint_backend,& use_k290_kpoint_symmetry,& use_real_wfn,& + use_spglib_kpoint_backend,& use_spglib_kpoint_symmetry USE input_section_types, ONLY: section_vals_get,& section_vals_type,& @@ -140,6 +142,7 @@ MODULE kpoint_types !> \param symmetry [input] use symmetry (atoms) to reduce kpoints !> \param full_grid [input] don't reduce kpoints at all !> \param inversion_symmetry_only [input] reduce kpoints only by inversion symmetry +!> \param symmetry_backend [input] k-point symmetry backend !> \param symmetry_reduction_method [input] k-point symmetry reduction method !> \param verbose [input] more output information !> \param eps_geo [input] accuracy of atom symmetry detection @@ -168,6 +171,7 @@ MODULE kpoint_types LOGICAL :: symmetry = .FALSE. LOGICAL :: full_grid = .FALSE. LOGICAL :: inversion_symmetry_only = .FALSE. + INTEGER :: symmetry_backend = use_k290_kpoint_backend INTEGER :: symmetry_reduction_method = use_k290_kpoint_symmetry LOGICAL :: verbose = .FALSE. REAL(KIND=dp) :: eps_geo = 0.0_dp @@ -231,6 +235,7 @@ CONTAINS kpoint%verbose = .FALSE. kpoint%full_grid = .FALSE. kpoint%inversion_symmetry_only = .FALSE. + kpoint%symmetry_backend = use_k290_kpoint_backend kpoint%symmetry_reduction_method = use_k290_kpoint_symmetry kpoint%use_real_wfn = .FALSE. kpoint%eps_geo = 1.0e-6_dp @@ -373,6 +378,7 @@ CONTAINS !> \param sab_nl neighbourlist that defines real space matrices !> \param sab_nl_nosym neighbourlist that defines real space matrices, non-symmetric !> \param inversion_symmetry_only reduce kpoints only by inversion symmetry +!> \param symmetry_backend k-point symmetry backend !> \param symmetry_reduction_method k-point symmetry reduction method !> \author JGH ! ************************************************************************************************** @@ -380,7 +386,8 @@ CONTAINS full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, & para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, & kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, & - sab_nl, sab_nl_nosym, inversion_symmetry_only, symmetry_reduction_method) + sab_nl, sab_nl_nosym, inversion_symmetry_only, symmetry_backend, & + symmetry_reduction_method) TYPE(kpoint_type), INTENT(IN) :: kpoint CHARACTER(LEN=*), OPTIONAL :: kp_scheme INTEGER, DIMENSION(3), OPTIONAL :: nkp_grid @@ -408,7 +415,8 @@ CONTAINS TYPE(neighbor_list_set_p_type), DIMENSION(:), & OPTIONAL, POINTER :: sab_nl, sab_nl_nosym LOGICAL, OPTIONAL :: inversion_symmetry_only - INTEGER, OPTIONAL :: symmetry_reduction_method + INTEGER, OPTIONAL :: symmetry_backend, & + symmetry_reduction_method IF (PRESENT(kp_scheme)) kp_scheme = kpoint%kp_scheme IF (PRESENT(nkp_grid)) nkp_grid = kpoint%nkp_grid @@ -417,6 +425,7 @@ CONTAINS IF (PRESENT(verbose)) verbose = kpoint%verbose IF (PRESENT(full_grid)) full_grid = kpoint%full_grid IF (PRESENT(inversion_symmetry_only)) inversion_symmetry_only = kpoint%inversion_symmetry_only + IF (PRESENT(symmetry_backend)) symmetry_backend = kpoint%symmetry_backend IF (PRESENT(symmetry_reduction_method)) & symmetry_reduction_method = kpoint%symmetry_reduction_method IF (PRESENT(use_real_wfn)) use_real_wfn = kpoint%use_real_wfn @@ -481,6 +490,7 @@ CONTAINS !> \param sab_nl neighbourlist that defines real space matrices !> \param sab_nl_nosym neighbourlist that defines real space matrices !> \param inversion_symmetry_only reduce kpoints only by inversion symmetry +!> \param symmetry_backend k-point symmetry backend !> \param symmetry_reduction_method k-point symmetry reduction method !> \author JGH ! ************************************************************************************************** @@ -488,7 +498,8 @@ CONTAINS full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, & para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, & kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, & - sab_nl, sab_nl_nosym, inversion_symmetry_only, symmetry_reduction_method) + sab_nl, sab_nl_nosym, inversion_symmetry_only, symmetry_backend, & + symmetry_reduction_method) TYPE(kpoint_type), INTENT(INOUT) :: kpoint CHARACTER(LEN=*), OPTIONAL :: kp_scheme INTEGER, DIMENSION(3), OPTIONAL :: nkp_grid @@ -516,7 +527,8 @@ CONTAINS TYPE(neighbor_list_set_p_type), DIMENSION(:), & OPTIONAL, POINTER :: sab_nl, sab_nl_nosym LOGICAL, OPTIONAL :: inversion_symmetry_only - INTEGER, OPTIONAL :: symmetry_reduction_method + INTEGER, OPTIONAL :: symmetry_backend, & + symmetry_reduction_method IF (PRESENT(kp_scheme)) kpoint%kp_scheme = kp_scheme IF (PRESENT(nkp_grid)) kpoint%nkp_grid = nkp_grid @@ -525,6 +537,7 @@ CONTAINS IF (PRESENT(verbose)) kpoint%verbose = verbose IF (PRESENT(full_grid)) kpoint%full_grid = full_grid IF (PRESENT(inversion_symmetry_only)) kpoint%inversion_symmetry_only = inversion_symmetry_only + IF (PRESENT(symmetry_backend)) kpoint%symmetry_backend = symmetry_backend IF (PRESENT(symmetry_reduction_method)) & kpoint%symmetry_reduction_method = symmetry_reduction_method IF (PRESENT(use_real_wfn)) kpoint%use_real_wfn = use_real_wfn @@ -580,7 +593,8 @@ CONTAINS CHARACTER(LEN=default_string_length), & DIMENSION(:), POINTER :: tmpstringlist INTEGER :: i, n_rep, nval, wfntype - LOGICAL :: available + LOGICAL :: available, backend_explicit, & + reduction_explicit REAL(KIND=dp) :: ff REAL(KIND=dp), DIMENSION(:), POINTER :: reallist @@ -651,8 +665,11 @@ CONTAINS CALL section_vals_val_get(kpoint_section, "FULL_GRID", l_val=kpoint%full_grid) CALL section_vals_val_get(kpoint_section, "INVERSION_SYMMETRY_ONLY", & l_val=kpoint%inversion_symmetry_only) + CALL section_vals_val_get(kpoint_section, "SYMMETRY_BACKEND", & + i_val=kpoint%symmetry_backend, explicit=backend_explicit) CALL section_vals_val_get(kpoint_section, "SYMMETRY_REDUCTION_METHOD", & - i_val=kpoint%symmetry_reduction_method) + i_val=kpoint%symmetry_reduction_method, explicit=reduction_explicit) + CALL resolve_kpoint_symmetry_settings(kpoint, backend_explicit, reduction_explicit) CALL section_vals_val_get(kpoint_section, "EPS_SYMMETRY", r_val=kpoint%eps_geo) CALL section_vals_val_get(kpoint_section, "PARALLEL_GROUP_SIZE", & i_val=kpoint%parallel_group_size) @@ -671,6 +688,35 @@ CONTAINS END SUBROUTINE read_kpoint_section +! ************************************************************************************************** +!> \brief Resolve legacy and backend k-point symmetry settings +!> \param kpoint ... +!> \param backend_explicit whether SYMMETRY_BACKEND was given +!> \param reduction_explicit whether SYMMETRY_REDUCTION_METHOD was given +! ************************************************************************************************** + SUBROUTINE resolve_kpoint_symmetry_settings(kpoint, backend_explicit, reduction_explicit) + TYPE(kpoint_type), INTENT(INOUT) :: kpoint + LOGICAL, INTENT(IN) :: backend_explicit, reduction_explicit + + IF (backend_explicit .AND. .NOT. reduction_explicit) THEN + SELECT CASE (kpoint%symmetry_backend) + CASE (use_k290_kpoint_backend) + kpoint%symmetry_reduction_method = use_k290_kpoint_symmetry + CASE (use_spglib_kpoint_backend) + kpoint%symmetry_reduction_method = use_spglib_kpoint_symmetry + CASE DEFAULT + CPABORT("Unknown k-point symmetry backend") + END SELECT + END IF + + IF (kpoint%symmetry_backend == use_spglib_kpoint_backend .AND. & + kpoint%symmetry_reduction_method /= use_spglib_kpoint_symmetry) THEN + CALL cp_abort(__LOCATION__, & + "SYMMETRY_BACKEND SPGLIB requires SYMMETRY_REDUCTION_METHOD SPGLIB") + END IF + + END SUBROUTINE resolve_kpoint_symmetry_settings + ! ************************************************************************************************** !> \brief Write information on the kpoints to output !> \param kpoint The kpoint environment @@ -735,6 +781,14 @@ CONTAINS IF (kpoint%symmetry .AND. .NOT. kpoint%full_grid .AND. & .NOT. kpoint%inversion_symmetry_only .AND. & (kpoint%kp_scheme == "MONKHORST-PACK" .OR. kpoint%kp_scheme == "MACDONALD")) THEN + SELECT CASE (kpoint%symmetry_backend) + CASE (use_k290_kpoint_backend) + WRITE (punit, '(A,T73,A)') ' BRILLOUIN| Symmetry backend', ' K290' + CASE (use_spglib_kpoint_backend) + WRITE (punit, '(A,T73,A)') ' BRILLOUIN| Symmetry backend', ' SPGLIB' + CASE DEFAULT + CPABORT("Unknown k-point symmetry backend") + END SELECT SELECT CASE (kpoint%symmetry_reduction_method) CASE (use_k290_kpoint_symmetry) WRITE (punit, '(A,T73,A)') ' BRILLOUIN| Symmetry reduction method', ' K290' diff --git a/src/qs_active_space_methods.F b/src/qs_active_space_methods.F index 504329348b..b5142889c7 100644 --- a/src/qs_active_space_methods.F +++ b/src/qs_active_space_methods.F @@ -64,6 +64,7 @@ MODULE qs_active_space_methods eri_operator_trunc, eri_operator_lr_trunc, & manual_selection, mao_projection, no_solver, qiskit_solver, wannier_projection, & eri_poisson_analytic, eri_poisson_periodic, eri_poisson_mt, high_spin_roks + USE kpoint_types, ONLY: get_kpoint_info, kpoint_type USE input_section_types, ONLY: section_vals_get, section_vals_get_subs_vals, & section_vals_set_subs_vals, section_vals_type, & section_vals_val_get, & @@ -215,16 +216,17 @@ CONTAINS CHARACTER(len=10) :: cshell, lnam(5) CHARACTER(len=default_path_length) :: qcschema_filename - CHARACTER(LEN=default_string_length) :: basis_type + CHARACTER(LEN=default_string_length) :: basis_type, kp_scheme INTEGER :: as_solver, eri_method, eri_operator, eri_print, group_size, handle, i, iatom, & ishell, isp, ispin, iw, j, jm, m, max_orb_ind, mselect, n1, n2, nao, natom, nel, & - nelec_active, nelec_inactive, nelec_total, nmo, nmo_active, nmo_available, nmo_inactive, & - nmo_inactive_remaining, nmo_occ, nmo_virtual, nn1, nn2, nrow_global, nspins + nelec_active, nelec_inactive, nelec_total, nkp, nmo, nmo_active, nmo_available, & + nmo_inactive, nmo_inactive_remaining, nmo_occ, nmo_virtual, nn1, nn2, nrow_global, nspins INTEGER, DIMENSION(5) :: nshell INTEGER, DIMENSION(:), POINTER :: invals LOGICAL :: do_ddapc, do_kpoints, ex_omega, & ex_operator, ex_perd, ex_rcut, & - explicit, stop_after_print, store_wfn + explicit, stop_after_print, store_wfn, & + use_real_wfn REAL(KIND=dp) :: alpha, eri_eps_filter, eri_eps_grid, eri_eps_int, eri_gpw_cutoff, & eri_op_omega, eri_rcut, eri_rel_cutoff, fel, focc, maxocc, nze_percentage REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: eigenvalues @@ -240,8 +242,10 @@ CONTAINS TYPE(cp_logger_type), POINTER :: logger TYPE(dbcsr_csr_type), POINTER :: eri_mat TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: ks_matrix, rho_ao, s_matrix + TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: ks_matrix_kp, rho_ao_kp, s_matrix_kp TYPE(dbcsr_type), POINTER :: denmat TYPE(dft_control_type), POINTER :: dft_control + TYPE(kpoint_type), POINTER :: kpoints TYPE(mo_set_type), DIMENSION(:), POINTER :: mos TYPE(mo_set_type), POINTER :: mo_set, mo_set_active, mo_set_inactive TYPE(mp_para_env_type), POINTER :: para_env @@ -277,9 +281,22 @@ CONTAINS END IF ! k-points? - CALL get_qs_env(qs_env, do_kpoints=do_kpoints, dft_control=dft_control) + NULLIFY (kpoints) + CALL get_qs_env(qs_env, do_kpoints=do_kpoints, dft_control=dft_control, kpoints=kpoints) IF (do_kpoints) THEN - CALL cp_abort(__LOCATION__, "k-points not supported in active space module") + IF (.NOT. ASSOCIATED(kpoints)) & + CALL cp_abort(__LOCATION__, "Missing Gamma-point environment for active space module") + CALL get_kpoint_info(kpoints, kp_scheme=kp_scheme, nkp=nkp, use_real_wfn=use_real_wfn) + IF (TRIM(kp_scheme) /= "GAMMA" .OR. nkp /= 1 .OR. .NOT. use_real_wfn) THEN + CALL cp_abort(__LOCATION__, & + "Only Gamma-point DFT%KPOINTS are supported in the active space module") + END IF + IF (.NOT. ASSOCIATED(kpoints%kp_env)) & + CALL cp_abort(__LOCATION__, "Missing Gamma-point environment for active space module") + IF (.NOT. ASSOCIATED(kpoints%kp_env(1)%kpoint_env)) & + CALL cp_abort(__LOCATION__, "Missing Gamma-point environment for active space module") + IF (.NOT. ASSOCIATED(kpoints%kp_env(1)%kpoint_env%mos)) & + CALL cp_abort(__LOCATION__, "Missing Gamma-point MOs for active space module") END IF ! adiabatic rescaling? @@ -428,7 +445,11 @@ CONTAINS CASE DEFAULT CPABORT("Unknown orbital selection method") CASE (casci_canonical) - CALL get_qs_env(qs_env, mos=mos) + IF (do_kpoints) THEN + mos => kpoints%kp_env(1)%kpoint_env%mos(1, :) + ELSE + CALL get_qs_env(qs_env, mos=mos) + END IF ! total number of occupied orbitals, i.e. inactive plus active MOs nmo_occ = nmo_inactive + nmo_active @@ -492,7 +513,14 @@ CONTAINS ALLOCATE (eigenvalues(nmo_occ, nspins)) eigenvalues = 0.0_dp - CALL get_qs_env(qs_env, matrix_ks=ks_matrix, matrix_s=s_matrix, scf_control=scf_control) + IF (do_kpoints) THEN + CALL get_qs_env(qs_env, matrix_ks_kp=ks_matrix_kp, matrix_s_kp=s_matrix_kp, & + scf_control=scf_control) + ks_matrix => ks_matrix_kp(:, 1) + s_matrix => s_matrix_kp(:, 1) + ELSE + CALL get_qs_env(qs_env, matrix_ks=ks_matrix, matrix_s=s_matrix, scf_control=scf_control) + END IF ! calculate virtual MOs and copy inactive and active orbitals IF (iw > 0) THEN @@ -643,7 +671,11 @@ CONTAINS END DO END DO - CALL get_qs_env(qs_env, mos=mos) + IF (do_kpoints) THEN + mos => kpoints%kp_env(1)%kpoint_env%mos(1, :) + ELSE + CALL get_qs_env(qs_env, mos=mos) + END IF ! include MOs up to the largest index in the list max_orb_ind = MAXVAL(invals) @@ -678,7 +710,14 @@ CONTAINS ALLOCATE (eigenvalues(max_orb_ind, nspins)) eigenvalues = 0.0_dp - CALL get_qs_env(qs_env, matrix_ks=ks_matrix, matrix_s=s_matrix, scf_control=scf_control) + IF (do_kpoints) THEN + CALL get_qs_env(qs_env, matrix_ks_kp=ks_matrix_kp, matrix_s_kp=s_matrix_kp, & + scf_control=scf_control) + ks_matrix => ks_matrix_kp(:, 1) + s_matrix => s_matrix_kp(:, 1) + ELSE + CALL get_qs_env(qs_env, matrix_ks=ks_matrix, matrix_s=s_matrix, scf_control=scf_control) + END IF ! calculate virtual MOs and copy inactive and active orbitals IF (iw > 0) THEN @@ -828,7 +867,12 @@ CONTAINS ! calculate inactive density matrix CALL get_qs_env(qs_env, rho=rho) - CALL qs_rho_get(rho, rho_ao=rho_ao) + IF (do_kpoints) THEN + CALL qs_rho_get(rho, rho_ao_kp=rho_ao_kp) + rho_ao => rho_ao_kp(:, 1) + ELSE + CALL qs_rho_get(rho, rho_ao=rho_ao) + END IF CPASSERT(ASSOCIATED(rho_ao)) CALL dbcsr_allocate_matrix_set(active_space_env%pmat_inactive, nspins) DO ispin = 1, nspins @@ -1155,8 +1199,10 @@ CONTAINS CHARACTER(len=*), PARAMETER :: routineN = 'calculate_spin_pol_overlap' INTEGER :: handle, nmo, nspins + LOGICAL :: do_kpoints TYPE(cp_fm_type), POINTER :: mo_coeff_a, mo_coeff_b TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: s_matrix + TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: s_matrix_kp CALL timeset(routineN, handle) @@ -1164,7 +1210,13 @@ CONTAINS ! overlap in AO IF (nspins > 1) THEN - CALL get_qs_env(qs_env, matrix_s=s_matrix) + CALL get_qs_env(qs_env, do_kpoints=do_kpoints) + IF (do_kpoints) THEN + CALL get_qs_env(qs_env, matrix_s_kp=s_matrix_kp) + s_matrix => s_matrix_kp(:, 1) + ELSE + CALL get_qs_env(qs_env, matrix_s=s_matrix) + END IF ALLOCATE (active_space_env%sab_sub(1)) CALL get_mo_set(mo_set=mos(1), mo_coeff=mo_coeff_a, nmo=nmo) diff --git a/src/qs_basis_rotation_methods.F b/src/qs_basis_rotation_methods.F index 96edc7c913..2f40a19a2e 100644 --- a/src/qs_basis_rotation_methods.F +++ b/src/qs_basis_rotation_methods.F @@ -19,6 +19,8 @@ MODULE qs_basis_rotation_methods USE orbital_transformation_matrices, ONLY: calculate_rotmat,& orbrotmat_type,& release_rotmat + USE qs_dftb_types, ONLY: qs_dftb_atom_type + USE qs_dftb_utils, ONLY: get_dftb_atom_param USE qs_environment_types, ONLY: get_qs_env,& qs_environment_type USE qs_kind_types, ONLY: get_qs_kind,& @@ -58,6 +60,7 @@ CONTAINS TYPE(gto_basis_set_type), POINTER :: orb_basis TYPE(kpoint_sym_type), POINTER :: kpsym TYPE(orbrotmat_type), DIMENSION(:), POINTER :: orbrot + TYPE(qs_dftb_atom_type), POINTER :: dftb_parameter TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set CPASSERT(ASSOCIATED(qs_env)) @@ -94,7 +97,12 @@ CONTAINS MATMUL(kpsym%rot(:, :, irot), cell%hmat)) CALL calculate_rotmat(orbrot, rotmat, lval) IF (dft_control%qs_control%method_id == do_method_dftb) THEN - CPABORT("ROTMAT") + DO ikind = 1, nkind + CALL get_qs_kind(qs_kind_set(ikind), dftb_parameter=dftb_parameter) + NULLIFY (kpoints%kind_rotmat(ira, ikind)%rmat) + CALL set_rotmat_dftb(kpoints%kind_rotmat(ira, ikind)%rmat, & + orbrot, dftb_parameter) + END DO ELSE DO ikind = 1, nkind CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis) @@ -112,6 +120,52 @@ CONTAINS END SUBROUTINE qs_basis_rotation +! ************************************************************************************************** +!> \brief Construct DFTB basis-set rotation matrices +!> \param rmat ... +!> \param orbrot ... +!> \param dftb_parameter ... +! ************************************************************************************************** + SUBROUTINE set_rotmat_dftb(rmat, orbrot, dftb_parameter) + REAL(KIND=dp), DIMENSION(:, :), POINTER :: rmat + TYPE(orbrotmat_type), DIMENSION(:), POINTER :: orbrot + TYPE(qs_dftb_atom_type), POINTER :: dftb_parameter + + INTEGER :: first, i, j, l, lmax, n, natorb + INTEGER, DIMENSION(5) :: perm + LOGICAL :: defined + + CALL get_dftb_atom_param(dftb_parameter, defined=defined, lmax=lmax, natorb=natorb) + CPASSERT(defined) + + ALLOCATE (rmat(natorb, natorb)) + rmat = 0.0_dp + + first = 1 + DO l = 0, lmax + n = nso(l) + SELECT CASE (l) + CASE (0) + perm(1) = 1 + CASE (1) + perm(1:3) = [3, 1, 2] + CASE (2) + perm(1:5) = [1, 2, 4, 5, 3] + CASE DEFAULT + CALL cp_abort(__LOCATION__, & + "DFTB k-point symmetry is implemented for basis functions up to d orbitals") + END SELECT + DO i = 1, n + DO j = 1, n + rmat(first + i - 1, first + j - 1) = orbrot(l)%mat(perm(i), perm(j)) + END DO + END DO + first = first + n + END DO + CPASSERT(first == natorb + 1) + + END SUBROUTINE set_rotmat_dftb + ! ************************************************************************************************** !> \brief ... !> \param rmat ... diff --git a/src/qs_environment.F b/src/qs_environment.F index 1842afca07..3b78ab1e24 100644 --- a/src/qs_environment.F +++ b/src/qs_environment.F @@ -94,12 +94,12 @@ MODULE qs_environment do_method_gapw, do_method_gapw_xc, do_method_gpw, do_method_lrigpw, do_method_mndo, & do_method_mndod, do_method_ofgpw, do_method_pdg, do_method_pm3, do_method_pm6, & do_method_pm6fm, do_method_pnnl, do_method_rigpw, do_method_rm1, do_method_xtb, & - do_qmmm_gauss, do_qmmm_swave, general_roks, hden_atomic, kg_tnadd_embed_ri, rel_none, & - rel_trans_atom, smear_fermi_dirac, vdw_pairpot_dftd2, vdw_pairpot_dftd3, & - vdw_pairpot_dftd3bj, vdw_pairpot_dftd4, wfi_gext_proj_nr, wfi_gext_proj_qtr_nr, & - wfi_linear_ps_method_nr, wfi_linear_wf_method_nr, wfi_use_prev_wf_method_nr, & - xc_vdw_fun_none, xc_vdw_fun_nonloc, xc_vdw_fun_pairpot, xtb_vdw_type_d3, xtb_vdw_type_d4, & - xtb_vdw_type_none + do_qmmm_gauss, do_qmmm_swave, general_roks, hden_atomic, kg_tnadd_embed_ri, & + linear_response_run, rel_none, rel_trans_atom, smear_fermi_dirac, vdw_pairpot_dftd2, & + vdw_pairpot_dftd3, vdw_pairpot_dftd3bj, vdw_pairpot_dftd4, wfi_gext_proj_nr, & + wfi_gext_proj_qtr_nr, wfi_linear_ps_method_nr, wfi_linear_wf_method_nr, & + wfi_use_prev_wf_method_nr, xc_vdw_fun_none, xc_vdw_fun_nonloc, xc_vdw_fun_pairpot, & + xtb_vdw_type_d3, xtb_vdw_type_d4, xtb_vdw_type_none USE input_section_types, ONLY: section_get_ivals,& section_vals_get,& section_vals_get_subs_vals,& @@ -268,8 +268,10 @@ CONTAINS CHARACTER(LEN=default_string_length) :: basis_type INTEGER :: ikind, method_id, nelectron_total, & nkind, nkp_grid(3) - LOGICAL :: do_admm_rpa, do_ec_hfx, do_et, do_exx, do_gw, do_hfx, do_kpoints, is_identical, & - is_semi, mp2_present, my_qmmm, qmmm_decoupl, same_except_frac, use_ref_cell + LOGICAL :: do_active_space, do_admm_rpa, do_bse, do_ec_hfx, do_et, do_exx, do_gw, do_hfx, & + do_kpoints, do_linear_response, do_mp2, do_ri_mp2, do_ri_rpa, do_ri_sos_mp2, do_tddfpt, & + do_wfc_low_scaling, do_wfc_low_scaling_kpoints, do_xtb_tblite, is_identical, is_semi, & + mp2_present, my_qmmm, qmmm_decoupl, same_except_frac, use_ref_cell REAL(KIND=dp), DIMENSION(:, :), POINTER :: rtmat TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set TYPE(cell_type), POINTER :: my_cell, my_cell_ref @@ -288,9 +290,9 @@ CONTAINS TYPE(qs_wf_history_type), POINTER :: wf_history TYPE(rel_control_type), POINTER :: rel_control TYPE(scf_control_type), POINTER :: scf_control - TYPE(section_vals_type), POINTER :: dft_section, ec_hfx_section, ec_section, & - et_coupling_section, gw_section, hfx_section, kpoint_section, mp2_section, & - rpa_hfx_section, transport_section + TYPE(section_vals_type), POINTER :: active_space_section, dft_section, ec_hfx_section, & + ec_section, et_coupling_section, gw_section, hfx_section, kpoint_section, mp2_section, & + rpa_hfx_section, tddfpt_section, transport_section NULLIFY (my_cell, my_cell_ref, atomic_kind_set, particle_set, & qs_kind_set, kpoint_section, dft_section, ec_section, & @@ -388,7 +390,59 @@ CONTAINS gw_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%BANDSTRUCTURE%GW") CALL section_vals_get(gw_section, explicit=do_gw) END IF - CALL restrict_unsupported_atomic_kpoint_symmetry(kpoints, method_id, do_hfx, do_exx, do_gw) + do_tddfpt = .FALSE. + do_bse = .FALSE. + tddfpt_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%TDDFPT") + CALL section_vals_get(tddfpt_section, explicit=do_tddfpt) + IF (do_tddfpt) THEN + CALL section_vals_val_get(tddfpt_section, "DO_BSE", l_val=do_bse) + IF (.NOT. do_bse) & + CALL section_vals_val_get(tddfpt_section, "DO_BSE_W_ONLY", l_val=do_bse) + IF (.NOT. do_bse) & + CALL section_vals_val_get(tddfpt_section, "DO_BSE_GW_ONLY", l_val=do_bse) + END IF + do_active_space = .FALSE. + active_space_section => section_vals_get_subs_vals(qs_env%input, "DFT%ACTIVE_SPACE") + CALL section_vals_get(active_space_section, explicit=do_active_space) + do_xtb_tblite = .FALSE. + IF (method_id == do_method_xtb) THEN + CALL section_vals_val_get(qs_env%input, "DFT%QS%XTB%TBLITE%_SECTION_PARAMETERS_", & + l_val=do_xtb_tblite) + END IF + do_linear_response = .FALSE. + IF (PRESENT(globenv)) do_linear_response = globenv%run_type_id == linear_response_run + do_mp2 = .FALSE. + do_ri_mp2 = .FALSE. + do_ri_sos_mp2 = .FALSE. + do_ri_rpa = .FALSE. + do_wfc_low_scaling = .FALSE. + do_wfc_low_scaling_kpoints = .FALSE. + mp2_section => section_vals_get_subs_vals(qs_env%input, "DFT%XC%WF_CORRELATION") + CALL section_vals_get(mp2_section, explicit=mp2_present) + IF (mp2_present) THEN + CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%MP2%_SECTION_PARAMETERS_", & + l_val=do_mp2) + CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%RI_MP2%_SECTION_PARAMETERS_", & + l_val=do_ri_mp2) + CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%RI_SOS_MP2%_SECTION_PARAMETERS_", & + l_val=do_ri_sos_mp2) + CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%RI_RPA%_SECTION_PARAMETERS_", & + l_val=do_ri_rpa) + CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%LOW_SCALING%_SECTION_PARAMETERS_", & + l_val=do_wfc_low_scaling) + CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%LOW_SCALING%DO_KPOINTS", & + l_val=do_wfc_low_scaling_kpoints) + IF (.NOT. do_bse) & + CALL section_vals_val_get(qs_env%input, & + "DFT%XC%WF_CORRELATION%RI_RPA%GW%BSE%_SECTION_PARAMETERS_", & + l_val=do_bse) + END IF + CALL restrict_unsupported_atomic_kpoint_symmetry(kpoints, method_id, do_hfx, do_exx, do_gw, & + do_tddfpt, do_active_space, do_linear_response, & + do_mp2 .OR. do_ri_mp2 .OR. do_ri_sos_mp2, & + do_ri_rpa .AND. .NOT. do_gw, do_bse, & + do_wfc_low_scaling, do_wfc_low_scaling_kpoints, & + do_xtb_tblite) CALL kpoint_initialize(kpoints, particle_set, my_cell) dft_section => section_vals_get_subs_vals(qs_env%input, "DFT") CALL write_kpoint_info(kpoints, dft_section=dft_section) @@ -602,21 +656,65 @@ CONTAINS !> \param do_hfx ... !> \param do_exx ... !> \param do_gw ... +!> \param do_tddfpt ... +!> \param do_active_space ... +!> \param do_linear_response ... +!> \param do_mp2 ... +!> \param do_rpa ... +!> \param do_bse ... +!> \param do_wfc_low_scaling ... +!> \param do_wfc_low_scaling_kpoints ... +!> \param do_xtb_tblite ... ! ************************************************************************************************** - SUBROUTINE restrict_unsupported_atomic_kpoint_symmetry(kpoints, method_id, do_hfx, do_exx, do_gw) + SUBROUTINE restrict_unsupported_atomic_kpoint_symmetry(kpoints, method_id, do_hfx, do_exx, do_gw, & + do_tddfpt, do_active_space, do_linear_response, & + do_mp2, do_rpa, do_bse, do_wfc_low_scaling, & + do_wfc_low_scaling_kpoints, do_xtb_tblite) TYPE(kpoint_type), POINTER :: kpoints INTEGER, INTENT(IN) :: method_id - LOGICAL, INTENT(IN) :: do_hfx, do_exx, do_gw + LOGICAL, INTENT(IN) :: do_hfx, do_exx, do_gw, do_tddfpt, do_active_space, & + do_linear_response, do_mp2, do_rpa, do_bse, do_wfc_low_scaling, & + do_wfc_low_scaling_kpoints, do_xtb_tblite - CHARACTER(LEN=default_string_length) :: reason + CHARACTER(LEN=default_string_length) :: kp_scheme, reason LOGICAL :: full_grid, inversion_symmetry_only, & kpoint_symmetry + reason = unsupported_kpoint_method_reason(method_id, do_gw, do_tddfpt, do_linear_response, & + do_mp2, do_bse, do_xtb_tblite) + IF (LEN_TRIM(reason) > 0) THEN + CALL get_kpoint_info(kpoints, kp_scheme=kp_scheme) + IF (LEN_TRIM(kp_scheme) > 0 .AND. TRIM(kp_scheme) /= "NONE") THEN + IF (TRIM(reason) == "GW") THEN + CALL cp_abort(__LOCATION__, & + "DFT%KPOINTS are not supported with GW; use "// & + "WF_CORRELATION%LOW_SCALING%KPOINTS and RI_RPA%GW%KPOINTS_SELF_ENERGY "// & + "for GW k-point sampling.") + ELSE + CALL cp_abort(__LOCATION__, & + "DFT%KPOINTS are not supported with "//TRIM(reason)// & + "; remove DFT%KPOINTS for these calculations.") + END IF + END IF + END IF + IF (do_active_space) THEN + CALL get_kpoint_info(kpoints, kp_scheme=kp_scheme) + IF (LEN_TRIM(kp_scheme) > 0 .AND. TRIM(kp_scheme) /= "NONE" .AND. & + TRIM(kp_scheme) /= "GAMMA") THEN + CALL cp_abort(__LOCATION__, & + "Only Gamma-point DFT%KPOINTS are supported with ACTIVE_SPACE; "// & + "use SCHEME GAMMA, SCHEME NONE, or remove DFT%KPOINTS.") + END IF + END IF + CALL get_kpoint_info(kpoints, symmetry=kpoint_symmetry, full_grid=full_grid, & inversion_symmetry_only=inversion_symmetry_only) IF (.NOT. (kpoint_symmetry .AND. .NOT. full_grid .AND. .NOT. inversion_symmetry_only)) RETURN - reason = unsupported_atomic_kpoint_symmetry_reason(method_id, do_hfx, do_exx, do_gw) + reason = unsupported_atomic_kpoint_symmetry_reason(method_id, do_hfx, do_exx, do_gw, & + do_tddfpt, do_active_space, do_linear_response, & + do_mp2, do_rpa, do_bse, do_wfc_low_scaling, & + do_wfc_low_scaling_kpoints, do_xtb_tblite) IF (LEN_TRIM(reason) == 0) RETURN CALL cp_warn(__LOCATION__, & @@ -626,38 +724,127 @@ CONTAINS END SUBROUTINE restrict_unsupported_atomic_kpoint_symmetry +! ************************************************************************************************** +!> \brief Return the reason why k-points are not enabled for a method +!> \param method_id ... +!> \param do_gw ... +!> \param do_tddfpt ... +!> \param do_linear_response ... +!> \param do_mp2 ... +!> \param do_bse ... +!> \param do_xtb_tblite ... +!> \return reason +! ************************************************************************************************** + FUNCTION unsupported_kpoint_method_reason(method_id, do_gw, do_tddfpt, do_linear_response, & + do_mp2, do_bse, do_xtb_tblite) RESULT(reason) + INTEGER, INTENT(IN) :: method_id + LOGICAL, INTENT(IN) :: do_gw, do_tddfpt, do_linear_response, & + do_mp2, do_bse, do_xtb_tblite + CHARACTER(LEN=default_string_length) :: reason + + reason = "" + MARK_USED(do_gw) + MARK_USED(do_mp2) + + IF (do_bse) THEN + reason = "BSE" + RETURN + END IF + IF (do_tddfpt) THEN + reason = "TDDFPT/TDDFT" + RETURN + END IF + IF (do_linear_response) THEN + reason = "LINEAR_RESPONSE/DFPT" + RETURN + END IF + IF (do_xtb_tblite) THEN + reason = "tblite xTB" + RETURN + END IF + + SELECT CASE (method_id) + CASE (do_method_rigpw) + reason = "RIGPW" + CASE (do_method_ofgpw) + reason = "OFGPW" + CASE (do_method_mndo, do_method_mndod, do_method_am1, do_method_pm3, & + do_method_pm6, do_method_pm6fm, do_method_pdg, do_method_rm1, do_method_pnnl) + reason = "semiempirical methods" + CASE DEFAULT + reason = "" + END SELECT + + END FUNCTION unsupported_kpoint_method_reason + ! ************************************************************************************************** !> \brief Return the reason why atomic k-point symmetry is not enabled !> \param method_id ... !> \param do_hfx ... !> \param do_exx ... !> \param do_gw ... +!> \param do_tddfpt ... +!> \param do_active_space ... +!> \param do_linear_response ... +!> \param do_mp2 ... +!> \param do_rpa ... +!> \param do_bse ... +!> \param do_wfc_low_scaling ... +!> \param do_wfc_low_scaling_kpoints ... +!> \param do_xtb_tblite ... !> \return reason ! ************************************************************************************************** - FUNCTION unsupported_atomic_kpoint_symmetry_reason(method_id, do_hfx, do_exx, do_gw) & - RESULT(reason) + FUNCTION unsupported_atomic_kpoint_symmetry_reason(method_id, do_hfx, do_exx, do_gw, do_tddfpt, & + do_active_space, do_linear_response, do_mp2, do_rpa, & + do_bse, do_wfc_low_scaling, do_wfc_low_scaling_kpoints, & + do_xtb_tblite) RESULT(reason) INTEGER, INTENT(IN) :: method_id - LOGICAL, INTENT(IN) :: do_hfx, do_exx, do_gw + LOGICAL, INTENT(IN) :: do_hfx, do_exx, do_gw, do_tddfpt, do_active_space, & + do_linear_response, do_mp2, do_rpa, do_bse, do_wfc_low_scaling, & + do_wfc_low_scaling_kpoints, do_xtb_tblite CHARACTER(LEN=default_string_length) :: reason reason = "" - IF (do_hfx) THEN - reason = "Hartree-Fock exchange" - ELSEIF (do_exx) THEN - reason = "RPA/GW exact exchange" - ELSEIF (do_gw) THEN + + SELECT CASE (method_id) + CASE (do_method_dftb) + reason = "DFTB" + CASE (do_method_lrigpw) + reason = "LRIGPW" + CASE (do_method_rigpw) + reason = "RIGPW" + CASE (do_method_xtb) + reason = "xTB" + CASE (do_method_mndo, do_method_mndod, do_method_am1, do_method_pm3, & + do_method_pm6, do_method_pm6fm, do_method_pdg, do_method_rm1, do_method_pnnl) + reason = "semiempirical methods" + CASE DEFAULT + reason = "" + END SELECT + + IF (LEN_TRIM(reason) > 0) RETURN + IF (do_bse) THEN + reason = "BSE" + ELSE IF (do_gw) THEN reason = "GW" - ELSE - SELECT CASE (method_id) - CASE (do_method_dftb) - reason = "DFTB" - CASE (do_method_lrigpw) - reason = "LRIGPW" - CASE (do_method_rigpw) - reason = "RIGPW" - CASE DEFAULT - reason = "" - END SELECT + ELSE IF (do_hfx .OR. do_exx) THEN + reason = "HFX/HF" + ELSE IF (do_xtb_tblite) THEN + reason = "tblite xTB" + ELSE IF (do_tddfpt) THEN + reason = "TDDFPT/TDDFT" + ELSE IF (do_active_space) THEN + reason = "ACTIVE_SPACE" + ELSE IF (do_linear_response) THEN + reason = "LINEAR_RESPONSE/DFPT" + ELSE IF (do_mp2) THEN + reason = "MP2" + ELSE IF (do_rpa .AND. do_wfc_low_scaling_kpoints) THEN + reason = "LOW_SCALING RPA" + ELSE IF (do_wfc_low_scaling) THEN + reason = "LOW_SCALING WF_CORRELATION" + ELSE IF (do_rpa) THEN + reason = "RPA" END IF END FUNCTION unsupported_atomic_kpoint_symmetry_reason diff --git a/tests/DFTB/regtest-nonscc/TEST_FILES.toml b/tests/DFTB/regtest-nonscc/TEST_FILES.toml index 370394be1d..4f08344111 100644 --- a/tests/DFTB/regtest-nonscc/TEST_FILES.toml +++ b/tests/DFTB/regtest-nonscc/TEST_FILES.toml @@ -26,6 +26,9 @@ "co2_3.inp" = [{matcher="E_total", tol=1.0E-14, ref=-8.55586246566686}] # "si_kp1.inp" = [{matcher="E_total", tol=1.0E-13, ref=-10.06358203475393}] -"si_kp1_kpsym.inp" = [{matcher="E_total", tol=1.0E-13, ref=-10.06358203475393}] +"si_kp1_kpsym.inp" = [{matcher="E_total", tol=1.0E-13, ref=-10.06358203475393}, + {matcher="N_special_kpoints", tol=0.0, ref=32}] +"si_kp1_spglib_backend.inp" = [{matcher="E_total", tol=1.0E-13, ref=-10.06358203475393}, + {matcher="N_special_kpoints", tol=0.0, ref=32}] "si_kp2.inp" = [] #EOF diff --git a/tests/DFTB/regtest-nonscc/si_kp1_spglib_backend.inp b/tests/DFTB/regtest-nonscc/si_kp1_spglib_backend.inp new file mode 100644 index 0000000000..89a4ca739c --- /dev/null +++ b/tests/DFTB/regtest-nonscc/si_kp1_spglib_backend.inp @@ -0,0 +1,63 @@ +@SET NREP 1 +&FORCE_EVAL + STRESS_TENSOR ANALYTICAL + &DFT + &KPOINTS + EPS_SYMMETRY 1.e-8 + FULL_GRID OFF + PARALLEL_GROUP_SIZE -1 + SCHEME MONKHORST-PACK 4 4 4 + SYMMETRY ON + SYMMETRY_BACKEND SPGLIB + VERBOSE T + &END KPOINTS + &QS + EXTRAPOLATION USE_GUESS + METHOD DFTB + &DFTB + DISPERSION T + ORTHOGONAL_BASIS F + SELF_CONSISTENT F + &PARAMETER + PARAM_FILE_NAME nonscc_parameter + PARAM_FILE_PATH DFTB/nonscc + SK_FILE Si Si sisi-d + UFF_FORCE_FIELD ../uff_table + &END PARAMETER + &END DFTB + &END QS + &SCF + SCF_GUESS NONE + &MIXING + ALPHA 1. + METHOD DIRECT_P_MIXING + &END MIXING + &END SCF + &END DFT + &SUBSYS + &CELL + ABC 5.431 5.431 5.431 + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END CELL + &COORD + SCALED + Si 0.000000 0.000000 0.000000 + Si 0.500000 0.500000 0.000000 + Si 0.500000 0.000000 0.500000 + Si 0.000000 0.500000 0.500000 + Si 0.250000 0.250000 0.250000 + Si 0.250000 0.750000 0.750000 + Si 0.750000 0.250000 0.750000 + Si 0.750000 0.750000 0.250000 + &END COORD + &TOPOLOGY + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END TOPOLOGY + &END SUBSYS +&END FORCE_EVAL + +&GLOBAL + PRINT_LEVEL high + PROJECT Si_spglib_backend + RUN_TYPE ENERGY +&END GLOBAL diff --git a/tests/DFTB/regtest-scc/TEST_FILES.toml b/tests/DFTB/regtest-scc/TEST_FILES.toml index 2b6b606e2d..d5bcfa1c4a 100644 --- a/tests/DFTB/regtest-scc/TEST_FILES.toml +++ b/tests/DFTB/regtest-scc/TEST_FILES.toml @@ -54,6 +54,7 @@ "h2o-atprop3.inp" = [{matcher="E_total", tol=2e-08, ref=-131.33465894123017}] # "c_kp1.inp" = [{matcher="E_total", tol=1.0E-14, ref=-13.76936385283589}] -"c_kp1_kpsym.inp" = [{matcher="E_total", tol=1.0E-14, ref=-13.76936385283589}] +"c_kp1_kpsym.inp" = [{matcher="E_total", tol=1.0E-14, ref=-13.76936385283589}, + {matcher="N_special_kpoints", tol=0.0, ref=32}] "c_kp2.inp" = [{matcher="E_total", tol=7e-14, ref=-13.76786045921772}] #EOF diff --git a/tests/QS/regtest-as-1/TEST_FILES.toml b/tests/QS/regtest-as-1/TEST_FILES.toml index 1959be31c9..625ec325fe 100644 --- a/tests/QS/regtest-as-1/TEST_FILES.toml +++ b/tests/QS/regtest-as-1/TEST_FILES.toml @@ -34,6 +34,9 @@ "h2o_gapw_2-2.inp" = [{matcher="E_total", tol=1e-12, ref=-76.011970410506123}, {matcher="M092", tol=1e-8, ref=77.48403318}] +"h2o_gpw_pade_gamma_kpoints.inp" = [{matcher="E_total", tol=1e-12, ref=-17.15466408099030}, + {matcher="M092", tol=1e-8, ref=28.21163259}] + "ch2_gapw_2-3.inp" = [{matcher="E_total", tol=1e-12, ref=-38.91914381184247}, {matcher="M092", tol=1e-8, ref=50.38752368}] diff --git a/tests/QS/regtest-as-1/h2o_gpw_pade_gamma_kpoints.inp b/tests/QS/regtest-as-1/h2o_gpw_pade_gamma_kpoints.inp new file mode 100644 index 0000000000..d78c6a1a94 --- /dev/null +++ b/tests/QS/regtest-as-1/h2o_gpw_pade_gamma_kpoints.inp @@ -0,0 +1,67 @@ +&GLOBAL + PRINT_LEVEL LOW + PROJECT h2o_gpw_pade_gamma_kpoints + RUN_TYPE ENERGY +&END GLOBAL + +&FORCE_EVAL + METHOD Quickstep + &DFT + &ACTIVE_SPACE + ACTIVE_ELECTRONS 4 + ACTIVE_ORBITALS 6 + ORBITAL_SELECTION CANONICAL + &ERI + METHOD FULL_GPW + OPERATOR COULOMB + &END ERI + &ERI_GPW + PRINT_LEVEL MEDIUM + &END ERI_GPW + &FCIDUMP + FILENAME __STD_OUT__ + &END FCIDUMP + &END ACTIVE_SPACE + &KPOINTS + SCHEME GAMMA + WAVEFUNCTIONS REAL + &END KPOINTS + &MGRID + CUTOFF 200 + &END MGRID + &QS + EPS_DEFAULT 1.0E-8 + &END QS + &SCF + ADDED_MOS 4 + MAX_SCF 30 + SCF_GUESS ATOMIC + &PRINT + &RESTART OFF + &END RESTART + &END PRINT + &END SCF + &XC + &XC_FUNCTIONAL Pade + &END XC_FUNCTIONAL + &END XC + &END DFT + &SUBSYS + &CELL + ABC 6.0 6.0 6.0 + &END CELL + &COORD + H 0.000000 -0.757136 0.520545 + O 0.000000 0.000000 -0.065587 + H 0.000000 0.757136 0.520545 + &END COORD + &KIND H + BASIS_SET ORB DZV-GTH-PADE + POTENTIAL GTH-PADE-q1 + &END KIND + &KIND O + BASIS_SET ORB DZVP-GTH-PADE + POTENTIAL GTH-PADE-q6 + &END KIND + &END SUBSYS +&END FORCE_EVAL diff --git a/tests/QS/regtest-kp-1/TEST_FILES.toml b/tests/QS/regtest-kp-1/TEST_FILES.toml index 9c02cf2c8c..ed3950596b 100644 --- a/tests/QS/regtest-kp-1/TEST_FILES.toml +++ b/tests/QS/regtest-kp-1/TEST_FILES.toml @@ -14,9 +14,13 @@ {matcher="N_special_kpoints", tol=0.0, ref=1}] "c_gapw_spglib_method.inp" = [{matcher="E_total", tol=1e-8, ref=-302.06260708591526}, {matcher="N_special_kpoints", tol=0.0, ref=1}] +"c_gapw_spglib_backend.inp" = [{matcher="E_total", tol=1e-8, ref=-302.06260708591526}, + {matcher="N_special_kpoints", tol=0.0, ref=1}] "c_gapwxc.inp" = [{matcher="E_total", tol=1e-12, ref=-45.66746891467081}] "c_gapwxc_kpsym.inp" = [{matcher="E_total", tol=1e-10, ref=-45.66746891467081}, {matcher="N_special_kpoints", tol=0.0, ref=1}] +"c_gapwxc_spglib_backend.inp" = [{matcher="E_total", tol=1e-8, ref=-45.66746891467081}, + {matcher="N_special_kpoints", tol=0.0, ref=1}] "cn_1.inp" = [{matcher="E_total", tol=5e-12, ref=-49.26750485181102}] "c_dos.inp" = [{matcher="E_total", tol=2e-14, ref=-45.65703654036614}] "h_sym_red.inp" = [{matcher="E_total", tol=1e-13, ref=-4.34916646889997}] @@ -25,6 +29,14 @@ {matcher="N_special_kpoints", tol=0.0, ref=1}] "h_fcc_spglib_method.inp" = [{matcher="E_total", tol=1e-13, ref=-4.35025489265897}, {matcher="N_special_kpoints", tol=0.0, ref=1}] +"h_fcc_spglib_backend.inp" = [{matcher="E_total", tol=1e-13, ref=-4.35025489265897}, + {matcher="N_special_kpoints", tol=0.0, ref=1}] +"c_spglib_backend_gamma_real_wfn.inp" = [{matcher="E_total", tol=1e-13, ref=-45.10384660417728}, + {matcher="N_special_kpoints", tol=0.0, ref=1}] +"h_fcc_macdonald_spglib_backend.inp" = [{matcher="E_total", tol=1e-13, ref=-4.35025489265897}, + {matcher="N_special_kpoints", tol=0.0, ref=1}] +"h_fcc_spglib_backend_4.inp" = [{matcher="E_total", tol=1e-13, ref=-4.31445892211372}, + {matcher="N_special_kpoints", tol=0.0, ref=4}] "h_spglib_sym_red.inp" = [{matcher="E_total", tol=1e-13, ref=-4.34916646889997}] "h_spglib_sym_red_restart.inp" = [{matcher="E_total", tol=1e-8, ref=-4.34916647312477}] "h_inv_red.inp" = [{matcher="E_total", tol=1e-13, ref=-4.34916646889997}] diff --git a/tests/QS/regtest-kp-1/c_gapw_spglib_backend.inp b/tests/QS/regtest-kp-1/c_gapw_spglib_backend.inp new file mode 100644 index 0000000000..7cc9f355cd --- /dev/null +++ b/tests/QS/regtest-kp-1/c_gapw_spglib_backend.inp @@ -0,0 +1,77 @@ +@SET NREP 1 +&FORCE_EVAL + &DFT + BASIS_SET_FILE_NAME ALL_BASIS_SETS + POTENTIAL_FILE_NAME ALL_POTENTIALS + &KPOINTS + EPS_SYMMETRY 1.e-8 + FULL_GRID OFF + PARALLEL_GROUP_SIZE -1 + SCHEME MONKHORST-PACK 2 2 2 + SYMMETRY ON + SYMMETRY_BACKEND SPGLIB + VERBOSE T + &END KPOINTS + &MGRID + CUTOFF 120 + &END MGRID + &QS + ALPHA0_H 10.0 + EPSFIT 1.0E-4 + EPSISO 1.0E-12 + EPSRHO0 1.0E-6 + EPS_DEFAULT 1.0E-08 + EXTRAPOLATION USE_GUESS + LMAXN0 2 + LMAXN1 4 + METHOD GAPW + &END QS + &SCF + EPS_SCF 1.0E-5 + IGNORE_CONVERGENCE_FAILURE + MAX_SCF 5 + SCF_GUESS ATOMIC + &MIXING + ALPHA 0.70 + METHOD DIRECT_P_MIXING + &END MIXING + &PRINT + &RESTART off + &END RESTART + &END PRINT + &END SCF + &XC + &XC_FUNCTIONAL PADE + &END XC_FUNCTIONAL + &END XC + &END DFT + &SUBSYS + &CELL + ABC 3.56683 3.56683 3.56683 + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END CELL + &COORD + SCALED + C 0.000000 0.000000 0.000000 + C 0.500000 0.500000 0.000000 + C 0.500000 0.000000 0.500000 + C 0.000000 0.500000 0.500000 + C 0.250000 0.250000 0.250000 + C 0.250000 0.750000 0.750000 + C 0.750000 0.250000 0.750000 + C 0.750000 0.750000 0.250000 + &END COORD + &KIND C + BASIS_SET DZVP-ALL + POTENTIAL ALL + &END KIND + &TOPOLOGY + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END TOPOLOGY + &END SUBSYS +&END FORCE_EVAL + +&GLOBAL + PRINT_LEVEL low + PROJECT C_gapw_spglib_backend +&END GLOBAL diff --git a/tests/QS/regtest-kp-1/c_gapwxc_spglib_backend.inp b/tests/QS/regtest-kp-1/c_gapwxc_spglib_backend.inp new file mode 100644 index 0000000000..92bc5ee11b --- /dev/null +++ b/tests/QS/regtest-kp-1/c_gapwxc_spglib_backend.inp @@ -0,0 +1,77 @@ +@SET NREP 1 +&FORCE_EVAL + &DFT + BASIS_SET_FILE_NAME GTH_BASIS_SETS + POTENTIAL_FILE_NAME POTENTIAL + &KPOINTS + EPS_SYMMETRY 1.e-8 + FULL_GRID OFF + PARALLEL_GROUP_SIZE -1 + SCHEME MONKHORST-PACK 2 2 2 + SYMMETRY ON + SYMMETRY_BACKEND SPGLIB + VERBOSE T + &END KPOINTS + &MGRID + CUTOFF 120 + &END MGRID + &QS + ALPHA0_H 10.0 + EPSFIT 1.0E-4 + EPSISO 1.0E-12 + EPSRHO0 1.0E-6 + EPS_DEFAULT 1.0E-8 + EXTRAPOLATION USE_GUESS + LMAXN0 2 + LMAXN1 4 + METHOD GAPW_XC + &END QS + &SCF + EPS_SCF 1.0E-6 + IGNORE_CONVERGENCE_FAILURE + MAX_SCF 5 + SCF_GUESS ATOMIC + &MIXING + ALPHA 0.70 + METHOD DIRECT_P_MIXING + &END MIXING + &PRINT + &RESTART off + &END RESTART + &END PRINT + &END SCF + &XC + &XC_FUNCTIONAL PADE + &END XC_FUNCTIONAL + &END XC + &END DFT + &SUBSYS + &CELL + ABC 3.56683 3.56683 3.56683 + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END CELL + &COORD + SCALED + C 0.000000 0.000000 0.000000 + C 0.500000 0.500000 0.000000 + C 0.500000 0.000000 0.500000 + C 0.000000 0.500000 0.500000 + C 0.250000 0.250000 0.250000 + C 0.250000 0.750000 0.750000 + C 0.750000 0.250000 0.750000 + C 0.750000 0.750000 0.250000 + &END COORD + &KIND C + BASIS_SET DZVP-GTH + POTENTIAL GTH-PADE-q4 + &END KIND + &TOPOLOGY + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END TOPOLOGY + &END SUBSYS +&END FORCE_EVAL + +&GLOBAL + PRINT_LEVEL LOW + PROJECT C_gapwxc_spglib_backend +&END GLOBAL diff --git a/tests/QS/regtest-kp-1/c_spglib_backend_gamma_real_wfn.inp b/tests/QS/regtest-kp-1/c_spglib_backend_gamma_real_wfn.inp new file mode 100644 index 0000000000..9636d98211 --- /dev/null +++ b/tests/QS/regtest-kp-1/c_spglib_backend_gamma_real_wfn.inp @@ -0,0 +1,74 @@ +# Reference energy -45.10384660417728 +@SET NREP 1 +&FORCE_EVAL + &DFT + BASIS_SET_FILE_NAME GTH_BASIS_SETS + POTENTIAL_FILE_NAME POTENTIAL + &KPOINTS + EPS_GEO 1.e-8 + FULL_GRID OFF + PARALLEL_GROUP_SIZE 0 + SCHEME MONKHORST-PACK 1 1 1 + SYMMETRY ON + SYMMETRY_BACKEND SPGLIB + VERBOSE T + WAVEFUNCTIONS REAL + &END KPOINTS + &MGRID + CUTOFF 120 + REL_CUTOFF 30 + &END MGRID + &QS + EPS_DEFAULT 1.0E-12 + EXTRAPOLATION USE_GUESS + METHOD GPW + &END QS + &SCF + EPS_SCF 1.0E-6 + IGNORE_CONVERGENCE_FAILURE + MAX_SCF 5 + SCF_GUESS ATOMIC + &MIXING + ALPHA 0.70 + METHOD DIRECT_P_MIXING + &END MIXING + &PRINT + &RESTART off + &END RESTART + &END PRINT + &END SCF + &XC + &XC_FUNCTIONAL PADE + &END XC_FUNCTIONAL + &END XC + &END DFT + &SUBSYS + &CELL + ABC 3.56683 3.56683 3.56683 + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END CELL + &COORD + SCALED + C 0.000000 0.000000 0.000000 + C 0.500000 0.500000 0.000000 + C 0.500000 0.000000 0.500000 + C 0.000000 0.500000 0.500000 + C 0.250000 0.250000 0.250000 + C 0.250000 0.750000 0.750000 + C 0.750000 0.250000 0.750000 + C 0.750000 0.750000 0.250000 + &END COORD + &KIND C + BASIS_SET DZVP-GTH + POTENTIAL GTH-PADE-q4 + &END KIND + &TOPOLOGY + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END TOPOLOGY + &END SUBSYS +&END FORCE_EVAL + +&GLOBAL + PRINT_LEVEL LOW + PROJECT C_SPGLIB_BACKEND_GAMMA_REAL_WFN +&END GLOBAL diff --git a/tests/QS/regtest-kp-1/h_fcc_macdonald_spglib_backend.inp b/tests/QS/regtest-kp-1/h_fcc_macdonald_spglib_backend.inp new file mode 100644 index 0000000000..eae84bad4e --- /dev/null +++ b/tests/QS/regtest-kp-1/h_fcc_macdonald_spglib_backend.inp @@ -0,0 +1,69 @@ +# Reference energy -4.35025489265897 +&GLOBAL + PRINT_LEVEL LOW + PROJECT H_FCC_MACDONALD_SPGLIB_BACKEND + RUN_TYPE ENERGY +&END GLOBAL + +&FORCE_EVAL + &DFT + BASIS_SET_FILE_NAME GTH_BASIS_SETS + POTENTIAL_FILE_NAME POTENTIAL + &KPOINTS + EPS_SYMMETRY 1.e-8 + FULL_GRID OFF + PARALLEL_GROUP_SIZE -1 + SCHEME MACDONALD 2 2 2 0.0 0.0 0.0 + SYMMETRY ON + SYMMETRY_BACKEND SPGLIB + VERBOSE T + &END KPOINTS + &MGRID + CUTOFF 280 + REL_CUTOFF 50 + &END MGRID + &QS + EPS_DEFAULT 1.0E-12 + METHOD GPW + &END QS + &SCF + CHOLESKY OFF + EPS_EIGVAL 1.e-8 + EPS_SCF 1.0E-8 + MAX_SCF 20 + SCF_GUESS ATOMIC + &MIXING + ALPHA 0.50 + METHOD BROYDEN_MIXING + &END MIXING + &PRINT + &RESTART OFF + &END RESTART + &END PRINT + &END SCF + &XC + &XC_FUNCTIONAL PADE + &END XC_FUNCTIONAL + &END XC + &END DFT + &SUBSYS + &CELL + ABC 3.56683 3.56683 3.56683 + &END CELL + &COORD + SCALED + H 0.000000 0.000000 0.000000 + H 0.500000 0.500000 0.000000 + H 0.500000 0.000000 0.500000 + H 0.000000 0.500000 0.500000 + H 0.250000 0.250000 0.250000 + H 0.250000 0.750000 0.750000 + H 0.750000 0.250000 0.750000 + H 0.750000 0.750000 0.250000 + &END COORD + &KIND H + BASIS_SET SZV-GTH + POTENTIAL GTH-PADE-q1 + &END KIND + &END SUBSYS +&END FORCE_EVAL diff --git a/tests/QS/regtest-kp-1/h_fcc_spglib_backend.inp b/tests/QS/regtest-kp-1/h_fcc_spglib_backend.inp new file mode 100644 index 0000000000..c556e33fce --- /dev/null +++ b/tests/QS/regtest-kp-1/h_fcc_spglib_backend.inp @@ -0,0 +1,70 @@ +# Reference energy -4.35025489265897 +&GLOBAL + PRINT_LEVEL LOW + PROJECT H_FCC_SPGLIB_BACKEND + RUN_TYPE ENERGY +&END GLOBAL + +&FORCE_EVAL + &DFT + BASIS_SET_FILE_NAME GTH_BASIS_SETS + POTENTIAL_FILE_NAME POTENTIAL + &KPOINTS + EPS_SYMMETRY 1.e-8 + FULL_GRID OFF + PARALLEL_GROUP_SIZE -1 + SCHEME MONKHORST-PACK 2 2 2 + SYMMETRY ON + SYMMETRY_BACKEND SPGLIB + VERBOSE T + WAVEFUNCTIONS COMPLEX + &END KPOINTS + &MGRID + CUTOFF 280 + REL_CUTOFF 50 + &END MGRID + &QS + EPS_DEFAULT 1.0E-12 + METHOD GPW + &END QS + &SCF + CHOLESKY OFF + EPS_EIGVAL 1.e-8 + EPS_SCF 1.0E-8 + MAX_SCF 20 + SCF_GUESS ATOMIC + &MIXING + ALPHA 0.50 + METHOD BROYDEN_MIXING + &END MIXING + &PRINT + &RESTART OFF + &END RESTART + &END PRINT + &END SCF + &XC + &XC_FUNCTIONAL PADE + &END XC_FUNCTIONAL + &END XC + &END DFT + &SUBSYS + &CELL + ABC 3.56683 3.56683 3.56683 + &END CELL + &COORD + SCALED + H 0.000000 0.000000 0.000000 + H 0.500000 0.500000 0.000000 + H 0.500000 0.000000 0.500000 + H 0.000000 0.500000 0.500000 + H 0.250000 0.250000 0.250000 + H 0.250000 0.750000 0.750000 + H 0.750000 0.250000 0.750000 + H 0.750000 0.750000 0.250000 + &END COORD + &KIND H + BASIS_SET SZV-GTH + POTENTIAL GTH-PADE-q1 + &END KIND + &END SUBSYS +&END FORCE_EVAL diff --git a/tests/QS/regtest-kp-1/h_fcc_spglib_backend_4.inp b/tests/QS/regtest-kp-1/h_fcc_spglib_backend_4.inp new file mode 100644 index 0000000000..59685a15ee --- /dev/null +++ b/tests/QS/regtest-kp-1/h_fcc_spglib_backend_4.inp @@ -0,0 +1,69 @@ +# Reference energy -4.31445892211372 +&GLOBAL + PRINT_LEVEL LOW + PROJECT H_FCC_SPGLIB_BACKEND_4 + RUN_TYPE ENERGY +&END GLOBAL + +&FORCE_EVAL + &DFT + BASIS_SET_FILE_NAME GTH_BASIS_SETS + POTENTIAL_FILE_NAME POTENTIAL + &KPOINTS + EPS_SYMMETRY 1.e-8 + FULL_GRID OFF + PARALLEL_GROUP_SIZE -1 + SCHEME MONKHORST-PACK 4 4 4 + SYMMETRY ON + SYMMETRY_BACKEND SPGLIB + VERBOSE T + &END KPOINTS + &MGRID + CUTOFF 280 + REL_CUTOFF 50 + &END MGRID + &QS + EPS_DEFAULT 1.0E-12 + METHOD GPW + &END QS + &SCF + CHOLESKY OFF + EPS_EIGVAL 1.e-8 + EPS_SCF 1.0E-8 + MAX_SCF 20 + SCF_GUESS ATOMIC + &MIXING + ALPHA 0.50 + METHOD BROYDEN_MIXING + &END MIXING + &PRINT + &RESTART OFF + &END RESTART + &END PRINT + &END SCF + &XC + &XC_FUNCTIONAL PADE + &END XC_FUNCTIONAL + &END XC + &END DFT + &SUBSYS + &CELL + ABC 3.56683 3.56683 3.56683 + &END CELL + &COORD + SCALED + H 0.000000 0.000000 0.000000 + H 0.500000 0.500000 0.000000 + H 0.500000 0.000000 0.500000 + H 0.000000 0.500000 0.500000 + H 0.250000 0.250000 0.250000 + H 0.250000 0.750000 0.750000 + H 0.750000 0.250000 0.750000 + H 0.750000 0.750000 0.250000 + &END COORD + &KIND H + BASIS_SET SZV-GTH + POTENTIAL GTH-PADE-q1 + &END KIND + &END SUBSYS +&END FORCE_EVAL diff --git a/tests/QS/regtest-kp-1/h_hex_c3_sym_red.inp b/tests/QS/regtest-kp-1/h_hex_c3_sym_red.inp index b6aaf7f6c8..a072c2f2e8 100644 --- a/tests/QS/regtest-kp-1/h_hex_c3_sym_red.inp +++ b/tests/QS/regtest-kp-1/h_hex_c3_sym_red.inp @@ -14,6 +14,7 @@ PARALLEL_GROUP_SIZE -1 SCHEME MONKHORST-PACK 3 3 2 SYMMETRY ON + SYMMETRY_BACKEND SPGLIB &END KPOINTS &MGRID CUTOFF 120 diff --git a/tests/QS/regtest-rpa-cubic-scaling/RPA_kpoints_H2O_kpsym.inp b/tests/QS/regtest-rpa-cubic-scaling/RPA_kpoints_H2O_kpsym.inp new file mode 100644 index 0000000000..a659c843c2 --- /dev/null +++ b/tests/QS/regtest-rpa-cubic-scaling/RPA_kpoints_H2O_kpsym.inp @@ -0,0 +1,89 @@ +&GLOBAL + PRINT_LEVEL MEDIUM + PROJECT RPA_H2O_kpoints_kpsym + RUN_TYPE ENERGY + &TIMINGS + THRESHOLD 0.01 + &END TIMINGS +&END GLOBAL + +&FORCE_EVAL + METHOD Quickstep + &DFT + BASIS_SET_FILE_NAME HFX_BASIS + POTENTIAL_FILE_NAME GTH_POTENTIALS + SORT_BASIS EXP + &KPOINTS + EPS_SYMMETRY 1.e-8 + FULL_GRID OFF + PARALLEL_GROUP_SIZE 0 + SCHEME MONKHORST-PACK 1 1 4 + SYMMETRY ON + VERBOSE T + &END KPOINTS + &MGRID + CUTOFF 100 + REL_CUTOFF 20 + &END MGRID + &QS + EPS_DEFAULT 1.0E-15 + EPS_PGF_ORB 1.0E-15 + METHOD GPW + &END QS + &SCF + ADDED_MOS 10000000 + EPS_SCF 1.0E-5 + MAX_SCF 100 + SCF_GUESS ATOMIC + &PRINT + &RESTART OFF + &END RESTART + &END PRINT + &END SCF + &XC + &WF_CORRELATION + MEMORY 200. + NUMBER_PROC 1 + &INTEGRALS + SIZE_LATTICE_SUM 3 + &END INTEGRALS + &LOW_SCALING + DO_EXTRAPOLATE_KPOINTS FALSE + DO_KPOINTS + MEMORY_CUT 1 + &END LOW_SCALING + &RI_RPA + RPA_NUM_QUAD_POINTS 6 + &END RI_RPA + &END WF_CORRELATION + &XC_FUNCTIONAL PBE + &END XC_FUNCTIONAL + &END XC + &END DFT + &SUBSYS + &CELL + ! warning: cell very small + ABC [angstrom] 5.000 5.000 10.000 + MULTIPLE_UNIT_CELL 1 1 1 + PERIODIC Z + &END CELL + &COORD + H 0.0 -0.5 -5.5 + O 0.5 0.0 5.5 + H 0.0 0.5 -5.5 + &END COORD + &KIND H + BASIS_SET ORB DZVP-GTH + BASIS_SET RI_AUX RI_DZVP-GTH + POTENTIAL GTH-PBE-q1 + &END KIND + &KIND O + BASIS_SET ORB DZVP-GTH + BASIS_SET RI_AUX RI_DZVP-GTH + POTENTIAL GTH-PBE-q6 + &END KIND + &TOPOLOGY + MULTIPLE_UNIT_CELL 1 1 1 + &END TOPOLOGY + &END SUBSYS +&END FORCE_EVAL diff --git a/tests/QS/regtest-rpa-cubic-scaling/TEST_FILES.toml b/tests/QS/regtest-rpa-cubic-scaling/TEST_FILES.toml index 8aa2f1e450..ddcad6bad2 100644 --- a/tests/QS/regtest-rpa-cubic-scaling/TEST_FILES.toml +++ b/tests/QS/regtest-rpa-cubic-scaling/TEST_FILES.toml @@ -4,6 +4,7 @@ "Cubic_RPA_CH3.inp" = [{matcher="M011", tol=3e-07, ref=-7.414901056476346}] "Cubic_RPA_H2O_standard_svd.inp" = [{matcher="M011", tol=1e-08, ref=-17.160104846594532}] "RPA_kpoints_H2O.inp" = [{matcher="M011", tol=5e-07, ref=-17.383890092101481}] +"RPA_kpoints_H2O_kpsym.inp" = [{matcher="M011", tol=5e-07, ref=-17.38389009210153}, {matcher="N_special_kpoints", tol=0.0, ref=2}] "RPA_kpoints_H2O_batched.inp" = [{matcher="M011", tol=5e-07, ref=-17.383890113270212}] "Cubic_RPA_H2O_admm.inp" = [{matcher="M011", tol=1e-08, ref=-17.147065793237985}] "Cubic_RPA_CH3_ri-hfx.inp" = [{matcher="M011", tol=2e-08, ref=-7.414775787676669}] diff --git a/tests/xTB/regtest-3/TEST_FILES.toml b/tests/xTB/regtest-3/TEST_FILES.toml index f75f623418..6cf3412af7 100644 --- a/tests/xTB/regtest-3/TEST_FILES.toml +++ b/tests/xTB/regtest-3/TEST_FILES.toml @@ -8,6 +8,10 @@ "h2o_emd.inp" = [{matcher="E_total", tol=1.0E-12, ref=-5.76621483534992}] "si8_wan.inp" = [{matcher="E_total", tol=1.0E-12, ref=-14.36588818966667}] "si_kp.inp" = [{matcher="E_total", tol=1.0E-12, ref=-14.73033123294306}] +"si_kp_kpsym.inp" = [{matcher="E_total", tol=1.0E-11, ref=-14.74208554207339}, + {matcher="N_special_kpoints", tol=0.0, ref=32}] +"si_kp_spglib_backend.inp" = [{matcher="E_total", tol=1.0E-11, ref=-14.74208554207337}, + {matcher="N_special_kpoints", tol=0.0, ref=32}] "tmol.inp" = [{matcher="E_total", tol=1.0E-12, ref=-41.90845660778482}] "ch2o.inp" = [{matcher="E_total", tol=1.0E-12, ref=-7.84456570305608}] "ch2o_print.inp" = [{matcher="E_total", tol=1.0E-12, ref=-7.84456570305608}] diff --git a/tests/xTB/regtest-3/si_kp_kpsym.inp b/tests/xTB/regtest-3/si_kp_kpsym.inp new file mode 100644 index 0000000000..a04dca8c92 --- /dev/null +++ b/tests/xTB/regtest-3/si_kp_kpsym.inp @@ -0,0 +1,72 @@ +@SET NREP 1 +&FORCE_EVAL + STRESS_TENSOR ANALYTICAL + &DFT + &KPOINTS + EPS_SYMMETRY 1.e-8 + FULL_GRID OFF + PARALLEL_GROUP_SIZE -1 + SCHEME MONKHORST-PACK 4 4 4 + SYMMETRY ON + VERBOSE T + &END KPOINTS + &POISSON + &EWALD + ALPHA 1.0 + EWALD_TYPE SPME + GMAX 50 + &END EWALD + &END POISSON + &QS + METHOD xTB + &XTB + DO_EWALD T + &END XTB + &END QS + &SCF + ADDED_MOS 100 + EPS_SCF 1.e-6 + MAX_SCF 100 + SCF_GUESS MOPAC + &MIXING + ALPHA 0.40 + METHOD BROYDEN_MIXING + NBUFFER 10 + &END MIXING + &PRINT + &RESTART OFF + &END RESTART + &END PRINT + &SMEAR + ELECTRONIC_TEMPERATURE 1000 + METHOD FERMI_DIRAC + &END SMEAR + &END SCF + &END DFT + &SUBSYS + &CELL + ABC 5.431 5.431 5.431 + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END CELL + &COORD + SCALED + Si 0.000000 0.000000 0.000000 + Si 0.500000 0.500000 0.000000 + Si 0.500000 0.000000 0.500000 + Si 0.000000 0.500000 0.500000 + Si 0.250000 0.250000 0.250000 + Si 0.250000 0.750000 0.750000 + Si 0.750000 0.250000 0.750000 + Si 0.750000 0.750000 0.250000 + &END COORD + &TOPOLOGY + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END TOPOLOGY + &END SUBSYS +&END FORCE_EVAL + +&GLOBAL + PRINT_LEVEL LOW + PROJECT Si_kpsym + RUN_TYPE ENERGY +&END GLOBAL diff --git a/tests/xTB/regtest-3/si_kp_spglib_backend.inp b/tests/xTB/regtest-3/si_kp_spglib_backend.inp new file mode 100644 index 0000000000..d34ea49d4b --- /dev/null +++ b/tests/xTB/regtest-3/si_kp_spglib_backend.inp @@ -0,0 +1,73 @@ +@SET NREP 1 +&FORCE_EVAL + STRESS_TENSOR ANALYTICAL + &DFT + &KPOINTS + EPS_SYMMETRY 1.e-8 + FULL_GRID OFF + PARALLEL_GROUP_SIZE -1 + SCHEME MONKHORST-PACK 4 4 4 + SYMMETRY ON + SYMMETRY_BACKEND SPGLIB + VERBOSE T + &END KPOINTS + &POISSON + &EWALD + ALPHA 1.0 + EWALD_TYPE SPME + GMAX 50 + &END EWALD + &END POISSON + &QS + METHOD xTB + &XTB + DO_EWALD T + &END XTB + &END QS + &SCF + ADDED_MOS 100 + EPS_SCF 1.e-6 + MAX_SCF 100 + SCF_GUESS MOPAC + &MIXING + ALPHA 0.40 + METHOD BROYDEN_MIXING + NBUFFER 10 + &END MIXING + &PRINT + &RESTART OFF + &END RESTART + &END PRINT + &SMEAR + ELECTRONIC_TEMPERATURE 1000 + METHOD FERMI_DIRAC + &END SMEAR + &END SCF + &END DFT + &SUBSYS + &CELL + ABC 5.431 5.431 5.431 + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END CELL + &COORD + SCALED + Si 0.000000 0.000000 0.000000 + Si 0.500000 0.500000 0.000000 + Si 0.500000 0.000000 0.500000 + Si 0.000000 0.500000 0.500000 + Si 0.250000 0.250000 0.250000 + Si 0.250000 0.750000 0.750000 + Si 0.750000 0.250000 0.750000 + Si 0.750000 0.750000 0.250000 + &END COORD + &TOPOLOGY + MULTIPLE_UNIT_CELL ${NREP} ${NREP} ${NREP} + &END TOPOLOGY + &END SUBSYS +&END FORCE_EVAL + +&GLOBAL + PRINT_LEVEL LOW + PROJECT Si_spglib_backend + RUN_TYPE ENERGY +&END GLOBAL