Skip to content

Commit

Permalink
aded IF ELSE for dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
GuiJanone committed Sep 19, 2024
1 parent 4b9ffae commit e033393
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions utility/wannier2xatu/utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ subroutine Export2Xatu
integer :: iunit, stat, i, j, k
integer :: pos
real*8 :: a1, a2, a3
logical :: is2D=.True.


! Find the position of '.dat' in the filename
Expand All @@ -105,7 +106,17 @@ subroutine Export2Xatu
! Open the file for writing (create it if it doesn't exist, overwrite if it does)
open(NEWUNIT=iunit, file=trim(outfile), action='write', status='replace', iostat=stat)
write(iunit, '(A)') '# dimension'
write(iunit, *) size(Rn)
do i=1,nFock
if (iRn(i,3).ne.0) then
is2D = .False.
end if
end do

if (is2D) then
write(iunit, *) 2
else
write(iunit, *) 3
end if
write(iunit, *) ''
! ------------------------------------------------------------------------------------ !
write(iunit, '(A)') '# norbitals'
Expand All @@ -130,7 +141,7 @@ subroutine Export2Xatu
! ------------------------------------------------------------------------------------ !
write(iunit, '(A)') '# motif'
do i=1, mSize
write(iunit, *) (real(Rhop(k, 1, i,i)),k=1,3), i-1
write(iunit, *) (real(Rhop(k, 2, i,i)),k=1,3), i-1
end do
write(iunit, *) ''

Expand Down

0 comments on commit e033393

Please sign in to comment.