Modeling And Engineering Impact Ionization In Avalanche Photodiodes For Near And Mid Infrared Applications