Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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
Posted
Updated 27-Feb-15 8:16am
v2
Comments
CHill60 26-Feb-15 10:28am    
Define what you mean by "doesn't work correctly"
azam1354 27-Feb-15 1:25am    
It doesn't run in FORTRAN.
Stefan_Lang 27-Feb-15 2:08am    
That doesn't really give us any more information.

Does it compile? link? Can you start the program? If it starts, what happens? If it doesn't work like you expected, what did you expect?

That is the kind of information we're looking for. Remember that we can't see what's in front of you, nor can we read your thoughts. We have no idea what you wish to accomplish, what kind of results or error messages you see, and pretty much no other information whatsoever that we can use to analyze the probelm. Heck, we can't even tell that there actually is a problem at all!
Sergey Alexandrovich Kryukov 26-Feb-15 10:37am    
"Cubic" in English is adjective, not a noun. Cubic what?
—SA
azam1354 27-Feb-15 1:27am    
I mean "cube" or "simple cubic".

1 solution

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!
 
Share this answer
 
Comments
CHill60 27-Feb-15 5:00am    
5. Good point that last one!
I beat you though ... I haven't used Fortran for over 30 years!! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900