Tutorial on adding phantom to pre-written MCNP program
Introduction
In radiation therapy simulations, one of the key challenges is accurately positioning human phantoms relative to the accelerator geometry. Existing MCNP programs are often complex, and integrating a phantom requires careful adherence to specific principles.
This tutorial will show you how to:
-
Add a MIRD phantom to an existing MCNP program
-
Avoid numbering conflicts between cells and surfaces
-
Apply complex geometric transformations
-
Optimize the program for dosimetric calculations
Table Of Content
1️⃣ Problem Statement
In radiation and imaging modeling using MCNP, it is often necessary to add a human phantom (e.g., MIRD) to a predefined geometry—such as a clinical linear accelerator. While this may seem straightforward, it presents several challenges that require precise geometry handling and card management.
2️⃣ Geometric Challenges in MCNP
-
Cell and Surface Number Conflicts: MCNP programs typically contain hundreds of cards. Adding a phantom without renumbering leads to geometry errors.
-
Merging Independent Geometries: Phantom and accelerator geometries are usually designed separately. Combining them requires precise alignment and transformation vectors.
-
Phantom Positioning: Depending on the study goal (e.g., dose analysis in the abdomen or head), the phantom must be placed in various spatial configurations.
3️⃣ Principles of Phantom Integration
To successfully add a phantom to an existing geometry, follow these steps:
-
Renumber all phantom cells and surfaces using a suitable offset
-
Use U and Fill cards to define repeatable geometry units
-
Define rotation and translation vectors using MATLAB or similar tools
-
Check for geometry conflicts using Plot cards or Visual Editor
4️⃣ Implementation Steps
4.1 Renumbering Cells and Surfaces
Use MATLAB or Python scripts to increment phantom cell and surface numbers by a fixed offset (e.g., +1000) to avoid conflicts with the main geometry.
4.2 Using U and Fill Cards
-
The U card defines a reusable geometry unit (e.g., the phantom).
-
The Fill card places that unit at the desired location within the main geometry.
-
This method allows multiple phantom placements in different positions.
4.3 Defining Rotation Vectors with MATLAB
To rotate or translate the phantom, calculate the rotation matrix. MATLAB can be used to generate TRCL cards or equivalent vector definitions. Example:
% Define a 90-degree rotation around the Z-axis
theta = pi/2;
Rz = [cos(theta) -sin(theta) 0;
sin(theta) cos(theta) 0;
0 0 1];
5️⃣ Key Tips for Writing MCNP Code
-
Use clear comments to explain each section
-
Prefix new cards (e.g., MIRD_) for easy identification
-
Use Plot cards to verify final geometry
-
If new sources are added, configure the SDEF card correctly
6️⃣ Resources and Downloadable Files
All required files are available for download, including:
-
MIRD phantom geometry
-
MCNP file for the Clinical Accelerator 2100
-
MATLAB scripts for rotation and renumbering