glassure.fitting module

glassure.fitting.i_q_peak(q, n, position, sigma, composition, element_1, element_2)

Calculates the contribution of one element 1 - element 2 peak in real space to i(Q) (remember i(Q)=S(Q)-1). We assume a gaussian broadening. The math is explained in the paper about NXFit (Pickup et al. 2014, J. Appl. Cryst. 47, 1790-1796).

Parameters:
  • q – Q value or numpy array with a unit of A^-1

  • n – coordination number of element 2 to element 1

  • position – average distance between the two elements

  • sigma – measure for broadness of distances distribution

  • composition – composition: dictionary with elements as key and abundances as relative numbers

  • element_1 – string giving element 1

  • element_2 – string giving element 1

glassure.fitting.t_r_peak(r, n, position, sigma, composition, element_1, element_2, q, use_modification_fcn=False, method='fft')

Calculates the contribution of one element 1 - element 2 peak in real space to t(r). We assume a gaussian broadening. The math is explained in the paper about NXFit (Pickup et al. 2014, J. Appl. Cryst. 47, 1790-1796).

The function will first calculate the peak in i(Q) with the appropriate weighting factor and then fourier transform it into real space.

Parameters:
  • r – numpy array giving the r-values for which the peak will be calculated

  • n – coordination number of element 2 to element 1

  • position – average distance between the two elements

  • sigma – measure for broadness of distances distribution

  • composition – composition: dictionary with elements as key and abundances as relative numbers

  • element_1 – string giving element 1

  • element_2 – string giving element 1

  • q – numpy array giving the q-values for which the peak will be calculated in q-space, should correspond to the same values as the experimental data. WARNING: check whether it works correctly, when your q values are not extended to close 0 A^{-1}. WARNING: q-array should not contain 0, since this will cause a division by zero and the calculation will fail.

  • use_modification_fcn – boolean flag whether to use the Lorch modification function, during the fourier transformation.

  • method – determines the method used for calculating fr, possible values are: - ‘integral’ solves the Fourier integral, by calculating the integral - ‘fft’ solves the Fourier integral by using fast fourier transformation

glassure.fitting.t_r_peak_gaussian(r, n, position, sigma, composition, element_1, element_2)

Calculates the contribution of one element 1 - element 2 peak in real space to t(r). We assume a gaussian distribution. The math is well explained in the LiquidDiffract paper (Heinen and Drewitt 2022. Physics and Chemistry of Minerals 49, no. 5: 9. https://doi.org/10.1007/s00269-022-01186-6).

The gaussian is weighted based on the X-ray form factors of the two elements.

Parameters:
  • r – numpy array giving the r-values for which the peak will be calculated

  • n – coordination number of element 2 to element 1

  • position – average distance between the two elements

  • sigma – measure for broadness of distances distribution

  • composition – composition: dictionary with elements as key and abundances as relative numbers

  • element_1 – string giving element 1

  • element_2 – string giving element 1

Returns:

T(r) pattern