Using Random Multipoles with Trajectory Correction

Moderators: cyao, michael_borland

Post Reply
foshea
Posts: 34
Joined: 23 Jun 2009, 21:00

Using Random Multipoles with Trajectory Correction

Post by foshea » 30 Jun 2021, 12:34

I'm not sure what to call this, bug or working as intended, but it appears that adding random multipoles to the elements that allow it (CCBEND,KQUAD, etc) doesn't play well with trajectory correction. I've created a minimum functioning examples of the issue and attached it. The example is based on staticPlusDynamicErrors, which I found in my elegant examples directory. I added a CCBEND to the lattice, and then used &alter_elements to include random multipoles when adding static errors to the lattice, and then turn off the dynamic errors.

When I comment out the &alter_elements line, I find that the centroid trajectory during the second run matches the trajectory reported by &correct during the first run:
WithoutErrors.png
When I leave the &alter_elements list in, the two trajectories are different:
WithErrors.png
When I look through the run1-131231119.param file, I see that the random multipoles added to the CCBEND aren't recorded anywhere. So of course the two lattices will be different. From this reply it appears that those multipoles errors aren't available anywhere at all, so I can't load them into the dynamic runs.

I guess this is a feature request to get those multipoles added to the parameter or error log file. But really, I just wanted to report behavior I didn't expect in case it helps out future readers.
Attachments
trajectory_random_multipoles.tar.gz
(1.17 KiB) Downloaded 101 times

michael_borland
Posts: 1796
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Using Random Multipoles with Trajectory Correction

Post by michael_borland » 15 Jul 2021, 14:07

The problem is that your random number seeds change between the two parts of the run

Code: Select all

! this run sets the static errors and corrects them.

&run_setup
        lattice = fodo.lte
        use_beamline = xport,
        p_central_mev = 100
        rootname = run1-<seed>,
        magnets = %s.mag
        parameters = %s.param
        random_number_seed = <seed>
&end

...

&run_setup
        lattice = fodo.lte
	use_beamline = xport,
        p_central_mev = 100
        rootname = run2-<seed>,
        centroid = %s.cen
        magnets = %s.mag
	parameters = %s.param
        final = %s.fin,
	random_number_seed = "(<seed> 2 +)",
&end
That causes different random multipole instances to be generated in the two stages of the run. If you use

Code: Select all

random_number_seed = <seed>
in both cases, you should get the same results for the trajectory.

--Michael

Post Reply