confused by code in hartre1.F90 (solved)  [SOLVED]

Documentation, Web site and code modifications

Moderators: baguetl, routerov

Locked
ldamewood
Posts: 14
Joined: Tue Mar 09, 2010 11:39 pm

confused by code in hartre1.F90 (solved)  [SOLVED]

Post by ldamewood » Wed May 04, 2011 9:55 pm

I'm trying to write a small routine to calculate some energy term and I was using hartre1.F90 (in 6.6.2) as a template. This part is giving me trouble:

Code: Select all

 do ii=1,3
   id(ii)=ngfft(ii)/2+2
   do ing=1,ngfft(ii)
     ig=ing-(ing/id(ii))*ngfft(ii)-1
     gq(ii,ing)=ig+qphon(ii)
   end do
 end do


For my calculation, ngfft(:)=36 and for simplicity, qphon(:)=0. The result is

Code: Select all

gq(1,:)=gq(2,:)=gq(3,:)=
   -1.8000
   -2.6000
   -3.4000
   -4.2000
   -5.0000
   -5.8000
   -6.6000
   -7.4000
   -8.2000
   -9.0000
   -9.8000
  -10.6000
  -11.4000
  -12.2000
  -13.0000
  -13.8000
  -14.6000
  -15.4000
  -16.2000
  -17.0000
  -17.8000
  -18.6000
  -19.4000
  -20.2000
  -21.0000
  -21.8000
  -22.6000
  -23.4000
  -24.2000
  -25.0000
  -25.8000
  -26.6000
  -27.4000
  -28.2000
  -29.0000
  -29.8000


Shouldn't the G vectors be whole numbers; or am I missing something?

Thanks!
Last edited by ldamewood on Thu May 05, 2011 6:32 pm, edited 1 time in total.

mverstra
Posts: 655
Joined: Wed Aug 19, 2009 12:01 pm

Re: confused by code in hartre1.F90

Post by mverstra » Thu May 05, 2011 8:34 am

yes, but

1) the gq are G+q, so they will certainly not be integers
2) if ngfft is odd it looks like you will get half integer values for id anyway

matthieu
Matthieu Verstraete
University of Liege, Belgium

ldamewood
Posts: 14
Joined: Tue Mar 09, 2010 11:39 pm

Re: confused by code in hartre1.F90

Post by ldamewood » Thu May 05, 2011 6:16 pm

nevermind, I got it. integer math. :-P

Locked