The purpose of mass spectrometry is to ionize a chemical sample, causing it to fragment, and to characterize the mass of the fragment ions that form to gain chemical information about the sample. The first thing that happens is that the sample molecules need to be ionized, and this is done by removing an electron from the sample to yield a positively charged species. Once ionized, a sample of molecules will typically fragment in a characteristic way. The ions that form, whether they are fragments or the original ionized species, are accelerated and then deflected in a magnetic field. Ions of different masses are deflected by different amounts, and this is how the masses of the different ions are distinguished.