Page 1 of 1

change charge in the elegant runfile

Posted: 27 Nov 2013, 11:27
by jzemella
Hi,

I like to track particle disrtibutions with different charges.
I know the way to change the charge in my lattice file (.lte).
But I like to have one lattice file (.lte) and change everything else in the run definition file (.ele).

Is there a way to do this?

Cheers, Johann

Re: change charge in the elegant runfile

Posted: 27 Nov 2013, 11:58
by michael_borland
Johann,

You can use the vary_elements command. Suppose your CHARGE element is called Q:

Code: Select all

&run_setup
...
&end

&run_control
n_indices = 1
&end

&vary_element
name=Q, item=TOTAL, initial=0, final=1e-9, index_number=0, index_limit=11 
&end

! Insertion beam definition (bunched_beam or sdds_beam)

&track &end

This would vary the TOTAL field of element Q from 0 to 1e-9, taking on 11 values.

Another method is using the &alter_elements command and a commandline macro. E.g.,

Code: Select all

...
&run_setup
 ...
 rootname = <rootname>
&end

&alter_elements name=Q, item=TOTAL, value=<charge> &end
...
This would then be executed with a command such as

Code: Select all

% elegant template.ele -macro=rootname=run-1000,charge=1e-9
% elegant template.ele -macro=rootname=run-100,charge=1e-10
If you have a batch system, you can make a loop and submit the different jobs to different nodes.

--Michael

Re: change charge in the elegant runfile

Posted: 28 Nov 2013, 03:25
by jzemella
I 've tried it but I did something wrong :-(
Now it works thanks

JOhann