The space in an atom counteracts the attraction and repulsion forces due to the positively charged protons and negatively charged electrons. Similarly, this happens in other atoms also. Now, if we try to merge two atoms then the electrostatic forces come into action and do not allow merging. The atom can stay at a stable distance to form a molecule or a compound.