From eb5ea1c2724c7fa269ea634e30f717b5f248f777 Mon Sep 17 00:00:00 2001 From: Alessandro Pecchia Date: Mon, 22 Aug 2022 18:16:12 +0200 Subject: [PATCH] Merge branch inelastic and cuda --- config.cmake | 1 + external/libnegf/origin | 2 +- src/dftbp/dftbplus/initprogram.F90 | 2 -- src/dftbp/dftbplus/parser.F90 | 14 +++++------ src/dftbp/transport/negfint.F90 | 25 +++++++++---------- .../dftb+/transport/local-curr/dftb_in.hsd | 2 +- 6 files changed, 21 insertions(+), 25 deletions(-) diff --git a/config.cmake b/config.cmake index fce8f25ec3..18a3cbff8e 100644 --- a/config.cmake +++ b/config.cmake @@ -22,6 +22,7 @@ option(WITH_ELSI "Whether DFTB+ with MPI-parallelism should use the ELSI librari # enabled (and must have been built with GPU support). option(WITH_TRANSPORT "Whether transport via libNEGF should be included." FALSE) +option(WITH_TRANSPORT_GPU "Whether libNEGF should enable GPU." FALSE) # Works only when building static libraries (see option BUILD_SHARED_LIBS) option(WITH_POISSON "Whether the Poisson-solver should be included" ${WITH_TRANSPORT}) diff --git a/external/libnegf/origin b/external/libnegf/origin index 0d45109fab..7971853dec 160000 --- a/external/libnegf/origin +++ b/external/libnegf/origin @@ -1 +1 @@ -Subproject commit 0d45109fab34722a9a72a142ea88729604fbf4ab +Subproject commit 7971853dec6d5fe36a9ab4fb68ae5746b8b3c031 diff --git a/src/dftbp/dftbplus/initprogram.F90 b/src/dftbp/dftbplus/initprogram.F90 index de304fe376..ccb645a927 100644 --- a/src/dftbp/dftbplus/initprogram.F90 +++ b/src/dftbp/dftbplus/initprogram.F90 @@ -4502,8 +4502,6 @@ subroutine initTransport_(env, input, electronicSolver, nSpin, tempElec, tNegf, end associate if (tNegf) then - write(stdOut,*) 'init negf' - ! Some checks and initialization of GDFTB/NEGF call TNegfInt_init(negfInt, input%transpar, env, input%ginfo%greendens,& & input%ginfo%tundos, tempElec, kPoint, kWeight, localKS) diff --git a/src/dftbp/dftbplus/parser.F90 b/src/dftbp/dftbplus/parser.F90 index 602cab2a45..f1a41c6c48 100644 --- a/src/dftbp/dftbplus/parser.F90 +++ b/src/dftbp/dftbplus/parser.F90 @@ -6714,7 +6714,7 @@ subroutine readInelastic(node, elph, geom, orb, tp) call getChildValue(child2, "Eps0", elph%eps_r, default=1.0_dp) call getChildValue(child2, "ScreeningLength", tmp, 10.0_dp, modifier=modifier,& & child=field) - call convertByMul(char(modifier), lengthUnits, field, tmp) + call convertUnitHsd(char(modifier), lengthUnits, field, tmp) elph%q0 = 1.0_dp/tmp case ("nonpolaroptical") elph%model = interaction_models%nonpolaroptical @@ -6722,7 +6722,7 @@ subroutine readInelastic(node, elph, geom, orb, tp) call read_common_part(child2) call getChildValue(child2, "DeformationPotential", elph%D0, 0.0_dp, modifier=modifier,& & child=field) - call convertByMul(char(modifier), energyUnits, field, elph%D0) + call convertUnitHsd(char(modifier), energyUnits, field, elph%D0) case default call detailedError(child,"unkown inelastic phonon type: "//char(phonontype)) end select @@ -6742,7 +6742,7 @@ subroutine read_common_part(node) if (tmp == 0.0_dp) then call detailedError(node, "PhononFrequency must be defined > 0.0") end if - call convertByMul(char(modifier), energyUnits, field, tmp) + call convertUnitHsd(char(modifier), energyUnits, field, tmp) elph%wq = tmp call getChildValue(node, "Umklapp", elph%tUmklapp, .false.) call getChildValue(node, "KSymmetry", elph%tKSymmetry, .true.) @@ -6916,7 +6916,7 @@ subroutine readCoupling(node, elph, geom, orb, tp) case (textNodeName) call getChildValue(node, "Coupling", rTmp, child=field, modifier=modifier) - call convertByMul(char(modifier), energyUnits, field, rTmp) + call convertUnitHsd(char(modifier), energyUnits, field, rTmp) elph%coupling = rTmp case ("constant") @@ -6959,12 +6959,10 @@ subroutine readCommonBlock(root, orb, geo, tundos, transpar, tempElec) call getChildValue(root, "Delta", tundos%delta, & &1.0e-5_dp, modifier=modifier, child=field) - call convertByMul(char(modifier), energyUnits, field, & - &tundos%delta) + call convertUnitHsd(char(modifier), energyUnits, field, tundos%delta) call getChildValue(root, "BroadeningDelta", tundos%broadeningDelta, & &0.0_dp, modifier=modifier, child=field) - call convertByMul(char(modifier), energyUnits, field, & - &tundos%broadeningDelta) + call convertUnitHsd(char(modifier), energyUnits, field, tundos%broadeningDelta) ! Read Temperature. Can override contact definition allocate(tundos%kbT(ncont)) diff --git a/src/dftbp/transport/negfint.F90 b/src/dftbp/transport/negfint.F90 index 81296eb3d0..caadbbebc1 100644 --- a/src/dftbp/transport/negfint.F90 +++ b/src/dftbp/transport/negfint.F90 @@ -120,7 +120,7 @@ subroutine TNegfInt_init(this, transpar, env, greendens, tundos, tempElec, kPoin integer :: i, l, ncont, nldos integer, allocatable :: sizes(:) type(lnParams) :: params - + #:if WITH_MPI call negf_mpi_init(this%negf, env%mpi%globalComm, env%mpi%groupComm, & & env%mpi%interGroupComm) @@ -132,6 +132,8 @@ subroutine TNegfInt_init(this, transpar, env, greendens, tundos, tempElec, kPoin ncont = 0 endif + write(stdOut,*) 'Initialize libNEGF' + ! ------------------------------------------------------------------------------ ! Set defaults and fill up the parameter structure with them call init_negf(this%negf) @@ -229,7 +231,7 @@ subroutine TNegfInt_init(this, transpar, env, greendens, tundos, tempElec, kPoin params%FictCont(i) = transpar%contacts(i)%wideBand params%contact_DOS(i) = transpar%contacts(i)%wideBandDOS - write(stdOut,"(1X,A,I0,A)") '(negf_init) CONTACT INFO #', i,& + write(stdOut,"(1X,A,I0,A)") 'CONTACT INFO #', i,& & ' "'//trim(transpar%contacts(i)%name)//'"' if (params%FictCont(i)) then @@ -238,20 +240,17 @@ subroutine TNegfInt_init(this, transpar, env, greendens, tundos, tempElec, kPoin end if write(stdOut,*) 'Temperature (DM): ', params%kbT_dm(i) write(stdOut,*) 'Temperature (Current): ', params%kbT_t(i) - if (transpar%contacts(i)%tFermiSet) then - write(stdOut,format2U)'Potential (with built-in)', pot(i), 'H', Hartree__eV*pot(i), 'eV' - write(stdOut,format2U)'eFermi', eFermi(i), 'H', Hartree__eV*eFermi(i), 'eV' - end if - write(stdOut,*) - ! Define electrochemical potentials params%mu(i) = eFermi(i) - pot(i) if (transpar%contacts(i)%tFermiSet) then + write(stdOut,format2U)'Potential (with built-in)', pot(i), 'H', Hartree__eV*pot(i), 'eV' + write(stdOut,format2U)'eFermi', eFermi(i), 'H', Hartree__eV*eFermi(i), 'eV' write(stdOut,format2U)'Electro-chemical potentials', params%mu(i), 'H',& & Hartree__eV*params%mu(i), 'eV' - write(stdOut,*) end if + + write(stdOut,*) enddo @@ -765,10 +764,10 @@ subroutine setup_str(this, denseDescr, transpar, greendens, coords, latVec, & end if - write(stdOut,*) ' Structure info:' - write(stdOut,*) ' Number of PLs:',nbl - write(stdOut,*) ' PLs coupled to contacts:',cblk(1:ncont) - write(stdOut,*) + !write(stdOut,*) ' Structure info:' + !write(stdOut,*) ' Number of PLs:',nbl + !write(stdOut,*) ' PLs coupled to contacts:',cblk(1:ncont) + !write(stdOut,*) end if diff --git a/test/app/dftb+/transport/local-curr/dftb_in.hsd b/test/app/dftb+/transport/local-curr/dftb_in.hsd index b294806d7e..62f2b6f63c 100644 --- a/test/app/dftb+/transport/local-curr/dftb_in.hsd +++ b/test/app/dftb+/transport/local-curr/dftb_in.hsd @@ -29,7 +29,7 @@ Transport{ Hamiltonian = DFTB { SCC = Yes - MaxSCCIterations = 100 + MaxSCCIterations = 1 SCCTolerance = 1e-6 ReadInitialCharges = Yes