diff --git a/src/ek_bulk.f90 b/src/ek_bulk.f90 index ec9381e6..5217dbdc 100644 --- a/src/ek_bulk.f90 +++ b/src/ek_bulk.f90 @@ -2871,7 +2871,7 @@ subroutine ek_bulk_spin nwann= Num_wann/2 - if (SOC==0) stop 'you should set soc=0 in the input file' + if (SOC==0) return !stop 'you should set soc=0 in the input file' !> construct spin matrix do i= 1, nwann sigmax(i, i+ nwann)= 1d0 diff --git a/src/lanczos_sparse.f90 b/src/lanczos_sparse.f90 index bab8f206..ebda413f 100644 --- a/src/lanczos_sparse.f90 +++ b/src/lanczos_sparse.f90 @@ -330,7 +330,7 @@ subroutine LandauLevel_B_dos_Lanczos use wmpi use mt19937_64 use para, only : Magq, Num_Wann, Bx, By, zi, pi, Fermi_broadening, iso_energy, & - OmegaNum, OmegaMin, OmegaMax, Magp, stdout, Magp_min, Magp_max, & + OmegaNum, OmegaMin, OmegaMax, Magp, stdout, Magp_min, Magp_max, nnzmax_input, & outfileindex, Single_KPOINT_3D_DIRECT,splen,Is_Sparse_Hr, eV2Hartree, & MagneticSuperProjectedArea,ijmax,NumLCZVecs, NumRandomConfs, Add_Zeeman_Field implicit none @@ -385,8 +385,12 @@ subroutine LandauLevel_B_dos_Lanczos Nq= Magq Nmag= Magp_max- Magp_min +1 Mdim= Num_Wann*Nq - nnzmax= Num_wann*(2*ijmax+1+2)*Mdim - if(Is_Sparse_Hr) nnzmax=splen*Nq + if (nnzmax_input<0)then + nnzmax= Num_wann*(2*ijmax+1+2)*Mdim + if(Is_Sparse_Hr) nnzmax=splen*Nq + else + nnzmax= nnzmax_input + endif if (cpuid==0) then write(stdout, '(a,i8)')' Magnetic supercell is Nq= ', Nq write(stdout, '(a,i18)')' Hamiltonian matrix dimension Mdim= ', Mdim @@ -702,7 +706,7 @@ subroutine LandauLevel_k_dos_Lanczos use para, only : Magq, Num_Wann, Bx, By, zi, pi, Fermi_broadening, Angstrom2atomic, & OmegaNum, OmegaMin, OmegaMax, nk3_band, Magp, stdout, kpath_3d, eV2Hartree, & outfileindex, K3len_mag,splen,Is_Sparse_Hr,ijmax,NumLCZVecs, MagneticSuperProjectedArea, & - Nk3lines, k3line_mag_stop, k3line_name, NumRandomConfs + Nk3lines, k3line_mag_stop, k3line_name, NumRandomConfs, nnzmax_input implicit none !> magnetic field strength, this number should compatiable with the magnetic supercell @@ -736,12 +740,15 @@ subroutine LandauLevel_k_dos_Lanczos Nq= Magq Mdim= Num_Wann*Magq - nnzmax= Num_wann*(2*ijmax+1)*Mdim - if(Is_Sparse_Hr) nnzmax=splen*Nq - !> need to be checked !if(Is_Sparse_Hr) nnzmax=Nq*splen - + if (nnzmax_input<0)then + nnzmax= Num_wann*(2*ijmax+1+2)*Mdim + if(Is_Sparse_Hr) nnzmax=splen*Nq + else + nnzmax= nnzmax_input + endif + NumLczVectors = NumLCZVecs NumLczVectors_out = NumLCZVecs if (NumLczVectors>Mdim) then @@ -930,7 +937,7 @@ subroutine bulkbandk_dos_lanczos use sparse use wmpi use para, only : Magq, Num_Wann, Bx, By, zi, pi, Fermi_broadening, Angstrom2atomic, & - OmegaNum, OmegaMin, OmegaMax, nk3_band, Magp, stdout, kpath_3d, & + OmegaNum, OmegaMin, OmegaMax, nk3_band, Magp, stdout, kpath_3d, nnzmax_input, & outfileindex, K3len,splen,Is_Sparse_Hr,ijmax,NumLCZVecs, eV2Hartree implicit none @@ -964,9 +971,13 @@ subroutine bulkbandk_dos_lanczos Nq= 1 Mdim= Num_Wann*Nq - nnzmax= Num_wann*(2*ijmax+1)*Mdim - if(Is_Sparse_Hr) nnzmax=splen*Nq - + if (nnzmax_input<0)then + nnzmax= Num_wann*(2*ijmax+1+2)*Mdim + if(Is_Sparse_Hr) nnzmax=splen*Nq + else + nnzmax= nnzmax_input + endif + !> need to be checked !if(Is_Sparse_Hr) nnzmax=Nq*splen @@ -1105,7 +1116,7 @@ subroutine bulk_dos_lanczos use sparse use wmpi use para, only : Num_Wann, Bx, By, zi, pi, Fermi_broadening, & - OmegaNum, OmegaMin, OmegaMax, nk3_band, Magp, stdout, & + OmegaNum, OmegaMin, OmegaMax, nk3_band, Magp, stdout, nnzmax_input, & outfileindex,splen,Is_Sparse_Hr,ijmax,NumLCZVecs,Nk1,Nk2,Nk3,& K3D_start_cube,K3D_vec1_cube,K3D_vec2_cube,K3D_vec3_cube, & NumRandomConfs, Omega_array, eV2Hartree @@ -1141,15 +1152,19 @@ subroutine bulk_dos_lanczos NumberofEta=9 Mdim= Num_Wann - nnzmax= Num_wann*(2*ijmax+1)*Mdim knv3= Nk1*Nk2*Nk3 - if (Is_Sparse_Hr) then - nnzmax=splen + if (nnzmax_input<0)then + nnzmax= Num_wann*(2*ijmax+1+2)*Mdim + if (Is_Sparse_Hr) then + nnzmax=splen + else + nnzmax= Num_wann* Num_wann + endif else - nnzmax= Num_wann* Num_wann + nnzmax= nnzmax_input endif - + !> need to be checked !if(Is_Sparse_Hr) nnzmax=Nq*splen diff --git a/src/landau_level_sparse.f90 b/src/landau_level_sparse.f90 index a7cd37f0..a3d1a66f 100644 --- a/src/landau_level_sparse.f90 +++ b/src/landau_level_sparse.f90 @@ -209,6 +209,10 @@ subroutine ham_3Dlandau_sparse1(nnz, Ndimq, Nq, k, acoo,jcoo,icoo) stop endif + !> if we want to calculate the Chern number, we use open boundary such + !> that we can get the Chern number from the edge states. + if(landau_chern_calc) goto 328 + !>> calculate inter-hopping between layers ! i1 column index do i1=1, Nq @@ -321,6 +325,7 @@ subroutine ham_3Dlandau_sparse1(nnz, Ndimq, Nq, k, acoo,jcoo,icoo) enddo ! i1 +328 continue if (cpuid.eq.0) write(stdout,*) 'nnz, nnzmax after H01:', ncoo, nnz if (nnz< ncoo) then write(*, *)'Please increase nnzmax in the sparse.f90' @@ -626,7 +631,7 @@ subroutine sparse_landau_level_B if (neval>=Ndimq) neval= Ndimq- 2 !> ncv - nvecs=int(2*neval) + nvecs=int(3*neval) if (nvecs<50) nvecs= 50 if (nvecs>Ndimq) nvecs= Ndimq @@ -637,9 +642,13 @@ subroutine sparse_landau_level_B Nmag= Magp-1 Nmag1=Nmag/1 - nnzmax= Num_wann*(2*ijmax+1)*Ndimq+Ndimq - if(Is_Sparse_Hr) nnzmax=splen*nq+Ndimq - + if (nnzmax_input<0)then + nnzmax= Num_wann*(2*ijmax+1)*Ndimq+Ndimq + if(Is_Sparse_Hr) nnzmax=splen*nq+Ndimq + else + nnzmax= nnzmax_input + endif + allocate( acoo(nnzmax), stat=ierr) call printallocationinfo('acoo', ierr) allocate( jcoo(nnzmax), stat=ierr) @@ -926,14 +935,20 @@ subroutine sparse_landau_level_k Nq= Magq Nmag= Nq Ndimq= Num_wann* Nq - nnzmax= Num_wann*(2*ijmax+1)*Ndimq+Ndimq - if(Is_Sparse_Hr) nnzmax=splen*nq+Ndimq + if (nnzmax_input<0)then + nnzmax= Num_wann*(2*ijmax+1)*Ndimq+Ndimq + if(Is_Sparse_Hr) nnzmax=splen*nq+Ndimq + else + nnzmax= nnzmax_input + endif + + if (NumSelectedEigenVals==0) NumSelectedEigenVals=OmegaNum neval=NumSelectedEigenVals if (neval>=Ndimq) neval= Ndimq- 2 !> ncv - nvecs=int(2*neval) + nvecs=int(3*neval) if (nvecs<50) nvecs= 50 if (nvecs>Ndimq) nvecs= Ndimq @@ -1514,7 +1529,7 @@ subroutine sparse_export_maghr if (neval>=Ndimq) neval= Ndimq- 2 !> ncv - nvecs=int(2*neval) + nvecs=int(3*neval) if (nvecs<50) nvecs= 50 if (nvecs>Ndimq) nvecs= Ndimq diff --git a/src/main.f90 b/src/main.f90 index e54c32ee..3a4cce96 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -246,7 +246,7 @@ program main if(cpuid.eq.0)write(stdout, *)'>> start of calculating the Hofstader butterfly ' call now(time_start) if (Is_HrFile) then - if(Is_Sparse_Hr) then + if(Is_Sparse_Hr.or.Num_wann*Magq>4000) then call sparse_landau_level_B else call landau_level_B diff --git a/src/module.f90 b/src/module.f90 index 2f55d75e..a8793ac0 100644 --- a/src/module.f90 +++ b/src/module.f90 @@ -606,6 +606,9 @@ module para !> iprint_level=3 : print all the debug messages integer :: iprint_level = 1 + !> an input integer to control the largest value of the non-zero entries of H + integer :: nnzmax_input + !> parameters for matrix element real(dp) :: penetration_lambda_arpes ! penetration depth of photon, appear in polarization term and the overlp_i in unfolding.f90 real(dp) :: photon_energy_arpes ! photon energy ,input unit eV @@ -622,7 +625,7 @@ module para wcc_neighbour_tol, wcc_calc_tol, Beta,NumLCZVecs, iprint_level, & Relaxation_Time_Tau, symprec, arpack_solver, RKF45_PERIODIC_LEVEL, & NumRandomConfs, NumSelectedEigenVals, projection_weight_mode, topsurface_atom_index, & - photon_energy_arpes, polarization_xi_arpes, test_namelist,& + photon_energy_arpes, polarization_xi_arpes, test_namelist, nnzmax_input, & polarization_alpha_arpes, polarization_delta_arpes, penetration_lambda_arpes, polarization_phi_arpes real(Dp) :: E_fermi ! Fermi energy, search E-fermi in OUTCAR for VASP, set to zero for Wien2k diff --git a/src/readinput.f90 b/src/readinput.f90 index ee7e5e2e..d0c05784 100644 --- a/src/readinput.f90 +++ b/src/readinput.f90 @@ -604,6 +604,7 @@ subroutine readinput arpack_solver= 'zndrv1' RKF45_PERIODIC_LEVEL= 1 iprint_level = 1 + nnzmax_input=-1 penetration_lambda_arpes= 5 ! in angstrom photon_energy_arpes= 0d0 ! photon energy for ARPES in ev polarization_phi_arpes = (0d0/180d0)*3.14159265358979d0 @@ -675,6 +676,7 @@ subroutine readinput write(stdout, '(1x, a, f16.2)')'RKF45_PERIODIC_LEVEL', RKF45_PERIODIC_LEVEL write(stdout, '(1x, a, i16 )')'Magp_min', Magp_min write(stdout, '(1x, a, i16 )')'Magp_max', Magp_max + write(stdout, '(1x, a, i16 )')'nnzmax_input', nnzmax_input write(stdout, '(1x, a, f16.5)')'wcc_calc_tol', wcc_calc_tol write(stdout, '(1x, a, f16.5)')'wcc_neighbour_tol', wcc_neighbour_tol write(stdout, '(1x, a, i6 )')'NumLCZVecs', NumLCZVecs