# GarField++ Gas File Error: "PROGRAM STOPPED TOO MANY PRIMARIES IPRIM"

**URL:** <https://root-forum.cern.ch/t/garfield-gas-file-error-program-stopped-too-many-primaries-iprim/55615>\
**Category:** Garfield++\
**Created:** [July 10, 2023, 12:00pm UTC](https://root-forum.cern.ch/t/garfield-gas-file-error-program-stopped-too-many-primaries-iprim/55615 "2023-07-10T12:00:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khalil\_Alashy](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/khalil_alashy/32/33464_2.png) [@Khalil\_Alashy](https://root-forum.cern.ch/u/Khalil_Alashy)\
**Post date:** [July 10, 2023, 12:00pm UTC](https://root-forum.cern.ch/t/garfield-gas-file-error-program-stopped-too-many-primaries-iprim/55615/1 "2023-07-10T12:00:34Z")

</div>

Hello everyone.

I am attempting to generate a Gas File in Garfield++ consisting 100% of Sulfur Hexafluoride (SF6) gas.

But when I run the executable, I encounter this error: " PROGRAM STOPPED TOO MANY PRIMARIES IPRIM."

For reference here is the code I am running:

```auto
#include <iostream>

#include <TCanvas.h>
#include <TROOT.h>
#include <TApplication.h>

#include "Garfield/MediumMagboltz.hh"
#include "Garfield/FundamentalConstants.hh"

using namespace Garfield;

int main(int argc, char * argv[]) {

  TApplication app("app", &argc, argv);
 
  const double temperature = ZeroCelsius+20;
  const double pressure = 1.1 * AtmosphericPressure;
 
  // Setup the gas.
  MediumMagboltz* gas = new MediumMagboltz();
  gas->SetTemperature(temperature);
  gas->SetPressure(pressure);
  gas->SetComposition("SF6", 100);

  // Set the field range to be covered by the gas table.
  const int nFields = 20;
    const double emin = 100;
    const double emax = 100000;
  // Flag to request logarithmic spacing.
  const bool useLog = true;
  gas->SetFieldGrid(emin, emax, nFields, useLog);

  const int ncoll = 10;
  // Switch on debugging to print the Magboltz output.
  gas->EnableDebugging();
  // Run Magboltz to generate the gas table.
  gas->GenerateGasTable(ncoll);
  gas->DisableDebugging();
  // Save the table.
  gas->WriteGasFile("SF6_20.gas");

}

```

I am not sure what I can do to mitigate this error. I tried changing the number of collisions, I tried 2, 5, 10, 20 and all have resulted in the same error.

Would appreciate any help.

Thank you.

Khalil

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [July 10, 2023, 12:27pm UTC](https://root-forum.cern.ch/t/garfield-gas-file-error-program-stopped-too-many-primaries-iprim/55615/2 "2023-07-10T12:27:09Z")

</div>

Try increasing the lower limit of the electric field range.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [July 24, 2023, 12:27pm UTC](https://root-forum.cern.ch/t/garfield-gas-file-error-program-stopped-too-many-primaries-iprim/55615/3 "2023-07-24T12:27:31Z")

</div>

Closed on July 24, 2023, 12:27pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
