module averagepropmodule
contains
subroutine averageprop(N,vx,vy,vz,LJ,t,Potential,Kinetic,Etotal,caltemp) !call prop for each particle at each time t
	
	implicit none 
	integer, intent(IN) :: N,t
    double precision, dimension(:), intent(in) :: vx,vy,vz
    double precision, dimension(:), intent(in) :: LJ
    double precision, dimension(:), intent(out) :: Kinetic,Potential,Etotal,caltemp
    integer i

    Kinetic(t)=0

    Potential(t)=LJ(t)

	do i=1,N
	   Kinetic(t)=Kinetic(t)+(0.5*(vx(i)*vx(i)+vy(i)*vy(i)+vz(i)*vz(i)))          !x,y,z direction summing
	end do

    Etotal(t)=Kinetic(t)+Potential(t)   !adding PE (@t) to total energy Et at t
    caltemp(t)=2.0*Kinetic(t)/(3.0*N)  !cal. theoritical temp using Kt at t apart from std. temp 'Temp'
	   
end subroutine averageprop

end module averagepropmodule
