Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/latte_mods/tbparams_latte_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ subroutine write_latteTBparams(latteTBparams,filename)
,latteTBparams%w(3,i)&
,latteTBparams%w(4,i)
enddo

close(io_unit)

end subroutine write_latteTBparams

Expand Down
7 changes: 4 additions & 3 deletions src/prg_chebyshev_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -318,22 +318,23 @@ subroutine prg_build_density_cheb_fermi(ham_bml, rho_bml, athr, threshold, ncoef
real(dp), allocatable :: domain2(:), gbnd(:), tn(:), tnm1(:)
real(dp), allocatable :: tnp1(:), tnp1_dense(:,:), tracesT(:)
real(dp), intent(in) :: athr, bndfil, kbt, threshold
real(dp), intent(inout) :: ef
real(dp), intent(out) :: ef
type(bml_matrix_t) :: aux_bml, tn_bml, tnm1_bml, tnp1_bml
type(bml_matrix_t) :: x_bml
type(bml_matrix_t), intent(in) :: ham_bml
type(bml_matrix_t), intent(inout) :: rho_bml
logical, intent(in) :: getef, jon, trkfunc

if(verbose >= 1)write(*,*)"Building rho via Chebyshev expansion of the Fermi function ..."

ef = 0.0_dp
write(*,*)"ef",ef
norb = bml_get_n(ham_bml) !Get the number of orbitals from H
mdim = bml_get_m(ham_bml)
bml_type = bml_get_type(ham_bml) !Get the bml type
mdim = bml_get_m(ham_bml)

if(verbose >= 1)mls_I = mls()
call bml_copy_new(ham_bml,x_bml)
allocate(gbnd(2))
call bml_gershgorin(x_bml, gbnd)
if(verbose >= 1)write(*,*)"Estimation for emin, emax", gbnd(1), gbnd(2)
call prg_normalize_cheb(x_bml,ef,gbnd(1),gbnd(2),alpha,scaledef)
Expand Down
12 changes: 7 additions & 5 deletions src/prg_densitymatrix_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ subroutine prg_build_density_T(ham_bml, rho_bml, threshold, bndfil, kbt, ef, eig

character(20) :: bml_type
integer :: i, norb
real(8), intent(in) :: bndfil, threshold, kbt
real(8), intent(inout) :: ef
real(dp), intent(in) :: bndfil, threshold, kbt
real(dp), intent(inout) :: ef
real(dp) :: nocc, fleveltol
real(dp), allocatable :: eigenvalues(:)
real(dp), allocatable, optional, intent(out) :: eigenvalues_out(:)
Expand Down Expand Up @@ -190,9 +190,11 @@ subroutine prg_build_density_T_Fermi(ham_bml, rho_bml, threshold, kbt, ef,verbos
type(bml_matrix_t), intent(inout) :: rho_bml

if (printRank() .eq. 1) then
if(present(verbose).and.verbose >= 1)then
write(*,*)"In get_density_t_Fermi ..."
write(*,*)"Ef = ",ef
if(present(verbose))then
if(verbose >= 1)then
write(*,*)"In get_density_t_Fermi ..."
write(*,*)"Ef = ",ef
endif
endif
endif

Expand Down
13 changes: 8 additions & 5 deletions src/prg_genz_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ subroutine prg_buildZdiag(smat_bml,zmat_bml,threshold,mdimin,bml_type,verbose)
type(bml_matrix_t) :: zmat_bml
type(bml_matrix_t), intent(inout) :: smat_bml

if(present(verbose).and.verbose >= 1) then
write(*,*)""; write(*,*)"In buildzdiag ..."
if(present(verbose))then
if(verbose >= 1)then
write(*,*)""; write(*,*)"In buildzdiag ..."
endif
endif

if(bml_get_precision(smat_bml) == 1 .or.&
Expand All @@ -206,7 +208,6 @@ subroutine prg_buildZdiag(smat_bml,zmat_bml,threshold,mdimin,bml_type,verbose)
allocate(nonotmp(norb,norb))
allocate(zmat(norb,norb))
allocate(smat(norb,norb))

!To bml dense. this is done because the diagonalization
!it is only implemented for bml_dense. In future versions of bml
!the api should do this automatically.
Expand All @@ -231,8 +232,10 @@ subroutine prg_buildZdiag(smat_bml,zmat_bml,threshold,mdimin,bml_type,verbose)
!Eigenvectors and eigenalues of the overlap s.
mls_i = mls()
call bml_diagonalize(saux_bml,nono_evals,umat_bml)
if(present(verbose).and.verbose >= 1) then
write(*,*)"Time for S diag = "//to_string(mls() - mls_i)//" ms"
if(present(verbose))then
if(verbose >= 1)then
write(*,*)"Time for S diag = "//to_string(mls() - mls_i)//" ms"
endif
endif

call bml_export_to_dense(umat_bml, umat)
Expand Down
16 changes: 12 additions & 4 deletions src/prg_homolumo_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ subroutine prg_homolumogap(vv, imax, pp, mineval, maxeval, ehomo, elumo, &
hgamma = 6.0_dp - 4.0_dp * sqrt(2.0_dp)
hgamma = hgamma * (1.0_dp - hgamma)

if(present(verbose).and.verbose.ge.1) write(*,*)"In prg_homolumogap ..."
if(present(verbose))then
if(verbose.ge.1) write(*,*)"In prg_homolumogap ..."
endif

do while (vv(i) .lt. hgamma)

Expand All @@ -69,7 +71,9 @@ subroutine prg_homolumogap(vv, imax, pp, mineval, maxeval, ehomo, elumo, &
x_a = max(x_a, y_a)
x_b = min(x_b, y_b)

if(present(verbose).and.verbose.ge.2) write(*,*)"x_a = ",x_a,"x_b = ",x_b
if(present(verbose))then
if(verbose.ge.2) write(*,*)"x_a = ",x_a,"x_b = ",x_b
endif

i = i - 1
if (i .lt. 1) then
Expand Down Expand Up @@ -107,12 +111,16 @@ subroutine prg_sp2sequence(pp, imax, mineval, maxeval, ehomo, elumo, errlimit, v

it = 0

if(present(verbose).and.verbose.ge.1) write(*,*)"In prg_sp2sequence ..."
if(present(verbose))then
if(verbose.ge.1) write(*,*)"In prg_sp2sequence ..."
endif

do while (error .gt. errlimit)
it = it + 1

if(present(verbose).and.verbose.ge.2) write(*,*)"error = ",error
if(present(verbose))then
if(verbose.ge.2) write(*,*)"error = ",error
endif

if ((abs(1.0_dp - eh * eh) + abs(el * el)) .lt. &
(abs(1.0_dp - (2.0_dp * eh - eh * eh) + &
Expand Down
23 changes: 23 additions & 0 deletions src/prg_normalize_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module prg_normalize_mod
public :: prg_normalize_implicit_fermi
public :: prg_normalize_fermi
public :: prg_normalize_cheb
public :: prg_normalize_cheb1
public :: prg_gershgorinReduction

contains
Expand Down Expand Up @@ -128,12 +129,14 @@ end subroutine prg_gershgorinReduction
!! \param h_bml Input/Output Hamiltonian matrix
subroutine prg_normalize_cheb(h_bml,mu,emin,emax,alpha,scaledmu)

implicit none
type(bml_matrix_t),intent(inout) :: h_bml

real(dp) :: beta, maxMinusMin
real(dp), intent(in) :: mu, emin, emax
real(dp), intent(inout) :: scaledmu, alpha

stop
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a left over debug statement, or do you want to leave it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch Nick, thanks!

maxMinusMin = emax - emin
alpha = 2.00_dp / maxMinusMin
beta = -1.00_dp*(2.00_dp*emin/maxMinusMin + 1.00_dp)
Expand All @@ -142,4 +145,24 @@ subroutine prg_normalize_cheb(h_bml,mu,emin,emax,alpha,scaledmu)

end subroutine prg_normalize_cheb

!> Normalize a Hamiltonian matrix prior to running the Chebyshev algorithm.
!!
!! X0 = 2*(H - e_min*I) / (e_max - e_min) - I
!!
!! where e_max and e_min are obtained sing the Gershgorin circle theorem.
!!
!! \param h_bml Input/Output Hamiltonian matrix
subroutine prg_normalize_cheb1(mu,scaledmu,alpha)

implicit none

real(dp), intent(in) :: mu
real(dp), intent(inout) :: scaledmu, alpha
scaledmu = 1.0_dp
alpha = 1.0_dp
write(*,*)"nomalize"

end subroutine prg_normalize_cheb1


end module prg_normalize_mod
12 changes: 8 additions & 4 deletions src/prg_sp2_fermi_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ subroutine prg_sp2_fermi_init_norecs(h_bml, nsteps, nocc, tscale, threshold, &
integer :: N, M, i
integer, optional :: verbose

if(present(verbose) .and. verbose >= 1) write(*,*)"Inside prg_sp2_fermi_init_norecs ..."
if(present(verbose))then
if(verbose >= 1) write(*,*)"Inside prg_sp2_fermi_init_norecs ..."
endif

bml_type = bml_get_type(h_bml)
N = bml_get_N(h_bml)
Expand Down Expand Up @@ -319,9 +321,11 @@ subroutine prg_sp2_fermi_init_norecs(h_bml, nsteps, nocc, tscale, threshold, &
! write(1000,*)gbnd(1) + ((gbnd(2)-gbnd(1))/1000.0_dp)*i,probe(i)
! enddo

if(present(verbose) .and. verbose >= 1) then
write(*,*)"beta = ",beta
write(*,*)"kbT = ",1.0_dp/beta
if(present(verbose))then
if(verbose >= 1) then
write(*,*)"beta = ",beta
write(*,*)"kbT = ",1.0_dp/beta
endif
endif

firstTime = .false.
Expand Down
6 changes: 4 additions & 2 deletions src/prg_sp2_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,10 @@ subroutine prg_sp2_alg1(h_bml, rho_bml, threshold, bndfil, minsp2iter, maxsp2ite
endif
#endif

if(present(verbose).and.verbose.ge.10)then
if (printRank() .eq. 1) write(*,*) 'iter = ', iter, 'trx = ', trx, ' trx2 = ', trx2
if(present(verbose))then
if(verbose.ge.10)then
if (printRank() .eq. 1) write(*,*) 'iter = ', iter, 'trx = ', trx, ' trx2 = ', trx2
endif
endif

limdiff = abs(trx - trx2 - occ) - abs(trx + trx2 - occ)
Expand Down
72 changes: 46 additions & 26 deletions src/prg_system_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,9 @@ subroutine prg_translateandfoldtobox(coords,lattice_vectors,origin, verbose)
real(dp), allocatable, intent(inout) :: origin(:),coords(:,:)
real(dp), intent(in) :: lattice_vectors(:,:)

if(present(verbose) .and. verbose >= 1)write(*,*)"In prg_translateandfoldtobox ..."
if(present(verbose))then
if(verbose >= 1)write(*,*)"In prg_translateandfoldtobox ..."
endif

if(.not.allocated(origin)) allocate(origin(3))

Expand Down Expand Up @@ -1324,7 +1326,9 @@ subroutine prg_centeratbox(coords,lattice_vectors,verbose)
real(dp), allocatable, intent(inout) :: coords(:,:)
real(dp), intent(in) :: lattice_vectors(:,:)

if(present(verbose) .and. verbose >= 1)write(*,*)"In prg_centeratbox ..."
if(present(verbose))then
if(verbose >= 1)write(*,*)"In prg_centeratbox ..."
endif

nats=size(coords,dim=2)

Expand Down Expand Up @@ -1365,7 +1369,9 @@ subroutine prg_wraparound(coords,lattice_vectors,index,verbose)
real(dp), allocatable :: origin(:)
real(dp), intent(in) :: lattice_vectors(:,:)

if(present(verbose) .and. verbose >= 1)write(*,*)"In prg_wraparound ..."
if(present(verbose))then
if(verbose >= 1)write(*,*)"In prg_wraparound ..."
endif

if(.not.allocated(origin)) allocate(origin(3))

Expand Down Expand Up @@ -1504,7 +1510,9 @@ subroutine prg_cleanuprepeatedatoms(nats,coords,symbols,verbose)
character(len=*), allocatable, intent(inout) :: symbols(:)
character(2), allocatable :: symbolstmp(:)

if(present(verbose) .and. verbose >= 1)write(*,*)"In prg_cleanuprepeatedatoms ..."
if(present(verbose))then
if(verbose >= 1)write(*,*)"In prg_cleanuprepeatedatoms ..."
endif

natstmp=nats

Expand Down Expand Up @@ -1705,10 +1713,12 @@ subroutine prg_get_covgraph(sy,nnStructMindist,nnStruct,nrnnstruct,bml_type,fact
Ly = sy%lattice_vector(2,2)
Lz = sy%lattice_vector(3,3)

if(present(verbose).and.verbose >= 1)then
write(*,*)" "
write(*,*)"Building covalency graph ..."
write(*,*)" "
if(present(verbose))then
if(verbose >= 1)then
write(*,*)" "
write(*,*)"Building covalency graph ..."
write(*,*)" "
endif
endif

allocate(ispresent(sy%nats))
Expand Down Expand Up @@ -1773,10 +1783,12 @@ subroutine prg_get_covgraph_int(sy,nnStructMindist,nnStruct,nrnnstruct,bml_type,

call bml_zero_matrix(bml_type,bml_element_real,dp,sy%nats,mdim,gcov_bml)

if(present(verbose).and.verbose >= 1)then
write(*,*)" "
write(*,*)"Building covalency graph ..."
write(*,*)" "
if(present(verbose))then
if(verbose >= 1)then
write(*,*)" "
write(*,*)"Building covalency graph ..."
write(*,*)" "
endif
endif

do i=1,sy%nats
Expand Down Expand Up @@ -1830,10 +1842,12 @@ subroutine prg_get_covgraph_h(sy,nnStructMindist,nnStruct,nrnnstruct,rcut,&

if(.not.allocated(graph_h)) allocate(graph_h(mdim,sy%nats))

if(present(verbose).and.verbose >= 1)then
write(*,*)" "
write(*,*)"Building H covalency graph ..."
write(*,*)" "
if(present(verbose))then
if(verbose >= 1)then
write(*,*)" "
write(*,*)"Building H covalency graph ..."
write(*,*)" "
endif
endif

graph_h = 0
Expand Down Expand Up @@ -1885,10 +1899,12 @@ subroutine prg_get_subsystem(sy,lsize,indices,sbsy,verbose)
type(system_type), intent(in) :: sy
type(system_type), intent(inout) :: sbsy

if(present(verbose).and.verbose >= 1)then
write(*,*)" "
write(*,*)"Extracting subsystem ..."
write(*,*)" "
if(present(verbose))then
if(verbose >= 1)then
write(*,*)" "
write(*,*)"Extracting subsystem ..."
write(*,*)" "
endif
endif

sbsy%nats = lsize
Expand Down Expand Up @@ -1970,10 +1986,12 @@ subroutine prg_destroy_subsystems(sbsy,verbose)
integer, optional, intent(in) :: verbose
integer :: nparts

if(present(verbose).and.verbose >= 1)then
write(*,*)" "
write(*,*)"Deallocating the multiple subsystem ..."
write(*,*)" "
if(present(verbose))then
if(verbose >= 1)then
write(*,*)" "
write(*,*)"Deallocating the multiple subsystem ..."
write(*,*)" "
endif
endif


Expand Down Expand Up @@ -2041,8 +2059,10 @@ subroutine prg_molpartition(sy,npart,nnStructMindist,nnStruct,nrnnstruct,hetatm,
type(graph_partitioning_t), intent(inout) :: gp
type(system_type), intent(in) :: sy

if(present(verbose).and.verbose >= 1)then
write(*,*)" "; write(*,*)"Partitioning by molecule ..."; write(*,*)" "
if(present(verbose))then
if(verbose >= 1)then
write(*,*)" "; write(*,*)"Partitioning by molecule ..."; write(*,*)" "
endif
endif

if(allocated(gp%nnodesInPart))then
Expand Down
Loading