24小时热门版块排行榜    

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

铁杆木虫 (正式写手)


ben_ladeng: 金币+1, 谢谢分享 2013-05-04 07:58:36
为题已解决,呵呵,自己找到了,谢谢各位了。
加了个:
character(len=32)::input,output
就可以了
17楼2013-05-03 17:28:57
已阅   回复此楼   关注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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 309求调剂 +8 呆菇不是戴夫 2026-04-02 8/400 2026-04-02 14:30 by oooqiao
[考研] 一志愿北京科技大学材料学硕328分求调剂 +6 1段时间 2026-03-31 7/350 2026-04-02 13:57 by 3041
[考研] 一志愿华东理工大学,080500学硕,317分,求调剂 +12 s1145 2026-03-31 12/600 2026-04-02 12:38 by smileboy2006
[考研] 085601一志愿中山大学深圳材料工程330求调剂 +8 pipiver 2026-03-30 8/400 2026-04-02 12:01 by ms629
[考研] 085600,材料与化工321分,求调剂 +13 大馋小子 2026-03-27 13/650 2026-04-02 10:48 by sanrepian
[考研] 一志愿346上海大学生物学 +3 上海大学346调剂 2026-04-01 3/150 2026-04-02 08:36 by w虫虫123
[考研] 304求调剂 +12 素年祭语 2026-03-31 15/750 2026-04-01 22:41 by peike
[考研] 273求调剂 +19 李芷新1 2026-03-31 19/950 2026-04-01 21:49 by chyhaha
[考研] 285求调剂 +5 FZAC123 2026-03-30 5/250 2026-04-01 15:50 by 韩雨涵
[考研] 一志愿北交材料工程总分358 +5 cs0106 2026-04-01 7/350 2026-04-01 11:45 by wangjy2002
[硕博家园] 博一被送出联培感觉不适应怎么办 +3 全村的狗 2026-03-31 3/150 2026-04-01 10:44 by 328838485
[考研] 0856调剂 +7 曲听筠 2026-03-30 7/350 2026-04-01 08:51 by JourneyLucky
[考研] 289求调剂 +7 BrightLL 2026-03-29 7/350 2026-03-31 22:05 by 544594351
[考研] 材料工程专硕求调剂 +10 hyl3153942 2026-03-29 10/500 2026-03-31 16:31 by hypershenger
[考研] 求收留 +8 1943443204 2026-03-28 8/400 2026-03-31 15:00 by -迷了路啊路
[考研] 081200-11408-276学硕求调剂 +4 崔wj 2026-03-31 4/200 2026-03-31 11:56 by jp9609
[考研] 一志愿西电085401数一英一299求调剂 六级521 +4 爱吃大鸭梨 2026-03-31 4/200 2026-03-31 11:51 by 搏击518
[考研] 本科211总分289,08工学真心求调剂 +3 utopiaE 2026-03-30 3/150 2026-03-30 23:42 by ms629
[考研] 085701环境工程求调剂 +11 多久上课 2026-03-27 12/600 2026-03-30 21:21 by 研究僧导导
[考研] 305求调剂 +8 RuiFairyrui 2026-03-28 8/400 2026-03-29 08:22 by fmesaito
信息提示
请填处理意见