INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

help please

help please

(OP)
Hi,,
I have afortran program for calculating density and when I execute it gives me zero and error.
program density
implicit none
integer :: r,IDm,n,m,i,j
real :: xm,ym,zm,p,p0,k,pi,s,ri,rj,l
real, dimension(1000) :: x,y,z,ID
p0=0.17
k=0.0
L=4.33
pi=3.1415927
do n=1,3000
open(unit=5,file='/home/toshiba/Desktop/urqmd-3.3p2/format1.dat')
read(5,*) l,l,l,l
do m=1,400
read(5,*) xm,ym,zm,IDm
if(xm==400) exit
r=m
x(r)=xm
y(r)=ym
z(r)=zm
ID(r)=IDm
write(*,*) xm, ym, zm, IDm

end do

do i=1,r-1
x(i)=xm
y(i)=ym
z(i)=zm
do j=i+1,r
x(j)=x(i+1)
y(j)=y(i+1)
z(j)=z(i+1)
s=ri-rj
s=sqrt((x(i)-x(j))**2 + (y(i)-y(j))**2 + (z(i)-z(j))**2)
K=K+s
end do
end do
p=(1/394)*(1/(2*pi*L)**1.5)*exp(-(K)**2/(2*L))*p0
write(*,*) p/p0

end do

end program density
can any one help me..

RE: help please

have you heard of integral division?

In computer programs, if you type 2 is a 2 and not a 2.0; without decimal point a number is an integer. When dividing two integers you only get the quotient...6/3=2, 7/3=2 ...and when the denominator is greater, you get the quotient of zero: 1/2=0, 1/394=0

If you do not desire integral division, you need to make sure one of the operands is a REAL number, i.e., has a decimal point or is a variable declared accordingly.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close