24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 742  |  回复: 16
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

fengshiquan

铁杆木虫 (正式写手)

[求助] 求助

要处理的文件如下:想把下面的数据的前三列做平方和再开平方得到一列数据:
          0.0000  0.0000  0.0000   1.0   
          0.0375  0.0375  0.0750   1.0
          0.0750  0.0750  0.1500   1.0
          0.1125  0.1125  0.2250   1.0
          0.1500  0.1500  0.3000   1.0
          0.1875  0.1875  0.3750   1.0
          0.2250  0.2250  0.4500   1.0
          0.2625  0.2625  0.5250   1.0
          0.3000  0.3000  0.6000   1.0
          0.3375  0.3375  0.6750   1.0
          0.3750  0.3750  0.7500   1.0   
          0.3875  0.3875  0.7750   1.0
          0.4000  0.4000  0.8000   1.0
          0.4125  0.4125  0.8250   1.0
          0.4250  0.4250  0.8500   1.0
          0.4375  0.4375  0.8750   1.0
          0.4500  0.4500  0.9000   1.0
          0.4625  0.4625  0.9250   1.0
          0.4750  0.4750  0.9500   1.0
          0.4875  0.4875  0.9750   1.0
          0.5000  0.5000  1.0000   1.0   
          0.5500  0.5500  1.0000   1.0
          0.6000  0.6000  1.0000   1.0
          0.6500  0.6500  1.0000   1.0
          0.7000  0.7000  1.0000   1.0
          0.7500  0.7500  1.0000   1.0
          0.8000  0.8000  1.0000   1.0
          0.8500  0.8500  1.0000   1.0
          0.9000  0.9000  1.0000   1.0
          0.9500  0.9500  1.0000   1.0
          1.0000  1.0000  1.0000   1.0   
          0.9500  0.9500  0.9500   1.0
          0.9000  0.9000  0.9000   1.0
          0.8500  0.8500  0.8500   1.0
          0.8000  0.8000  0.8000   1.0
          0.7500  0.7500  0.7500   1.0
          0.7000  0.7000  0.7000   1.0
          0.6500  0.6500  0.6500   1.0
          0.6000  0.6000  0.6000   1.0
          0.5500  0.5500  0.5500   1.0
          0.5000  0.5000  0.5000   1.0   
          0.5000  0.4500  0.5000   1.0
          0.5000  0.4000  0.5000   1.0
          0.5000  0.3500  0.5000   1.0
          0.5000  0.3000  0.5000   1.0
          0.5000  0.2500  0.5000   1.0
          0.5000  0.2000  0.5000   1.0
          0.5000  0.1500  0.5000   1.0
          0.5000  0.1000  0.5000   1.0
          0.5000  0.0500  0.5000   1.0
          0.5000  0.0000  0.5000   1.0   
          0.5000  0.0250  0.5250   1.0
          0.5000  0.0500  0.5500   1.0
          0.5000  0.0750  0.5750   1.0
          0.5000  0.1000  0.6000   1.0
          0.5000  0.1250  0.6250   1.0
          0.5000  0.1500  0.6500   1.0
          0.5000  0.1750  0.6750   1.0
          0.5000  0.2000  0.7000   1.0
          0.5000  0.2250  0.7250   1.0
          0.5000  0.2500  0.7500   1.0   
          0.5000  0.2750  0.7250   1.0
          0.5000  0.3000  0.7000   1.0
          0.5000  0.3250  0.6750   1.0
          0.5000  0.3500  0.6500   1.0
          0.5000  0.3750  0.6250   1.0
          0.5000  0.4000  0.6000   1.0
          0.5000  0.4250  0.5750   1.0
          0.5000  0.4500  0.5500   1.0
          0.5000  0.4750  0.5250   1.0
          0.5000  0.5000  0.5000   1.0   
写的处理程序如下:
CODE:
program abinit

real,allocatable :: q(:,:)
real, dimension(3) ::a

write(6,*)"Please input the number of q points"
read(5,*)nq
write(6,*)"Please input the name of the input and output file names"
read(5,*)input,output

allocate(q(nq,3))
open(10,file=input, status='old')
open(11,file=output, status='new')

do i=1,nq
read(10,*)(q(i,n),n=1,3),a
write(13,"(3F10.4)")(q(i,n),n=1,3)
enddo

dk=0
do i=1,nq
a=q(i,:)
dk=dk+sqrt(dot_product(a,a))
write(11,"(F10.4)")dk
enddo
write(11,*)
stop
end program abinit

调试没有格式错误,但是运行出错,报的错误是:
forrt1:severe<59>:list-directed I/O syntax error, unit5, file CONIN$
Image                 PC               Routine              Line                Source
.....

[ Last edited by jjdg on 2013-4-28 at 22:42 ]
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

fengshiquan

铁杆木虫 (正式写手)

引用回帖:
6楼: Originally posted by nono2009 at 2013-04-28 22:08:31
屏幕输入不是read(*,*)吗?

write(6,*)"Please input the number of q points"
这个应该没错吧,你的意思吧5,6都改成*嘛
7楼2013-04-28 22:14:53
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 17 个回答

fengshiquan

铁杆木虫 (正式写手)

请教各位高手,帮忙看看,如何解决
2楼2013-04-28 21:07:53
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

nono2009

超级版主 (文学泰斗)

No gains, no pains.

优秀区长优秀区长优秀区长优秀区长优秀版主

【答案】应助回帖

★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
fengshiquan: 金币+5, 有帮助 2013-04-28 22:04:40
jjdg: 金币+1, 感谢参与 2013-04-28 22:43:18
write(6,*)"Please input the number of q points"
read(5,*)nq
write(6,*)"Please input the name of the input and output file names"
read(5,*)input,output
你有open通道5和6吗?

write(13,"(3F10.4)"(q(i,n),n=1,3)
你有open通道13吗?
3楼2013-04-28 21:33:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

fengshiquan

铁杆木虫 (正式写手)

引用回帖:
3楼: Originally posted by nono2009 at 2013-04-28 21:33:55
write(6,*)"Please input the number of q points"
read(5,*)nq
write(6,*)"Please input the name of the input and output file names"
read(5,*)input,output
你有open通道5和6吗?

...

有吧,可以从屏幕输入,open通道13不知道有没有,这个怎么看有没有了,如果没有怎么改了
4楼2013-04-28 22:04:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 348求调剂 +11 zzzzyk123 2026-04-01 11/550 2026-04-02 16:52 by Wang200018
[考研] 330分求调剂 +13 qzenlc 2026-03-29 13/650 2026-04-02 16:45 by SZW_UJN
[考研] 071000生物学调剂 +6 知昭蔓 2026-04-02 6/300 2026-04-02 15:28 by sophie2180
[考研] 一志愿郑大材料工程290求调剂 +20 Youth_ 2026-03-30 20/1000 2026-04-02 14:48 by 5896
[考研] 一志愿同济大学323分(080500)求调剂 +6 yikeniu 2026-04-01 6/300 2026-04-02 14:19 by smileboy2006
[考研] 学硕化学工程与技术,一志愿中国海洋大学320+求调剂 +8 披星河 2026-04-02 8/400 2026-04-02 14:12 by oooqiao
[考研] 301求调剂 +14 骆驼男人 2026-04-02 14/700 2026-04-02 14:08 by baoball
[考研] 377求调剂 +3 RASKIN 2026-04-02 3/150 2026-04-02 09:45 by zzchen2000
[考研] 材料专硕306英一数二 +7 z1z2z3879 2026-03-31 7/350 2026-04-01 14:50 by ZXlzxl0425
[考研] 求调剂:一志愿:南京大学 专业:0705 总分320 ,本科985,四六级已过 +3 lfy760306 2026-03-31 3/150 2026-04-01 01:57 by Creta
[考研] 070300化学专业279调剂 +10 哈哈哈^_^ 2026-03-31 10/500 2026-03-31 23:13 by liu823948201
[考研] 材料工程085601数二英一335求调剂 +5 双马尾痞老板2 2026-03-31 5/250 2026-03-31 19:07 by Wang200018
[考研] 一志愿a区211,085601-307分求调剂 +10 党嘉豪 2026-03-31 23/1150 2026-03-31 18:44 by JourneyLucky
[考研] 江苏苏北高校诚邀调剂同学 +3 zzll406 2026-03-31 3/150 2026-03-31 16:54 by 及时行乐fan
[考研] 340求调剂 +4 希望如此i 2026-03-31 4/200 2026-03-31 16:40 by 690616278
[考研] 材料工程专硕求调剂 +10 hyl3153942 2026-03-29 10/500 2026-03-31 16:31 by hypershenger
[考研] 南京大学化学调剂 +11 景随风 2026-03-29 16/800 2026-03-31 10:14 by herarysara
[考研] 本科双非材料,跨考一志愿华电085801电气,283求调剂,任何专业都可以 +6 芝士雪baoo 2026-03-28 8/400 2026-03-29 08:16 by 松花缸1201
[考研] 11408软件工程求调剂 +3 Qiu学ing 2026-03-28 3/150 2026-03-28 21:50 by zhq0425
[考研] 265求调剂 +8 小木虫085600 2026-03-27 8/400 2026-03-27 22:16 by 无际的草原
信息提示
请填处理意见