I want to read .xyz file which looks like....
3 !no. of particles
1.0000 ! time step
a 2.345 2.458 0.564 ! ID x y z for 1st particle
a 5.455 2.486 5.456 ! ID x y z for 2nd particle
a 6.545 4.566 2.665 ! ID x y z for 3rd particle
3 !no.of particles (same as before)
2.000 ! next time step
a 4.345 3.458 4.564 ! ID x y z for 1st particle
a 4.455 3.486 4.456 ! ID x y z for 2nd particle
a 8.545 3.566 4.665 ! ID x y z for 3rd particle
...... continue..... for 1000 time step
I want to calculate distance of each particle from others at each time step. How to read this file?
program size
implicit none
integer i,j,k
integer,parameter :: n=400,t=714
integer dn(n),n1
real*8 px(n,t),py(n,t),dt,pz
character(75) nam
open (unit=50,file='vmd.xyz',status='old',action='read')
do k=1,t
do i=1,n
read(50,*) n1
read(50,*) dt
read(50,*) nam,px(i,k),py(i,k),pz
end do
end do
close(50)
end program