def build(monte, chamber, origin, buildParams): p1Mat, p1Radius = buildParams["P1"] p2Mat, p2Radius = buildParams["P2"] separation = buildParams["Separation"] substrate = buildParams["Substrate"] sphere1 = nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, p1Radius]), p1Radius) monte.addSubRegion(chamber, p1Mat, sphere1) sphere2 = nm.Sphere(epu.Math2.plus(origin, [separation, 0.0, 2.0 * p1Radius - p2Radius]), p2Radius) monte.addSubRegion(chamber, p2Mat, sphere2) if substrate: monte.addSubRegion(chamber, substrate, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], epu.Math2.plus(origin, [0.0, 0.0, 2.0 * p1Radius])))
def buildSphere(monte, chamber, origin, buildParams): radius = buildParams["Radius"] subMat = buildParams["Substrate"] mat = buildParams["Material"] coating = buildParams["Coating"] thickness = buildParams["Thickness"] coatSphere = nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, radius + thickness]), radius + thickness) srC = monte.addSubRegion(chamber, coating, coatSphere) sphere = nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, radius + thickness]), radius) monte.addSubRegion(srC, mat, sphere) if subMat: monte.addSubRegion(chamber, subMat, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], epu.Math2.plus(origin, [0.0, 0.0, 2.0 * radius])))
def buildEmbeddedSphere(monte, chamber, origin, buildParams): mat = buildParams["Material"] radius = buildParams["Radius"] subMat = buildParams["Substrate"] depth = buildParams["Depth"] sr = monte.addSubRegion(chamber, subMat, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], origin)) monte.addSubRegion(sr, mat, nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, depth + radius]), radius))
def buildSphere(monte, chamber, origin, buildParams): radius = buildParams["Radius"] subMat = buildParams["Substrate"] mat = buildParams["Material"] sphere = nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, radius]), radius) monte.addSubRegion(chamber, mat, sphere) if subMat: monte.addSubRegion(chamber, subMat, nm.MultiPlaneShape.createSubstrate([0.0, 0.0, -1.0], epu.Math2.plus(origin, [0.0, 0.0, 2.0 * radius])))
def buildSphere(monte, chamber, origin, buildParams): mat = buildParams["Material"] radius = buildParams["Radius"] coating = buildParams["Coating"] cThick = buildParams["Coating Thickness"] film = buildParams["Film"] fThick = buildParams["Film Thickness"] coatSphere = nm.Sphere( epu.Math2.plus(origin, [0.0, 0.0, radius + cThick]), radius + cThick) srC = monte.addSubRegion(chamber, coating, coatSphere) sphere = nm.Sphere(epu.Math2.plus(origin, [0.0, 0.0, radius + cThick]), radius) monte.addSubRegion(srC, mat, sphere) monte.addSubRegion( chamber, film, nm.MultiPlaneShape.createFilm( [0.0, 0.0, -1.0], epu.Math2.plus(origin, [0.0, 0.0, 2.0 * radius]), fThick))
def stemCell(h2oThickness, objMat, objDiameter, objDepth, e0, beamOffset=0.0, detectorDistance=0.008, detectorRadius=0.02, detRingCount=100, nTraj=10000): """stemCell(h2oThickness, objMat, objDiameter, objDepth, e0, [beamOffset=0.0], [detectorDistance=0.008], [detectorRadius=0.02], [detRingCount=100], [nTraj=10000]): Model scattering from a spherical object embedded in a suspended water film. Example: > import dtsa2.stemCell as sc > sc.stemCell(1.0e-6, material("Au",10.0), 2.0e-7, 4.0e-7, 100.0,nTraj=1000)""" monte = nm.MonteCarloSS() monte.setBeamEnergy(epq.ToSI.keV(e0)) beam = nm.GaussianBeam(1.0e-10) beam.setCenter((beamOffset, 0.0, -0.01)) monte.setElectronGun(beam) h2o = d2.material("H2O", 1.0) h2oThickness = max(h2oThickness, objDiameter) objDepth = max(0.5 * objDiameter, min(h2oThickness - 0.5 * objDiameter, objDepth)) h2oSr = monte.addSubRegion( monte.getChamber(), h2o, nm.MultiPlaneShape.createFilm((0.0, 0.0, -1.0), (0.0, 0.0, 0.0), h2oThickness)) monte.addSubRegion(h2oSr, objMat, nm.Sphere((0.0, 0.0, objDepth), 0.5 * objDiameter)) ann = nm.AnnularDetector(detectorRadius, detRingCount, (0.0, 0.0, detectorDistance), (0.0, 0.0, -1.0)) monte.addActionListener(ann) monte.runMultipleTrajectories(nTraj) header = "Parameters:\nWater thickness\t%g nm\nSphere material\t%s\nSphere diameter\t%g nm\nSphere center depth\t%g nm\nBeam offset\t%g nm\nDetector distance\t%g mm\nDetector radius\t%g mm\nE0\t%g keV" % ( 1.0e9 * h2oThickness, objMat.descriptiveString(False), 1.0e9 * objDiameter, 1.0e9 * objDepth, 1.0e9 * beamOffset, 1.0e3 * detectorDistance, 1.0e3 * detectorRadius, e0) print header return (header, ann)