MODULE variables

    real(kind=8), parameter :: Pi=4.0D0*DATAN(1.0D0) ! pi
    real(kind=8), parameter :: d2pi=2*Pi,d4pi=4*Pi  ! 2pi e 4Pi

    real(kind=8):: dt=1.0D-3,dt2,dt6,dt24

    integer :: np,dimen=3
    real(kind=8) , dimension(:,:) , allocatable :: pos,vel,forca,ace,posini
    real(kind=8) , dimension(:,:) , allocatable :: K1v,K2v,K3v,K4v,K1a,K2a,K3a,K4a
    real(kind=8) , dimension(:,:) , allocatable :: pos0,vel0
    real(kind=8) , dimension(:,:) , allocatable :: pkn,pkn1,pkn2,pkn3,vkn,vkn1,vkn2,vkn3
    real(kind=8) ,  dimension(:)  , allocatable :: massa
    integer(kind=8) , dimension(:), allocatable :: nv,nv1,tipo,nv_t

    real(kind=8) :: Ecin, Epot
    
    type vizinhos
        integer(kind=8), dimension(:),allocatable:: vv,vv1,vv_t
        real(kind=8), dimension(:),allocatable:: costhetaijk0
    end type vizinhos


    CONTAINS

      subroutine allocatevars(np)
        implicit none
        save
        integer, intent(in) :: np

        dt2=dt/2.D0
        dt6=dt/6.D0
        dt24=dt/24.D0
   
        allocate(pos(np,dimen),vel(np,dimen),forca(np,dimen),ace(np,dimen),posini(np,dimen))
        allocate(K1v(np,dimen),K2v(np,dimen),K3v(np,dimen),K4v(np,dimen))
        allocate(K1a(np,dimen),K2a(np,dimen),K3a(np,dimen),K4a(np,dimen))
        allocate(pkn(np,dimen),pkn1(np,dimen),pkn2(np,dimen),pkn3(np,dimen))        
        allocate(vkn(np,dimen),vkn1(np,dimen),vkn2(np,dimen),vkn3(np,dimen))        
        allocate(pos0(np,dimen),vel0(np,dimen))
        
        pos=0.D0 ; vel=0.D0 ; forca=0.D0 ; ace=0.D0 ; posini=0.D0
        K1v=0.D0 ; K2v=0.D0 ; K3v=0.D0 ; K4v=0.D0 
        K1a=0.D0 ; K2a=0.D0 ; K3a=0.D0 ; K4a=0.D0
        pos0=0.D0 ; vel0=0.D0
        pkn=0.D0 ; pkn1=0.D0 ; pkn2=0.D0 ; pkn3=0.D0
        vkn=0.D0 ; vkn1=0.D0 ; vkn2=0.D0 ; vkn3=0.D0
        massa=0.D0
        nv=0 ; nv1=0 ; tipo=0 ; nv_t=0
        
        write(*,*) pos(np,dimen)
        pos(np,1)=np
        write(*,*) pos(np,dimen)
        
!        call calc()
        !deallocate(realOutput)
        return
    end subroutine allocatevars

END MODULE variables

