Skip to content

Bug in compton.c in electron velocities #1189

Description

@jhmatthews

Taya Govreen-Segal raised the following issue - it looks like there's a typo in compton.c where there is some code to reverse velocities:

  if (random_number (0.0, 1.0) < 0.5 * (1. + fabs (v / VLIGHT)))
  {
    /* Then we want the photon to be headed  towards the photon */
    if (v > 0)
    {
      velocity_electron[0] = (-velocity_electron[0]);
      velocity_electron[2] = (-velocity_electron[1]);
      velocity_electron[2] = (-velocity_electron[2]);
    }
  }
  else if (v < 0)
  {
    velocity_electron[0] = (-velocity_electron[0]);
    velocity_electron[2] = (-velocity_electron[1]);
    velocity_electron[2] = (-velocity_electron[2]);
  }

where the second line of each block assigns velocity_electron[2] twice and doesn't change velocity_electron[1]. I'm a bit confused how this hasn't been picked up in tests, it seems important.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions