Skip to content

Commit bcba4ca

Browse files
committed
remove write(*,*) ''; write right number of 'bravaislattice'
1 parent d3f189e commit bcba4ca

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

utility/wannier2xatu/utils.f90

+23-26
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ module utils
66
character(len=:), allocatable :: FileName
77
integer :: nFock, mSize
88
integer, allocatable :: Degen(:)
9-
real(kind = 8) :: Rn(3, 3)
9+
real(8) :: Rn(3, 3)
1010
integer, allocatable :: iRn(:,:)
11-
complex(kind = 8), allocatable :: H(:,:,:)
12-
complex(kind = 8), allocatable :: Rhop(:,:,:,:) ! motif
11+
complex(8), allocatable :: H(:,:,:)
12+
complex(8), allocatable :: Rhop(:,:,:,:) ! motif
1313

1414
!todo
1515
!w90 hamiltoniana
@@ -28,8 +28,8 @@ end subroutine LoadArguments
2828

2929
subroutine LoadSystem
3030
integer :: fp, ii, jj, i, j
31-
real(kind = 8) :: R, Im
32-
real(kind = 8) :: a1, a1j, a2, a2j, a3, a3j
31+
real(8) :: R, Im
32+
real(8) :: a1, a1j, a2, a2j, a3, a3j
3333

3434
!read filename by terminal arguments
3535
call LoadArguments()
@@ -88,8 +88,8 @@ subroutine Export2Xatu
8888
implicit none
8989
character(len=len(FileName)+2) :: outfile ! +2 because (.model=.dat+2)
9090
integer :: iunit, stat, i, j, k
91-
integer :: filePos, diag
92-
real*8 :: a1, a2, a3
91+
integer :: filePos, diag, dimensions
92+
real(8) :: a1, a2, a3
9393
logical :: is2D=.True.
9494

9595

@@ -109,35 +109,26 @@ subroutine Export2Xatu
109109
do i=1,nFock
110110
if (iRn(i,3).ne.0) then
111111
is2D = .False.
112+
else
113+
is2D = .true. ! 2D system only if all iRn(i, 3) = 0.0
112114
end if
113115
end do
114116

115117
if (is2D) then
116118
write(iunit, *) 2
119+
dimensions = 2
117120
else
118121
write(iunit, *) 3
122+
dimensions = 3
119123
end if
120-
write(iunit, *) ''
121124
! ------------------------------------------------------------------------------------ !
122125
write(iunit, '(A)') '# norbitals'
123-
write(iunit, '(*(I1,1X))') (1, i=1,mSize)
124-
write(iunit, *) ''
126+
write(iunit, '(*(I1,2X))') (1, i=1,mSize)
125127
! ------------------------------------------------------------------------------------ !
126128
write(iunit, '(A)') '# bravaislattice'
127-
do i = 1,3
129+
do i = 1, dimensions
128130
write(iunit, *) Rn(i, :)
129131
end do
130-
write(iunit, *) ''
131-
! ------------------------------------------------------------------------------------ !
132-
write(iunit, '(A)') '# bravaisvectors'
133-
do i=1, nFock
134-
a1 = iRn(i,1)*Rn(1,1)+iRn(i,2)*Rn(2,1)+iRn(i,3)*Rn(3,1)
135-
a2 = iRn(i,1)*Rn(1,2)+iRn(i,2)*Rn(2,2)+iRn(i,3)*Rn(3,2)
136-
a3 = iRn(i,1)*Rn(1,3)+iRn(i,2)*Rn(2,3)+iRn(i,3)*Rn(3,3)
137-
write(iunit, *) a1,' ',a2,' ',a3
138-
end do
139-
write(iunit, *) ''
140-
141132
! ------------------------------------------------------------------------------------ !
142133
write(iunit, '(A)') '# motif'
143134
do i=1, nFock
@@ -148,8 +139,14 @@ subroutine Export2Xatu
148139
do i=1, mSize
149140
write(iunit, *) (real(Rhop(k, diag, i,i)),k=1,3), i-1
150141
end do
151-
write(iunit, *) ''
152-
142+
! ------------------------------------------------------------------------------------ !
143+
write(iunit, '(A)') '# bravaisvectors'
144+
do i=1, nFock
145+
a1 = iRn(i,1)*Rn(1,1)+iRn(i,2)*Rn(2,1)+iRn(i,3)*Rn(3,1)
146+
a2 = iRn(i,1)*Rn(1,2)+iRn(i,2)*Rn(2,2)+iRn(i,3)*Rn(3,2)
147+
a3 = iRn(i,1)*Rn(1,3)+iRn(i,2)*Rn(2,3)+iRn(i,3)*Rn(3,3)
148+
write(iunit, *) a1,' ',a2,' ',a3
149+
end do
153150
! ------------------------------------------------------------------------------------ !
154151
write(iunit, '(A)') '# hamiltonian'
155152
do i=1, nFock
@@ -163,9 +160,9 @@ subroutine Export2Xatu
163160
end do
164161
write(iunit, *) ''
165162
! ------------------------------------------------------------------------------------ !
166-
! write(iunit, '(A)') '# filling'
163+
write(iunit, '(A)') '# filling'
167164

168165
! flush(iunit)
169166
close(iunit)
170167
end subroutine
171-
end module
168+
end module

0 commit comments

Comments
 (0)