Interference 1D lattice

In this example we simulate the scattering from infinite 1D repetition of rectangular patches (rectangular grating). This is done by using the interference function of a 1D lattice together with very long boxes.

• By-default, the axis of the one-dimensional lattice coincides with the $x$-axis of the reference cartesian frame, so it coinsides with the beam direction.
• Long boxes are placed along a one-dimensional lattice on top of substrate, the lattice_length parameter corresponds to the grating period.
• The size of boxes is initially chosen to form a grating which is perpendicular to the beam (long side of the box is along $y$-axis).
• Please keep in mind, that length, width, height in the FormFactorBox(length, width, height) constructor correspond to the directions in the $x,y,z$ axes, in that order, so to achieve the desired setup we use the values: length= $10$ nm, width= $10000$ nm, height= $10$ nm.
• The whole grating is rotated at the end by an angle of $45^{\circ}$ with respect to the beam axis. This is achieved by rotating both the 1D lattice and the long boxes (see lines 25 and 34).
• To avoid the problem of rapidly oscillating form factors of long boxes (see this example for more details), the simulation is performed in monte carlo integration mode.
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70  #!/usr/bin/env python3 """ Simulation of grating using very long boxes and 1D lattice. Monte-carlo integration is used to get rid of large-particle form factor oscillations. """ import bornagain as ba from bornagain import angstrom, deg, nm, nm2, kvector_t def get_sample(): """ Returns a sample with a grating on a substrate, modelled by very long boxes forming a 1D lattice with Cauchy correlations. """ # Define materials material_Particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) material_Substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) material_Vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0) # Define form factors ff = ba.FormFactorBox(10.0*nm, 10000.0*nm, 10.0*nm) # Define particles particle = ba.Particle(material_Particle, ff) particle_rotation = ba.RotationZ(45.0*deg) particle.setRotation(particle_rotation) # Define interference functions iff = ba.InterferenceFunction1DLattice(30.0*nm, 45.0*deg) iff_pdf = ba.FTDecayFunction1DCauchy(1000.0*nm) iff.setDecayFunction(iff_pdf) # Define particle layouts layout = ba.ParticleLayout() layout.addParticle(particle, 1.0) layout.setInterferenceFunction(iff) layout.setWeight(1) layout.setTotalParticleSurfaceDensity(0.01) # Define layers layer_1 = ba.Layer(material_Vacuum) layer_1.addLayout(layout) layer_2 = ba.Layer(material_Substrate) # Define sample sample = ba.MultiLayer() sample.addLayer(layer_1) sample.addLayer(layer_2) return sample def get_simulation(sample): beam = ba.Beam(1.0, 1.0*angstrom, ba.Direction(0.2*deg, 0.0*deg)) det = ba.SphericalDetector(200, -1*deg, 1*deg, 200, 0*deg, 2*deg) simulation = ba.GISASSimulation(beam, sample, det) simulation.getOptions().setMonteCarloIntegration(True, 100) if not "__no_terminal__" in globals(): simulation.setTerminalProgressMonitor() return simulation if __name__ == '__main__': import ba_plot sample = get_sample() simulation = get_simulation(sample) ba_plot.run_and_plot(simulation, intensity_min=1e-03) 
Interference1DLattice.py