Ion bombardment effects during deposition of nitride and metal films