Message: Re: Can't change Physics of G4VModularPhysicsList after first run Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: Can't change Physics of G4VModularPhysicsList after first run 

Forum: Physics List
Re: Question Can't change Physics of G4VModularPhysicsList after first run (Daniel Brandt)
Date: 01 Oct, 2014
From: Michael H. Kelsey <Michael H. Kelsey>

On Tue, 30 Sep 2014 20:50:25 GMT, Daniel Brandt wrote:
> I am trying to use a G4VModularPhysicsList together with physics
> constructors to allow my users a choice of physics list without having
> to restart the software. Selecting the desired physics list for the
> first time works great, however once the simulation has run all attempts
> at changing the physics list have no effect.

Hi, Daniel. Unfortunately, you _cannot_ change physics lists once /run/initialize has been completed. All you can do is activate or de-activate the processes within the chosen physics list. Take a look at the EM stuff and Optical physics for examples of how this is done.

For what you want to do, it would be possible in principle to write code that goes through and removes all the registered processes from all particles, cleans out the contents of the hadronic process and model registries, and then deletes the old physics list instance, before creating and initializing a new one. The trouble is that this would be very invasive into memory, and is likely to have problems in a multithreaded environment (where each thread has its own copy of the physics list).

Having said that, I'm not sure it's necessary what you need. Let your users choose the physics list at start time. Some examples use the PHYSLIST environment variable, or you can have a macro command which only works in the PreInit state (i.e., before /run/initialize). Once a job has started, users could turn off different physics processes within the list.

  -- Michael Kelsey

 Add Message Add Message
to: "Re: Can't change Physics of G4VModularPhysicsList after first run"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]