【发布时间】:2020-06-11 08:17:59
【问题描述】:
我正在尝试获取一行数据,其中字符位置 21:28 是 x 值,字符位置 29:36 是 y 值。我想将这两组数字放在两个变量中并比较两者。然后如果 x
下面是我的代码,但是fortran学起来很困难,所以部分遗漏了。
program open
implicit none
call getarg(1,"block2.gro")
open(12,file="output.gro",status ='new')
Line =0
x = (21:28) !from input file to be x variable
y= (29:36) !from input file to be y variable
row = !unsure if I need a variable to contain the row
Line=line +1
if (line .ne. 2) then
if x < y
write(12,*) row
line = line+1
else
line=line +1
end if
end program open
任何学习 fortran 的帮助或有用的地方都将不胜感激!
【问题讨论】:
-
fortran 很难学 噗,学C++ :-)
-
我知道这个问题是关于 Fortran 的。然而,为模拟编写可靠的分析代码需要的不仅仅是语法。您是否考虑过使用专门用于读取此类文件的库?如chemfiles.org/chemfiles.f03/latest
-
我会查看 chemfiles,也许这会让生活更轻松!