49 rotation, antiunitary, status)
51 INTEGER,
INTENT(IN) :: representative, operation
52 REAL(
dp),
INTENT(IN) ::
target(3)
53 COMPLEX(dp),
INTENT(OUT) :: action(:, :)
54 REAL(
dp),
INTENT(OUT) :: rotation(3, 3)
55 LOGICAL,
INTENT(OUT) :: antiunitary
56 INTEGER,
INTENT(OUT) :: status
58 INTEGER :: a, b, first, i, kind, n, na, nb, slot
59 INTEGER,
ALLOCATABLE :: offset(:), seen(:), width(:)
68 IF (n < 1 .OR.
SIZE(action, 2) /= n .OR. .NOT.
ASSOCIATED(kpoints))
RETURN
69 IF (representative < 1 .OR. representative > kpoints%nkp)
RETURN
70 IF (operation == 0 .OR. operation == -1)
THEN
71 antiunitary = operation == -1
72 IF (operation == 0)
THEN
81 rotation(i, i) = 1.0_dp
86 IF (operation < 1 .OR. .NOT.
ASSOCIATED(kpoints%kp_sym))
RETURN
87 sym => kpoints%kp_sym(representative)%kpoint_sym
88 IF (.NOT.
ASSOCIATED(sym))
RETURN
89 IF (.NOT. sym%apply_symmetry .OR. operation > sym%nwred)
RETURN
91 IF (.NOT.
ASSOCIATED(kpoints%atype) .OR. .NOT.
ASSOCIATED(kpoints%kind_rotmat))
RETURN
92 IF (.NOT.
ASSOCIATED(sym%fcell_gauge))
RETURN
95 na =
SIZE(kpoints%atype)
96 ALLOCATE (offset(na), width(na), seen(na))
100 kind = kpoints%atype(a)
101 IF (kind < 1 .OR. kind >
SIZE(kpoints%kind_rotmat, 2))
RETURN
102 IF (.NOT.
ASSOCIATED(kpoints%kind_rotmat(slot, kind)%rmat))
RETURN
104 width(a) =
SIZE(kpoints%kind_rotmat(slot, kind)%rmat, 2)
105 first = first + width(a)
107 IF (first /= n + 1)
RETURN
109 b = sym%f0(a, operation)
110 IF (b < 1 .OR. b > na)
RETURN
111 seen(b) = seen(b) + 1
112 IF (seen(b) /= 1 .OR. kpoints%atype(b) /= kpoints%atype(a))
RETURN
113 kind = kpoints%atype(a)
115 IF (
SIZE(kpoints%kind_rotmat(slot, kind)%rmat, 1) /= nb)
RETURN
116 angle = -
twopi*dot_product(
TARGET, real(sym%fcell_gauge(:, a, operation),
dp))
117 action(offset(b):offset(b) + nb - 1, offset(a):offset(a) + width(a) - 1) = &
118 cmplx(cos(angle), sin(angle),
dp)*kpoints%kind_rotmat(slot, kind)%rmat
120 rotation = sym%rot(:, :, operation)
121 antiunitary = sym%rotp(operation) < 0
153 isym, success, reason)
156 INTEGER,
INTENT(IN) :: ikred, isym
157 LOGICAL,
INTENT(OUT) :: success
158 CHARACTER(LEN=*),
INTENT(OUT) :: reason
160 COMPLEX(KIND=dp) :: coeff, phase
161 COMPLEX(KIND=dp),
ALLOCATABLE,
DIMENSION(:, :) :: dst_coeff, src_coeff
162 INTEGER :: iao, iatom, ikind, imo, irow, irow_source, irow_target, irow_work, nao, natom, &
163 nmo, rot_slot, source_atom, source_dim, target_atom, target_dim
164 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: ao_size, ao_start
165 LOGICAL :: reverse_phase, time_reversal
166 REAL(kind=
dp) :: arg, coskl, sinkl
167 REAL(kind=
dp),
DIMENSION(3) :: xkp_phase
168 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: rotmat
181 ALLOCATE (src_coeff(nao, nmo), dst_coeff(nao, nmo))
183 dst_coeff(:, :) = cmplx(0.0_dp, 0.0_dp, kind=
dp)
186 dst_coeff(:, :) = conjg(src_coeff)
192 IF (.NOT.
ASSOCIATED(qs_kpoint%kp_sym))
THEN
193 reason =
"SCF symmetry operation data are not available"
196 kpsym => qs_kpoint%kp_sym(ikred)%kpoint_sym
197 IF (.NOT.
ASSOCIATED(
kpsym))
THEN
198 reason =
"SCF k-point symmetry operation is not available"
201 IF (isym >
kpsym%nwred)
THEN
202 reason =
"SCF k-point symmetry operation index is out of range"
205 IF (.NOT.
ASSOCIATED(qs_kpoint%atype) .OR. .NOT.
ASSOCIATED(qs_kpoint%kind_rotmat))
THEN
206 reason =
"SCF atom mappings or basis rotation matrices are not available"
211 IF (rot_slot == 0)
THEN
212 reason =
"could not match the SCF symmetry operation to a basis rotation"
215 kind_rot => qs_kpoint%kind_rotmat(rot_slot, :)
216 natom =
SIZE(qs_kpoint%atype)
217 ALLOCATE (ao_start(natom), ao_size(natom))
220 ikind = qs_kpoint%atype(iatom)
221 IF (.NOT.
ASSOCIATED(kind_rot(ikind)%rmat))
THEN
222 reason =
"a required basis rotation matrix is not available"
225 ao_start(iatom) = irow
226 ao_size(iatom) =
SIZE(kind_rot(ikind)%rmat, 2)
227 irow = irow + ao_size(iatom)
229 IF (irow - 1 /= nao)
THEN
230 reason =
"atom-resolved AO dimensions do not match the MO coefficient matrix"
234 time_reversal =
kpsym%rotp(isym) < 0
235 reverse_phase = qs_kpoint%gamma_centered .AND. any(mod(qs_kpoint%nkp_grid, 2) == 0)
236 IF (
ASSOCIATED(
kpsym%phase_mode))
THEN
237 IF (
kpsym%phase_mode(isym) > 0) reverse_phase =
kpsym%phase_mode(isym) == 2
239 xkp_phase(1:3) =
kpsym%xkp(1:3, isym)
242 target_atom =
kpsym%f0(iatom, isym)
243 ikind = qs_kpoint%atype(source_atom)
244 rotmat => kind_rot(ikind)%rmat
245 source_dim = ao_size(source_atom)
246 target_dim = ao_size(target_atom)
247 IF (
SIZE(rotmat, 1) /= target_dim .OR.
SIZE(rotmat, 2) /= source_dim)
THEN
248 reason =
"basis rotation dimensions do not match the atom/AO symmetry transform"
251 arg = real(
kpsym%fcell_gauge(1, source_atom, isym), kind=
dp)*xkp_phase(1) + &
252 REAL(
kpsym%fcell_gauge(2, source_atom, isym), kind=
dp)*xkp_phase(2) + &
253 REAL(
kpsym%fcell_gauge(3, source_atom, isym), kind=
dp)*xkp_phase(3)
256 IF (reverse_phase) arg = -arg
257 coskl = cos(
twopi*arg)
258 sinkl = sin(
twopi*arg)
260 DO irow_work = 1, source_dim
261 irow_source = ao_start(source_atom) + irow_work - 1
262 coeff = src_coeff(irow_source, imo)
263 IF (time_reversal) coeff = conjg(coeff)
264 phase = cmplx(coskl, sinkl, kind=
dp)*coeff
265 DO iao = 1, target_dim
266 irow_target = ao_start(target_atom) + iao - 1
267 dst_coeff(irow_target, imo) = dst_coeff(irow_target, imo) + &
268 rotmat(iao, irow_work)*phase
subroutine, public cp_cfm_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)
Extract a sub-matrix from the full matrix: op(target_m)(1:n_rows,1:n_cols) = fm(start_row:start_row+n...
subroutine, public cp_cfm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, matrix_struct, para_env)
Returns information about a full matrix.
subroutine, public cp_cfm_set_submatrix(matrix, new_values, start_row, start_col, n_rows, n_cols, alpha, beta, transpose)
Set a sub-matrix of the full matrix: matrix(start_row:start_row+n_rows,start_col:start_col+n_cols) = ...