def calc_fm_perp_for_fm_loc(k_loc_i, fm_loc):
    """Calculate perpendicular component of fm to scattering vector."""
    k_1, k_2, k_3 = k_loc_i[0], k_loc_i[1], k_loc_i[2]
    mag_1, mag_2, mag_3 = fm_loc[0], fm_loc[1], fm_loc[2]
    mag_p_1 = (k_3*mag_1 - k_1*mag_3)*k_3 - (k_1*mag_2 - k_2*mag_1)*k_2
    mag_p_2 = (k_1*mag_2 - k_2*mag_1)*k_1 - (k_2*mag_3 - k_3*mag_2)*k_3
    mag_p_3 = (k_2*mag_3 - k_3*mag_2)*k_2 - (k_3*mag_1 - k_1*mag_3)*k_1
    return mag_p_1, mag_p_2, mag_p_3