如何在Fortran中创建简单的立方体? [英] How do I create a simple cubic in Fortran?

查看:117
本文介绍了如何在Fortran中创建简单的立方体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友;

我需要帮助才能在FORTRAN中创建一个简单的立方体。

我编写了这个程序,但它无法正常工作。

请帮帮我...



natom = 27

x(natom),y(natom),z(natom )

x(1)= 0

y(1)= 0

z(1)= 0

n = 1

我= 1,3

做j = 1,3

做k = 1,3

rx(n)= x(1)+(i-1)a

ry(n)= y(1)+(j-1)a

rz( n)= z(1)+(k-1)a

n = n + 1

结束做

hello friends;
I need help for creating a simple cubic in FORTRAN.
I have writing this program,but it doesn't work correctly.
please help me...

natom=27
x(natom),y(natom),z(natom)
x(1)=0
y(1)=0
z(1)=0
n=1
do i=1,3
do j=1,3
do k=1,3
rx(n)=x(1)+(i-1)a
ry(n)=y(1)+(j-1)a
rz(n)=z(1)+(k-1)a
n=n+1
end do

推荐答案

由于代码看起来不完整,即使考虑到我在过去的25年里没有使用过Fortran,我也检查了这个网站: http://en.wikibooks.org/wiki/Fortran/Fortran_examples [ ^ ]



我注意到两件事:

1.显然,不同版本的Fortran之间存在很大差异,因此您最好说明您使用的是哪个版本。

2.您的代码不是任何版本的完整程序Fortran版本。至少你没有复制样板(程序/结束程序)。这不是一个大问题,但如果你不提供完整的程序,很难判断你的代码是否真的丢失了这些位。



还有一个建议:尝试我上面链接的网站上的一些示例程序,并验证它们是否按预期工作。如果没有,可能会出现与您的程序代码无关的问题!
Since the code looks incomplete, even when considering I haven't worked with Fortran the last 25 years, I've checked this site: http://en.wikibooks.org/wiki/Fortran/Fortran_examples[^]

I've noticed two things:
1. Apparently there are considerable differences between the different versions of Fortran, so you better state what version you are using.
2. Your code is not a complete program in any version of Fortran. At the very least you didn't copy the boilerplate (program / end program). That's not a big issue, but if you don't provide the full program it's hard to tell whether your code is actually missing those bits or not.

And one more piece of advice: try some of the example programs from the site I linked above and verify they are working as intended. If not, there may be issues that are not related to your program code at all!


这篇关于如何在Fortran中创建简单的立方体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆