In [1]:
import numpy as np
import escape as esc
esc.require('0.9.1')

from escape.utils import show
import escape.utils.mdb as mdb

Overview of Material Database Package¶

In ESCAPE there is a scattering.material module which contains factory functions for creating different types of material objects. Currently, amorphous, crystal and generic material types are supported. The generic material is used when other material types do not meet the requirements. If more specific materials are required, they will be added in future versions of ESCAPE.

The Factory functions of the material types listed above are not very convenient because they require user to define scattering length dnsity parameters with initial values. Calculation of these values from compound and mass density is straightforward but tedious. In order to simplify the input of materials and their parameters the utils.mdb package was created. In this notebook we give some examples how to use it.

The mdb is based on the periodictable package which is an optional package along with ESCAPE. You can also install it with the command

pip install periodictable

Amorphous materials¶

There are several possible scenarious:

  1. user would like to implement model using mass density as independent parameter, i.e. the parameter which will be obtained from the model fit.
  2. user would like to implement model using SLD real sld0_re and SLD imaginary sld0_im independent parameters.

Let's consider the first scenario. As a material we choose deuterated polystyrene (compound: C8D8) with mass density $1.05\;g/cm^3$

In [2]:
md = esc.par("dPS density", 1.05, units="g/cm^3")
dPS = mdb.amorphous("C8D8", density=md, source=mdb.Source.NEUTRONS)
print(dPS)
Name: C8D8                	Parameters number:          1
Parameter           	Value          	+-	Error     	Units     	Fixed
dPS density         	           1.05	+-	0         	g/cm^3    	    0

There is also a shorter way to achieve the same result.

In [3]:
dPS = mdb.amorphous("C8D8", density=1.05, source=mdb.Source.NEUTRONS, density_based=True)
print(dPS)
Name: C8D8                	Parameters number:          1
Parameter           	Value          	+-	Error     	Units     	Fixed
Density C8D8        	           1.05	+-	0         	g/cm^3    	    0

In the first case density can be dependent parameter or shared with another material. In the last case the density parameter is independent and created together with material.

For the second scenario when material is defined using SLDs parameters, the following code is used:

In [4]:
dPS= mdb.amorphous("C8D8", density=1.05, source=mdb.Source.NEUTRONS) #density_based=False by default
print(dPS)
Name: C8D8                	Parameters number:          2
Parameter           	Value          	+-	Error     	Units     	Fixed
SLDRe C8D8          	         6.0066	+-	0         	x1e-06	1/A^2	    0
SLDIm C8D8          	     -5.039e-07	+-	0         	x1e-06	1/A^2	    0

By default SLDs parameters have scale=1e-6 and units=1/A^-2. You can set both arguments using sldscale and sldunits arguments as following.

In [5]:
dPS = mdb.amorphous("C8D8", density=1.05, sldscale=1e-4, sldunit="1/nm^2", source=mdb.Source.NEUTRONS)
print(dPS)
Name: C8D8                	Parameters number:          2
Parameter           	Value          	+-	Error     	Units     	Fixed
SLDRe C8D8          	         6.0066	+-	0         	x0.0001	1/nm^2	    0
SLDIm C8D8          	     -5.039e-07	+-	0         	x0.0001	1/nm^2	    0

Amorphous magnetic material¶

For the case of polarized neutrons and magnetic sample, the magnetic scattering length density has to be included in the model. User can provide it as a constant value or a parameter.

In [6]:
Fe = mdb.amorphous("Fe", density=7.874, sldscale=1e-4, sldunit="1/nm^2", sldm=5.00, source=mdb.Source.NEUTRONS)
In [7]:
print(Fe)
Name: Fe                  	Parameters number:          3
Parameter           	Value          	+-	Error     	Units     	Fixed
SLDRe Fe            	         8.0241	+-	0         	x0.0001	1/nm^2	    0
SLDIm Fe            	    -0.00060448	+-	0         	x0.0001	1/nm^2	    0
SLDMag Fe           	              5	+-	0         	x0.0001	1/nm^2	    0

In [ ]:
 
In [ ]: