Stopping of implanted charged particles in solid targets and calculation of radiation damage induced by them