Skip to content
Snippets Groups Projects
Commit 7bc3df3c authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

CoreShellNanoparticles2: alternative implementation using ParticleComposition

parent 606fa1ba
No related branches found
No related tags found
1 merge request!1039+ alternative script to emulate core-shell particle
#!/usr/bin/env python3
"""
Core shell nanoparticles.
Alternative implementation using particle composition
"""
import bornagain as ba
from bornagain import ba_plot as bp, deg, nm, std_samples
def get_sample():
"""
Returns a sample with box-shaped core-shell particles.
"""
# Define materials
material_Diff = ba.RefractiveMaterial("Core", -4e-5, 0)
material_Shell = ba.RefractiveMaterial("Shell", 1e-4, 2e-8)
# Define form factors
ff_1 = ba.Box(12*nm, 12*nm, 7*nm)
ff_2 = ba.Box(16*nm, 16*nm, 8*nm)
# Define particles
core = ba.Particle(material_Diff, ff_1)
shell = ba.Particle(material_Shell, ff_2)
particle = ba.ParticleComposition()
particle.addParticle(shell)
particle.addParticle(core, ba.R3(0,0,0.5*nm))
return std_samples.sas_sample_with_particle(particle)
def get_simulation(sample):
beam = ba.Beam(1, 0.1*nm, ba.Direction(0.2*deg, 0))
detector = ba.SphericalDetector(bp.simargs['n'], 2*deg, 0, 1*deg)
simulation = ba.ScatteringSimulation(beam, sample, detector)
return simulation
if __name__ == '__main__':
bp.parse_args(sim_n=200)
sample = get_sample()
simulation = get_simulation(sample)
result = simulation.simulate()
bp.plot_simulation_result(result)
......@@ -138,6 +138,7 @@ test_example(scatter2d/BoxesWithSpecularPeak 2e-10)
test_example(scatter2d/BuriedParticles 2e-10)
test_example(scatter2d/ConstantBackground 2e-10)
test_example(scatter2d/CoreShellNanoparticles 2e-10)
test_equality(scatter2d/CoreShellNanoparticles2 scatter2d/CoreShellNanoparticles 2e-10)
test_example(scatter2d/CorrelatedRoughness 2e-10)
test_example(scatter2d/CosineRipplesAtRectLattice 2e-10)
test_example(scatter2d/CustomFormFactor 2e-10)
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment