sample.material - Material¶
Mixed block of material. |
|
Unknown composition. |
|
Empty layer (all sld = 0) |
|
A generic scatterer separates the lookup of the scattering factors from the calculation of the scattering length density. |
|
Probe proxy for materials properties. |
|
A solid block of material, described by its bulk density |
|
A solid block of material, described by its natural density |
|
A solid block of material, described by its number density |
|
A solid block of material, described by its relative density |
|
A solid block of material, described by the volume of one unit cell |
Reflectometry materials.
Materials (see Material
) have a composition and a density.
Density may not be known, either because it has not been measured or
because the measurement of the bulk value does not apply to thin films.
The density parameter can be fitted directly, or the bulk density can be
used, and a stretch parameter can be fitted.
Mixtures (see Mixture
) are a special kind of material which are
composed of individual parts in proportion. A mixture can be constructed
in a number of ways, such as by measuring proportional masses and mixing
or measuring proportional volumes and mixing. The parameter of interest
may also be the relative number of atoms of one material versus another.
The fractions of the different mixture components are fitted parameters,
with the remainder of the bulk filled by the final component.
SLDs (see SLD
) are raw scattering length density values. These
should be used if the material composition is not known. In that case,
you will need separate SLD materials for each wavelength and probe.
air (see Vacuum
) is a predefined scatterer transparent to
all probes.
Scatter (see Scatterer
) is the abstract base class from which
all scatterers are derived.
The probe cache (see ProbeCache
) stores the scattering factors
for the various materials and calls the material sld method on demand.
Because the same material can be used for multiple measurements, the
scattering factors cannot be stored with material itself, nor does it
make sense to store them with the probe. The scattering factor lookup
for the material is separate from the scattering length density
calculation so that you only need to look up the material once per fit.
The probe itself deals with all computations relating to the radiation type and energy. Unlike the normally tabulated scattering factors f’, f’’ for X-ray, there is no need to scale by probe by electron radius. In the end, sld is just the returned scattering factors times density.
- class refl1d.sample.material.BulkDensityMaterial(formula: str | Formula, density: float | Parameter | None = None, name=None, use_incoherent=False)[source]¶
Bases:
BaseMaterial
A solid block of material, described by its bulk density
- Parameters:
- densityfloat | g·cm-3
the bulk density for the material.
- density: Parameter¶
- formula: str¶
- name: str¶
- sld(probe)¶
Return the scattering length density pair (rho, irho) expected for the given scattering factors, as returned from a call to scattering_factors() for a particular probe.
- use_incoherent: bool = False¶
- class refl1d.sample.material.CellVolumeMaterial(formula: str | Formula, cell_volume: float | Parameter | None = None, density: float | None = None, natural_density: float | None = None, name=None, use_incoherent=False)[source]¶
Bases:
BaseMaterial
A solid block of material, described by the volume of one unit cell
- Parameters:
- cell_volumeÅ3
Density is mass / cell_volume
- densityfloat | g·cm-3
if specified, the bulk density for the material.
- natural_densityfloat | g·cm-3
if specified, the natural bulk density for the material.
- For example, to fit Pd by cell volume use::
>>> m = Material('Pd', fitby='cell_volume') >>> m.cell_volume.range(1, 10) Parameter(Pd cell volume) >>> print("%.2f %.2f"%(m.density.value, m.cell_volume.value)) 12.02 14.70
- cell_volume: Parameter¶
- density: Expression¶
- formula: str¶
- name: str¶
- sld(probe)¶
Return the scattering length density pair (rho, irho) expected for the given scattering factors, as returned from a call to scattering_factors() for a particular probe.
- use_incoherent: bool = False¶
- refl1d.sample.material.Material(formula: str | Formula, density: float | None = None, natural_density: float | None = None, name: str | None = None, use_incoherent: bool = False, fitby: Literal['bulk_density', 'natural_density', 'relative_density', 'number_density', 'cell_volume'] = 'bulk_density', **kw)[source]¶
- class refl1d.sample.material.Mixture(base, parts, by='volume', name=None, use_incoherent=False)[source]¶
Bases:
Scatterer
Mixed block of material.
The components of the mixture can vary relative to each other, either by mass, by volume or by number:
Mixture.bymass(base, M2, F2..., name='mixture name') Mixture.byvolume(base, M2, F2..., name='mixture name')
The materials base, M2, M3, … can be chemical formula strings including @density or from material objects. Use natural_density to change from bulk values if the formula has isotope substitutions.
The fractions F2, F3, … are percentages in [0, 100]. The implicit fraction for the base material is 100 - (F2+F3+…). The SLD is NaN then F1 < 0.
name defaults to M2.name+M3.name+…
- classmethod bymass(base, *parts, **kw)[source]¶
Returns an alloy defined by relative mass of the constituents.
Mixture.bymass(base, M2, F2, …, name=’mixture name’)
- classmethod byvolume(base, *parts, **kw)[source]¶
Returns an alloy defined by relative volume of the constituents.
Mixture.byvolume(base, M2, F2, …, name=’mixture name’)
- property density¶
Compute the density of the mixture from the density and proportion of the individual components.
- class refl1d.sample.material.NaturalDensityMaterial(formula: str | Formula, natural_density: float | Parameter | None = None, name=None, use_incoherent=False)[source]¶
Bases:
BaseMaterial
A solid block of material, described by its natural density
- Parameters:
- natural_densityfloat | g·cm-3
the natural bulk density for the material.
- density: Expression¶
- formula: str¶
- name: str¶
- natural_density: Parameter¶
- sld(probe)¶
Return the scattering length density pair (rho, irho) expected for the given scattering factors, as returned from a call to scattering_factors() for a particular probe.
- use_incoherent: bool = False¶
- class refl1d.sample.material.NumberDensityMaterial(formula: str | Formula, number_density: float | Parameter | None = None, density: float | None = None, natural_density: float | None = None, name=None, use_incoherent=False)[source]¶
Bases:
BaseMaterial
A solid block of material, described by its number density
- Parameters:
- number_density: [atoms/cm^3]
Density is number_density * molar mass / avogadro constant
- densityfloat | g·cm-3
if specified, the bulk density for the material.
- natural_densityfloat | g·cm-3
if specified, the natural bulk density for the material.
- density: Expression¶
- formula: str¶
- name: str¶
- number_density: Parameter¶
- sld(probe)¶
Return the scattering length density pair (rho, irho) expected for the given scattering factors, as returned from a call to scattering_factors() for a particular probe.
- use_incoherent: bool = False¶
- class refl1d.sample.material.ProbeCache(probe=None)[source]¶
Bases:
object
Probe proxy for materials properties.
A caching probe which only looks up scattering factors for materials which it hasn’t seen before. Note that caching is based on object id, and will fail if the material object is updated with a new atomic structure.
probe is the probe to use when looking up the scattering length density.
The scattering factors need to be retrieved each time the probe or the composition changes. This can be done either by deleting an individual material from probe (using del probe[material]) or by clearing the entire cash.
- class refl1d.sample.material.RelativeDensityMaterial(formula: str | Formula, relative_density: float | Parameter | None = None, density: float | None = None, natural_density: float | None = None, name=None, use_incoherent=False)[source]¶
Bases:
BaseMaterial
A solid block of material, described by its relative density
- Parameters:
- relative_densityunitless
Density is relative_density * formula density
- densityfloat | g·cm-3
if specified, the bulk density for the material.
- natural_densityfloat | g·cm-3
if specified, the natural bulk density for the material.
- density: Expression¶
- formula: str¶
- name: str¶
- relative_density: Parameter¶
- sld(probe)¶
Return the scattering length density pair (rho, irho) expected for the given scattering factors, as returned from a call to scattering_factors() for a particular probe.
- use_incoherent: bool = False¶
- class refl1d.sample.material.SLD(name='SLD', rho: float | Parameter = 0, irho=0)[source]¶
Bases:
Scatterer
Unknown composition.
Use this when you don’t know the composition of the sample. The absorption and scattering length density are stored directly rather than trying to guess at the composition from details about the sample.
The complex scattering potential is defined by \(\rho + j \rho_i\). Note that this differs from \(\rho + j \mu/(2 \lambda)\) more traditionally used in neutron reflectometry, and \(N r_e (f_1 + j f_2)\) traditionally used in X-ray reflectometry.
Given that \(f_1\) and \(f_2\) are always wavelength dependent for X-ray reflectometry, it will not make much sense to uses this for wavelength varying X-ray measurements. Similarly, some isotopes, particularly rare earths, show wavelength dependence for neutrons, and so time-of-flight measurements should not be fit with a fixed SLD scatterer.
- irho: Parameter¶
- name: str¶
- rho: Parameter¶
- class refl1d.sample.material.Scatterer[source]¶
Bases:
object
A generic scatterer separates the lookup of the scattering factors from the calculation of the scattering length density. This allows programs to fit density and alloy composition more efficiently.