<commit_before>
#include "PlasmaFunctions.h"

#include "Composition.h"
#include "Element.h"
#include "Gfdi.h"
#include "PhysicalConstants.h"
#include "PlasmaState.h"

#include <cmath>


namespace {
  const double& me = PhysicalConstantsCGS::ElectronMass;
  const double& hb = PhysicalConstantsCGS::Hbar;
  const double PrefactorNe = pow(2.0 * me, 1.5) / (2.0 * M_PI*M_PI * hb*hb*hb);
}


double Plasma::rhoFromNe(const double ne, const Composition& comp) {
  const double& mp = PhysicalConstantsCGS::ProtonMass;
  return ne * mp * comp.meanMolecularWeightPerElectron;
}


double Plasma::ne(const double chi, const double xi, const double kt,
    const double tau) {
  if (xi < 0) {
    return 0.0;
  }
  else {
    const double i12 = gfdi(GFDI::Order12, chi + xi, tau);
    const double i32 = gfdi(GFDI::Order32, chi + xi, tau);
    return PrefactorNe * pow(kt, 1.5) * (i12 + tau*i32);
  }
}

double Plasma::ne(const double phi, const PlasmaState& p) {
  return ne(p.chi, phi/p.kt, p.kt, p.tau);
}



std::vector<double> Plasma::ni(const double phi, const PlasmaState& p) {
  const double xi = phi/p.kt;<commit_msg>Fix incorrect handling of xi=phi/kt < 0<commit_after>
#include "PlasmaFunctions.h"

#include "Composition.h"
#include "Element.h"
#include "Gfdi.h"
#include "PhysicalConstants.h"
#include "PlasmaState.h"

#include <cmath>


namespace {
  const double& me = PhysicalConstantsCGS::ElectronMass;
  const double& hb = PhysicalConstantsCGS::Hbar;
  const double PrefactorNe = pow(2.0 * me, 1.5) / (2.0 * M_PI*M_PI * hb*hb*hb);
}


double Plasma::rhoFromNe(const double ne, const Composition& comp) {
  const double& mp = PhysicalConstantsCGS::ProtonMass;
  return ne * mp * comp.meanMolecularWeightPerElectron;
}


double Plasma::ne(const double chi, const double xi, const double kt,
    const double tau) {
  const double xiPos = (xi >= 0) ? xi : 0.0;
  const double i12 = gfdi(GFDI::Order12, chi + xiPos, tau);
  const double i32 = gfdi(GFDI::Order32, chi + xiPos, tau);
  return PrefactorNe * pow(kt, 1.5) * (i12 + tau*i32);
}

double Plasma::ne(const double phi, const PlasmaState& p) {
  return ne(p.chi, phi/p.kt, p.kt, p.tau);
}



std::vector<double> Plasma::ni(const double phi, const PlasmaState& p) {
  const double xi = (phi >= 0.0) ? phi/p.kt : 0.0;
{'fraction_non_alphanumeric': 0.14298284205895292, 'fraction_numerical': 0.02243730752309723, 'mean_word_length': 4.288372093023256, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2451677', 'n_tokens_mistral': 928, 'n_tokens_neox': 853, 'n_words': 228}