(git:6344619)
Loading...
Searching...
No Matches
qs_property_symmetry.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Cell-gauge scalar/spinor reconstruction on independent complete property meshes.
10!> \author Thomas D. Kuehne, tkuehne@cp2k.org
11! **************************************************************************************************
13 USE cell_types, ONLY: cell_type
17 USE kinds, ONLY: dp
21 USE kpoint_types, ONLY: kpoint_create,&
30#include "./base/base_uses.f90"
31
32 IMPLICIT NONE
33 PRIVATE
34 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_property_symmetry'
36CONTAINS
37! **************************************************************************************************
38!> \brief Construct a geometric orbit plan; each reconstructed frame still needs H/S validation.
39!> \param qs_env Frozen property environment
40!> \param k Full mesh in fractional reciprocal coordinates
41!> \param grid Complete Gamma-centered property mesh dimensions
42!> \param projection Cartesian periodic-space projector
43!> \param backend Existing K290 or SPGLIB backend identifier
44!> \param tolerance Geometric symmetry tolerance
45!> \param points Owned irreducible k-point object; caller must release it
46!> \param representative Source irreducible index for each full point
47!> \param operation Source-to-target operation, zero identity or minus one time reversal
48! **************************************************************************************************
49 SUBROUTINE property_symmetry_plan(qs_env, k, grid, projection, backend, tolerance, points, representative, operation)
50 TYPE(qs_environment_type), POINTER :: qs_env
51 REAL(dp), INTENT(IN) :: k(:, :)
52 INTEGER, INTENT(IN) :: grid(3)
53 REAL(dp), INTENT(IN) :: projection(3, 3)
54 INTEGER, INTENT(IN) :: backend
55 REAL(dp), INTENT(IN) :: tolerance
56 TYPE(kpoint_type), POINTER :: points
57 INTEGER, ALLOCATABLE, INTENT(OUT) :: representative(:), operation(:)
58
59 INTEGER :: ik, ir, is, nk
60 REAL(dp) :: r(3, 3)
61 TYPE(cell_type), POINTER :: cell
62 TYPE(kpoint_sym_type), POINTER :: sym
63 TYPE(particle_type), POINTER :: particles(:)
64
65 CALL get_qs_env(qs_env, cell=cell, particle_set=particles)
66 nk = SIZE(k, 2)
67 CALL kpoint_create(points)
68 points%kp_scheme = 'MONKHORST-PACK'
69 points%nkp_grid = grid
70 points%gamma_centered = .true.
71 points%symmetry = .true.
72 points%symmetry_backend = backend
73 points%symmetry_reduction_method = use_k290_kpoint_symmetry
74 IF (backend == use_spglib_kpoint_backend) points%symmetry_reduction_method = use_spglib_kpoint_symmetry
75 points%eps_geo = tolerance
76 CALL kpoint_initialize(points, particles, cell)
77 CALL qs_basis_rotation(qs_env, points)
78 ALLOCATE (representative(nk), operation(nk))
79 representative = 0
80 operation = 0
81 DO ik = 1, nk
82 DO ir = 1, points%nkp
83 IF (kpoint_same_periodic(k(:, ik), points%xkp(:, ir))) THEN
84 representative(ik) = ir
85 EXIT
86 END IF
87 IF (kpoint_same_periodic(k(:, ik), -points%xkp(:, ir))) THEN
88 representative(ik) = ir
89 operation(ik) = -1
90 EXIT
91 END IF
92 sym => points%kp_sym(ir)%kpoint_sym
93 IF (.NOT. sym%apply_symmetry) cycle
94 DO is = 1, sym%nwred
95 IF (.NOT. kpoint_same_periodic(k(:, ik), sym%xkp(:, is))) cycle
96 r = sym%rot(:, :, is)
97 IF (maxval(abs(matmul(r, matmul(projection, transpose(r))) - projection)) > 1.e-9_dp) cycle
98 representative(ik) = ir
99 operation(ik) = is
100 EXIT
101 END DO
102 IF (representative(ik) > 0) EXIT
103 END DO
104 END DO
105 IF (any(representative == 0)) THEN
106 cpabort('Property symmetry orbit does not preserve the periodic subspace.')
107 END IF
108 END SUBROUTINE property_symmetry_plan
109! **************************************************************************************************
110!> \brief Reconstruct a target eigenframe with atomic image phases and physical SU(2)/Theta action.
111!> \param points Property symmetry plan
112!> \param representative Source index
113!> \param operation Signed operation index
114!> \param k Target point in the cell Fourier gauge
115!> \param source Source eigenframe
116!> \param soc Whether the frame is spin-major doubled
117!> \param TARGET Reconstructed frame, not rediagonalized or gauge-aligned
118!> \param rotation Cartesian spatial rotation for property tensors
119!> \param antiunitary Whether physical time reversal was applied
120!> \param status Zero on success; the caller must additionally check the target H/S eigensystem
121! **************************************************************************************************
122 SUBROUTINE property_symmetry_frame(points, representative, operation, k, source, soc, TARGET, &
123 rotation, antiunitary, status)
124 TYPE(kpoint_type), POINTER :: points
125 INTEGER, INTENT(IN) :: representative, operation
126 REAL(dp), INTENT(IN) :: k(3)
127 COMPLEX(dp), INTENT(IN) :: source(:, :)
128 LOGICAL, INTENT(IN) :: soc
129 COMPLEX(dp), INTENT(OUT) :: target(:, :)
130 REAL(dp), INTENT(OUT) :: rotation(3, 3)
131 LOGICAL, INTENT(OUT) :: antiunitary
132 INTEGER, INTENT(OUT) :: status
133
134 COMPLEX(dp) :: spin(2, 2)
135 COMPLEX(dp), ALLOCATABLE :: orbital(:, :)
136 INTEGER :: n
137
138 n = SIZE(source, 1)
139 IF (soc) n = n/2
140 ALLOCATE (orbital(n, n))
141 CALL kpoint_cell_gauge_action(points, representative, operation, k, orbital, rotation, antiunitary, status)
142 IF (status /= 0) RETURN
143 IF (soc) THEN
144 CALL spin_rotation(rotation, spin, 1.e-9_dp, status)
145 IF (status /= 0) RETURN
146 ! CP2K assembles SOC with (sigma_x,-sigma_y,sigma_z), the conjugate spin representation.
147 spin = conjg(spin)
148 CALL transform_spinor_frame(orbital, spin, source, antiunitary, TARGET, 1.e-9_dp, status)
149 ELSE IF (antiunitary) THEN
150 TARGET = matmul(orbital, conjg(source))
151 ELSE
152 TARGET = matmul(orbital, source)
153 END IF
154 END SUBROUTINE property_symmetry_frame
155END MODULE qs_property_symmetry
Handles all functions related to the CELL.
Definition cell_types.F:15
function that build the kpoints section of the input
integer, parameter, public use_spglib_kpoint_symmetry
integer, parameter, public use_k290_kpoint_symmetry
integer, parameter, public use_spglib_kpoint_backend
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Routines needed for kpoint calculation.
subroutine, public kpoint_initialize(kpoint, particle_set, cell)
Generate the kpoints and initialize the kpoint environment.
Utilities for transforming k-point MO coefficients under symmetry operations.
logical function, public kpoint_same_periodic(xkp_a, xkp_b)
Compare two fractional k-points modulo reciprocal lattice vectors.
subroutine, public kpoint_cell_gauge_action(kpoints, representative, operation, target, action, rotation, antiunitary, status)
AO action in the cell Fourier gauge H(k)=sum_R exp(+ikR) H(R).
Types and basic routines needed for a kpoint calculation.
subroutine, public kpoint_create(kpoint)
Create a kpoint environment.
Define the data structure for the particle information.
subroutine, public qs_basis_rotation(qs_env, kpoints, basis_type)
Construct basis set rotation matrices.
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Cell-gauge scalar/spinor reconstruction on independent complete property meshes.
subroutine, public property_symmetry_frame(points, representative, operation, k, source, soc, target, rotation, antiunitary, status)
Reconstruct a target eigenframe with atomic image phases and physical SU(2)/Theta action.
subroutine, public property_symmetry_plan(qs_env, k, grid, projection, backend, tolerance, points, representative, operation)
Construct a geometric orbit plan; each reconstructed frame still needs H/S validation.
Native character decomposition and metric-aware inversion representations.
subroutine, public transform_spinor_frame(orbital, spin, source, antiunitary, image, tolerance, status)
Compose orbital, Bloch, physical-spin and optional time-reversal transformations.
subroutine, public spin_rotation(rotation, spin, tolerance, status)
Lift a Cartesian orthogonal operation to the physical spin-1/2 representation.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
Keeps symmetry information about a specific k-point.
Contains information about kpoints.
Orbital angular momentum.