! Physics 222 Class example - a simple progr
!      by Jim Crumley  -  1/24/2007
PROGRAM two_body_structure
  IMPLICIT NONE

  !Define particle structure for two-body collision
  TYPE :: particle
    REAL :: mass, initial_position(3), final_position(3)  ! in kg and m respectively
    REAL :: initial_velocity(3), final_velocity(3)        ! m/s
  END TYPE particle
  
  !Define experiment structure that holds information about the simulation
  TYPE :: experiment
    CHARACTER (len=20) :: experimenter, date_of_experiment, start_time   
    REAL :: time_length                                   ! duration of collision in s
  END TYPE
  
  TYPE(particle) :: body(2)
  TYPE(experiment) :: collision
  INTEGER :: i

  ! Prompt for and read in initial values:
  DO i = 1,2
    WRITE(*,*) 'Input the mass of object ', i, ' in kg.'
    READ (*,*) body(i)%mass
    WRITE(*,*) 'Input the three components of the initial position of object', & 
      i, ' in m.  Use scientific notation and separate the components with commas.'
    READ (*,*) body(i)%initial_position
    WRITE(*,*) 'Input the three components of the initial velocity of object', & 
      i, ' in m/s.  Use scientific notation and separate the components with commas.'
    READ (*,*) body(i)%initial_velocity
  ENDDO

  ! Continue initialization and go from there .

END PROGRAM two_body_structure

