Implemented magnetic structure factor calculation