TABLE OF CONTENTS


ABINIT/dfpt_sygra [ Functions ]

[ Top ] [ Functions ]

NAME

 dfpt_sygra

FUNCTION

 Symmetrize derivatives of energy with respect to coordinates,
 as appearing in phonon calculations ...
 Unsymmetrized gradients are input as deunsy; symmetrized grads are then
 placed in desym.
 If nsym=1 simply copy deunsy into desym (only symmetry is identity).
 The index of the initial perturbation is needed, in case there is a change
 of atom position (moved in another cell) due to the symmetry operation.

COPYRIGHT

 Copyright (C) 1999-2018 ABINIT group (DCA,XG)
 This file is distributed under the terms of the
 GNU General Public License, see ~abinit/COPYING
 or http://www.gnu.org/copyleft/gpl.txt .
 For the initials of contributors, see ~abinit/doc/developers/contributors.txt .

INPUTS

  natom=number of atoms in cell
  deunsy(2,3,natom)=unsymmetrized gradients wrt dimensionless tn (hartree)
  note : there is a real and a imaginary part ...
  indsym(4,nsym,natom)=label given by subroutine symatm, indicating atom
   label which gets rotated into given atom by given symmetry
   (first three elements are related primitive translation--
   see symatm where this is computed)
  nsym=number of symmetry operators in group
  ipert=index of the initial perturbation
  qpt(3)= wavevector of the phonon, in reduced coordinates
  symrec(3,3,nsym)=symmetries of group in terms of operations on
    reciprocal space primitive translations--see comments below

OUTPUT

 desym(2,3,natom)=symmetrized gradients wrt dimensionless tn (hartree)

NOTES

 Written by X. Gonze starting from sygrad, written by D.C. Allan :
    introduction of the q vector for phonon symmetrization
 This routine should once be merged with sygrad ...

PARENTS

      dfpt_nstdy,dfpt_nstpaw

CHILDREN

SOURCE

 52 #if defined HAVE_CONFIG_H
 53 #include "config.h"
 54 #endif
 55 
 56 #include "abi_common.h"
 57 
 58 
 59 subroutine dfpt_sygra(natom,desym,deunsy,indsym,ipert,nsym,qpt,symrec)
 60 
 61  use defs_basis
 62  use m_profiling_abi
 63 
 64 !This section has been created automatically by the script Abilint (TD).
 65 !Do not modify the following lines by hand.
 66 #undef ABI_FUNC
 67 #define ABI_FUNC 'dfpt_sygra'
 68 !End of the abilint section
 69 
 70  implicit none
 71 
 72 !Arguments -------------------------------
 73 !scalars
 74  integer,intent(in) :: ipert,natom,nsym
 75 !arrays
 76  integer,intent(in) :: indsym(4,nsym,natom),symrec(3,3,nsym)
 77  real(dp),intent(in) :: deunsy(2,3,natom),qpt(3)
 78  real(dp),intent(out) :: desym(2,3,natom)
 79 
 80 !Local variables -------------------------
 81 !scalars
 82  integer :: ia,ind,isym,mu
 83  real(dp) :: arg,im,re,sumi,sumr
 84 
 85 ! *********************************************************************
 86 
 87 !DEBUG
 88 !write(std_out,*)' dfpt_sygra : enter '
 89 !write(std_out,*)' dfpt_sygra : qpt(:)',qpt(:)
 90 !do ia=1,natom
 91 !do mu=1,3
 92 !write(std_out,*)' dfpt_sygra : deunsy(:2,mu,ia)',deunsy(:2,mu,ia)
 93 !enddo
 94 !enddo
 95 !ENDDEBUG
 96 
 97  if (nsym==1) then
 98 
 99 !  Only symmetry is identity so simply copy
100    desym(:,:,:)=deunsy(:,:,:)
101 
102  else
103 
104 !  Actually conduct symmetrization
105 !  DEBUG
106 !  write(std_out,*)' dfpt_sygra : desym(:2,:3,:natom),qpt(:)',desym(:2,:3,:natom),qpt(:)
107 !  ENDDEBUG
108    do ia=1,natom
109 !    DEBUG
110 !    write(std_out,*)' dfpt_sygra : ia=',ia
111 !    ENDDEBUG
112      do mu=1,3
113        sumr=zero
114        sumi=zero
115 !      DEBUG
116 !      write(std_out,*)' dfpt_sygra : mu=',mu
117 !      ENDDEBUG
118        do isym=1,nsym
119          ind=indsym(4,isym,ia)
120 !        Must shift the atoms back to the unit cell.
121 !        arg=two_pi*( qpt(1)*indsym(1,isym,ia)&
122 !        &         +qpt(2)*indsym(2,isym,ia)&
123 !        &         +qpt(3)*indsym(3,isym,ia) )
124 !        Selection of non-zero q point, to avoid ipert being outside the 1 ... natom range
125          if(qpt(1)**2+qpt(2)**2+qpt(3)**2 > tol16)then
126            arg=two_pi*( qpt(1)*(indsym(1,isym,ia)-indsym(1,isym,ipert))&
127 &           +qpt(2)* (indsym(2,isym,ia)-indsym(2,isym,ipert))&
128 &           +qpt(3)* (indsym(3,isym,ia)-indsym(3,isym,ipert)))
129          else
130            arg=zero
131          end if
132 
133          re=dble(symrec(mu,1,isym))*deunsy(1,1,ind)+&
134 &         dble(symrec(mu,2,isym))*deunsy(1,2,ind)+&
135 &         dble(symrec(mu,3,isym))*deunsy(1,3,ind)
136          im=dble(symrec(mu,1,isym))*deunsy(2,1,ind)+&
137 &         dble(symrec(mu,2,isym))*deunsy(2,2,ind)+&
138 &         dble(symrec(mu,3,isym))*deunsy(2,3,ind)
139          sumr=sumr+re*cos(arg)-im*sin(arg)
140          sumi=sumi+re*sin(arg)+im*cos(arg)
141 !        sumr=sumr+re
142 !        sumi=sumi+im
143 !        DEBUG
144 !        write(std_out,*)' dfpt_sygra : isym,indsym(4,isym,ia),arg,re,im,sumr,sumi',&
145 !        &      isym,indsym(4,isym,ia),arg,re,im,sumr,sumi
146 !        ENDDEBUG
147        end do
148        desym(1,mu,ia)=sumr/dble(nsym)
149        desym(2,mu,ia)=sumi/dble(nsym)
150 !      DEBUG
151 !      write(std_out,*)' dfpt_sygra : desym(:,mu,ia)',desym(:,mu,ia)
152 !      ENDDEBUG
153      end do
154    end do
155  end if
156 
157 end subroutine dfpt_sygra