Formation and reactivity of nitrides. IV. Titanium and zirconium nitrides