def runSimulation(): # defining materials mAmbience = ba.HomogeneousMaterial("Air", 0.0, 0.0) mSubstrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8) magnetic_field = ba.kvector_t(0, 0, 0) magParticle = ba.HomogeneousMaterial("magParticle", 6e-4, 2e-8, magnetic_field) # collection of particles cylinder_ff = ba.FormFactorCylinder(5 * nanometer, 5 * nanometer) cylinder = ba.Particle(magParticle, cylinder_ff) particle_layout = ba.ParticleLayout() particle_layout.addParticle(cylinder, 1.0) interference = ba.InterferenceFunctionNone() particle_layout.setInterferenceFunction(interference) # air layer with particles and substrate form multi layer air_layer = ba.Layer(mAmbience) air_layer.addLayout(particle_layout) substrate_layer = ba.Layer(mSubstrate, 0) multi_layer = ba.MultiLayer() multi_layer.addLayer(air_layer) multi_layer.addLayer(substrate_layer) # build and run experiment simulation = ba.GISASSimulation() simulation.setDetectorParameters(100, 0 * degree, 2.0 * degree, 100, 0.0 * degree, 2.0 * degree) simulation.setBeamParameters(1.0 * angstrom, 0.2 * degree, 0.0 * degree) simulation.setSample(multi_layer) simulation.runSimulation() ## intensity data return simulation.getIntensityData()
def get_sample(self, particle): mAmbience = ba.HomogeneousMaterial("Air", 0.0, 0.0) mMiddle= ba.HomogeneousMaterial("Teflon", 2.900e-6, 6.019e-9) mSubstrate = ba.HomogeneousMaterial("Substrate", 3.212e-6, 3.244e-8) layout = ba.ParticleLayout() layout.addParticle(particle) air_layer = ba.Layer(mAmbience) middle_layer = ba.Layer(mMiddle, layer_thickness) middle_layer.addLayout(layout) substrate = ba.Layer(mSubstrate) multi_layer = ba.MultiLayer() multi_layer.addLayer(air_layer) multi_layer.addLayer(middle_layer) multi_layer.addLayer(substrate) return multi_layer
def get_sample(self, particle_to_air=None, particle_to_substrate=None): """ Helper function returning a multilayer (air, substrate) using particles provided by the user. """ air_layer = ba.Layer(mAmbience) if particle_to_air: layout = ba.ParticleLayout() layout.addParticle(particle_to_air) air_layer.addLayout(layout) substrate = ba.Layer(mSubstrate) if particle_to_substrate: layout = ba.ParticleLayout() layout.addParticle(particle_to_substrate) substrate.addLayout(layout) multi_layer = ba.MultiLayer() multi_layer.addLayer(air_layer) multi_layer.addLayer(substrate) return multi_layer