  We use first principles calculations to investigate how deviations from
perfect chemical order affect the magneto-crystalline anisotropy energy (MAE)
in L$1_0$ FeNi. We first analyze the local chemical environment of the Fe atoms
in various partially ordered configurations, using the orbital magnetic moment
anisotropy (OMA) as proxy for a local contribution to the MAE. We are able to
identify a specific nearest neighbor configuration and use this "favorable
environment" to successfully design various structures with MAE higher than the
perfectly ordered system. However, a systematic analysis of the correlation
between local environment and OMA using smooth overlap of atomic positions
(SOAP), indicates only a partial correlation, which exists only if the
deviation from full chemical order is not too large, whereas in general no such
correlation can be identified even using up to third nearest neighbors. Guided
by the observation that the identified "favorable environment" implies an
Fe-rich composition, we investigate the effect of randomly inserting additional
Fe into the nominal Ni planes of the perfectly ordered structure. We find that
the MAE increases with Fe content, at least up to 62.5% Fe. Thus, our study
shows that the perfectly ordered case is not the one with highest MAE and that
an increased MAE can be obtained for slightly Fe-rich compositions.
