| 6 | 1/1 | 返回列表 |
| 查看: 2459 | 回復(fù): 5 | |||
alvin510銀蟲 (小有名氣)
|
[求助]
Fortran編程過程中遇到錯(cuò)誤,求大俠幫忙看下
|
|
我在用FORTRAN計(jì)算NLO過程中,編的一段程序遇到錯(cuò)誤,請(qǐng)高手幫忙看下,萬分感謝。 其中的一段程序?yàn)椋?br /> module def implicit none integer :: nk,nkpts,ndum,ns,nspins,nb,locat_str character (len=80) :: dummy real num_e real fermi_energy integer num_bands real,allocatable :: weight( ![]() real,allocatable :: kpoints(:, ![]() end module program main !讀入 kpoints, weights 和 eigenvalues use def implicit none integer,parameter :: fileid=10 character (len=80) :: filename="F:\FORTRAN\NLOC\CGA\unit_bands.txt" logical alive inquire (file=filename,exist=alive) if(.not. alive) then write(*,*) trim(filename), "doesn't exist!" stop end if open(unit=10,file=filename) read(unit=10,"(19XI6,/,26XI2,/,20XF7.1,/,22XI7,/,31XF13.8)" nkpts,spins,num_e,num_bands,fermi_energyallocate(kpoints(1,nkpts)) allocate(kpoints(2,nkpts)) allocate(kpoints(3,nkpts)) allocate(weight(nkpts)) do nk = 1, nkpts read(fileid, '(a)') dummy locat_str = index(dummy,'K-point') read(dummy(locat_str+7 ,*) ndum, kpoints(1,nk), kpoints(2,nk), kpoints(3,nk), weight(nk)do ns = 1, nspins read(fileid,*) dummy do nb = 1, num_bands read(fileid,*) eigenvalues(nb, nk, ns) enddo enddo enddo close(fileid) stop end program 其中調(diào)用了一個(gè)數(shù)據(jù)文件unit_bands.txt。這個(gè)文件我已經(jīng)上傳了上來。 再次感謝你的幫助! |
銀蟲 (小有名氣)
專家顧問 (正式寫手)
![]() |
專家經(jīng)驗(yàn): +14 |
銀蟲 (小有名氣)
|
3樓: Originally posted by jerkwin at 2013-07-18 21:10:42 eigenvalues沒有定義啊 謝謝你發(fā)現(xiàn)這個(gè)問題。后來我自己又發(fā)現(xiàn)了幾個(gè)問題一并做了更改,發(fā)現(xiàn)還是出現(xiàn)問題了。我的代碼如下: module def implicit none integer :: nk,nkpts,ndum,ns,nspins,nb,locat_str character (len=80) :: dummy real num_e real fermi_energy integer num_bands real,allocatable :: weight( ![]() real,allocatable :: kpoints(:, ![]() real,allocatable :: eigenvalues(:,:, ![]() end module program main !讀入 kpoints, weights 和 eigenvalues use def implicit none integer,parameter :: fileid=10 character (len=80) :: filename="F:\FORTRAN\NLOC\CGA\unit_bands.txt" logical alive inquire (file=filename,exist=alive) if(.not. alive) then write(*,*) trim(filename), "doesn't exist!" stop end if open(unit=fileid,file=filename) read(unit=fileid,"(19XI6,/,26XI2,/,20XF7.1,/,22XI7,/,31XF13.8)" nkpts,nspins,num_e,num_bands,fermi_energy!read(unit=fileid,"(19XI6)" nkpts!read(unit=fileid,"(26XI2)" nspins!read(unit=fileid,"(20XF7.1)" num_e!read(unit=fileid,"(22XI7)" num_bands!read(unit=fileid,"(31XF13.8)" fermi_energyallocate(kpoints(3,nkpts)) allocate(weight(nkpts)) allocate(eigenvalues(num_bands,nkpts,nspins)) do nk = 1, nkpts read(fileid, '(a)') dummy locat_str = index(dummy,'K-point') read(dummy(locat_str+7 ,*) ndum, kpoints(1,nk), kpoints(2,nk), kpoints(3,nk), weight(nk)do ns = 1, nspins read(fileid,*) dummy do nb = 1, num_bands read(fileid,*) eigenvalues(nb, nk, ns) enddo enddo enddo close(fileid) stop end program |
銀蟲 (小有名氣)
|
提示出錯(cuò)的地方在 read(unit=fileid,"(19XI6,/,26XI2,/,20XF7.1,/,22XI7,/,31XF13.8)" nkpts,nspins,num_e,num_bands,fermi_energy這一行。 錯(cuò)誤 1 error #6357: This is not a valid specifier for a control list. ['(19XI6,/,26XI2,/,20XF7.1,/,22XI7,/,31XF13.] F:\FORTRAN\NLOC\CGA\CGA-01.f90 30 請(qǐng)幫我查查看原因,謝謝 |
專家顧問 (正式寫手)
![]() |
專家經(jīng)驗(yàn): +14 |
| 6 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 312求調(diào)劑 +6 | 陌宸希 2026-03-16 | 7/350 |
|
|---|---|---|---|---|
|
[考研] 化學(xué)工程321分求調(diào)劑 +13 | 大米飯! 2026-03-15 | 16/800 |
|
|
[考研] 工科材料085601 279求調(diào)劑 +5 | 困于星晨 2026-03-17 | 5/250 |
|
|
[考研] 考研求調(diào)劑 +3 | 橘頌. 2026-03-17 | 4/200 |
|
|
[考研] 材料與化工求調(diào)劑 +6 | 為學(xué)666 2026-03-16 | 6/300 |
|
|
[考研] 070300化學(xué)319求調(diào)劑 +4 | 錦鯉0909 2026-03-17 | 4/200 |
|
|
[考研] 308求調(diào)劑 +4 | 是Lupa啊 2026-03-16 | 4/200 |
|
|
[考研] 274求調(diào)劑0856材料化工 +13 | z2839474511 2026-03-11 | 14/700 |
|
|
[考研] 求調(diào)劑,總分315,考的生物醫(yī)藥,一志愿湖南師范大學(xué)。調(diào)劑到任何專業(yè)都可以 +4 | 小丁想進(jìn)步 2026-03-11 | 5/250 |
|
|
[考研] 290求調(diào)劑 +6 | 孔志浩 2026-03-12 | 11/550 |
|
|
[論文投稿] 有沒有大佬發(fā)小論文能帶我個(gè)二作 +3 | 增銳漏人 2026-03-17 | 4/200 |
|
|
[考研] 321求調(diào)劑 +5 | 大米飯! 2026-03-15 | 5/250 |
|
|
[考研] 中科院材料273求調(diào)劑 +4 | yzydy 2026-03-15 | 4/200 |
|
|
[考研] 0703 物理化學(xué)調(diào)劑 +3 | 我可以上岸的對(duì)?/a> 2026-03-13 | 5/250 |
|
|
[考研] 289求調(diào)劑 +4 | 這么名字咋樣 2026-03-14 | 6/300 |
|
|
[考研] 308 085701 四六級(jí)已過求調(diào)劑 +7 | 溫喬喬喬喬 2026-03-12 | 14/700 |
|
|
[考研] 330求調(diào)劑 +3 | ?醬給調(diào)劑跪了 2026-03-13 | 3/150 |
|
|
[考研] 材料工程調(diào)劑 +9 | 咪咪空空 2026-03-12 | 9/450 |
|
|
[考研] 求材料調(diào)劑 085600英一數(shù)二總分302 前三科235 精通機(jī)器學(xué)習(xí) 一志愿哈工大 +4 | 林yaxin 2026-03-12 | 4/200 |
|
|
[考研] 工科調(diào)劑 +4 | Jiang191123! 2026-03-11 | 4/200 |
|