Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
quanshengwu committed Aug 30, 2024
1 parent 4e6f57d commit 76bc421
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/ek_bulk.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 33 additions & 18 deletions src/lanczos_sparse.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
31 changes: 23 additions & 8 deletions src/landau_level_sparse.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/readinput.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 76bc421

Please sign in to comment.