|Message: Re: Can't change Physics of G4VModularPhysicsList after first run||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
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