Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Particle Emission in SPRRZnrc Using IAEA Phase Space Files #1253

Open
3 tasks
yamane89 opened this issue Feb 14, 2025 · 7 comments
Open
3 tasks
Labels

Comments

@yamane89
Copy link

Hello,
I conducted a simulation of stopping-power ratio (SPR) using SPRRZnrc with the Varian_9MeV phase space file downloaded from IAEA. However, the results differed significantly from the SPR calculated manually. Upon investigation, I found that when using an IAEA-format phase space file as the source in SPRRZnrc, even if the particle type is set to "all," only photons are being emitted.

To verify this, I used Beamnrc with the same settings and generated two types of phase space files: one in egsphsp1 format and the other in IAEA format (IAEAphsp). Then, I performed the same calculations using SPRRZnrc with these two phase space files.
To use EGS_window, I set IWATCH to "graph" and set the source particle type to "all."
(Since setting IWATCH to "graph" in SPRRZnrc does not generate a .egsgeom file, I created my own .egsgeom file.)

The images are as follows:
① IAEAphsp
② IAEAphsp with photons hidden in EGS_window
③ egsphsp1
④ egsphsp1 with photons hidden in EGS_window

Color representation in the images:

Yellow: Photons
Blue: Electrons
Red: Positrons
The beam is incident from right to left.

Do you have any solutions for this issue?

Additionally, I have encountered frequent errors when using IAEA-format phase space files.
Is there a way to convert an IAEA-format phase space file to egsphsp1 format?

Thank you!

Image

Image

Image

Image

Operating system

  • [*] Linux
  • Windows
  • macOS
  • Other:

EGSnrc version
2025ver

@yamane89 yamane89 added the bug label Feb 14, 2025
@rtownson
Copy link
Collaborator

The first place to check is in the .IAEAheader file. Are there any electrons saved in the file, and they're just not being read? There should be a section in the header that tells you how many particles of each type there are.

Take a look in the output from the SPRRZnrc simulation, and see if you can find where it prints out information about the phase-space. Does it say that it's reading all types of particles from the file (I don't recall off hand if it prints this, you can copy/paste the output here if you like).

@yamane89
Copy link
Author

yamane89 commented Feb 18, 2025

Thank you very much.
Below is the IAEA header file. The phase space file I used is the Varian_9MeV_10*10 provided by the IAEA.
https://www-nds.iaea.org/phsp/electron1/


$IAEA_INDEX:
603 // IAEA website: www-nds.iaea.org/phsp/electron/

$TITLE:
Varian Clinac 2100CD, 9MeV, 10x10

$FILE_TYPE:
0

$CHECKSUM:
2147483647

$RECORD_CONTENTS:
1 // X is stored ?
1 // Y is stored ?
1 // Z is stored ?
1 // U is stored ?
1 // V is stored ?
1 // W is stored ?
1 // Weight is stored ?
0 // Extra floats stored ?
2 // Extra longs stored ?
1 // Incremental history number stored in the extralong array [ 0]
3 // ILB PENELOPE variable stored in the extralong array [ 1]

$RECORD_CONSTANT:

$RECORD_LENGTH:
37

$BYTE_ORDER:
1234

$ORIG_HISTORIES:
415667127

$PARTICLES:
56197810

$PHOTONS:
24189154

$ELECTRONS:
31999608

$POSITRONS:
9048

$TRANSPORT_PARAMETERS:
C1 = C2 = 0.1
WCC = 100 keV and WCR = 20 keV

$MACHINE_TYPE:
VARIAN CLINAC 2100 C/D

$MONTE_CARLO_CODE_VERSION:
PENELOPE 2008
penEasyLinac 2009-12-01
penEasy 2009-11-04

$GLOBAL_PHOTON_ENERGY_CUTOFF:
20 keV
$GLOBAL_PARTICLE_ENERGY_CUTOFF:
100 keV
$COORDINATE_SYSTEM_DESCRIPTION:
Cartesian right-handed
Origin: z = 0, upstream face of the target, x = y = 0 central position of the target
z axis parallel to beam direction, pointing downstream
y along the direction of movement of the upper jaws, pointing towards the accesory holder when seen from its aperture
x axis along the direction of movement of the lower jaws

// OPTIONAL INFORMATION

$BEAM_NAME:
9 MeV ELECTRON BEAM

$FIELD_SIZE:
10X10 cm2

$NOMINAL_SSD:
100 cm

$MC_INPUT_FILENAME:

$VARIANCE_REDUCTION_TECHNIQUES:
Movable skins applied to the primary collimator and the jaws
Rotational splitting applied on a plane located below the ionisation chamber and above the secondary collimator

$INITIAL_SOURCE_DESCRIPTION:
Electron point source at x = y = z = 0
Monodirectional beam vx = vy = 0, vz = 1
Monoenergetic, E = 10.21 MeV

$PUBLISHED_REFERENCE:
L Brualla, R Palanco-Zamora, A Wittig, J Sempau and W Sauerwein
Comparison between PENELOPE and electron Monte Carlo simulations of electron fields used in the treatment of the conjunctival lymphoma
Phys. Med. Biol. 54 (2009) 5469-5481.
PHSP available online at http://www-nds.iaea.org/phsp/, IAEA, Vienna

$AUTHORS:
L. Brualla, R. Palanco-Zamora, MA. Duch, J. Sempau

$INSTITUTION:
Universit�tsklinikum Essen (Germany), Karolinska University Hospital (Sweden), Universitat Politecnica de Catalunya (Spain)

$LINK_VALIDATION:
VarianClinac_2100CD-readme.PDF. Available online at http://www-nds.iaea.org/phsp/electron , IAEA, Vienna

$ADDITIONAL_NOTES:
This is IAEA header as defined in the technical
report IAEA(NDS)-0484, Vienna, 2006

$STATISTICAL_INFORMATION_PARTICLES:
// Weight Wmin Wmax Emin Emax Particle
2.41892E+07 1 1 1.091 0.02 10.19 PHOTONS
3.19996E+07 1 1 8.73 0.1 9.962 ELECTRONS
9048 1 1 2.071 0.1003 8.393 POSITRONS

$STATISTICAL_INFORMATION_GEOMETRY:
-4.90659 4.90659
-4.90659 4.90659
78.45 78.5

@yamane89
Copy link
Author

The egslst file is quite long, so I will include only the source section.



                         SOURCE PARAMETERS

              Full phase space input for each incident particle. 
 Source data file: /home/yamane/Desktop/IAEAsource/Varian_Clinac_2100CD_9MeV_10x10
                    Source incident on plane        21.5500 cm from the point of rotation
                     Angle with respect to z-axis         0.0000 degrees.
                     z-position of point of rotation         0.0000
                     X offset of phsp (before rotation)        0.0000 cm
                     Y offset of phsp (before rotation)        0.0000 cm
                     # of particles read from ph-sp file =    1.000E+08.
           Total number of particles in file      :  56197810
           Total number of photons                :  24189154
           (the rest are electrons and positrons)

           Maximum kinetic energy of the particles:    10.190 MeV
           Minimum kinetic energy of the electrons:     0.000 MeV
           # particles incident when phase space created :  415667127.

Particles will be recycled 1 times before moving on to next one.

\f

                                                  Tue Feb 18 12:09:12 2025

@yamane89
Copy link
Author

yamane89 commented Feb 18, 2025

This is the input file used in the SPRRZnrc simulation.


TITLE= sprrznrc_template

##########################
:start I/O control:

IWATCH= off
STORE INITIAL RANDOM NUMBERS= no
IRESTART= first
STORE DATA ARRAYS= yes
SPR OUTPUT= slabs/cylinders
SPR IN CYLINDER IX= 1
SPR IN SLAB IZ= 0

:stop I/O control:
#########################

##########################
:start Monte Carlo inputs:

NUMBER OF HISTORIES= 100000000
INITIAL RANDOM NO. SEEDS= 1, 3
MAX CPU HOURS ALLOWED= 999
IFULL= dose and stoppers
STATISTICAL ACCURACY SOUGHT= 0.0000
PHOTON REGENERATION= no

:stop Monte Carlo inputs:
#########################

##########################
:start geometrical inputs:

METHOD OF INPUT= groups
Z OF FRONT FACE= -100
NSLAB= 1, 90, 1, 1
SLAB THICKNESS= 100, 0.1, 32, 59
RADII= 0.6, 16, 100
MEDIA= H2O521ICRU,
AIR521ICRU;

DESCRIPTION BY= planes
MEDNUM= 1, 2, 2, 2
START ZSLAB= 2, 1, 2, 93
STOP ZSLAB= 92, 1, 92, 93
START RING= 1, 1, 3, 1
STOP RING= 2, 3, 3, 3

:stop geometrical inputs:
#########################

##########################
:start source inputs:

INCIDENT PARTICLE= all
SOURCE NUMBER= 22
SOURCE OPTIONS= 0, 21.55, 0, 0, 0, 0, 0
FILSPC= /home/yamane/Desktop/IAEAsource/Varian_Clinac_2100CD_9MeV_10x10.IAEAphsp

:stop source inputs:
#########################

##########################
:start MC transport parameter:

Global ECUT= 0.521
Global PCUT= 0.01
Global SMAX= 1e10
ESTEPE= 0.25
XImax= 0.5
Skin depth for BCA= 3
Boundary crossing algorithm= EXACT
Electron-step algorithm= PRESTA-II
Spin effects= on
Brems angular sampling= KM
Brems cross sections= BH
Photon cross sections= si
Electron Impact Ionization= Off
Photon cross-sections output= off
Bound Compton scattering= Off
Pair angular sampling= Simple
Photoelectron angular sampling= On
Rayleigh scattering= Off
Atomic relaxations= On
Set PCUT= 0
Set PCUT start region= 1
Set PCUT stop region= 1
Set ECUT= 0
Set ECUT start region= 1
Set ECUT stop region= 1
Set SMAX= 0
Set SMAX start region= 1
Set SMAX stop region= 1

:stop MC transport parameter:
#########################

##########################
:start media definition:

:stop media definition:
#########################

##########################
:start variance reduction:

ELECTRON RANGE REJECTION= off
ESAVEIN= 0.0
RUSSIAN ROULETTE DEPTH= 0.0000
RUSSIAN ROULETTE FRACTION= 0.0000
EXPONENTIAL TRANSFORM C= 0.0000
PHOTON FORCING= off
START FORCING= 1
STOP FORCING AFTER= 1

:stop variance reduction:
#########################

@yamane89
Copy link
Author

It seems that electrons might not be irradiated in this simulation.
Could you please let me know if you have any suggestions or solutions for this issue?

rtownson added a commit that referenced this issue Feb 18, 2025
Fix missing initialization of variables for IAEA phase-spaces in the RZ
codes. While this didn't result in a crash, it did result in a bug where
all particles were assigned a charge of 0 during the transport.
rtownson added a commit that referenced this issue Feb 18, 2025
Fix missing initialization of variables for IAEA phase-spaces in the RZ
codes. While this didn't result in a crash, it did result in a bug where
all particles were assigned a charge of 0 during the transport.
@rtownson
Copy link
Collaborator

Please give my fix #1256 a try and let me know if it solves the issue for you. Thanks for reporting this!

@yamane89
Copy link
Author

yamane89 commented Feb 19, 2025

Thank you very much for the fix!
I ran the simulation again, and the stopping-power ratio values seem to be generally reasonable.
I really appreciate it!

rtownson added a commit that referenced this issue Feb 19, 2025
Fix missing initialization of variables for IAEA phase-spaces in the RZ
codes. While this didn't result in a crash, it did result in a bug where
all particles were assigned a charge of 0 during the transport.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants