Skip to content

Conversation

@cemitch99
Copy link
Member

@cemitch99 cemitch99 commented Nov 21, 2025

The PR add the basic spin data structure and initialization. It is needed by PR#1219.

  • add spin data structure(s) to particle container
  • add initialization of spin data
  • add user-facing inputs for spin tracking
  • P to kappa: root finding
  • Python: expose SpinvMF class
  • Python: update pyAMReX particle class (ImpactX: +3 Real Components AMReX-Codes/pyamrex#518) OR make spin vector a runtime component in ImpactX (that would be best)
  • add benchmark test of spin sampling
  • add app docs
  • add Python docs
  • Restart of spin in Source element

Used a von Mises-Fisher distribution for spin initialization. This supports an unpolarized beam as a special case.

See also here.

Follow-up:

  • Add a simple binary (Bernoulli) distribution as a second option.

@cemitch99
Copy link
Member Author

The failing tests are expected, because initialization has not been implemented yet. (That is, the call to AddNParticles in InitDistribution.cpp needs to be updated, TODO.)

@cemitch99 cemitch99 requested a review from ax3l November 21, 2025 17:46
@ax3l ax3l force-pushed the add_spin_container branch from e4222c4 to 7608fb3 Compare November 26, 2025 00:32
@cemitch99
Copy link
Member Author

Status and notes:

  1. This builds and compiles locally on a Mac with OpenMP.
  2. The function for sampling the distribution in SpinvMF appears to work correctly - this was checked by printing data (sx,sy,sz) directly from within SpinvMF.H.
  3. The use of optional arguments in the call to AddNParticles within InitDistribution.cpp needs to be clarified. This causes a problem with initialization of the spin data based on the output from 2.
  4. The installation of the Python bindings does not yet work and needs to be fixed.
  5. On GPU there is an error triggered by line 406 of InitDistribution.cpp (as evidenced by the above tests).

@ax3l
Copy link
Member

ax3l commented Nov 26, 2025

@cemitch99 thanks, I'll take a look!

ax3l and others added 6 commits November 26, 2025 14:50
Update after 25.12 releases to development branch, once
PR is merged
AMReX-Codes/pyamrex#518
Just some readability, already fixed in prior commit
Update after 25.12 releases to development branch, once
PR is merged
AMReX-Codes/pyamrex#518
@cemitch99
Copy link
Member Author

cemitch99 commented Dec 4, 2025

Updated status:

A CI test has been added. This PR builds and compiles locally on a Mac with OpenMP, and the test passes. Local test:

The following tests FAILED:
1 - pytest.AMReX (Failed)
34 - chicane.analysis (Failed)
165 - FODO.tune.py.analysis (Failed)
175 - chicane_csr.analysis (Failed)
208 - chicane_isr.analysis (Failed)
222 - pytest.ImpactX (SEGFAULT)

@ax3l

This comment was marked as resolved.

ax3l added 3 commits December 15, 2025 17:36
Same work-around for NVCC as for phase space init.
ax3l added a commit to AMReX-Codes/pyamrex that referenced this pull request Dec 16, 2025
For Spin tracking, maybe.
(We might better use runtime components.)

See BLAST-ImpactX/impactx#1226
@ax3l ax3l self-assigned this Dec 16, 2025
@ax3l ax3l changed the title Add spin to particle container. Add Spin to Particle Container Dec 16, 2025
@ax3l ax3l enabled auto-merge (squash) December 16, 2025 16:52
@ax3l
Copy link
Member

ax3l commented Dec 16, 2025

I think the NVCC runner has some issues... Not sure why it aborts.

ax3l added 2 commits December 16, 2025 18:14
Aborts close to the end of the build process. Probably
a resource limit hit on the runners.
@ax3l ax3l merged commit a2f53c5 into BLAST-ImpactX:development Dec 16, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants