[Pw_forum] question on q2r.f90

Guoying Gao gaoguoying at gmail.com
Wed Dec 5 08:05:32 CET 2007


Dear everyone,
      When I read the routine q2r.f90 given in the pwtools directory,
I find the following lines:
  %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        lq = .true.
        do ipol=1,3
           xq = 0.0
           do icar=1,3
              xq = xq + at(icar,ipol) * q(icar,nq) * nr(ipol)
           end do
           lq = lq .and. (abs(nint(xq) - xq) .lt. eps)
           iq = nint(xq)
           !
           m(ipol)= mod(iq,nr(ipol)) + 1
           if (m(ipol) .lt. 1) m(ipol) = m(ipol) + nr(ipol)
        end do
        if (.not.lq) call errore('init','q not allowed',1)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I know the parameters at(icar, ipol) means the components of the
crystal vectors, q(icar, np) is the coordinates of the qpoints and
nr(ipol) are the dimensions
of the FFT grid formed by the q-point grid. What I don't understand is
why the three parameters multiply and sum for x, y and z
components:that is,
          do icar=1,3
              xq = xq + at(icar,ipol) * q(icar,nq) * nr(ipol)
           end do
and then there is another line: lq = lq .and. (abs(nint(xq) - xq) .lt. eps
what makes (abs(nint(xq) - xq) should be less than eps.
Is there anyone familiar with this part? Any small suggestions may be
a great help for me.
Thanks for your help!
Best wishes,
Guoying



More information about the users mailing list