Structural stability and magnetism of FeN from first principles