9 subroutine eveqnfvr(nmatp,ngp,vpc,h_,o_,evalfv,evecfv)
12 use,
intrinsic :: iso_c_binding
36 integer,
intent(in) :: nmatp,ngp
37 real(8),
intent(in) :: vpc(3)
38 real(8),
target :: h_(*),o_(*)
39 real(8),
intent(out) :: evalfv(nstfv)
40 complex(8),
intent(out) :: evecfv(nmatmax,nstfv)
42 integer is,ia,ja,jas,ilo
47 real(8) v(3),s1,t1,t2,t3,t4
50 logical tr(nlotot),tp(nlotot)
51 integer idx(nlotot),s(nlotot)
54 real(8),
allocatable :: rh(:)
55 real(8),
pointer,
contiguous :: ro(:),rv(:,:)
56 complex(8),
pointer,
contiguous :: h(:),o(:)
59 call c_f_pointer(c_loc(h_),h,shape=[n2])
60 call c_f_pointer(c_loc(o_),o,shape=[n2])
61 call c_f_pointer(c_loc(h_),ro,shape=[n2])
62 call c_f_pointer(c_loc(h_(n2+1)),rv,shape=[nmatp,nstfv])
72 t1=0.5d0*(vpc(1)*v(1)+vpc(2)*v(2)+vpc(3)*v(3))
73 z1=cmplx(cos(t1),sin(t1),8)
79 idx(i)=
idxlo(l*(l+1)-m+1,ilo,jas)
82 if (mod(l+m,2) == 0)
then 90 else if (ia > ja)
then 97 if (mod(m,2) == 0)
then 103 if (mod(l,2) == 0)
then 122 if (abs(t1) > 1.d-8)
then 137 rh(k:k+j-1)=dble(h(k:k+j-1))
142 j2=(ngp+idx(m1)-1)*nmatp
146 rh(j1+1:j1+ngp)=dble(h(j1+1:j1+ngp)*z1)+s1*dble(h(j2+1:j2+ngp)*z1)
148 rh(j1+1:j1+ngp)=aimag(h(j1+1:j1+ngp)*z1)+s1*aimag(h(j2+1:j2+ngp)*z1)
152 rh(j1+1:j1+ngp)=dble(h(j1+1:j1+ngp))+s1*dble(h(j2+1:j2+ngp))
154 rh(j1+1:j1+ngp)=aimag(h(j1+1:j1+ngp))+s1*aimag(h(j2+1:j2+ngp))
163 k1=
map(l1,m1); k2=
map(l1,m2); k3=
map(l2,m1); k4=
map(l2,m2)
164 if ((tr(l1).and.tr(m1)).or.((.not.tr(l1)).and.(.not.tr(m1))))
then 165 rh(k1)=h(k1)%re+s(m1)*h(k2)%re+s(l1)*(h(k3)%re+s(m1)*h(k4)%re)
173 rh(k1)=h(k1)%im+s(m1)*t2+s(l1)*(t3+s(m1)*t4)
174 if (.not.tr(l1)) rh(k1)=-rh(k1)
184 ro(k:k+j-1)=dble(o(k:k+j-1))
189 j2=(ngp+idx(m1)-1)*nmatp
193 ro(j1+1:j1+ngp)=dble(o(j1+1:j1+ngp)*z1)+s1*dble(o(j2+1:j2+ngp)*z1)
195 ro(j1+1:j1+ngp)=aimag(o(j1+1:j1+ngp)*z1)+s1*aimag(o(j2+1:j2+ngp)*z1)
199 ro(j1+1:j1+ngp)=dble(o(j1+1:j1+ngp))+s1*dble(o(j2+1:j2+ngp))
201 ro(j1+1:j1+ngp)=aimag(o(j1+1:j1+ngp))+s1*aimag(o(j2+1:j2+ngp))
210 k1=
map(l1,m1); k2=
map(l1,m2); k3=
map(l2,m1); k4=
map(l2,m2)
211 if ((tr(l1).and.tr(m1)).or.((.not.tr(l1)).and.(.not.tr(m1))))
then 212 ro(k1)=o(k1)%re+s(m1)*o(k2)%re+s(l1)*(o(k3)%re+s(m1)*o(k4)%re)
220 ro(k1)=o(k1)%im+s(m1)*t2+s(l1)*(t3+s(m1)*t4)
221 if (.not.tr(l1)) ro(k1)=-ro(k1)
226 call dsygvxi(nmatp,nstfv,nmatp,rh,ro,evalfv,nmatp,rv,n2,o_)
229 evecfv(1:ngp,j)=rv(1:ngp,j)
230 evecfv(ngp+1:nmatp,j)=0.d0
236 evecfv(i1,j)=evecfv(i1,j)+t1
237 evecfv(i2,j)=evecfv(i2,j)+s(l1)*t1
239 evecfv(i1,j)%im=evecfv(i1,j)%im-t1
240 evecfv(i2,j)%im=evecfv(i2,j)%im-s(l1)*t1
246 evecfv(i1,j)=evecfv(i1,j)*zp(l1)
254 elemental integer function map(i,j)
257 integer,
intent(in) :: i,j
259 map=merge(ngp+i+(ngp+j-1)*nmatp,ngp+j+(ngp+i-1)*nmatp,i <= j)
integer, dimension(maxspecies) nlorb
integer, dimension(:,:,:), allocatable idxlo
integer, dimension(maxatoms, maxspecies) idxas
subroutine dsygvxi(n, m, ld1, a, b, w, ld2, z, lwork, work)
integer, dimension(:,:,:), allocatable ieqatom
subroutine eveqnfvr(nmatp, ngp, vpc, h_, o_, evalfv, evecfv)
integer, dimension(maxspecies) natoms
elemental integer function map(i, j)
integer, dimension(maxlorb, maxspecies) lorbl
real(8), dimension(3, maxatoms, maxspecies) atposc