Line data Source code
1 : MODULE m_spgrot
2 : ! Perform the space group operations of the system.
3 : ! I.e. construct all G vectors (and optionally phases) of a star from
4 : ! its representative reciprocal lattice vector k in internal coordinates.
5 :
6 : CONTAINS
7 27565992 : SUBROUTINE spgrot(nop, symor, mrot, tau, invtab, k, kr, phas)
8 :
9 : USE m_constants
10 :
11 : IMPLICIT NONE
12 :
13 : ! Scalar arguments:
14 : INTEGER, INTENT(IN) :: nop
15 : LOGICAL, INTENT(IN) :: symor
16 :
17 : ! Array arguments:
18 : INTEGER, INTENT(IN) :: k(:), mrot(:,:, :), invtab(:)
19 : REAL, INTENT(IN) :: tau(:,:)
20 :
21 : INTEGER, INTENT(OUT) :: kr(:,:)
22 : COMPLEX, OPTIONAL, INTENT(OUT) :: phas(:) ! Could be complex!
23 :
24 : ! Local scalars:
25 : INTEGER :: n, ni
26 :
27 181677748 : DO n = 1, nop
28 : ! Construct \vec{G}_{op}^T = \vec{G}_{star}^T \cdot \mat{R}_{op}
29 2493277844 : kr(:, n) = matmul(k, mrot(:, :, n))
30 : END DO
31 :
32 27565992 : IF (.NOT.PRESENT(phas)) RETURN
33 :
34 13560549 : IF (symor) THEN
35 125029100 : phas(:) = 1.0
36 : ELSE
37 3000609 : DO n = 1,nop
38 2774080 : ni = invtab(n)
39 : ! Construct e^{-i * \vec{G}_{op}^T \cdot \vec{\tau}_{op}}
40 : phas(n) = exp( -ImagUnit * tpi_const &
41 11322849 : & * dot_product(real(kr(:, n)), tau(:, ni)) )
42 : END DO
43 : END IF
44 :
45 : END SUBROUTINE spgrot
46 : END MODULE m_spgrot
|