Skip to content

Commit

Permalink
Bugfix of previous bugfix (v0.2.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
freddieknets committed Aug 16, 2023
1 parent 9d2543a commit 23ecb01
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions xcoll/scattering_routines/everest/scatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,20 @@ void scatter(LocalParticle* part, double length, MaterialData material, RandomRu
y_out = z*cRRot - x*sRRot;
xp_out = xp*cRRot + zp*sRRot;
yp_out = zp*cRRot - xp*sRRot;

LocalParticle_set_x(part, x_out);
LocalParticle_set_px(part, xp_out/rpp_in);
LocalParticle_set_y(part, y_out);
LocalParticle_set_py(part, yp_out/rpp_in);

if (val_part_abs==0){
LocalParticle_add_to_s(part, length);
}

} else {
Drift_single_particle_4d(part, length);
}

LocalParticle_set_x(part, x_out);
LocalParticle_set_px(part, xp_out/rpp_in);
LocalParticle_set_y(part, y_out);
LocalParticle_set_py(part, yp_out/rpp_in);

double energy_out = p_out; // Cannot assign energy directly to LocalParticle as it would update dependent variables, but needs to be corrected first!

// Update energy ---------------------------------------------------
Expand Down Expand Up @@ -271,12 +276,6 @@ void scatter(LocalParticle* part, double length, MaterialData material, RandomRu
LocalParticle_add_to_zeta(part, drift_zeta_single(rvv, px*rpp, py*rpp, length/2) );
}

// Update s --------------------------------------------------------
// TODO: move absorbed particles to last impact location
if (val_part_abs==0){
LocalParticle_add_to_s(part, length);
}

// Update state ----------------------------------------------------
if (val_part_abs > 0){
LocalParticle_set_state(part, XC_LOST_ON_EVEREST);
Expand Down

0 comments on commit 23ecb01

Please sign in to comment.