def testSpheresCrossingInterface(self): """ Compares two simulation intended to provide identical results. Simulation #1: full sphere inserted in air layer to cross interface Simulation #2: full sphere inserted in substrate layer to cross interface Both spheres are made of same material. """ mParticle = ba.HomogeneousMaterial("Ag", 1.245e-5, 5.419e-7) sphere_radius = 10.0 sphere_shift = 4.0 # shift beneath interface in absolute units # Sphere intended for air layer and crossing interface sphere1 = ba.Particle(mParticle, ba.FormFactorFullSphere(sphere_radius)) sphere1.setPosition(0, 0, -sphere_shift) reference = self.get_result(particle_to_air=sphere1) # Sphere intended for substrate layer and crossing interface sphere2 = ba.Particle(mParticle, ba.FormFactorFullSphere(sphere_radius)) sphere2.setPosition(0, 0, -sphere_shift) data = self.get_result(particle_to_substrate=sphere2) diff = ba.RelativeDifference(data, reference) print(diff) self.assertLess(diff, 1e-10)
def testSphericalLacuneInSubstrate(self): """ Similar to previous. Truncated sphere and sphere are made of air material. From scattering point of view, both cases should look like an air lacune in substrate. """ sphere_radius = 10.0 sphere_shift = 4.0 # shift beneath interface in absolute units # Sphere truncated from top. Intended to go below interface. truncatedSphere = ba.Particle( mAmbience, ba.FormFactorTruncatedSphere(sphere_radius, sphere_radius * 2, sphere_radius * 2 - sphere_shift)) truncatedSphere.setPosition(0, 0, -sphere_shift) reference = self.get_result(truncatedSphere) # sphere crossing interface to look like truncated sphere above sphere = ba.Particle(mAmbience, ba.FormFactorFullSphere(sphere_radius)) sphere.setPosition(0, 0, -sphere_shift) data = self.get_result(sphere) diff = ba.RelativeDifference(data, reference) print(diff) self.assertLess(diff, 1e-10)
def testSphericalCupOnTopOfSubstrate(self): """ Compares two simulation intended to provide identical results. Simulation #1: truncated sphere on top of substrate. Simulation #2: spherical particle crossing the interface. Both particles are made of same material as substrate. From scattering point of view, both cases should look like a truncated sphere on top of substrate. """ sphere_radius = 10.0 sphere_shift = 4.0 # shift beneath interface in absolute units # truncated sphere on top of substrate with height 16nm truncatedSphere = ba.Particle( mSubstrate, ba.FormFactorTruncatedSphere(sphere_radius, sphere_radius * 2 - sphere_shift)) reference = self.get_result(truncatedSphere) # sphere crossing interface to look like truncated sphere above sphere = ba.Particle(mSubstrate, ba.FormFactorFullSphere(sphere_radius)) sphere.setPosition(0, 0, -sphere_shift) data = self.get_result(sphere) diff = ba.RelativeDifference(data, reference) print(diff) self.assertLess(diff, 1e-10)
def testComposition(self): """ Compares two simulation intended to provide identical results. Simulation #1: spherical particle on top of substrate Simulation #2: spherical composition on top of substrate, where top and bottom are made of same material """ # spherical particle sphere = ba.Particle(mParticle, ba.FormFactorFullSphere(sphere_radius)) reference = self.get_intensity_data(sphere) # spherical composition composition = self.get_composition(mParticle, mParticle) data = self.get_intensity_data(composition) diff = ba.getRelativeDifference(data, reference) print(diff) self.assertLess(diff, 1e-10)
def testSlicedComposition(self): """ Compares two simulation intended to provide identical results. Simulation #1: spherical particle on top of substrate Simulation #2: spherical composition on top of substrate, where top and bottom are made of same material Both particles are inserted in air layer with shift to go below interface """ shift = 3 * nm # spherical particle sphere = ba.Particle(mParticle, ba.FormFactorFullSphere(sphere_radius)) sphere.setPosition(0, 0, -shift) reference = self.get_intensity_data(sphere) # spherical composition composition = self.get_composition(mParticle, mParticle) composition.setPosition(0, 0, -shift) data = self.get_intensity_data(composition) diff = ba.getRelativeDifference(data, reference) print(diff) self.assertLess(diff, 1e-10)