Skip to content

Commit

Permalink
Fix test inelastic_H-sheet and start fixing DM
Browse files Browse the repository at this point in the history
  • Loading branch information
pecchia committed Apr 3, 2024
1 parent baca6b2 commit b32e1d8
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ external/gbsa/origin
external/gbsa/status
external/slakos/origin
external/slakos/status
build
custom.cmake
build*
custom*.cmake
__pycache__
.idea
tools/dptools/build
Expand Down
2 changes: 1 addition & 1 deletion external/libnegf/origin
2 changes: 1 addition & 1 deletion src/dftbp/extlibs/negf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module dftbp_extlibs_negf
& compute_phonon_current, thermal_conductance, convertHeatCurrent, convertHeatConductance, &
& interaction_models, set_elph_polaroptical, set_elph_nonpolaroptical, set_kpoints, &
& init_basis, compute_layer_current, compute_meir_wingreen, set_scba_tolerances, create_dm, &
& create_hs, destroy_hs, copy_hs, pass_hs, integration_type
& create_hs, destroy_hs, copy_hs, pass_hs, copy_dm, get_dm, integration_type
#:if WITH_MPI
use libnegf, only : negf_mpi_init, negf_cart_init
#:endif
Expand Down
37 changes: 25 additions & 12 deletions src/dftbp/transport/negfint.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ module dftbp_transport_negfint
& set_bp_dephasing, set_drop, set_elph_block_dephasing, set_elph_dephasing, destroy_hs,&
& set_elph_s_dephasing, set_ldos_indexes, set_params, set_scratch, writememinfo, create_dm,&
& writepeakinfo, printcsr, set_elph_polaroptical, set_elph_nonpolaroptical, set_kpoints, &
& init_basis, compute_layer_current, compute_meir_wingreen, set_scba_tolerances
& init_basis, compute_layer_current, compute_meir_wingreen, set_scba_tolerances, get_dm,&
& copy_dm
use dftbp_io_formatout, only : writeXYZFormat
use dftbp_io_message, only : error, warning
use dftbp_math_eigensolver, only : heev
Expand Down Expand Up @@ -1388,18 +1389,20 @@ end subroutine calc_density_ela
subroutine calc_density_inel()

type(z_CSR), target :: csrDens
type(z_CSR), pointer :: pCsrDens

if (nSpin == 2) then
call error('Collinear spin not supported with inelastic scattering yet')
end if
type(z_CSR), pointer :: pcsrDens

call get_params(this%negf, params)
if (params%Np_real == 0) then
return
end if

pCsrDens => csrDens
if (nSpin == 2) then
call error('Collinear spin not supported with inelastic scattering yet')
end if

if (nKS > 1) then
call error('Inelastic DM currently works with just one k-point')
end if

write(stdOut, *)
write(stdOut, '(80("="))')
Expand All @@ -1408,10 +1411,12 @@ subroutine calc_density_inel()

params%DorE = 'D'
params%mu(1:ncont) = mu(1:ncont,1)
params%spin = 1
params%iKpoint = 1
call set_params(this%negf, params)
! Container for H(k) and S(k)
call destroy_HS(this%negf)
call create_HS(this%negf, nKS)
call create_DM(this%negf, nKS)
! Pass all local H(k) and S(k) beforehand
do iKS = 1, nKS
iK = groupKS(1, iKS)
Expand All @@ -1426,14 +1431,22 @@ subroutine calc_density_inel()
call copy_HS(this%negf, this%csrHam, this%csrOver, iKS)
end do

call pass_DM(this%negf,rho=pCsrDens)
pcsrDens => csrDens
call pass_DM(this%negf,rho=pcsrDens)

call compute_density_dft(this%negf)

call unfoldFromCSR(rho(:,1), csrDens, kPoints(:,iK), kWeights(iK), iAtomStart, &
& iPair, iNeighbor, nNeighbor, img2CentCell, iCellVec, cellVec, orb)
do iKS = 1, nKS
iK = groupKS(1, iKS)
iS = groupKS(2, iKS)

call destroy(csrDens)
!call get_DM(this%negf, csrDens)

call unfoldFromCSR(rho(:,1), csrDens, kPoints(:,iK), kWeights(iK), iAtomStart, &
& iPair, iNeighbor, nNeighbor, img2CentCell, iCellVec, cellVec, orb)
end do

call destruct(csrDens)

write(stdOut,'(80("="))')
write(stdOut,*)
Expand Down
2 changes: 2 additions & 0 deletions test/app/dftb+/tagdiff.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ orbital_charges: @ 1.0e-6
forces: @ 1.0e-6
total_localdos: @ 1.0e-5
dEidV: @ 5.0e-6
dipole_moments: @ 1.0e-5
scaled_dipole: @ 1.0e-5

############################################################################
# General rules for non-explicitely specified properties:
Expand Down
2 changes: 1 addition & 1 deletion test/app/dftb+/tests
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ transport/polyacetylene_semiInf #? WITH_TRANSPORT and MPI_PROCS <= 4
transport/H-sheet_end #? WITH_TRANSPORT and MPI_PROCS <= 4
transport/deph_H5 #? WITH_TRANSPORT and MPI_PROCS <= 4
transport/inelastic_H56 #? WITH_TRANSPORT and MPI_PROCS <= 4
transport/inelastic_H-sheet #? WITH_TRANSPORT and MPI_PROCS <= 4
transport/inelastic_H-sheet #? WITH_TRANSPORT and MPI_PROCS >= 2 and MPI_PROCS <= 4

pp-RPA/ethene #? not WITH_MPI
pp-RPA/benzene_TammDancoff #? not WITH_MPI
Expand Down
4 changes: 2 additions & 2 deletions test/app/dftb+/transport/inelastic_H-sheet/_autotest.tag
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ end_coords :real:2:3,80
0.000000000000000E+000 0.377945197715785E+001 0.188972598857892E+002
0.000000000000000E+000 0.566917796573677E+001 0.188972598857892E+002
contact_currents :real:1:5
-0.228772760845725E-004 -0.228769804935716E-004 -0.228766938059616E-004
-0.228764329213880E-004 -0.228761703108644E-004
-0.229801071960333E-004 -0.229801089678273E-004 -0.229801123199019E-004
-0.229801004930085E-004 -0.229800600056852E-004
dipole_moments :real:2:3,1
0.000000000000000E+000 0.136060271177682E+003 0.167807667785808E+004
scaled_dipole :real:2:3,1
Expand Down

0 comments on commit b32e1d8

Please sign in to comment.