| 查看: 3538 | 回復(fù): 11 | |||
[求助]
fortran編譯 read出錯(cuò) 完畢
|
|
錯(cuò)誤提示 POSITION.F(31): error #6358: Constants and expressions are invalid in read-only I/O lists. [MSP] read(15,*) (msp(i),i=1,10) 前面msp有定義 character msp(10) read(15,*) (msp(i),i=1,10) 語(yǔ)法有問題嗎? 一下是全部程序 program getpos ccccccccc 12 is SPPARKS OUTPUT cccccccc ccccccccc 15 is the molecure ccccccccc ccccccccc 13 is OUTPUT ccccccccccc integer mnum nsp real coord(2000,3) real species(10,3) integer nsp(10) real x y z character tile cellp cella cellb cellz msp(10) open(12,file='POSCAR',status='old') open(15,file='POSCAR',status='old') open(13,file='CONTCAR',status='new') ccccccccccccccccccc sys param a b c cccccccccccccc read(12,*) tile write(13,*) tile read(12,*) cellp write(13,*) cellp read(12,*) cella ; write(13,*) cella read(12,*) cellb ; write(13,*) cellb read(12,*) cellc ; write(13,*) cellc read(15,*); read(15,*); read(15,*); read(15,*); read(15,*); cccccccccccccccccccc atom char ccccccccccccccccccccccc read(15,*) (msp(i),i=1,10) write(13,*) (msp(i),i=1,10) read(12,*); cccccccccccccccccccc atom num cccccccccccccccccccccccc read(12,*) mnum read(15,*) (nsp(i),i=1,10) DO i=1, 10 N_anum=mnum*nsp(i) write(13,N_anum) END DO read(12,*) read(15,*) write(13,*) 'R' cccccccccccccccc read molecue coord cccccccccccc DO i=1, mnum read(12,*) (coord(i,j),j=1,13) ENDDO close(12) cc DO j=1, 10 !!! species cyc !!!!!! DO i=1, nsp(j) !!! the j atom cyc !!!!!! read(15,*) x y z !!!!!!!!!!!!!!!!!!!!!!!! molecure coord !!!!!!!!!!!!! DO k=1, mnum nx=x+coord(k,1) ny=y+coord(k,2) nz=z+coord(k,3) write(13,*) nx ,ny ,nz ENDDO ENDDO ENDDO close(15) close(13) END [ Last edited by 賀儀 on 2011-8-23 at 14:53 ] |

至尊木蟲 (職業(yè)作家)
至尊木蟲 (職業(yè)作家)

至尊木蟲 (職業(yè)作家)
|
是的 錯(cuò)誤很多 這是最開始的 現(xiàn)在調(diào)好了,程序如下: program getpos ccccccccc 12 is SPPARKS OUTPUT cccccccc ccccccccc 15 is the molecure ccccccccc ccccccccc 13 is OUTPUT ccccccccccc integer mnum Nanum real::coord(2000,3) integer::nsp(4) real x y z character tile cellp character::msp(4) real::cella(3) real::cellb(3) real::cellc(3) open(12,file='POSCARS',status='old') open(15,file='POSCARV',status='old') open(13,file='CONTCAR',status='new') ccccccccccccccccccc sys param a b c cccccccccccccc read(12,*) tile write(13,"(2XA10)" tileread(12,*) cellp write(13,*) cellp read(12,*) (cella(i),i=1,3) write(13,"(3(2XF10.7))" (cella(i),i=1,3)read(12,*) (cellb(i),i=1,3) write(13,"(3(2XF10.7))" (cellb(i),i=1,3)read(12,*) (cellc(i),i=1,3) write(13,"(3(2XF10.7))" (cellc(i),i=1,3)read(15,*) read(15,*) read(15,*) read(15,*) read(15,*) cccccccccccccccccccc atom char ccccccccccccccccccccccc read(15,*) (msp(i),i=1,4) write(13,"(4(2XA2))" (msp(i),i=1,4)read(12,*) cccccccccccccccccccc atom num cccccccccccccccccccccccc read(12,*) mnum read(15,*) (nsp(i),i=1,4) DO i=1, 4 Nanum=mnum*nsp(i) write(13,10) Nanum END DO read(12,*) read(15,*) write(13,"(/,A1)" 'D'DO i=1, mnum read(12,*) (coord(i,j),j=1,3) END DO close(12) cc DO j=1, 4 !!! species cyc !!!!!! DO i=1, nsp(j) !!! the j species atom cyc !!!!!! read(15,*) x, y, z !!!!!!!!!!!!!!!!!!!!!!!! molecure coord !!!!!!!!!!!!! DO k=1, mnum write(13,100) x+coord(k,1), y+coord(k,2), z+coord(k,3) END DO END DO END DO close(15) close(13) 10 FORMAT(2XI5.0,\) 100 FORMAT(3(2XF10.6)) END |

至尊木蟲 (職業(yè)作家)

至尊木蟲 (職業(yè)作家)

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 086502化學(xué)工程342求調(diào)劑 +6 | 阿姨復(fù)古不過 2026-03-27 | 6/300 |
|
|---|---|---|---|---|
|
[考研] 085600 286分 材料求調(diào)劑 +5 | 麻辣魷魚 2026-03-27 | 6/300 |
|
|
[考研] 085701環(huán)境工程求調(diào)劑 +9 | 多久上課 2026-03-27 | 9/450 |
|
|
[考研] 求調(diào)劑 +8 | 張zz111 2026-03-27 | 9/450 |
|
|
[考研] 352分 化工與材料 +5 | 海納百川Ly 2026-03-27 | 5/250 |
|
|
[考研] 一志愿211院校 344分 東北農(nóng)業(yè)大學(xué)生物學(xué)學(xué)碩,求調(diào)劑 +5 | 丶風(fēng)雪夜歸人丶 2026-03-26 | 8/400 |
|
|
[考研] 一志愿北化085600材料專碩275|有文章專利|求調(diào)劑 +3 | Micky11223 2026-03-25 | 3/150 |
|
|
[考研] 329求調(diào)劑 +4 | 星野? 2026-03-26 | 4/200 |
|
|
[考研] 一志愿吉大071010,316分求調(diào)劑 +3 | xgbiknn 2026-03-27 | 3/150 |
|
|
[考研] 0703化學(xué)338求調(diào)劑! +6 | Zuhui0306 2026-03-26 | 7/350 |
|
|
[考研] 336材料求調(diào)劑 +7 | 陳瀅瑩 2026-03-26 | 9/450 |
|
|
[考研] 341求調(diào)劑 +7 | 青檸檬1 2026-03-26 | 7/350 |
|
|
[考研] 求調(diào)劑 +5 | 蘆lty 2026-03-25 | 6/300 |
|
|
[考研] 求調(diào)劑 +8 | Auroracx 2026-03-22 | 8/400 |
|
|
[考研] 286求調(diào)劑 +13 | Faune 2026-03-21 | 13/650 |
|
|
[考研] 279求調(diào)劑 +6 | 紅衣隱官 2026-03-21 | 6/300 |
|
|
[考研] 309求調(diào)劑 +4 | gajsj 2026-03-25 | 5/250 |
|
|
[考研] 340求調(diào)劑 +5 | 話梅糖111 2026-03-24 | 5/250 |
|
|
[考研] 311求調(diào)劑 +3 | 冬十三 2026-03-24 | 3/150 |
|
|
[考研] 考研調(diào)劑 +3 | 呼呼?~+123456 2026-03-21 | 3/150 |
|