diff --git a/vgen/mt_tofrom_grid.F90 b/vgen/mt_tofrom_grid.F90 index 9c1046d65fee4771871479e99aec79d29e810929..24e7a49979833cb03e3ec7e88f92277b98f3c7e5 100644 --- a/vgen/mt_tofrom_grid.F90 +++ b/vgen/mt_tofrom_grid.F90 @@ -45,7 +45,7 @@ CONTAINS END IF END SUBROUTINE init_mt_grid - SUBROUTINE mt_to_grid(xcpot, jspins, atoms, sphhar, den_mt, nsp, n, grad, ch) + SUBROUTINE mt_to_grid(xcpot, jspins, atoms, sphhar, den_mt, n, grad, ch) USE m_grdchlh USE m_mkgylm IMPLICIT NONE @@ -53,7 +53,7 @@ CONTAINS TYPE(t_atoms), INTENT(IN) :: atoms TYPE(t_sphhar), INTENT(IN) :: sphhar REAL, INTENT(IN) :: den_mt(:, 0:, :) - INTEGER, INTENT(IN) :: n, jspins, nsp + INTEGER, INTENT(IN) :: n, jspins REAL, INTENT(OUT), OPTIONAL :: ch(:, :) TYPE(t_gradients), INTENT(INOUT):: grad @@ -61,9 +61,10 @@ CONTAINS REAL, ALLOCATABLE :: chdr(:, :), chdt(:, :), chdf(:, :), ch_tmp(:, :) REAL, ALLOCATABLE :: chdrr(:, :), chdtt(:, :), chdff(:, :), chdtf(:, :) REAL, ALLOCATABLE :: chdrt(:, :), chdrf(:, :) - INTEGER:: nd, lh, js, jr, kt, k + INTEGER:: nd, lh, js, jr, kt, k, nsp nd = atoms%ntypsy(SUM(atoms%neq(:n - 1)) + 1) + nsp = atoms%nsp() ALLOCATE (chlh(atoms%jmtd, 0:sphhar%nlhd, jspins)) ALLOCATE (ch_tmp(nsp, jspins)) diff --git a/vgen/rotate_mt_den_tofrom_local.f90 b/vgen/rotate_mt_den_tofrom_local.f90 index 1a1874aedb19422048755048fe2916c64bdbbd9d..a37b1dcbe496c0ecea1d825219cff203e2027c5a 100644 --- a/vgen/rotate_mt_den_tofrom_local.f90 +++ b/vgen/rotate_mt_den_tofrom_local.f90 @@ -34,7 +34,7 @@ CONTAINS CALL init_mt_grid(nsp,4,atoms,sphhar,xcpot,sym) DO n=1,atoms%ntype - CALL mt_to_grid(xcpot,4,atoms,sphhar,den%mt(:,0:,n,:),nsp,n,grad,ch) + CALL mt_to_grid(xcpot,4,atoms,sphhar,den%mt(:,0:,n,:),n,grad,ch) DO imesh = 1,nsp*atoms%jri(n) rho_11 = ch(imesh,1) @@ -112,7 +112,7 @@ CONTAINS CALL init_mt_grid(nsp,4,atoms,sphhar,xcpot,sym) DO n=1,atoms%ntype - CALL mt_to_grid(xcpot,4,atoms,sphhar,vtot%mt(:,0:,n,:),nsp,n,grad,ch) + CALL mt_to_grid(xcpot,4,atoms,sphhar,vtot%mt(:,0:,n,:),n,grad,ch) DO imesh = 1,nsp*atoms%jri(n) vup = ch(imesh,1) vdown = ch(imesh,2) diff --git a/vgen/vmt_xc.F90 b/vgen/vmt_xc.F90 index fb67214a6cf0a6c7df49fec33aff3227fb54a517..699647acd2f517f2541c34bf5dc6f4c77427eff0 100644 --- a/vgen/vmt_xc.F90 +++ b/vgen/vmt_xc.F90 @@ -99,7 +99,7 @@ CONTAINS #endif DO n = n_start,atoms%ntype,n_stride - CALL mt_to_grid(xcpot, input%jspins, atoms,sphhar,den%mt(:,0:,n,:),nsp,n,grad,ch) + CALL mt_to_grid(xcpot, input%jspins, atoms,sphhar,den%mt(:,0:,n,:),n,grad,ch) ! ! calculate the ex.-cor. potential CALL xcpot%get_vxc(input%jspins,ch(:nsp*atoms%jri(n),:),v_xc(:nsp*atoms%jri(n),:),v_x(:nsp*atoms%jri(n),:),grad) diff --git a/xc-pot/libxc_postprocess_gga.f90 b/xc-pot/libxc_postprocess_gga.f90 index 97be0932419e61a0ffcccb9bed0ea503de033fae..ea2ffdf5f8d0627063bc1cedd1ec5b741e2521cf 100644 --- a/xc-pot/libxc_postprocess_gga.f90 +++ b/xc-pot/libxc_postprocess_gga.f90 @@ -31,7 +31,7 @@ CONTAINS vsigma_mt(i,:,:)=vsigma_mt(i,:,:)*atoms%rmsh(i,n)**2 ENDDO ALLOCATE(grad_vsigma%gr(3,nsp,n_sigma)) - CALL mt_to_grid(xcpot,n_sigma,atoms,sphhar,vsigma_mt,nsp/atoms%jmtd,n,grad=grad_vsigma) + CALL mt_to_grid(xcpot,n_sigma,atoms,sphhar,vsigma_mt,n,grad=grad_vsigma) CALL libxc_postprocess_gga(transpose(grad%vsigma),grad,grad_vsigma,v_xc) END SUBROUTINE libxc_postprocess_gga_mt