Skip to content

Beam read_from_file also reads spin #1172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: development
Choose a base branch
from

Conversation

MaxThevenet
Copy link
Member

@MaxThevenet MaxThevenet commented Oct 7, 2024

As reported by @pots007, when reading a beam from file the spin data is currently ignored. This PR proposes to fix this. The behavior is determined by the user: if do_spin_tracking is specified, the corresponding runtime components are allocated and read from file. Otherwise, they are neither allocated nor read.

@MaxThevenet MaxThevenet changed the title [WIP] Beam read_from_file also reads beam [WIP] Beam read_from_file also reads spin Oct 7, 2024
@MaxThevenet MaxThevenet changed the title [WIP] Beam read_from_file also reads spin Beam read_from_file also reads spin Oct 7, 2024
@AlexanderSinn AlexanderSinn added the component: beam About the beam species label Oct 14, 2024
@MaxThevenet
Copy link
Member Author

Thanks for the review, some tests are on the way, I'll merge once we have confirmation that it works as expected.

@MaxThevenet MaxThevenet changed the title Beam read_from_file also reads spin [WIP] Beam read_from_file also reads spin Feb 14, 2025
@AlexanderSinn
Copy link
Member

Restart test
image

@MaxThevenet
Copy link
Member Author

Looks great! was this on GPU? If not, do you know why there is a tiny difference, don't we expect them to be equal to machine precision?

@AlexanderSinn
Copy link
Member

Unfortunately, there are tiny differences even on CPU. I added some oscillations in x to the witness so the spin has a signal. Without that, the spin is very constant, and both cases are within 1e-6, but with the autoscale plot the restart looks different. One possible reason for this could be that the momentum is multiplied with the speed of light and its inverse.

@pots007
Copy link

pots007 commented Feb 27, 2025

Hey!
I tested this WIP fix and there are still some differences. The scripts I used are attached: I restart after 2.5m propagation and run for another 5. The plot below is from the restart point: beam parameters start from exactly values, however, for spin there is a small offset.
Handover

Scripts:
halhf_spin_test.zip

I also ran a total of 6 stages (disclaimer: I ran stage 1 with randomised spins, but this should not make any difference). The differences end up getting bigger and bigger:
Screenshot 2025-02-27 at 13 40 24

Could you check if there's still any reason why the spins would be initialised different from what was read in?
Cheers,
Kris

@AlexanderSinn
Copy link
Member

@pots007 indeed, there was an indexing issue of the spin when reading the beam from a file, related to the per slice sorting that is done.

@pots007
Copy link

pots007 commented Mar 7, 2025

Same crappy plot as above from the handover. Seems this has really done the trick, the spin tracks are now identically the same. I will run the longer test case I had.
Screenshot 2025-03-07 at 14 52 46

@MaxThevenet
Copy link
Member Author

MaxThevenet commented Mar 7, 2025

Cool, thanks @AlexanderSinn! Hm it seems from these plots (also the previous ones) that the rest of the handshake may have a hiccup? A comparison between w/ and w/o restart would be helpful indeed.

@MaxThevenet MaxThevenet changed the title [WIP] Beam read_from_file also reads spin Beam read_from_file also reads spin Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: beam About the beam species
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants