One-dimensional ideal diatomic gas is simulated through possible types of motions of its molecule. Energy of each type of its motion is calculated by both theoretical and numerical methods. Analytical calculation of kinetic energy of an atom in translational-vibrational motion is not simple, but it can be solved by numerical method using molecular dynamic simulation. This paper justifies that the kinetic energy of a diatomic molecule can be determined by two different approaches which give the same results. In the first approach, the kinetic energy is calculated as a summation of kinetic energy of each atom. In the second approach, the kinetic energy is calculated as a summation of kinetic energy of translational and vibrational motions.