@@ -756,6 +756,62 @@ instance, whereas the :meth:`openmc.Track.filter` method returns a new
756756 track_files = [f"tracks_p{rank}.h5" for rank in range(32)]
757757 openmc.Tracks.combine(track_files, "tracks.h5")
758758
759+ Collision Track File
760+ ---------------------
761+
762+ OpenMC can generate a collision track file that contains detailed collision
763+ information (position, direction, energy, deposited energy, time, weight, cell
764+ ID, material ID, universe ID, nuclide ZAID, particle type, particle delayed
765+ group and particle ID) for each particle collision depending on user-defined
766+ parameters. To invoke this feature, set the
767+ :attr: `~openmc.Settings.collision_track ` attribute as shown in this example::
768+
769+ settings.collision_track = {
770+ "max_collisions": 300,
771+ "reactions": ["(n,fission)", "(n,2n)"],
772+ "material_ids": [1,2],
773+ "nuclides": ["U238", "O16"],
774+ "cell_ids": [5, 12]
775+ }
776+
777+ In this example, collision track information is written to the
778+ collision_track.h5 file at the end of the simulation. The file contains
779+ 300 recorded collisions that occurred in materials with IDs 1 or 2, involving
780+ fission or (n,2n) reactions on the nuclides U-238 or O-16, within cells
781+ with IDs 5 and 12.
782+ The file can be read using :func: `openmc.read_collision_track_file `.
783+ The example below shows how to extract the data from the collision_track
784+ feature and displays the fields stored in the file:
785+
786+ >>> data = openmc.read_collision_track_file(' collision_track.h5' )
787+ >>> data.dtype
788+ dtype([('r', [('x', '<f8'), ('y', '<f8'), ('z', '<f8')]),
789+ ('u', [('x', '<f8'), ('y', '<f8'), ('z', '<f8')]), ('E', '<f8'),
790+ ('dE', '<f8'), ('time', '<f8'), ('wgt', '<f8'), ('event_mt', '<i4'),
791+ ('delayed_group', '<i4'), ('cell_id', '<i4'), ('nuclide_id', '<i4'),
792+ ('material_id', '<i4'), ('universe_id', '<i4'), ('n_collision', '<i4'),
793+ ('particle', '<i4'), ('parent_id', '<i8'), ('progeny_id', '<i8')])
794+
795+
796+ The full list of fields is as follows:
797+
798+ :r: Position (each direction in [cm])
799+ :u: Direction
800+ :E: Energy in [eV]
801+ :dE: Energy deposited during collision in [eV]
802+ :time: Time in [s]
803+ :wgt: Weight of the particle
804+ :event_mt: Reaction MT number
805+ :delayed_group: Delayed group of the particle
806+ :cell_id: Cell ID
807+ :nuclide_id: Nuclide ID (10000×Z + 10×A + M)
808+ :material_id: Material ID
809+ :universe_id: Universe ID
810+ :n_collision: Number of collision suffered by the particle
811+ :particle: Particle type
812+ :parent_id: Source particle ID
813+ :progeny_id: Progeny ID
814+
759815-----------------------
760816Restarting a Simulation
761817-----------------------
0 commit comments