24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 733  |  回复: 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

铁杆木虫 (正式写手)

引用回帖:
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的回帖
查看全部 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的回帖

nono2009

超级版主 (文学泰斗)

No gains, no pains.

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

【答案】应助回帖

引用回帖:
4楼: Originally posted by fengshiquan at 2013-04-28 22:04:45
有吧,可以从屏幕输入,open通道13不知道有没有,这个怎么看有没有了,如果没有怎么改了...

屏幕输入不是*吗?
5楼2013-04-28 22:05:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 一志愿上海海洋大学083200食品学硕,求调剂,接受其他专业 +6 what张 2026-04-01 7/350 2026-04-02 16:48 by zzsw+
[考博] 材料工程专业硕士申博 +3 麟正宇 2026-03-30 3/150 2026-04-02 15:04 by greychen00
[考研] 266分,一志愿电气工程,本科材料,求材料专业调剂 +4 哇呼哼呼哼 2026-04-02 4/200 2026-04-02 13:10 by yulian1987
[考研] 重庆大学材料与化工085600,初试370+,求求调剂建议 +5 shzhou_ 2026-04-01 6/300 2026-04-02 10:05 by olim
[考研] 材料调剂 +11 一样YWY 2026-03-31 11/550 2026-04-01 22:25 by zhouyuwinner
[考研] 286求调剂 +16 PolarBear11 2026-03-26 16/800 2026-04-01 21:31 by 七度不信任
[考研] 265求调剂 +11 yelck 2026-04-01 12/600 2026-04-01 19:12 by 549790059
[考研] 070300求调剂306分 +5 26要上岸 2026-03-27 5/250 2026-04-01 11:09 by oooqiao
[考研] 0855机械初试280求调剂 +3 kazenotori 2026-03-31 3/150 2026-04-01 10:08 by JourneyLucky
[考研] 311(085601)求调剂 +12 liziyeyeye 2026-03-28 13/650 2026-04-01 00:34 by fmesaito
[考研] 一志愿:西北大学,英一数一408-284分求调剂 +7 12.27 2026-03-27 7/350 2026-03-31 21:59 by lbsjt
[考研] 318求调剂 +10 陈晨79 2026-03-30 10/500 2026-03-31 17:37 by 544594351
[考研] 343求调剂 +8 爱羁绊 2026-03-28 8/400 2026-03-31 16:12 by 不吃魚的貓
[考研] 334求调剂 +7 Trying] 2026-03-31 7/350 2026-03-31 12:33 by 无际的草原
[考研] 323分 食品与营养调剂 +3 嘿ooo 2026-03-31 3/150 2026-03-31 09:38 by longlotian
[考研] 370求调剂 +3 080700调剂 2026-03-30 3/150 2026-03-31 01:09 by A_Zhe
[考研] 348求调剂 +6 小懒虫不懒了 2026-03-28 6/300 2026-03-30 10:29 by Evan_Liu
[考研] 085600,专业课化工原理,321分求调剂 +5 大馋小子 2026-03-28 5/250 2026-03-29 08:56 by qingfeng258
[考研] 304求调剂 +6 曼殊2266 2026-03-27 6/300 2026-03-28 14:10 by 唐沐儿
[考研] 265求调剂 +8 小木虫085600 2026-03-27 8/400 2026-03-27 22:16 by 无际的草原
信息提示
请填处理意见