Skip to content

Commit

Permalink
Add local current to tagged out
Browse files Browse the repository at this point in the history
  • Loading branch information
pecchia committed Mar 6, 2024
1 parent f93c9b0 commit 4af47e1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/dftbp/dftbplus/main.F90
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ subroutine runDftbPlus(this, env)
& this%tStress, this%totalStress, this%pDynMatrix,&
& this%dftbEnergy(this%deltaDftb%iFinal), this%extPressure, this%coord0, this%tLocalise,&
& localisation, this%electrostatPot, this%taggedWriter, this%tunneling, this%ldos,&
& this%lCurrArray, this%polarisability, this%dEidE, this%dipoleMoment, this%eFieldScaling)
& this%lCurrArray, this%leadCurrents, this%polarisability, this%dEidE, this%dipoleMoment,&
& this%eFieldScaling)
end if
if (this%tWriteResultsTag) then
call writeResultsTag(resultsTag, this%dftbEnergy(this%deltaDftb%iFinal), this%derivs,&
Expand Down
19 changes: 13 additions & 6 deletions src/dftbp/dftbplus/mainio.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1881,7 +1881,7 @@ end subroutine initOutputFile
subroutine writeAutotestTag(fileName, electronicSolver, tPeriodic, cellVol, tMulliken, qOutput,&
& derivs, chrgForces, excitedDerivs, tStress, totalStress, pDynMatrix, energy, pressure,&
& endCoords, tLocalise, localisation, esp, taggedWriter, tunneling, ldos, lCurrArray,&
& polarisability, dEidE, dipoleMoment, eFieldScaling)
& currents, polarisability, dEidE, dipoleMoment, eFieldScaling)

!> Name of output file
character(*), intent(in) :: fileName
Expand Down Expand Up @@ -1950,6 +1950,9 @@ subroutine writeAutotestTag(fileName, electronicSolver, tPeriodic, cellVol, tMul
!> This array is for testing only since it misses info
real(dp), allocatable, intent(in) :: lCurrArray(:,:)

!> contact or layer currents
real(dp), allocatable, intent(in) :: currents(:)

!> Static electric polarisability
real(dp), intent(in), allocatable :: polarisability(:,:,:)

Expand Down Expand Up @@ -2025,6 +2028,10 @@ subroutine writeAutotestTag(fileName, electronicSolver, tPeriodic, cellVol, tMul
end if
end if

if (allocated(currents)) then
call taggedWriter%write(fd, tagLabels%contactCurrents, currents)
end if

if (allocated(lCurrArray)) then
call taggedWriter%write(fd, tagLabels%localCurrents, lCurrArray)
end if
Expand Down Expand Up @@ -2498,23 +2505,23 @@ subroutine writeHessianOut(fileName, pDynMatrix, indMovedAtoms)

integer :: ii, fd
character(10) :: suffix1, suffix2
logical :: tPartialHessian = .false.
logical :: tPartialHessian = .false.

! Sanity check in case some bug is introduced
if (size(pDynMatrix, dim=2) /= 3*size(indMovedAtoms)) then
call error('Internal error: incorrect number of rows of dynamical Matrix')
end if
call error('Internal error: incorrect number of rows of dynamical Matrix')
end if
! It is a partial Hessian Calculation if DynMatrix is not squared
if (size(pDynMatrix, dim=1) > size(pDynMatrix, dim=2)) then
tPartialHessian = .true.
end if

if (tPartialHessian) then
write(suffix1,'(I10)') indMovedAtoms(1)
write(suffix2,'(I10)') indMovedAtoms(size(indMovedAtoms))
write(suffix2,'(I10)') indMovedAtoms(size(indMovedAtoms))
open(newunit=fd, file=fileName//"."//trim(adjustl(suffix1))//"-"//trim(adjustl(suffix2)), &
& action="write", status="replace")
else
else
open(newunit=fd, file=fileName, action="write", status="replace")
end if

Expand Down
6 changes: 6 additions & 0 deletions src/dftbp/io/taggedoutput.F90
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ module dftbp_io_taggedoutput
!> total projected DOS vector
character(lenLabel) :: ldos = 'total_localdos'

!> contact currents
character(lenLabel) :: contactCurrents = 'contact_currents'

!> layer currents
character(lenLabel) :: layerCurrents = 'layer_currents'

!> total bond currents
character(lenLabel) :: localCurrents = 'local_currents'

Expand Down

0 comments on commit 4af47e1

Please sign in to comment.