API

The braggedgemodeling package provides tools to calculate neutron Bragg Edge spectrum for a material.

Atomic structure

bem.matter.loadCif(path)

load CIF file from given path to create a Structure instance

bem.matter.Structure(*args, **kwds)

a wrapper for diffpy Structure method that injects “sg” data member.

Structure(atoms, lattice, sgid=): create an atomic structure given the list of atoms, the lattice, and the space group id. This method is mainly for advanced users, and for testing and exploration purpose.

Parameters:
  • atoms (list) – list of atoms
  • lattice (Lattice) –
  • sgid (int) – space group id. For example 225 for FCC

Examples

>>> from bem.matter import Atom, Lattice, Structure
>>> atoms = [Atom('Fe', (0,0,0)), Atom('Fe', (0.5, 0.5, 0.5))]
>>> a=2.856
>>> alpha = 90.
>>> lattice = Lattice(a=a, b=a, c=a, alpha=alpha, beta=alpha, gamma=alpha)
>>> astruct = Structure(atoms, lattice, sgid=229)

For more details on Atom, Lattice, and Structure, please refer to http://www.diffpy.org/diffpy.structure/

Cross section calculator

class bem.xscalc.XSCalculator(structure, T, xopm=None, max_diffraction_index=5, size=0)

Cross section calculator

This class implements formulas in Chapter 3, section 2 of Sven Vogel’s thesis, “A Rietveld-approach for the analysis of neutron time-of-flight transmission data”

__init__(structure, T, xopm=None, max_diffraction_index=5, size=0)

constructor

Parameters:
  • structure (diffpy.structure) – lattice structure
  • T (float) – temperature (Kelvin)
  • max_diffraction_index (int, optional) – max integer for h,k, and l
  • xopm (xtaloriprobmodel.XtalOriProbModel, optional) – crystal orientation probability model
  • size (int, optional) – size of crystallites along beam (for extinction effect calculation)
extinction_factor(wavelen, pk)

compute extinction factor for given wavelength and diffraction peak

plotAll(wavelen)

plot all cross sections w.r.t the given wavelength array

Parameters:wavelen (floats) – wavelengths. unit: angstrom
xs(wavelen)

calculate total cross section in barns

Parameters:wavelen (float, floats) – wavelength or wavelengths. unit: angstrom
xs_abs(wavelen)

calculate absorption cross section in barns

Parameters:wavelen (float, floats) – wavelength or wavelengths. unit: angstrom
xs_coh_el(wavelen)

calculate coherent elastic cross section in barns

Parameters:wavelen (float, floats) – wavelength or wavelengths. unit: angstrom
xs_coh_el__peak(wavelen, peak)

calculate coherent elastic cross section for one peak in barns

Parameters:
  • wavelen (float, floats) – wavelength or wavelengths. unit: angstrom
  • peak (diffraction.DiffrPeak) – diffraction peak instance
xs_coh_inel(wavelen)

calculate coherent inelastic cross section in barns

Parameters:wavelen (float, floats) – wavelength or wavelengths. unit: angstrom
xs_inc_el(wavelen)

calculate incoherent elastic cross section in barns

Parameters:wavelen (float, floats) – wavelength or wavelengths. unit: angstrom
xs_inc_inel(wavelen)

calculate incoherent inelastic cross section in barns

Parameters:wavelen (float, floats) – wavelength or wavelengths. unit: angstrom
xs_inel(wavelen)

calculate inelastic cross section in barns

Parameters:wavelen (float, floats) – wavelength or wavelengths. unit: angstrom

Texture

class bem.xtaloriprobmodel.MarchDollase(r=None, beta=None)

March Dollase model for texture

This class implements the formula 3.68 of Sven Vogel’s thesis, “A Rietveld-approach for the analysis of neutron time-of-flight transmission data”. An easier to read reference is Eq. (5) of “Imaging of a spatial distribution of preferred orientation of crystallites by pulsed neutron Bragg edge transmission” by H Sato et. al. http://iopscience.iop.org/article/10.1088/1742-6596/251/1/012070

Create an instance

>>> md = MarchDollase()

Now md.r and md.beta are parameters. The default value for r is 1. The default value for beta is 0.

To change r and beta value for a specific hkl, do

>>> md.r[hkl] = new_r_value
>>> md.beta[hkl] = new_beta_value

The r value is unitless. The beta value is in radian.

Peak profile

class bem.peak_profile.Jorgensen(alpha=None, beta=None, sigma=None)

Jorgensen peak profile

This class implements formulas in section 3.3.3 of Sven Vogel’s thesis, “A Rietveld-approach for the analysis of neutron time-of-flight transmission data”

__init__(alpha=None, beta=None, sigma=None)

Jorgensen peak profile constructor

Parameters:
  • alpha – 2-tuple of floats. units: 1/angstrom, 1
  • beta – 2-tuple of floats. units: 1/angstrom, angstrom^3
  • sigma – 3-tuple of floats. units: angstrom, 1, 1/angstrom