Magnetic particles

This example demonstrates how to include particles with non-zero magnetization. The sample consist on magnetic spherical particles embedded in the substrate of a simple 2-layer system. The beam is polarized and the analysis focuses on the spin-flip channel.

A more detailed description of this example can be found in the Magnetic Particles Tutorial.

  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 71 72  """ Simulation demo: magnetic spheres in substrate """ import bornagain as ba from bornagain import deg, angstrom, nm # Magnetization of the particle's material (A/m) magnetization_particle = ba.kvector_t(0.0, 0.0, 1e7) def get_sample(): """ Returns a sample with magnetic spheres in the substrate. """ # defining materials particle_material = ba.HomogeneousMaterial("Particle", 2e-5, 4e-7, magnetization_particle) air_material = ba.HomogeneousMaterial("Air", 0.0, 0.0) substrate_material = ba.HomogeneousMaterial("Substrate", 7e-6, 1.8e-7) # spherical magnetic particle sphere_ff = ba.FormFactorFullSphere(5*nm) sphere = ba.Particle(particle_material, sphere_ff) position = ba.kvector_t(0.0, 0.0, -10.0*nm) particle_layout = ba.ParticleLayout() particle_layout.addParticle(sphere, 1.0, position) # defining layers air_layer = ba.Layer(air_material) substrate_layer = ba.Layer(substrate_material) substrate_layer.addLayout(particle_layout) # defining the multilayer multi_layer = ba.MultiLayer() multi_layer.addLayer(air_layer) multi_layer.addLayer(substrate_layer) return multi_layer def get_simulation(): """ Returns a GISAXS simulation with beam and detector defined """ simulation = ba.GISASSimulation() simulation.setDetectorParameters(200, -3.0*deg, 3.0*deg, 200, 0.0*deg, 6.0*deg) simulation.setBeamParameters(1.*angstrom, 0.5*deg, 0.0*deg) simulation.setBeamIntensity(1e12) analyzer_dir = ba.kvector_t(0.0, 0.0, -1.0) beampol = ba.kvector_t(0.0, 0.0, 1.0) simulation.setBeamPolarization(beampol) simulation.setAnalyzerProperties(analyzer_dir, 1.0, 0.5) return simulation def run_simulation(): """ Runs simulation and returns intensity map. """ simulation = get_simulation() simulation.setSample(get_sample()) simulation.runSimulation() return simulation.result() if __name__ == '__main__': result = run_simulation() ba.plot_simulation_result(result, cmap='jet', aspect='auto') 
MagneticSpheres.py