aboutsummaryrefslogtreecommitdiff
blob: 8f871d8fde506d5627f60aa30225015e3f54231a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
diff -crB bigdft-abi-1.0.4/src/init/projectors.f90 bigdft-patch/src/init/projectors.f90
*** bigdft-abi-1.0.4/src/init/projectors.f90	Thu Nov 29 11:09:02 2012
--- bigdft-patch/src/init/projectors.f90	Thu Jun  6 11:31:46 2013
***************
*** 383,394 ****
  END SUBROUTINE fill_projectors
  
  subroutine atom_projector_paw(ikpt,iat,idir,istart_c,iproj,nprojel,&
!      lr,hx,hy,hz,rxyz,at,orbs,plr,proj,nwarnings,proj_G)
    use module_base
    use module_types
    implicit none
    integer, intent(in) :: iat,idir,ikpt,nprojel
!   real(gp), intent(in) :: hx,hy,hz
    type(atoms_data), intent(in) :: at
    type(orbitals_data), intent(in) :: orbs
    type(locreg_descriptors), intent(in) :: plr
--- 383,394 ----
  END SUBROUTINE fill_projectors
  
  subroutine atom_projector_paw(ikpt,iat,idir,istart_c,iproj,nprojel,&
!      lr,hx,hy,hz,rpaw,rxyz,at,orbs,plr,proj,nwarnings,proj_G)
    use module_base
    use module_types
    implicit none
    integer, intent(in) :: iat,idir,ikpt,nprojel
!   real(gp), intent(in) :: hx,hy,hz,rpaw
    type(atoms_data), intent(in) :: at
    type(orbitals_data), intent(in) :: orbs
    type(locreg_descriptors), intent(in) :: plr
***************
*** 460,466 ****
          !     plr%wfd%keyvglob,plr%wfd%keyglob,proj_tmp(1),nwarnings)
          !END DEBUG
          call projector_paw(at%geocode,at%atomnames(ityp),iat,idir,l,i,&
!              proj_G%psiat(:,jj),proj_G%xp(:,jj),rxyz(1),lr,&
               hx,hy,hz,kx,ky,kz,proj_G%ncplx,ncplx_k,&
               mbvctr_c,mbvctr_f,mbseg_c,mbseg_f,&
               plr%wfd%keyvglob,plr%wfd%keyglob,proj_tmp(1),nwarnings)
--- 460,466 ----
          !     plr%wfd%keyvglob,plr%wfd%keyglob,proj_tmp(1),nwarnings)
          !END DEBUG
          call projector_paw(at%geocode,at%atomnames(ityp),iat,idir,l,i,&
!              proj_G%psiat(:,jj),proj_G%xp(:,jj),rpaw,rxyz(1),lr,&
               hx,hy,hz,kx,ky,kz,proj_G%ncplx,ncplx_k,&
               mbvctr_c,mbvctr_f,mbseg_c,mbseg_f,&
               plr%wfd%keyvglob,plr%wfd%keyglob,proj_tmp(1),nwarnings)
***************
*** 646,651 ****
--- 646,652 ----
    integer :: istart_c,nterm,idir2
    real(gp) :: fpi,factor,rx,ry,rz
    real(dp) :: scpr
+   real(gp) :: gau_cut !dummy here just for PAW
    integer, dimension(3) :: nterm_arr
    integer, dimension(nterm_max) :: lx,ly,lz
    integer, dimension(3,nterm_max,3) :: lxyz_arr
***************
*** 709,715 ****
       
       call crtproj(geocode,nterm,lr,hx,hy,hz,kx,ky,kz,&
            ncplx_g,ncplx,&
!           gau_a,factors,rx,ry,rz,lx,ly,lz,&
            mbvctr_c,mbvctr_f,mseg_c,mseg_f,keyv_p,keyg_p,proj(istart_c))
  
       ! testing
--- 710,716 ----
       
       call crtproj(geocode,nterm,lr,hx,hy,hz,kx,ky,kz,&
            ncplx_g,ncplx,&
!           gau_a,gau_cut,factors,rx,ry,rz,lx,ly,lz,&
            mbvctr_c,mbvctr_f,mseg_c,mseg_f,keyv_p,keyg_p,proj(istart_c))
  
       ! testing
***************
*** 1055,1061 ****
  end subroutine projector_paw_isf
  
  subroutine projector_paw(geocode,atomname,iat,idir,l,i,&
!      factor,gau_a,rxyz,lr,&
       hx,hy,hz,kx,ky,kz,ncplx_g,ncplx_k,&
       mbvctr_c,mbvctr_f,mseg_c,mseg_f,keyv_p,keyg_p,proj,nwarnings)
    use module_base
--- 1056,1062 ----
  end subroutine projector_paw_isf
  
  subroutine projector_paw(geocode,atomname,iat,idir,l,i,&
!      factor,gau_a,gau_cut,rxyz,lr,&
       hx,hy,hz,kx,ky,kz,ncplx_g,ncplx_k,&
       mbvctr_c,mbvctr_f,mseg_c,mseg_f,keyv_p,keyg_p,proj,nwarnings)
    use module_base
***************
*** 1066,1072 ****
    integer, intent(in) :: iat,idir,l,i,mbvctr_c,mbvctr_f,mseg_c,mseg_f
    integer, intent(in) :: ncplx_k,ncplx_g
    type(locreg_descriptors),intent(in) :: lr
!   real(gp), intent(in) :: hx,hy,hz,kx,ky,kz
    !integer, dimension(2,3), intent(in) :: nboxp_c,nboxp_f
    integer, dimension(mseg_c+mseg_f), intent(in) :: keyv_p
    integer, dimension(2,mseg_c+mseg_f), intent(in) :: keyg_p
--- 1067,1073 ----
    integer, intent(in) :: iat,idir,l,i,mbvctr_c,mbvctr_f,mseg_c,mseg_f
    integer, intent(in) :: ncplx_k,ncplx_g
    type(locreg_descriptors),intent(in) :: lr
!   real(gp), intent(in) :: hx,hy,hz,kx,ky,kz,gau_cut
    !integer, dimension(2,3), intent(in) :: nboxp_c,nboxp_f
    integer, dimension(mseg_c+mseg_f), intent(in) :: keyv_p
    integer, dimension(2,mseg_c+mseg_f), intent(in) :: keyg_p
***************
*** 1131,1137 ****
  
       call crtproj(geocode,nterm,lr,hx,hy,hz,kx,ky,kz,&
            ncplx_g,ncplx_k,&
!           gau_a,factors(1:ncplx_g,1:nterm),&
            rx,ry,rz,lx(1:nterm),ly(1:nterm),lz(1:nterm),&
            mbvctr_c,mbvctr_f,mseg_c,mseg_f,keyv_p,keyg_p,&
            proj(istart_c))
--- 1132,1138 ----
  
       call crtproj(geocode,nterm,lr,hx,hy,hz,kx,ky,kz,&
            ncplx_g,ncplx_k,&
!           gau_a,gau_cut,factors(1:ncplx_g,1:nterm),&
            rx,ry,rz,lx(1:nterm),ly(1:nterm),lz(1:nterm),&
            mbvctr_c,mbvctr_f,mseg_c,mseg_f,keyv_p,keyg_p,&
            proj(istart_c))
***************
*** 1248,1254 ****
  !!   in the arrays proj_c, proj_f
  subroutine crtproj(geocode,nterm,lr, & 
       hx,hy,hz,kx,ky,kz,ncplx_g,ncplx_k,&
!      gau_a,fac_arr,rx,ry,rz,lx,ly,lz, & 
       mvctr_c,mvctr_f,mseg_c,mseg_f,keyv_p,keyg_p,proj)
    use module_base
    use module_types
--- 1249,1255 ----
  !!   in the arrays proj_c, proj_f
  subroutine crtproj(geocode,nterm,lr, & 
       hx,hy,hz,kx,ky,kz,ncplx_g,ncplx_k,&
!      gau_a,gau_cut,fac_arr,rx,ry,rz,lx,ly,lz, & 
       mvctr_c,mvctr_f,mseg_c,mseg_f,keyv_p,keyg_p,proj)
    use module_base
    use module_types
***************
*** 1256,1262 ****
    character(len=1), intent(in) :: geocode
    integer, intent(in) :: nterm,mvctr_c,mvctr_f,mseg_c,mseg_f
    integer, intent(in) :: ncplx_g,ncplx_k
!   real(gp), intent(in) :: hx,hy,hz,rx,ry,rz,kx,ky,kz
    integer, dimension(nterm), intent(in) :: lx,ly,lz
    real(gp), dimension(ncplx_g,nterm), intent(in) :: fac_arr
    real(gp), dimension(ncplx_g),intent(in):: gau_a
--- 1257,1263 ----
    character(len=1), intent(in) :: geocode
    integer, intent(in) :: nterm,mvctr_c,mvctr_f,mseg_c,mseg_f
    integer, intent(in) :: ncplx_g,ncplx_k
!   real(gp), intent(in) :: hx,hy,hz,rx,ry,rz,kx,ky,kz,gau_cut
    integer, dimension(nterm), intent(in) :: lx,ly,lz
    real(gp), dimension(ncplx_g,nterm), intent(in) :: fac_arr
    real(gp), dimension(ncplx_g),intent(in):: gau_a
***************
*** 1313,1327 ****
  
       factor(:)=fac_arr(:,iterm)
       n_gau=lx(iterm) 
!      call gauss_to_daub_k(hx,kx*hx,ncplx_w,ncplx_g,ncplx_k,factor,rx,gau_a,n_gau,ns1,n1,ml1,mu1,&
            wprojx(1,0,1,iterm),work,nw,perx) 
       
       n_gau=ly(iterm) 
!      call gauss_to_daub_k(hy,ky*hy,ncplx_w,ncplx_g,ncplx_k,1.d0,ry,gau_a,n_gau,ns2,n2,ml2,mu2,&
            wprojy(1,0,1,iterm),work,nw,pery) 
  
       n_gau=lz(iterm) 
!      call gauss_to_daub_k(hz,kz*hz,ncplx_w,ncplx_g,ncplx_k,1.d0,rz,gau_a,n_gau,ns3,n3,ml3,mu3,&
            wprojz(1,0,1,iterm),work,nw,perz)
    end do
    !the filling of the projector should be different if ncplx_k==1 or 2
--- 1314,1328 ----
  
       factor(:)=fac_arr(:,iterm)
       n_gau=lx(iterm) 
!      call gauss_to_daub_k(hx,kx*hx,ncplx_w,ncplx_g,ncplx_k,factor,rx,gau_a,gau_cut,n_gau,ns1,n1,ml1,mu1,&
            wprojx(1,0,1,iterm),work,nw,perx) 
       
       n_gau=ly(iterm) 
!      call gauss_to_daub_k(hy,ky*hy,ncplx_w,ncplx_g,ncplx_k,1.d0,ry,gau_a,gau_cut,n_gau,ns2,n2,ml2,mu2,&
            wprojy(1,0,1,iterm),work,nw,pery) 
  
       n_gau=lz(iterm) 
!      call gauss_to_daub_k(hz,kz*hz,ncplx_w,ncplx_g,ncplx_k,1.d0,rz,gau_a,gau_cut,n_gau,ns3,n3,ml3,mu3,&
            wprojz(1,0,1,iterm),work,nw,perz)
    end do
    !the filling of the projector should be different if ncplx_k==1 or 2
diff -crB bigdft-abi-1.0.4/src/modules/types.f90 bigdft-patch/src/modules/types.f90
*** bigdft-abi-1.0.4/src/modules/types.f90	Thu Jan  3 10:18:08 2013
--- bigdft-patch/src/modules/types.f90	Thu Jun  6 11:27:48 2013
***************
*** 1119,1124 ****
--- 1119,1125 ----
      type(cprj_objects),dimension(:,:),allocatable :: cprj
      real(wp),dimension(:),pointer :: spsi
      real(wp),dimension(:,:),pointer :: sij
+     real(dp),dimension(:),pointer :: rpaw
    end type paw_objects
  
  contains
***************
*** 2090,2095 ****
--- 2091,2097 ----
    nullify(paw%indlmn) 
    nullify(paw%spsi) 
    nullify(paw%sij) 
+   nullify(paw%rpaw)
  
    if(present(rholoc)) then
     nullify(rholoc%msz)
diff -crB bigdft-abi-1.0.4/src/wavelib/gauss_to_daub.f90 bigdft-patch/src/wavelib/gauss_to_daub.f90
*** bigdft-abi-1.0.4/src/wavelib/gauss_to_daub.f90	Mon Jul  9 16:43:33 2012
--- bigdft-patch/src/wavelib/gauss_to_daub.f90	Thu Jun  6 13:01:01 2013
***************
*** 448,454 ****
  !!  In this version, we dephase the projector to wrt the center of the gaussian
  !!  this should not have an impact on the results since the operator is unchanged
  subroutine gauss_to_daub_k(hgrid,kval,ncplx_w,ncplx_g,ncplx_k,&
!      factor,gau_cen,gau_a,n_gau,&!no err, errsuc
       nstart,nmax,n_left,n_right,c,& 
       ww,nwork,periodic)      !added work arrays ww with dimension nwork
    use module_base
--- 448,454 ----
  !!  In this version, we dephase the projector to wrt the center of the gaussian
  !!  this should not have an impact on the results since the operator is unchanged
  subroutine gauss_to_daub_k(hgrid,kval,ncplx_w,ncplx_g,ncplx_k,&
!      factor,gau_cen,gau_a,gau_cut,n_gau,&!no err, errsuc
       nstart,nmax,n_left,n_right,c,& 
       ww,nwork,periodic)      !added work arrays ww with dimension nwork
    use module_base
***************
*** 458,464 ****
    integer, intent(in) :: ncplx_w !size of the ww matrix
    integer, intent(in) :: ncplx_g !1 or 2 for simple or complex gaussians, respectively.
    integer, intent(in) :: ncplx_k !use 2 for k-points.
!   real(gp), intent(in) :: hgrid,gau_cen,kval
    real(gp),dimension(ncplx_g),intent(in)::factor,gau_a
    real(wp), dimension(0:nwork,2,ncplx_w), intent(inout) :: ww 
    integer, intent(out) :: n_left,n_right
--- 458,464 ----
    integer, intent(in) :: ncplx_w !size of the ww matrix
    integer, intent(in) :: ncplx_g !1 or 2 for simple or complex gaussians, respectively.
    integer, intent(in) :: ncplx_k !use 2 for k-points.
!   real(gp), intent(in) :: hgrid,gau_cen,kval,gau_cut
    real(gp),dimension(ncplx_g),intent(in)::factor,gau_a
    real(wp), dimension(0:nwork,2,ncplx_w), intent(inout) :: ww 
    integer, intent(out) :: n_left,n_right
***************
*** 467,473 ****
    character(len=*), parameter :: subname='gauss_to_daub_k'
    integer :: i_all,i_stat
    integer :: rightx,leftx,right_t,i0,i,k,length,j,icplx
!   real(gp) :: a1,a2,z0,h,x,r,coeff,r2,rk
    real(gp) :: fac(ncplx_g)
    real(wp) :: func,cval,sval,cval2,sval2
    real(wp), dimension(:,:,:), allocatable :: cc
--- 467,473 ----
    character(len=*), parameter :: subname='gauss_to_daub_k'
    integer :: i_all,i_stat
    integer :: rightx,leftx,right_t,i0,i,k,length,j,icplx
!   real(gp) :: a1,a2,z0,h,x,r,coeff,r2,rk,gcut
    real(gp) :: fac(ncplx_g)
    real(wp) :: func,cval,sval,cval2,sval2
    real(wp), dimension(:,:,:), allocatable :: cc
***************
*** 487,492 ****
--- 487,493 ----
    end if
    i0=nint(gau_cen/hgrid) ! the array is centered at i0
    z0=gau_cen/hgrid-real(i0,gp)
+   gcut=gau_cut/hgrid
    h=.125_gp*.5_gp
  
    !calculate the array sizes;
***************
*** 655,681 ****
              do i=leftx,rightx
                 x=real(i-i0*16,gp)*h
                 r=x-z0
!                r2=r*r
!                cval=real(cos(a2*r2),wp)
!                sval=real(sin(a2*r2),wp)
!                r2=0.5_gp*r2/(a1**2)
!                func=real(dexp(-real(r2,kind=8)),wp)
!                ww(i-leftx,1,1)=func*cval
!                ww(i-leftx,1,2)=func*sval
              enddo
           else
              do i=leftx,rightx
                 x=real(i-i0*16,gp)*h
                 r=x-z0
!                r2=r*r
!                cval=real(cos(a2*r2),wp)
!                sval=real(sin(a2*r2),wp)
!                coeff=r**n_gau
!                r2=0.5_gp*r2/(a1**2)
!                func=real(dexp(-real(r2,kind=8)),wp)
!                func=real(coeff,wp)*func
!                ww(i-leftx,1,1)=func*cval
!                ww(i-leftx,1,2)=func*sval
              enddo
           end if
  
--- 656,690 ----
              do i=leftx,rightx
                 x=real(i-i0*16,gp)*h
                 r=x-z0
!                if(abs(r)-gcut < 1e-8) then
!                  r2=r*r
!                  cval=real(cos(a2*r2),wp)
!                  sval=real(sin(a2*r2),wp)
!                  r2=0.5_gp*r2/(a1**2)
!                  func=real(dexp(-real(r2,kind=8)),wp)
!                  ww(i-leftx,1,1)=func*cval
!                  ww(i-leftx,1,2)=func*sval
!                else
!                  ww(i-leftx,1,:)=0.0_wp
!                end if
              enddo
           else
              do i=leftx,rightx
                 x=real(i-i0*16,gp)*h
                 r=x-z0
!                if( abs(r)-gcut < 1e-8 ) then
!                  r2=r*r
!                  cval=real(cos(a2*r2),wp)
!                  sval=real(sin(a2*r2),wp)
!                  coeff=r**n_gau
!                  r2=0.5_gp*r2/(a1**2)
!                  func=real(dexp(-real(r2,kind=8)),wp)
!                  func=real(coeff,wp)*func
!                  ww(i-leftx,1,1)=func*cval
!                  ww(i-leftx,1,2)=func*sval
!                else
!                  ww(i-leftx,1,:)=0.0_wp
!                end if
              enddo
           end if