Structural, electronic and magnetic properties of NiAl and FeAl alloys