SHIELD-HIT12A
SHIELD-HIT12A is the primary and most complete engine in the YAPTIDE converter. It produces four fixed-width text files that control particle transport simulation.
Output Files
Section titled “Output Files”| File | Purpose | Config Class |
|---|---|---|
beam.dat | Beam parameters | BeamConfig |
mat.dat | Material definitions | GeoMatConfig (shared) |
geo.dat | Geometry description | GeoMatConfig (shared) |
detect.dat | Scoring detectors | DetectConfig |
File Formats
Section titled “File Formats”beam.dat
Section titled “beam.dat”Defines the particle source:
RNDSEED 89736501 0JPART0 2TMAX0 150.00000 0.00NSTAT 10000 0STRAGG 2MSCAT 2NUCRE 1Key parameters:
| Keyword | Description |
|---|---|
RNDSEED | Random number seed |
JPART0 | Particle type (1=H, 2=He, 6=C, 25=proton, etc.) |
TMAX0 | Beam energy in MeV (or MeV/nucl for ions) |
NSTAT | Number of primary particles |
STRAGG | Energy straggling model |
MSCAT | Multiple scattering model |
NUCRE | Nuclear reactions toggle |
The converter handles the energy unit conversion between MeV (editor) and MeV/nucleon (SHIELD-HIT12A) automatically via convert_beam_energy().
geo.dat
Section titled “geo.dat”Uses a zone-based CSG geometry format:
0 0 Proton pencil beam in water 0 1 geometry for simple simulations RCC 1 0.000 0.000 0.000 0.000 0.000 20.000 5.000 RCC 2 0.000 0.000 -1.000 0.000 0.000 22.000 6.000 END 001 +1 002 +2 -1 END 1 1 1 2 1000The file has three sections:
- Figures — geometric primitives (
RCC= cylinder,RPP= box,SPH= sphere) - Zones — boolean CSG expressions using figure IDs (
+N= inside,-N= outside) - Medium assignments — zone-to-material mapping
The converter auto-generates a black-hole boundary zone that surrounds the entire geometry, filled with vacuum (material 1000).
mat.dat
Section titled “mat.dat”Defines materials using ICRU numbers or custom element compositions:
MEDIUM 1ICRU 276ENDFor custom materials, the converter writes element-by-element composition with density.
detect.dat
Section titled “detect.dat”Defines scoring meshes and quantities:
Geometry Cyl 0.000 0.000 0.000 CYL 200.000 200.000 0.000 1.000 1.000 400.000 1 1 400 DOSE APTS Detector0Detector types supported:
| Type | Keyword | Description |
|---|---|---|
| Mesh | MSH | Cartesian grid |
| Cylinder | CYL | Cylindrical mesh (r, θ, z) |
| Zone | ZONE | Score in a named geometric zone |
Scored quantities:
| Keyword | Quantity |
|---|---|
DOSE | Absorbed dose |
FLUENCE | Particle fluence |
LETFLU | Fluence-weighted LET |
DLETFLU | Dose-weighted LET (via fluence) |
TLETFLU | Track-averaged LET |
SPC | Energy spectrum |
APTS | Average point of the track scored |
Parser Internals
Section titled “Parser Internals”Module Structure
Section titled “Module Structure”shieldhit/├── __init__.py├── parser.py # ShieldhitParser orchestration├── beam.py # BeamConfig dataclass + rendering├── geo.py # GeoMatConfig — figures, zones, materials├── detect.py # DetectConfig — detectors + scoring└── ...Parsing Flow
Section titled “Parsing Flow”class ShieldhitParser(Parser): def parse_configs(self, json_data): self.beam_config = BeamConfig() self.beam_config.parse(json_data)
self.geo_mat_config = GeoMatConfig() self.geo_mat_config.parse(json_data)
self.detect_config = DetectConfig() self.detect_config.parse(json_data)Each config class follows the same pattern:
- Extract relevant JSON keys
- Validate required fields
- Convert editor units to SHIELD-HIT12A units
- Populate a fixed-width formatted string
Fixed-Width Formatting
Section titled “Fixed-Width Formatting”SHIELD-HIT12A input files use Fortran-style fixed-width columns. The converter uses format_float() from converter/common.py:
from converter.common import format_float
format_float(5.0, 10) # " 5.00000" — 10 chars, right-alignedformat_float(0.001, 10) # " 0.00100"This ensures correct alignment expected by the SHIELD-HIT12A parser.
Zone Construction
Section titled “Zone Construction”The converter transforms the editor’s figure + zone model into SHIELD-HIT12A’s CSG syntax:
- Each figure becomes a named primitive (RCC, RPP, SPH)
- Each zone becomes a boolean expression:
+N(inside figure N),-N(outside figure N) - A surrounding black-hole zone is auto-generated using
SolidFigure.expand() - Zone numbering and material assignment are serialized in the final section
Common Issues
Section titled “Common Issues”| Problem | Cause | Fix |
|---|---|---|
| Overlapping zones | Zone definitions in JSON share the same figure without subtraction | Ensure zones correctly subtract each other in the editor |
| Missing black-hole boundary | World zone not generated | Check that expand() covers all figures |
| Wrong energy units | MeV vs MeV/nucl mismatch | convert_beam_energy() handles this; verify heavy_ion_a field |
| Truncated numbers | Value too large for column width | Adjust precision in format_float() |