SolidStateDetectors.jl
SolidStateDetectors.jl copied to clipboard
Allow for contact_id to be any Int
This should solve issue #288
Thank you. I saw that also changes in the I/O. Will this change allow to read in saved simulations (so no changes for the user)?
And what happens if two contacts have the same ID in the config file?
Can you add tests where the contact IDs are not in order? And maybe also a case in which two contacts have the same ID and running the code fails.
Thank you. I saw that also changes in the I/O. Will this change allow to read in saved simulations (so no changes for the user)?
Partly yes. Before, the different weighting potentials were initialized inside a list, while now that is being done in a dictionary, so now changes for the user in the rea-in of a config file. At least not ones, that I can think of now. What changes is the final struct. Meaning, if the user wants to access sim.weighting potentials a dict will be returned instead of a list.
And what happens if two contacts have the same ID in the config file?
No error is thrown right now, when reading in a config file with two contacts of id: 1 and using simulate()
julia> sim = Simulation{Float32}("Software/SolidStateDetectors.jl/examples/example_config_files/contact_id_same_id.yaml")
julia> simulate!(sim)
Simulation{Float32, Cartesian} - Coordinate system: Cartesian
Environment Material: High Purity Germanium
Detector: Contact ID test file
Electric potential: (58, 34, 34)
Charge density: (58, 34, 34)
Impurity scale: (58, 34, 34)
Fix Charge density: (58, 34, 34)
Dielectric distribution: (59, 35, 35)
Point types: (58, 34, 34)
Electric field: (58, 34, 34)
Weighting potentials:
Contact 1: (14, 12, 12)
Contact 1: (14, 12, 12)
But when accessing the weighting potentials directly, only one is shown
julia> sim.weighting_potentials
OrderedCollections.OrderedDict{Int64, Union{Missing, WeightingPotential}} with 1 entry:
1 => [0.999674 0.999675 … 0.999684 0.999682; 0.999672 0.999676 … 0.999684 0.999681; … ; 0.999682 0.999686 … 0.999696 0.999692; 0.999684 0.999687 ……
How do we want to handle that case? We can throw an error if there is ambiguity in the contact ids. Another option is changing the ambigous contact id internally, maybe by adding one to the id or multiplying by 10.
I get an error in
sim = Simulation(SSD_examples[:ContactIDTest])
simulate!(sim)
calculate_capacitance_matrix(sim)
Also,
sim = Simulation(SSD_examples[:ContactIDTest])
simulate!(sim)
calculate_weighting_potential!(sim, 4)
does actually calculate some field and stores it into the dict. This should throw an error.
And what happens if two contacts have the same ID in the config file?
How do we want to handle that case? We can throw an error if there is ambiguity in the contact ids. Another option is changing the ambigous contact id internally, maybe by adding one to the id or multiplying by 10.
No, we should throw an error in the construction of the SolidStateDetector
.
sim = Simulation(SSD_examples[:ContactIDTest]) simulate!(sim) calculate_weighting_potential!(sim, 4)
All calls of this function already use contact.id
calculate_weighting_potential!(sim, 4)
But there is no contact with id == 4
. That's the issue.