Line data Source code
1 : !!****m* ABINIT/m_qplusg
2 : !! NAME
3 : !! m_qplusg
4 : !!
5 : !! FUNCTION
6 : !!
7 : !! COPYRIGHT
8 : !! Copyright (C) 1999-2026 ABINIT group (MG, FB, BG)
9 : !! This file is distributed under the terms of the
10 : !! GNU General Public License, see ~abinit/COPYING
11 : !! or http://www.gnu.org/copyleft/gpl.txt .
12 : !! For the initials of contributors, see ~abinit/doc/developers/contributors.txt .
13 : !!
14 : !! SOURCE
15 :
16 : #if defined HAVE_CONFIG_H
17 : #include "config.h"
18 : #endif
19 :
20 : #include "abi_common.h"
21 :
22 : module m_qplusg
23 :
24 : use defs_basis
25 :
26 : implicit none
27 :
28 : private
29 : !!***
30 :
31 : public :: cmod_qpg
32 : !!***
33 :
34 : CONTAINS
35 : !!***
36 :
37 : !!****f* m_qplusg/cmod_qpg
38 : !! NAME
39 : !! cmod_qpg
40 : !!
41 : !! FUNCTION
42 : !! Set up table of lengths |q+G| for the Coulomb potential.
43 : !!
44 : !! INPUTS
45 : !! gvec(3,npwvec)=Reduced coordinates of the G vectors.
46 : !! gprimd(3,3)=Dimensional primitive translations for reciprocal space ($\textrm{bohr}^{-1}$)
47 : !! iq=Index specifying the q point.
48 : !! npwvec=Number of planewaves
49 : !! nq=Number of q points.
50 : !! q=Coordinates of q points.
51 : !!
52 : !! OUTPUT
53 : !! qplusg(npwvec)=Norm of q+G vector
54 : !!
55 : !! SOURCE
56 :
57 2863 : subroutine cmod_qpg(nq, iq, q, npwvec, gvec, gprimd, qplusg)
58 :
59 : !Arguments ------------------------------------
60 : !scalars
61 : integer,intent(in) :: iq,npwvec,nq
62 : !arrays
63 : integer,intent(in) :: gvec(3,npwvec)
64 : real(dp),intent(in) :: gprimd(3,3),q(3,nq)
65 : real(dp),intent(out) :: qplusg(npwvec)
66 :
67 : !Local variables ------------------------------
68 : !scalars
69 : integer :: ig
70 : !arrays
71 : real(dp) :: gmet(3,3),gpq(3)
72 : !************************************************************************
73 :
74 : ! Compute reciprocal space metrics
75 114520 : gmet = MATMUL(TRANSPOSE(gprimd),gprimd)
76 :
77 5368 : if (ALL(ABS(q(:,iq)) < tol3)) then
78 : ! Treat q as if it were zero except when G=0
79 11440 : qplusg(1)=two_pi*SQRT(DOT_PRODUCT(q(:,iq),MATMUL(gmet,q(:,iq))))
80 94625 : do ig=2,npwvec
81 375640 : gpq(:)=gvec(:,ig)
82 1503275 : qplusg(ig)=two_pi*SQRT(DOT_PRODUCT(gpq,MATMUL(gmet,gpq)))
83 : end do
84 : else
85 231518 : do ig=1,npwvec
86 917480 : gpq(:)=gvec(:,ig)+q(:,iq)
87 3672068 : qplusg(ig)=two_pi*SQRT(DOT_PRODUCT(gpq,MATMUL(gmet,gpq)))
88 : end do
89 : end if
90 :
91 2863 : end subroutine cmod_qpg
92 : !!***
93 :
94 : end module m_qplusg
95 : !!***
|