16integer lm1,lm2,lm3,lm4
22real(8) vee(-lmaxdm:lmaxdm,-lmaxdm:lmaxdm,-lmaxdm:lmaxdm,-lmaxdm:lmaxdm)
23complex(8) dm(lmmaxdm,nspinor,lmmaxdm,nspinor)
24complex(8) dms(nspinor,nspinor)
32 lma=l**2+1; lmb=lma+2*l
35 if ((abs(u) < 1.d-10).and.(abs(j) < 1.d-10)) cycle
40 dm(:,:,:,:)=
dmatmt(:,:,:,:,ias)
43 if (.not.
spinpol) dm(:,:,:,:)=0.5d0*dm(:,:,:,:)
50 zsm=zsm+dm(lm1,ispn,lm1,jspn)
52 dms(ispn,jspn)=dms(ispn,jspn)+zsm
62 mg(3)=dble(dms(1,1)-dms(2,2))
65 mg(1)=dble(dms(1,2)+dms(2,1))
66 mg(2)=dble(
zi*(dms(1,2)-dms(2,1)))
68 mg0(:)=mg(:)/dble(nspinor*nm)
77 dm(lm1,1,lm1,1)=dm(lm1,1,lm1,1)-(n0+mg0(3))
78 dm(lm1,2,lm1,2)=dm(lm1,2,lm1,2)-(n0-mg0(3))
81 dm(lm1,1,lm1,2)=dm(lm1,1,lm1,2)-(mg0(1)-
zi*mg0(2))
82 dm(lm1,2,lm1,1)=dm(lm1,2,lm1,1)-(mg0(1)+
zi*mg0(2))
86 dm(lm1,1,lm1,1)=dm(lm1,1,lm1,1)-n0
106 z1=dm(lm2,ispn,lm1,ispn)*dm(lm4,jspn,lm3,jspn)
107 z2=dm(lm4,jspn,lm1,ispn)*dm(lm2,ispn,lm3,jspn)
109 vmatmt(lm1,ispn,lm2,ispn,ias)=
vmatmt(lm1,ispn,lm2,ispn,ias) &
110 +dm(lm4,jspn,lm3,jspn)*v
111 vmatmt(lm1,ispn,lm4,jspn,ias)=
vmatmt(lm1,ispn,lm4,jspn,ias) &
112 -dm(lm2,ispn,lm3,jspn)*v
132 edc=0.5d0*u*n*(n-1.d0)
133 edc=edc-0.5d0*j*dble(dms(1,1)*(dms(1,1)-1.d0))
134 edc=edc-0.5d0*j*dble(dms(2,2)*(dms(2,2)-1.d0))
135 edc=edc-0.5d0*j*dble(dms(1,2)*dms(2,1))
136 edc=edc-0.5d0*j*dble(dms(2,1)*dms(1,2))
140 -u*(n-0.5d0)+j*(dms(1,1)-0.5d0)
142 -u*(n-0.5d0)+j*(dms(2,2)-0.5d0)
143 vmatmt(lm1,1,lm1,2,ias)=
vmatmt(lm1,1,lm1,2,ias)+j*dms(1,2)
144 vmatmt(lm1,2,lm1,1,ias)=
vmatmt(lm1,2,lm1,1,ias)+j*dms(2,1)
149 edc=0.5d0*u*n*(n-1.d0)
150 edc=edc-0.5d0*j*dble(dms(1,1)*(dms(1,1)-1.d0))
151 edc=edc-0.5d0*j*dble(dms(2,2)*(dms(2,2)-1.d0))
155 -u*(n-0.5d0)+j*(dms(1,1)-0.5d0)
157 -u*(n-0.5d0)+j*(dms(2,2)-0.5d0)
163 edc=0.5d0*u*n*(n-1.d0)
164 edc=edc-0.5d0*j*n*(n-1.d0)
167 vmatmt(lm1,1,lm1,1,ias)=
vmatmt(lm1,1,lm1,1,ias)-u*(n-0.5d0) &
182 sm=sm+dble(dm(lm1,ispn,lm2,jspn)*
vmatmt(lm2,jspn,lm1,ispn,ias))
integer, dimension(maxspecies) natoms
integer, dimension(maxatoms, maxspecies) idxas