I'm using a Fortran program to sum the orbitals coefficients. At first I use the following program:
Original file MOs_sum.f90 looks like this
MOnumber = 1
do i = 1,nsnaps_alpha
read(20,'(a80)')string
read(20,*)EMO(1),EMO(2),EMO(3),EMO(4),EMO(5)
do j = 1,8
**Line 51** read(20,*)coef_Li1(j,1),coef_Li1(j,2),coef_Li1(j,3),coef_Li1(j,4),coef_Li1(j,5)
enddo
do j = 1,8
read(20,*)coef_Li2(j,1),coef_Li2(j,2),coef_Li2(j,3),coef_Li2(j,4),coef_Li2(j,5)
enddo
do j = 1,19
read(20,*)coef_C3(j,1),coef_C3(j,2),coef_C3(j,3),coef_C3(j,4),coef_C3(j,5)
enddo
do j = 1,19
read(20,*)coef_C4(j,1),coef_C4(j,2),coef_C4(j,3),coef_C4(j,4),coef_C4(j,5)
enddo
do ii = 1,5
coef_Li1_sum = 0.0d0
coef_Li2_sum = 0.0d0
coef_C3_sum = 0.0d0
coef_C4_sum = 0.0d0
do j = 1,8
coef_Li1_sum = coef_Li1_sum + coef_Li1(j,ii)*coef_Li1(j,ii)
coef_Li2_sum = coef_Li2_sum + coef_Li2(j,ii)*coef_Li2(j,ii)
enddo
do j = 1,19
coef_C3_sum = coef_C3_sum + coef_C3(j,ii)*coef_C3(j,ii)
coef_C4_sum = coef_C4_sum + coef_C4(j,ii)*coef_C4(j,ii)
enddo
write(30,100)MOnumber,EMO(ii),coef_Li1_sum,coef_Li2_sum,coef_C3_sum,coef_C4_sum
MOnumber = MOnumber + 1
enddo
enddo
100 format(i6,2x,5(f20.5,5x))
And I obtain this error:
At line 51 of file MOs_sum.f90 (unit = 20, file = 'raw_MOs.txt')
Fortran runtime error: Bad real number in item 4 of list input
I know the problem is caused by a large number in one column that intersects with another column (in the input). To solve it, I tried to use 5F11.5 format in read command. But I obtain the following error:
At line 49 of file MOs_sum.f90 (unit = 20, file = 'raw_MOs.txt')
Fortran runtime error: Bad value during floating point read
raw_MOs.txt looks like this
-19.66145 0.00177 0.00005 0.00005 0.00266
-19.65987 0.00099 0.00032 0.00011 0.00120
-10.59358 0.00017 0.00012 0.00006 0.00036
And the file MOs_sum.f90 looks like this (see line 49):
MOnumber = 1
do i = 1,nsnaps_alpha
read(20,'(a80)')string
**Line 49** read(20,"(5F11.5)")EMO(1),EMO(2),EMO(3),EMO(4),EMO(5)
do j = 1,8
read(20,"(5F11.5)")coef_Li1(j,1),coef_Li1(j,2),coef_Li1(j,3),coef_Li1(j,4),coef_Li1(j,5)
enddo
do j = 1,8
read(20,"(5F11.5)")coef_Li2(j,1),coef_Li2(j,2),coef_Li2(j,3),coef_Li2(j,4),coef_Li2(j,5)
enddo
do j = 1,19
read(20,"(5F11.5)")coef_C3(j,1),coef_C3(j,2),coef_C3(j,3),coef_C3(j,4),coef_C3(j,5)
enddo
do j = 1,19
read(20,"(5F11.5)")coef_C4(j,1),coef_C4(j,2),coef_C4(j,3),coef_C4(j,4),coef_C4(j,5)
enddo
do ii = 1,5
coef_Li1_sum = 0.0d0
coef_Li2_sum = 0.0d0
coef_C3_sum = 0.0d0
coef_C4_sum = 0.0d0
do j = 1,8
coef_Li1_sum = coef_Li1_sum + coef_Li1(j,ii)*coef_Li1(j,ii)
coef_Li2_sum = coef_Li2_sum + coef_Li2(j,ii)*coef_Li2(j,ii)
enddo
do j = 1,19
coef_C3_sum = coef_C3_sum + coef_C3(j,ii)*coef_C3(j,ii)
coef_C4_sum = coef_C4_sum + coef_C4(j,ii)*coef_C4(j,ii)
enddo
write(30,100)MOnumber,EMO(ii),coef_Li1_sum,coef_Li2_sum,coef_C3_sum,coef_C4_sum
MOnumber = MOnumber + 1
enddo
enddo
100 format(i6,2x,5(f20.5,5x))
I've tried different modifications of the format but I didn't get any result. Any help would be greatly appreciated!
Comments
Post a Comment