# Magnetic Form Factor

## `periodictable.magnetic_ff`

Adds magnetic_ff[charge].t for t in j0, j2, j4, j6, and J. J should be the dipole approximation <j0> + (1 - 2/g) <j2>, according to the documentation for CrysFML [1] , but that does not seem to be the case in practice.

[1] | Brown. P. J. (Section 4.4.5) International Tables for Crystallography Volume C, Wilson. A. J. C.(ed).

class `periodictable.magnetic_ff.``MagneticFormFactor`

  Bases: `object`

  Magnetic form factor for the ion.

  The available form factors are:

      M = <j0> form factor coefficients
      J = <j0> + C2 <j2> form factor coeffients
      jn = <jn> form factor coefficients for n = 0, 2, 4, 6

  Not all form factors are available for all ions. Use the expression `hasattr(ion.magnetic_ff, '<ff>')` to test for the particular form factor <ff>. The form factor coefficients are a tuple (A, a, B, b, C, c, D). The following expression computes the M/j0 and J form factors from the corresponding coefficients:

      s = q^2 / 16 pi^2
      ff = A exp(-a s^2) + B exp(-b s^2) + C exp(-c s^2) + D

  The remaining form factors j2, j4 and j6 are scalled by an additional s^2. The form factor calculation is performed by the <ff>_Q method for <ff> in M, J, j0, j2, j4, j6. For example, here is the calculation for the M form factor for Fe^2+ computed at 0, 0.1 and 0.2:

      >>> import periodictable
      >>> ion = periodictable.Fe.ion[2]
      >>> print(ion.magnetic_ff[ion.charge].M_Q([0, 0.1, 0.2]))
      [ 1.          0.99935255  0.99741366]

  `J_Q`(Q)

    Returns J scattering potential at Q Å-1

  `M_Q`(Q)

    Returns j0 scattering potential at Q Å-1

  `j0_Q`(Q)

    Returns j0 scattering potential at Q Å-1

  `j2_Q`(Q)

    Returns j2 scattering potential at Q Å-1

  `j4_Q`(Q)

    Returns j4 scattering potential at Q Å-1

  `j6_Q`(Q)

    Returns j6 scattering potential at Q Å-1

  `M`

    j0

`periodictable.magnetic_ff.``formfactor_0`(j0, q)

  Returns the scattering potential for form factor j0 at the given q.

`periodictable.magnetic_ff.``formfactor_n`(jn, q)

  Returns the scattering potential for form factor jn at the given q.

`periodictable.magnetic_ff.``init`(table, reload=False)

  Add magnetic form factor properties to the periodic table