Segmentation Fault when Generating Gas File

Hello,

So my Garfield installation seems to work fine and I can use gas files made by others just fine. I just have a problem when I try to run the gas file generator, as it spits me out with a Segmentation Fault quickly.

Here’s my code. I’ve isolated the line that causes the SegFault.

``
#include

#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 pressure = 3 * AtmosphericPressure;
const double temperature = 293.15;

// Setup the gas.
MediumMagboltz gas;
gas.SetComposition(“Ar”, 93., “CO2”, 7.);
gas.SetTemperature(temperature);

gas.SetPressure(pressure);

// 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.
constexpr bool useLog = true;

gas.SetFieldGrid(emin, emax, nFields, useLog);

const int ncoll = 10;

// Run Magboltz to generate the gas table.
gas.GenerateGasTable(ncoll); //Seg Fault Here

// Save the table.
gas.WriteGasFile(“ar_93_co2_7.gas”);
// app.Run(kTRUE);

}
``

When I actually try to run this code I get the following results.

``
Heed:
Database path: /home/jason/garfield/Heed/heed++/database

MediumMagboltz::SetComposition:
Ar/CO2 (93/7)

MediumMagboltz::GenerateGasTable: Found 44 excitations and 18 ionisations.

Ar EXC 1S5    J=2 METASTABLE         ELEVEL= 11.548 , energy = 11.5478 eV.
Ar EXC 1S4    J=1 RESONANT           ELEVEL= 11.624 , energy = 11.6238 eV.
Ar EXC 1S3    J=0 METASTABLE         ELEVEL= 11.723 , energy = 11.7228 eV.
Ar EXC 1S2    J=1 RESONANT           ELEVEL= 11.828 , energy = 11.8278 eV.
Ar EXC 2P10   J=1                    ELEVEL= 12.907 , energy = 12.9068 eV.
Ar EXC 2P9    J=3                    ELEVEL= 13.076 , energy = 13.0758 eV.
Ar EXC 2P8    J=2                    ELEVEL= 13.095 , energy = 13.0948 eV.
Ar EXC 2P7    J=1                    ELEVEL= 13.153 , energy = 13.1528 eV.
Ar EXC 2P6    J=2                    ELEVEL= 13.172 , energy = 13.1718 eV.
Ar EXC 2P5    J=0                    ELEVEL= 13.273 , energy = 13.2728 eV.
Ar EXC 2P4    J=1                    ELEVEL= 13.283 , energy = 13.2828 eV.
Ar EXC 2P3    J=2                    ELEVEL= 13.302 , energy = 13.3018 eV.
Ar EXC 2P2    J=1                    ELEVEL= 13.328 , energy = 13.3278 eV.
Ar EXC 2P1    J=0                    ELEVEL= 13.480 , energy = 13.4798 eV.
Ar EXC 3D6    J=0                    ELEVEL= 13.845 , energy = 13.8448 eV.
Ar EXC 3D5    J=1 RESONANT           ELEVEL= 13.864 , energy = 13.8638 eV.
Ar EXC 3D3    J=2                    ELEVEL= 13.903 , energy = 13.9028 eV.
Ar EXC 3D4!   J=4                    ELEVEL= 13.979 , energy = 13.9788 eV.
Ar EXC 3D4    J=3                    ELEVEL= 14.013 , energy = 14.0128 eV.
Ar EXC 3D1!!  J=2                    ELEVEL= 14.063 , energy = 14.0628 eV.
Ar EXC 2S5    J=2                    ELEVEL= 14.068 , energy = 14.0678 eV.
Ar EXC 2S4    J=1 RESONANT           ELEVEL= 14.090 , energy = 14.0898 eV.
Ar EXC 3D1!   J=3                    ELEVEL= 14.099 , energy = 14.0988 eV.
Ar EXC 3D2    J=1 RESONANT           ELEVEL= 14.153 , energy = 14.1528 eV.
Ar EXC 3S1!!!!J=2                    ELEVEL= 14.214 , energy = 14.2138 eV.
Ar EXC 3S1!!  J=2                    ELEVEL= 14.234 , energy = 14.2338 eV.
Ar EXC 3S1!!! J=3                    ELEVEL= 14.236 , energy = 14.2358 eV.
Ar EXC 2S3    J=0                    ELEVEL= 14.241 , energy = 14.2408 eV.
Ar EXC 2S2    J=1 RESONANT           ELEVEL= 14.255 , energy = 14.2548 eV.
Ar EXC 3S1!   J=1 RESONANT           ELEVEL= 14.304 , energy = 14.3038 eV.
Ar EXC 4D5    J=1 RESONANT           ELEVEL= 14.711 , energy = 14.7108 eV.
Ar EXC 3S4    J=1 RESONANT           ELEVEL= 14.848 , energy = 14.8478 eV.
Ar EXC 4D2    J=1 RESONANT           ELEVEL= 14.859 , energy = 14.8588 eV.
Ar EXC 4S1!   J=1 RESONANT           ELEVEL= 15.004 , energy = 15.0038 eV.
Ar EXC 3S2    J=1 RESONANT           ELEVEL= 15.022 , energy = 15.0218 eV.
Ar EXC 5D5    J=1 RESONANT           ELEVEL= 15.118 , energy = 15.1178 eV.
Ar EXC 4S4    J=1 RESONANT           ELEVEL= 15.186 , energy = 15.1858 eV.
Ar EXC 5D2    J=1 RESONANT           ELEVEL= 15.190 , energy = 15.1898 eV.
Ar EXC 6D5    J=1 RESONANT           ELEVEL= 15.308 , energy = 15.3078 eV.
Ar EXC 5S1!   J=1 RESONANT           ELEVEL= 15.351 , energy = 15.3508 eV.
Ar EXC 4S2    J=1 RESONANT           ELEVEL= 15.360 , energy = 15.3598 eV.
Ar EXC 5S4    J=1 RESONANT           ELEVEL= 15.366 , energy = 15.3658 eV.
Ar EXC 6D2    J=1 RESONANT           ELEVEL= 15.374 , energy = 15.3738 eV.
Ar EXC HIGH   J=1 RESONANT           ELEVEL= 15.660 , energy = 15.6598 eV.
Ar IONISATION CHARGE STATE =1      ELOSS=   15.75961, energy = 15.7594 eV.
Ar IONISATION CHARGE STATE =2      ELOSS=   43.38928, energy = 43.3887 eV.
Ar IONISATION CHARGE STATE =3      ELOSS=   84.124  , energy = 84.1228 eV.
Ar IONISATION L3 SHELL             ELOSS=  248.4    , energy = 248.397 eV.
Ar IONISATION L2 SHELL             ELOSS=  250.6    , energy = 250.597 eV.
Ar IONISATION L1 SHELL             ELOSS=  326.3    , energy = 326.296 eV.
Ar IONISATION K  SHELL             ELOSS= 3205.9    , energy = 3205.86 eV.
CO2 IONISATION        CO2+           ELOSS=  13.776  , energy = 13.7758 eV.
CO2 IONISATION-EXC    CO2+(A2PIu)    ELOSS=  17.314  , energy = 17.3138 eV.
CO2 IONISATION-EXC    CO2+(B2SIG+u)  ELOSS=  18.077  , energy = 18.0768 eV.
CO2 DISSOCIATIVE ION  O+             ELOSS=  19.07   , energy = 19.0698 eV.
CO2 DISSOCIATIVE ION  CO+            ELOSS=  19.47   , energy = 19.4698 eV.
CO2 DISSOCIATIVE ION  C+             ELOSS=  27.82   , energy = 27.8197 eV.
CO2 DISSOCIATIVE ION  CO2++          ELOSS=  37.4    , energy = 37.3995 eV.
CO2 DISSOCIATIVE ION  C++            ELOSS=  72.0    , energy = 71.9991 eV.
CO2 DISSOCIATIVE ION  O++            ELOSS=  74.0    , energy = 73.9991 eV.
CO2 IONISATION CARBON K-SHELL        ELOSS= 285.0    , energy = 284.996 eV.
CO2 IONISATION OXYGEN K-SHELL        ELOSS= 532.0    , energy = 531.993 eV.

MediumMagboltz::GenerateGasTable: E = 100 V/cm, B = 0 T, angle: 1.5708 rad

Segmentation fault (core dumped)
``

Not entirely sure why I’m SegFaulting here, and any help fixing this would be appreciated.

Hi,
can you try increasing the stack size limit

ulimit -s unlimited

and rerunning the program?

If you are who I think you are, that’s kind of funny. I was trying to give you at least a few days off. XD

Trying it now. It’s not far enough along that I can tell you 100% for sure that it worked, but it’s definitely acting like it’s going to work.