Skip to content

Commit df88a2f

Browse files
committed
bug fix, freezing with gcc ver>8, resolves issue #12
1 parent 2e70b5c commit df88a2f

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

src/lattice.f

+16-15
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ end subroutine LAT_CLEAR
7676
subroutine LAT_INIT(LAT)
7777
! calculate dependent fields in LAT (metric tensor, cell volume, ...)
7878
!-------------------------------------------------------------
79-
TYPE (TCR_LATTICE) :: LAT
80-
LAT%VOL=GET_CELLVOL(LAT,298.D0)
81-
call GET_METRIC(LAT,LAT%G)
79+
TYPE (TCR_LATTICE) :: LAT
80+
call GET_METRIC(LAT)
8281
end subroutine LAT_INIT
8382

8483
!--------------------------------------------------------
@@ -226,32 +225,34 @@ real(kind(1.D0)) function GET_CELLVOL(LAT,T)
226225
end function GET_CELLVOL
227226
228227
!-------------------------------------------------------------
229-
subroutine GET_METRIC(LAT,G)
228+
subroutine GET_METRIC(LAT)
230229
! calculate metric tensor for reciprocal lattice at T=298 K
231230
!-------------------------------------------------------------
232-
TYPE (TCR_LATTICE),intent(in) :: LAT
233-
real(kind(1.D0)),intent(out) :: G(3,3)
231+
TYPE (TCR_LATTICE) :: LAT
232+
real(kind(1.D0)) :: G(3,3)
234233
integer :: k
235-
real(kind(1.D0)) :: AX(3),SINA(3),COSA(3),VOL
236-
VOL=GET_CELLVOL(LAT,298.D0)
237-
if (VOL.gt.0.D0) then
234+
real(kind(1.D0)) :: AX(3),SINA(3),COSA(3),VOL2
235+
LAT%VOL=GET_CELLVOL(LAT,298.D0)
236+
if (LAT%VOL.gt.0.D0) then
237+
VOL2 = LAT%VOL**2
238238
do k=1,3
239239
COSA(k)=cos(LAT%ANG(k)*deg)
240240
SINA(k)=sin(LAT%ANG(k)*deg)
241241
AX(k)=LAT%AX(k)
242242
enddo
243-
G(1,1)=(AX(2)*AX(3)*SINA(1))**2/VOL**2
244-
G(2,2)=(AX(1)*AX(3)*SINA(2))**2/VOL**2
245-
G(3,3)=(AX(1)*AX(2)*SINA(3))**2/VOL**2
246-
G(1,2)=AX(1)*AX(2)*AX(3)**2*(COSA(1)*COSA(2)-COSA(3))/VOL**2
243+
G(1,1)=(AX(2)*AX(3)*SINA(1))**2/VOL2
244+
G(2,2)=(AX(1)*AX(3)*SINA(2))**2/VOL2
245+
G(3,3)=(AX(1)*AX(2)*SINA(3))**2/VOL2
246+
G(1,2)=AX(1)*AX(2)*AX(3)**2*(COSA(1)*COSA(2)-COSA(3))/VOL2
247247
G(2,1)=G(1,2)
248-
G(1,3)=AX(1)*AX(3)*AX(2)**2*(COSA(1)*COSA(3)-COSA(2))/VOL**2
248+
G(1,3)=AX(1)*AX(3)*AX(2)**2*(COSA(1)*COSA(3)-COSA(2))/VOL2
249249
G(3,1)=G(1,3)
250-
G(2,3)=AX(2)*AX(3)*AX(1)**2*(COSA(2)*COSA(3)-COSA(1))/VOL**2
250+
G(2,3)=AX(2)*AX(3)*AX(1)**2*(COSA(2)*COSA(3)-COSA(1))/VOL2
251251
G(3,2)=G(2,3)
252252
else
253253
G=0.D0
254254
endif
255+
LAT%G = G
255256
end subroutine GET_METRIC
256257
257258

src/simath.f

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ real(kind(1.D0)) function DW_PHI1(x)
9090
dx=x/100
9191
DO i=2,100
9292
ksi=(i-1)*dx
93-
Z=Z+P(MOD(i,2))*ksi/(exp(ksi)-1.D0)
93+
Z=Z+P(MOD(i,2)+1)*ksi/(exp(ksi)-1.D0)
9494
ENDDO
9595
DW_PHI1=Z*dx/3.D0
9696
endif

0 commit comments

Comments
 (0)