nrc-cnrc / EGSnrc

Toolkit for Monte Carlo simulation of ionizing radiation — Trousse d'outils logiciels pour la simulation Monte Carlo du rayonnement ionisant
http://nrc-cnrc.github.io/EGSnrc
GNU Affero General Public License v3.0
238 stars 146 forks source link

egs_view crash for photons below 1.5 MeV #529

Open mhul opened 5 years ago

mhul commented 5 years ago

(win7, EGS_2019, MinGW 6.4)

Dear all,

I'm new to EGSnrc and have started to play around a bit. For my first project, I plan to scatter x-ray photons (in the diagnostic energy range) of a water phantom and detrmine the dose in some point at some angle. So far I've got my collimated source and my phantom inscribed in a box of air.

#DEFINE GEOMETRY
:start geometry definition:

    #Water phantom 20x20x20cm
    :start geometry:
        name = water_phantom
        library = egs_box
        box size = 20
        :start media input:
            media = H2O521ICRU
        :stop media input:
    :stop geometry:

    #Move phantom away from origin
    :start geometry:
        name        = water_phantom_trans
        library     = egs_gtransformed
        my geometry = water_phantom
        :start transformation:
            translation = 0 0 10
        :stop transformation:
    :stop geometry:

    #Outer air box
    :start geometry:
        name = surrounding_air
        library = egs_box
        box size = 100 100 201
        :start media input:
            media = AIR521ICRU
        :stop media input:
    :stop geometry:

    #Inscribe water in air
    :start geometry:
        name = water_in_air
        library = egs_genvelope
        base geometry = surrounding_air
        inscribed geometries = water_phantom_trans
    :stop geometry:

    simulation geometry = water_in_air

:stop geometry definition:

#DEFINE SOURCE
:start source definition:
    :start source:
        library = egs_collimated_source
        name = my_source
        :start source shape:
            type = point
            position = 0 0 -100
        :stop source shape:
        :start target shape:
            library   = egs_rectangle
            rectangle = -5 -5 5 5
        :stop target shape:
        distance = 100
        :start spectrum:
            type = monoenergetic
            energy = 1.5
        :stop spectrum:
        charge = 0
    :stop source:

    simulation source = my_source

:stop source definition:

#DEFINE RUN CONTROL
    :start run control:
        ncase = 10000
    :stop run control:

#DEFINE OUTPUT (AUSGAB)
:start ausgab object definition:

    # Particle tracks
    :start ausgab object:
        name = tracker
        library = egs_track_scoring
        score electrons = yes
        score positrons = yes
        score photons = yes
        stop scoring = 512
    :stop ausgab object:

:stop ausgab object definition:

Problem starts when I want to look at the result in egs_view. It works for electrons and for high MeV photons (> 1.5 Mev works fine, at 1.4 MeV and below egs_view crash when ptracks are loaded, so far I've only tried monoenergetic).

I suspect it could have something to do with my build/make. For .cpp I only use the two rows from the first example in the "getting_started" manual:

#include "egs_advanced_application.h"
APP_MAIN (EGS_AdvancedApplication);

I've tried to use the .cpp from tutor7pp but get "Error 1" message when I run "make" and "undefined reference to 'egs_scalebc' ".

screenshot

The part of the tutor7pp.cpp code containing the egs_scale_bc references seems to be related to the paritcle tracks, correct? Could this be related to the problem? I am very thankful for any sugesstions on how to fix this issue.

Best regards, Markus

mhul commented 5 years ago

Installed a virtual box with Ubuntu/EGS and ran the code. Works fine for lower energies as well. So problem solved I guess.

// Markus

rtownson commented 5 years ago

Glad it works for you on linux, but it still fails on Windows if I understand correctly. I am going to reopen this so that I remember to take a look at the issue on Windows.

mhul commented 5 years ago

Correct, I didn't get it to work in the windows environment. I no longer believe it has to do with the make though since it works on linux (but you probably knew that from the beginning).

So the make error for tutor7pp becomes a separate problem I suppose :)

Regards,

Markus