diffpy.srreal package
Tools for real space structure analysis.
Submodules
diffpy.srreal.atomradiitable module
diffpy.srreal.attributes module
diffpy.srreal.bondcalculator module
diffpy.srreal.bvparameterstable module
diffpy.srreal.bvscalculator module
diffpy.srreal.eventticker module
diffpy.srreal.overlapcalculator module
diffpy.srreal.overlapcalculator module
diffpy.srreal.pairquantity module
diffpy.srreal.parallel module
diffpy.srreal.pdfbaseline module
diffpy.srreal.pdfcalculator module
diffpy.srreal.pdfenvelope module
diffpy.srreal.peakprofile module
diffpy.srreal.peakwidthmodel module
diffpy.srreal.scatteringfactortable module
diffpy.srreal.sfaverage module
Compositional averaging of atom scattering factors.
Examples
import numpy as np
from diffpy.srreal.scatteringfactortable import SFTXray
xtb = SFTXray()
qa = np.linspace(0, 25)
sfavg1 = SFAverage.fromComposition({'Na' : 1, 'Cl' : 1}, xtb, qa)
sfavg2 = SFAverage.fromComposition([('Mn', 1), ('O', 2)], xtb, qa)
from diffpy.structure import loadStructure
from diffpy.srreal.pdfcalculator import DebyePDFCalculator
dpdfc = DebyePDFCalculator()
dpdfc(loadStructure('rutile.cif'))
sfavg3 = SFAverage.fromStructure(dpdfc.getStructure(),
dpdfc.scatteringfactortable, dpdfc.qgrid)
- class diffpy.srreal.sfaverage.SFAverage[source]
Bases:
object
Calculate compositional statistics of atom scattering factors.
Compositional averages can be calculated for an array of Q-values. Results are stored in the class attributes.
- f1sum
Sum of scattering factors from all atoms. Float or NumPy array.
- f2sum
Sum of squared scattering factors from all atoms. Float or NumPy array.
- count
Total number of atoms. Can be non-integer in case of fractional occupancies.
- f1avg
Compositional average of scattering factors. Float or NumPy array.
- f2avg
Compositional average of squared scattering factors. Float or NumPy array.
- composition
Dictionary of atom symbols and their total abundance.
- composition = None
- count = 0
- f1avg = 0
- f1sum = 0
- f2avg = 0
- f2sum = 0
- classmethod fromComposition(composition, sftb, q=0)[source]
Calculate average scattering factors from atom concentrations.
- Parameters:
composition (dictionary or a list of (symbol, amount) pairs.) – The chemical composition for evaluating the average. Atom symbols may repeat when it is a list of (symbol, amount) pairs.
sftb (ScatteringFactorTable or str) – The ScatteringFactorTable object for looking up the values. When string use ScatteringFactorTable.createByType to create a new lookup table of the specified type.
q (float or NumPy array (optional)) – The Q value in inverse Angstroms for which to lookup the scattering factor values.
- Returns:
The calculated scattering factor averages.
- Return type:
- classmethod fromStructure(stru, sftb, q=0)[source]
Calculate average scattering factors from a structure object.
- Parameters:
stru (diffpy Structure or pyobjcryst Crystal or StructureAdapter) – The structure object that stores the atom species and their occupancies. Can be any type with a registered conversion to the StructureAdapter class.
sftb (ScatteringFactorTable or str) – The ScatteringFactorTable object for looking up the values. When string use ScatteringFactorTable.createByType to create a new lookup table of the specified type.
q (float or NumPy array (optional)) – The Q value in inverse Angstroms for which to lookup the scattering factor values.
See also
RegisterStructureAdapter
to add support for more structure types.
- Returns:
The calculated scattering factor averages.
- Return type: