@@ -6,10 +6,10 @@ module utils
6
6
character (len= :), allocatable :: FileName
7
7
integer :: nFock, mSize
8
8
integer , allocatable :: Degen(:)
9
- real (kind = 8 ) :: Rn(3 , 3 )
9
+ real (8 ) :: Rn(3 , 3 )
10
10
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
13
13
14
14
! todo
15
15
! w90 hamiltoniana
@@ -28,8 +28,8 @@ end subroutine LoadArguments
28
28
29
29
subroutine LoadSystem
30
30
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
33
33
34
34
! read filename by terminal arguments
35
35
call LoadArguments()
@@ -88,8 +88,8 @@ subroutine Export2Xatu
88
88
implicit none
89
89
character (len= len (FileName)+ 2 ) :: outfile ! +2 because (.model=.dat+2)
90
90
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
93
93
logical :: is2D= .True.
94
94
95
95
@@ -109,35 +109,26 @@ subroutine Export2Xatu
109
109
do i= 1 ,nFock
110
110
if (iRn(i,3 ).ne. 0 ) then
111
111
is2D = .False.
112
+ else
113
+ is2D = .true. ! 2D system only if all iRn(i, 3) = 0.0
112
114
end if
113
115
end do
114
116
115
117
if (is2D) then
116
118
write (iunit, * ) 2
119
+ dimensions = 2
117
120
else
118
121
write (iunit, * ) 3
122
+ dimensions = 3
119
123
end if
120
- write (iunit, * ) ' '
121
124
! ------------------------------------------------------------------------------------ !
122
125
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)
125
127
! ------------------------------------------------------------------------------------ !
126
128
write (iunit, ' (A)' ) ' # bravaislattice'
127
- do i = 1 ,3
129
+ do i = 1 , dimensions
128
130
write (iunit, * ) Rn(i, :)
129
131
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
-
141
132
! ------------------------------------------------------------------------------------ !
142
133
write (iunit, ' (A)' ) ' # motif'
143
134
do i= 1 , nFock
@@ -148,8 +139,14 @@ subroutine Export2Xatu
148
139
do i= 1 , mSize
149
140
write (iunit, * ) (real (Rhop(k, diag, i,i)),k= 1 ,3 ), i-1
150
141
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
153
150
! ------------------------------------------------------------------------------------ !
154
151
write (iunit, ' (A)' ) ' # hamiltonian'
155
152
do i= 1 , nFock
@@ -163,9 +160,9 @@ subroutine Export2Xatu
163
160
end do
164
161
write (iunit, * ) ' '
165
162
! ------------------------------------------------------------------------------------ !
166
- ! write(iunit, '(A)') '# filling'
163
+ write (iunit, ' (A)' ) ' # filling'
167
164
168
165
! flush(iunit)
169
166
close (iunit)
170
167
end subroutine
171
- end module
168
+ end module
0 commit comments