// bytran -|- spectral calculations for portable devices using the HITRAN database
//
// Developed by Dzianis Pliutau (Denis Plutov) and Kostya Roslyakov
// www.bytran.org | bytran@bytran.org
// Copyright (c) 2016 Dzianis Pliutau
// Distributed under the MIT license
//
// The MIT License (MIT)
// Copyright (c) 2016 Dzianis Pliutau
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



// Object with all the main calculaion paramters
#include "params.h"
#include <QFile>
#include <QTextStream>
#include <QLocale>
#include <QDir>
#include <QMessageBox>
#include <QApplication>
#include "auxiliary.h"
#include <QDebug>

Params::Params(QObject *parent) : QObject(parent)
{
    // Creating connections
    createActions();

    // Initializing the molecular parameters from the embedded datasets
    initMolParams();

    // Setting the default horizontal path parameters
    horiz.setPathLength(1000);  // Pathlength, 1000 meters
    horiz.setTemp(296);         // Temperature, 296 Kelvin

    // Setting other default internal lineshape parameters
    this->lineshapeProfile = 1;
    this->useLineShift = true;
    this->lineBroadening = 2;   // Both air- and self- broadening are to be used
    this->intensThresh = 1E-25;
    this->wingContribSatHw = 50;
    this->wingContribAbs = 1;

    // Number of TIPS data points
    this->numTipsPoints = 2930;  // Increment this to the maximum number currently available, this will only be used for isotopes with no TIPS data available

    // Indicating that the units are HITRAN units
    this->hitranUnits = true;

    // Setting the default value for the horizontal or slant path
    this->horizVsSlant = 0;

    // Indicating that all molecules are to be calculated b default
    this->calcNotSelectedMols = true;

    // Setting the default format and precision of the output strings (for the remote control mode)
    this->outStrFormat = 'g';
    this->outStrPrecision = 8;
    this->delimiter = ";";
}

// Methos to create connections
void Params::createActions()
{
    connect(this, SIGNAL(accessNextTipsFile(int,int)), this, SLOT(readOneTipsFile(int,int)));
    connect(this, SIGNAL(readingTipsFilesComplete()), this, SLOT(readTempTipsValues()));
}

// Horizonatal path parameters
OneSlantLayer *Params::getHorizParams() { return &(this->horiz); }
void Params::setHorizParams(OneSlantLayer *newHorizParams) { this->horiz = *newHorizParams; }

// Method to initialize the horizontal path parameters from the standard atmospheric models
void Params::initHorizPathParamsFromStandardAtmModel(OneAtmModel *newOneAtmModel)
{
    int i;  // Loop variable


    // Passing in the core object
    horiz.setTotalPress(newOneAtmModel->getTotalPress()->getY()->at(0));
    horiz.setTemp(newOneAtmModel->getTemp()->getY()->at(0));
    horiz.setDensity(newOneAtmModel->getDensity()->getY()->at(0));

    // Copying the partial pressures for all molecules at the 0 altitude (ground level altitude)
    horiz.getPartPressArray()->resize(newOneAtmModel->getPartPressArray()->count());
    for (i = 0; i < newOneAtmModel->getPartPressArray()->count(); i ++)
    {
        horiz.setPartPress(i, newOneAtmModel->getPartPressSpecByMolIndex(i)->getY()->at(0));
    }
}

// Array (of type hitranOneMolObj) with the parameters for each isotope and molecule
QVector<HitranOneMol> *Params::getMol() { return &(this->mol); }
void Params::setMol(QVector<HitranOneMol> *newMol) { this->mol = *newMol; }
HitranOneMol *Params::getMolAt(int index) { return &(this->mol[index]); }
void Params::setMolAt(int index, HitranOneMol *newMol) { this->mol[index] = *newMol; }  // Replaces the old one molecule object with another

// Number of molecules in the HITRAN database;
int Params::getNumMols() { return this->numMols; }
void Params::setNumMols(int newNumMols) { this->numMols = newNumMols; }

// Variable indicating if the horizontal or slant path calculations are to be performed (o - horizontal, 1 - slant)
int Params::getHorizVsSlant() { return this->horizVsSlant; }
void Params::setHorizVsSlant(int newHorizVsSlant) { this->horizVsSlant = newHorizVsSlant; }

// Methods to get and set the TIPS folder
QString Params::getTipsFolder() { return this->tipsFolder; }
void Params::setTipsFolder(QString newTipsFolder) { this->tipsFolder = newTipsFolder; }

// Method to get and set the HITRAN database units
bool Params::getHitranUnits() { return this->hitranUnits; }
void Params::setHitranUnits(bool newHitranUnits) { this->hitranUnits = newHitranUnits; }

// Methods to get and set the lineshape profile
quint8 Params::getLineshapeProfile() { return this->lineshapeProfile; }
void Params::setLineshapeProfile(quint8 newLineshapeProfile) { this->lineshapeProfile = newLineshapeProfile; }

// Methods to get and set the line wing (in saturated line widths) contribution
int Params::getWingContribSatHw() { return this->wingContribSatHw; }
void Params::setWingContribSatHw(int newLineWingContribSatHw) { this->wingContribSatHw = newLineWingContribSatHw; }

// Absolute line wing contribution
double Params::getWingContribAbs() { return this->wingContribAbs; }
void Params::setWingContribAbs(double newWingContribAbs) { this->wingContribAbs = newWingContribAbs; }

// Methods to get and set the line broadening type to use
quint8 Params::getLineBroadening() { return this->lineBroadening; }
void Params::setLineBroadening(quint8 newLineBroadening) { this->lineBroadening = newLineBroadening; }

// Method to get and set the intensity threshold
double Params::getIntensThresh() { return this->intensThresh; }
void Params::setIntensThresh(double newIntensThresh) { this->intensThresh = newIntensThresh; }

// Method to set the state of a variable indicating if the line shift should be used or not
bool Params::getUseLineShift() { return this->useLineShift; }
void Params::setUseLineShift(bool newUseLineShift) { this->useLineShift = newUseLineShift; }

// Methods to get and set the state of the variable indicating if not selected molecules are to be included in calcualtions
bool Params::getCalcNotSelectedMols() { return this->calcNotSelectedMols; }
void Params::setCalcNotSelectedMols(bool newCalcNotSelectedMols) { this->calcNotSelectedMols = newCalcNotSelectedMols; }

// Getting and setting the precision and the format
quint8 Params::getOutStrPrecision() { return this->outStrPrecision; }
void Params::setOutStrPrecision(quint8 newOutStrPrecision) { this->outStrPrecision = newOutStrPrecision; }
char Params::getOutStrFormat() { return this->outStrFormat; }
void Params::setOutStrFormat(char newOutStrFormat) { this->outStrFormat = newOutStrFormat; }

// Methods to set and retrieve the string delimiter for numerical output
QString Params::getStrDelimiter() { return this->delimiter; }
void Params::setStrDelimiter(QString newDelimiter) { this->delimiter = newDelimiter; }

// Function to read the contents of the HITRAN TIPS file
void Params::readCumulativeTipsFileContents(QString fileName) {

    QFile inFile(fileName);  // Name of the HITRAN file in a text form to use

    int startMolInd;    // Starting molecule index
    int startIsoInd;    // Starting isotope index
    QStringList fields; // Fields in a single line of data;
    QStringList splitStr;   // Array of strings corresponding to individual string lines
    QStringList colTitle;   // Column title for a given molecule name and isotopologue number
    int j;   // Loop variable
    int k;   // Array index variable
    int m;   // Loop variable
    int molInd;  // Molecule index
    int isoInd;  // Isotope index
    double auxDbl;  // Auxiliary double variable
    int auxInt;     // Auxiliary integer variable
    int molIndToAppend;  // Molecule index to append
    int isoIndToAppend;  // Isotope index to append
    QString line;  // Line of string read in from a file
    QLocale c(QLocale::English, QLocale::UnitedStates);     // Object to convert string representation read in from a file into numbers
    // The locality has to be set to the United States beacause the TIPS files were generated in the USA

    // Indices of the molecule and isotope corresponding to the given column index
    QVector<int> molIndex;
    QVector<int> isoIndex;


    // Opening the HITRAN database text file for reading
    inFile.open(QIODevice::ReadOnly);
    QTextStream in(&inFile);

    // Reading the first line to establish which column belongs to which molecule and isotope (removing empty lines)
    line = in.readAll();
    splitStr = line.split("\n");
    for (j = 0; j < splitStr.length(); j++)
    {
        if ((splitStr[j]).count() < 10) { splitStr.removeAt(j); }
    }

    fields = splitStr[0].split(" ");
    j = 1;  // The first item is skipped because it belongs to the temperature column

    // Reading in and extracting information from the TIPE file titles
    startMolInd = 0;
    startIsoInd = 0;
    while (j < fields.length() - 1)
    {
        while (fields[j] == "") { j++; }
        colTitle = fields[j].split("_");
        auxInt = c.toInt(colTitle[1]);
        j++;

        molIndToAppend = -1;
        isoIndToAppend = -1;

        for (molInd = startMolInd; molInd < mol.length(); molInd++)
        {
            for (isoInd = startIsoInd; isoInd < mol[molInd].getIso()->length(); isoInd++)
            {
                if ( (colTitle[0] == mol[molInd].getChemForm()) && (auxInt == mol[molInd].getIsoAt(isoInd)->getIsoLog()) )
                {
                    molIndToAppend = molInd;
                    isoIndToAppend = isoInd;
                }
            }
        }
        molIndex.append(molIndToAppend);
        isoIndex.append(isoIndToAppend);
    }

    // Reading in and saving the TIPS values
    for (m = 1; m < splitStr.length(); m++)
    {
        // Initializing the value of column index to 0
        k = 0;

        // Reading in the next line with the data
        fields = splitStr[m].split(" ");
        j = 1;
        while (fields[j] == "") { j++; }

        // Skipping the temperature value
        j++;
        while (fields[j] == "") { j++; }

        // Saving the TIPS data into the corresponding arrays
        while (j < fields.length() - 1)
        {
            auxDbl = c.toDouble(fields[j]);   // Converting the text representation of the TIPS value into the corresponding numerical one
            molInd = molIndex[k];
            isoInd = isoIndex[k];
            if ((molInd != -1) && (isoInd != -1))
            {
                mol[molInd].getIsoAt(isoInd)->getTips()->append(auxDbl);
            }
            j++;
            while (fields[j] == "") { j++; }

            // Incrementing the temperature index
            k++;
        }
    }
}

// Method to read the TIPs values from individual files (2016 HITRAN format for the online database listing)
// This method does not download the data from HITRAN online but assumes that all the data has already been downloaded
void Params::read2016HitranOnlineTipsFilesContents()
{
    int i;  // Loop variable
    int j;  // Loop variable
    int k;  // Loop variable
    QFile file;   // File variable to read data from a file
    QString str;  // The string containing the entire contents of a file
    QStringList lines;  // String list to contain the split string (individual rows split up)
    QStringList splitLine;  // Variable to contain split lines
    // QLocale has to be set to the United States because the TIPS files where generated in the united states
    QLocale c(QLocale::English, QLocale::UnitedStates);  // Locale variable to convert string representation into numerical
    QFileInfo info;     // Object to get information about a file
    QString fileName;   // File name without the path

    // Need to make adjustments to remove the line.count() from the previous read, not a very good approach, modify

    // Scanning through all isotopes and reading in the TIPS values from individual files
    for (i = 0; i < mol.count(); i++)
    {
        for (j = 0; j < mol[i].getIso()->count(); j++)
        {
            fileName = "q" + QString::number(mol[i].getIsoAt(j)->getGlobalId()) + ".txt";
            file.setFileName(this->tipsFolder + "/" + fileName);
            info.setFile(file);

            if (info.exists())
            {
                emit notify("Loading downloaded TIPS data.\nLoading file: " + fileName, 0, true, false);
                QApplication::processEvents();

                // Indicating that the TIPS are available
                mol[i].getIsoAt(j)->setTipsFileAvailableLocally(true);

                if ( file.open(QIODevice::ReadOnly) )
                {
                    QTextStream in(&file);
                    str = in.readAll();  // Reading all the data contained in the file

                    // Saving the data into the internal variables
                    lines = str.split("\n", QString::SkipEmptyParts);

                    // Scanning through all split lines to extract the TIPS values
                    for (k = 0; k < lines.count(); k++)
                    {
                        // splitLine = (lines[k]).split(" ", QString::SkipEmptyParts);   // Does not work anymore (July 3, 2017) because the TIPS number is too large for isotope under index 78
                        str = (lines[k]).mid(4, 22);
                        mol[i].getIsoAt(j)->getTips()->append(c.toDouble(str));
                    }
                    file.flush();
                    file.close();
                }
                else
                {
                    // Indicating that the TIPS are unavailable
                    mol[i].getIsoAt(j)->setTipsFileAvailableLocally(false);

                    // Scanning through all split lines to extract the TIPS values
                    for (k = 0; k <= lines.count(); k++)  // Lines count is saved from the previous read when the read from the file is successful, not a very good approach, should change that later
                    {
                        mol[i].getIsoAt(j)->getTips()->append(mol[i].getIsoAt(j)->getQ296K());
                    }
                }
            }
            else
            {
                // Indicating that the TIPS are unavailable
                mol[i].getIsoAt(j)->setTipsFileAvailableLocally(false);

                // Scanning through all split lines to extract the TIPS values
                for (k = 0; k <= lines.count(); k++)  // Lines count is saved from the previous read when the read from the file is successful, not a very good approach, should change that later
                {
                    mol[i].getIsoAt(j)->getTips()->append(mol[i].getIsoAt(j)->getQ296K());
                }
            }
        }
    }

    // Reading the first one in separately to also read in the temperature values
    file.setFileName(this->tipsFolder + "/q" + QString::number(mol[0].getIsoAt(0)->getGlobalId()) + ".txt");
    if (file.open(QIODevice::ReadOnly))
    {
        QTextStream in(&file);
        str = in.readAll();  // Reading all the data contained in the file

        // Saving the data into the internal variables
        lines = str.split("\n", QString::SkipEmptyParts);

        emit notify("Loading downloaded TIPS data.\nLoading temperature values.", 0, true, false);

        // Scanning through all split lines to extract the TIPS values
        for (k = 0; k < lines.count(); k++)
        {
            splitLine = (lines[k]).split(" ", QString::SkipEmptyParts);
            this->tipsTempValues.append(c.toDouble(splitLine[0]));  // Need to expand this array to the maximum number of records possible, do the same for the TIPS data when not specified in a file but Q296K is used.
        }
    }
}

// This method used signal-slots because on a cell phone the read operations are sometimes slow and not everything gets read in (need to wait for each operation to complete)
void Params::read2016HitranOnlineTipsFilesContentsRecursively()
{
    // Beginning reading from the first molecule and isotope
    readOneTipsFile(0, 0);
}

// Slot to read in temperature values corresponding to the TIPS values
void Params::readTempTipsValues()
{
    int k;  // Loop variable
    QFile file;   // File variable to read data from a file
    QString str;  // The string containing the entire contents of a file
    QStringList lines;  // String list to contain the split string (individual rows split up)
    QStringList splitLine;  // Variable to contain split lines
    // QLocale has to be set to the United States because the TIPS files where generated in the united states
    QLocale c(QLocale::English, QLocale::UnitedStates);  // Locale variable to convert string representation into numerical


    // Reading the first one in separately to also read in the temperature values
    file.setFileName(this->tipsFolder + "/q" + QString::number(mol[0].getIsoAt(0)->getGlobalId()) + ".txt");
    if (file.open(QIODevice::ReadOnly))
    {
        QTextStream in(&file);
        str = in.readAll();  // Reading all the data contained in the file

        // Saving the data into the internal variables
        lines = str.split("\n", QString::SkipEmptyParts);

        // Scanning through all split lines to extract the TIPS values
        for (k = 0; k < lines.count(); k++)
        {
            splitLine = (lines[k]).split(" ", QString::SkipEmptyParts);
            this->tipsTempValues.append(c.toDouble(splitLine[0]));
        }
    }
}

// Slot to read a single TIPS file
void Params::readOneTipsFile(int i, int j)
{
    int k;  // Loop variable
    QFile file;   // File variable to read data from a file
    QString str;  // The string containing the entire contents of a file
    QStringList lines;  // String list to contain the split string (individual rows split up)
    QStringList splitLine;  // Variable to contain split lines
    // QLocale has to be set to the United States because the TIPS files where generated in the united states
    QLocale c(QLocale::English, QLocale::UnitedStates);  // Locale variable to convert string representation into numerical
    QFileInfo info;  // Object to get information about a file


    file.setFileName(this->tipsFolder + "/q" + QString::number(mol[i].getIsoAt(j)->getGlobalId()) + ".txt");
    info.setFile(file);
    if (info.exists())
    {
        if ( file.open(QIODevice::ReadOnly))
        {
            QTextStream in(&file);
            str = in.readAll();  // Reading all the data contained in the file

            // Saving the data into the internal variables
            lines = str.split("\n", QString::SkipEmptyParts);

            // Scanning through all split lines to extract the TIPS values
            for (k = 0; k < lines.count(); k++)
            {
                // splitLine = (lines[k]).split(" ", QString::SkipEmptyParts);  // Does not work anymore (July 3, 2017) because the TIPS number is too large for isotope under index 78
                str = (lines[k]).mid(4, 22);
                mol[i].getIsoAt(j)->getTips()->append(c.toDouble(str));
            }
            file.close();

            // Indicating that the TIPS are available
            mol[i].getIsoAt(j)->setTipsFileAvailableLocally(true);

            QApplication::processEvents();
        }
        else
        {
            // Indicating that the TIPS are anavailable
            mol[i].getIsoAt(j)->setTipsFileAvailableLocally(false);

            // Scanning through all split lines to extract the TIPS values
            for (k = 0; k <= this->numTipsPoints; k++)  // Lines count is saved from the previous read when the read from the file is successful
            {
                mol[i].getIsoAt(j)->getTips()->append(mol[i].getIsoAt(j)->getQ296K());
            }
        }
    }
    else
    {
        // Indicating that the TIPS are anavailable
        mol[i].getIsoAt(j)->setTipsFileAvailableLocally(false);

        // Scanning through all split lines to extract the TIPS values
        for (k = 0; k <= this->numTipsPoints; k++)  // Lines count is saved from the previous read when the read from the file is successful
        {
            mol[i].getIsoAt(j)->getTips()->append(mol[i].getIsoAt(j)->getQ296K());
        }
    }

    if ((i >= (mol.count() - 1)) && (j >= (mol.last().getIso()->count() - 1)))
    {
        // Sending out a signal indicating that the reading of TIPS files is complete
        emit readingTipsFilesComplete();
    }
    else
    {
        // Incrementing the i and j (molecule and isotope numbers)
        if (j < (mol[i].getIso()->count() - 1)) { j++; }
                                           else { i++; j = 0; }

        // Reading next TIPS file
        emit accessNextTipsFile(i, j);
    }
    QApplication::processEvents();
}

// This method will read the TIPS data from the HITRAN online formatted one and prepare TIPS strings which may be embedded into the application
void Params::readConvert2016HitranOnlineTipsFilesContents(QString folderName)
{
    QFile inFile;  // Path to the folder with the TIPS data
    QFile outFile;   // File used to output the data in the format compatible with the internal variable initialization
    int i, j;  // Loop variables
    QDir directory = QDir(folderName);
    QStringList strList;   // String list with the file names contained in the directory being processed
    QString fileContents;  // Contents of each file (file contents are read in completely for each file, not a line-by-line read)
    QStringList lines;  // List of individual lines read in from a file
    QStringList lineSplitVals;  // Variable containing the split values from one line (one temperature and one TIPS value for each line)
    QString strValue;   // String TIPS value
    QString outputStr;   // String to contain all the putput information


    // Getting the list of files in a directory
    strList = directory.entryList(QDir::Files | QDir::NoDotAndDotDot);

    // Scanning though all files and reading in the data, making sure these are the files with the TIPS values by making sure
    // that the first letter is 'd', this is probably not a complete check but cuts off some files which are obviously not TIPS
    for (i = 0; i < strList.count(); i++)
    {
        if ((strList[i])[0] != 'p')
        {
            // Scanning through a list of all files and saving them into the local variables
            inFile.setFileName(folderName + "/" + strList[i]);

            if ( inFile.open(QIODevice::ReadOnly))
            {
                // Creating the stream to output the processed data to
                QTextStream inStream( &inFile );

                // Reading in data from a file
                fileContents = inStream.readAll();
            }

            // Splitting the file contents by lines
            lines = fileContents.split("\n");

            outFile.setFileName(folderName + "/p" + strList[i]);
            if ( outFile.open(QIODevice::WriteOnly) )
            {
                // Creating the stream to output the processed data to
                QTextStream outStream( &outFile );

                outputStr = "";
                for (j = 0; j < lines.count(); j++)
                {
                    if (lines[j] != "")
                    {
                        // Splitting each line to separate the TIPS value from the temperature value
                        lineSplitVals = (lines[j]).split(" ", QString::SkipEmptyParts);

                        // TIPS value extracted from a line of temperature and TIPS pair
                        strValue = lineSplitVals[1];

                        // Writing out the value to a file in the format compatible with the internatl variable Qt initialization format
                        //outputStr = outputStr + " << " + strValue;

                        // Forming the output string with all the values saved down to an array
                        //outputStr = outputStr + "mol[0].getIso(0)->getTips()->append(" + strValue +  ");  ";
                        //outputStr = outputStr + "mol[0].getIso(0)->setTipsAtIndex(" + QString::number(j) + ", " + strValue + ");  ";
                    }
                }

                // Writing out all the data to the stream
                outStream << outputStr;
                outStream.flush();

                // Closing the file
                outFile.close();
            }
            inFile.close();
        }
    }

    // Reading in the file data and saving it into a local array

    // Each file has to be cross-referenced because the file number does not directly correspond to the molecule and isotope

}

// Function to read the contents of the HITRAN file with the molecular parameters
void Params::readMolparamFileContents(QString fileName) {

    QFile inFile(fileName);  // Name of the HITRAN file in a text form to use
    QStringList splitStr;    // String with the values split up
    double auxDbl;   // Auxiliary double variable
    int auxInt;      // Auxiliary integer variable
    QString auxStr;  // Auxiliary string
    int i;   // Loop variable
    int j;   // Loop variable
    int k;   // Loop variable

    QString line;   // Single line read in from a text file
    int molIndex;   // Molecule index in the array (molecule number - 1)
    int isoIndex;   // Isotope index in the array (isotope number - 1)
    // QLocale has to be set to the United States because the TIPS files where generated in the united states
    QLocale c(QLocale::English, QLocale::UnitedStates);  // Locale variable to convert string representation into numerical
    HitranOneMol hiOneMol;  // HITRAN one molecule object
    HitranOneIso hiOneIso;  // HITRAN one isotope object
    QStringList fields;     // Fields in a single line of data;


    // Opening the HITRAN database molparam.txt text file for reading
    if ( inFile.open(QIODevice::ReadOnly))
    {
        // Creating the stream to output the processed data to
        QTextStream in( &inFile );

        // Reading in data from a file
        auxStr = in.readAll();

        // Closing the file
        inFile.close();
    }

    // Reading all data from the molecular parameters file
    splitStr = auxStr.split("\n");
    for (j = 0; j < splitStr.length(); j++) // This additional check is here to remove the very last line if it is present as an empty line
    {
        if ((splitStr[j]).count() < 10) { splitStr.removeAt(j); }
    }

    // Initializing the molecule and isotope indices
    molIndex = -1;
    isoIndex = 0;

    // First line is skipped because it contains column titles
    mol.resize(0);
    for (k = 1; k < splitStr.length(); k++)
    {
        // Setting the molecule index
        if (splitStr[k].contains("(", Qt::CaseInsensitive))
        {
            molIndex++;
            mol.append(hiOneMol);   // Appending one element to the array of HITRAN molecules

            isoIndex = 0;
            fields = splitStr[k].split(" ", QString::SkipEmptyParts);
            auxStr = fields[0];   // Molecule chemical formula
            mol[molIndex].setChemForm(auxStr);
        }
        else
        {
            // Incrementing the isotope index
            mol[molIndex].getIso()->append(hiOneIso);

            // Splitting the line using the space delimiter
            auxInt = c.toInt((splitStr[k]).mid(0, 12));     // Isotopologue number
            mol[molIndex].getIsoAt(isoIndex)->setIsoLog(auxInt);

            auxDbl = c.toDouble((splitStr[k]).mid(12, 13));  // Abundance value
            mol[molIndex].getIsoAt(isoIndex)->setTerrAbund(auxDbl);

            auxDbl = c.toDouble((splitStr[k]).mid(25, 14));  // Setting the partition sum value at 296K
            mol[molIndex].getIsoAt(isoIndex)->setQ296K(auxDbl);

            auxInt = c.toInt((splitStr[k]).mid(39, 5));      // Degeneracy factor
            mol[molIndex].getIsoAt(isoIndex)->setGj(auxInt);

            auxDbl = c.toDouble((splitStr[k]).mid(44, 14));  // Molar mass (g)
            mol[molIndex].getIsoAt(isoIndex)->setMolarMass(auxDbl);

            // Initializing the global id to -1 assuming that the TIPS are not available for variable temperatures by default
            mol[molIndex].getIsoAt(isoIndex)->setGlobalId(-1);

            // Setting each molecule selected for calculation
            mol[molIndex].setSelected(true);

            // Incrementing the isotope index
            isoIndex++;
        }
    }

    // Populating the calculation abundances with the terrestrial abundances
    for (i = 0; i < mol.count(); i++)
    {
        for (j = 0; j < mol[i].getIso()->count(); j++)
        {
            mol[i].getIsoAt(j)->setAbund(mol[i].getIsoAt(j)->getTerrAbund());
        }
    }

    // Initializing colors
    initColorsAndGlobalIds();

    // Emitting a signal indicating that reading of the molecular parameters file is complete
    emit readingMolParamsComplete();
}

// Method to read the contents of the global IDs file
int Params::readGlobalIdFileContents(QString fileName)
{
    int j;  // Loop variable
    QFile inFile(fileName);  // Name of the HITRAN file in a text form to use
    QString auxStr;  // Auxiliary string
    QStringList splitStr;    // String with the values split up
    QStringList splitLine;   // String list with the values contained in one line
    int globalId;  // Global ID value
    int molIndex;  // Molecule index
    int isoIndex;  // Isotope Index
    QLocale c(QLocale::English, QLocale::UnitedStates);  // Locale variable to convert string representation into numerical


    // Reading in the contents of the file
    if ( inFile.open(QIODevice::ReadOnly))
    {
        // Creating the stream to output the processed data to
        QTextStream in( &inFile );

        // Reading in data from a file
        in.readLine();  // Reading in the line with the column titles
        auxStr = in.readAll();

        // Closing the file
        inFile.close();
    }

    // Reading all data from the molecular parameters file
    splitStr = auxStr.split("\n", QString::SkipEmptyParts);
    for (j = 0; j < splitStr.length(); j++) // This additional check is here to remove the very last line if it is present as an empty line
    {
        splitLine = splitStr[j].split("\t");
        globalId = c.toInt(splitLine[0]);
        if ((splitLine[1] != "") && (splitLine[1] != "-"))
        {
            molIndex = c.toInt(splitLine[1]);
            isoIndex = c.toInt(splitLine[2]);
            mol[molIndex - 1].getIsoAt(isoIndex - 1)->setGlobalId(globalId);
            // Saving the status if a TIPS file for a given isotope is available on the HITRAN server
            if (splitLine[3] == "yes") {
                mol[molIndex - 1].getIsoAt(isoIndex - 1)->setTipsFileAvailableOnHitranServer(true);
            }
            else {
                mol[molIndex - 1].getIsoAt(isoIndex - 1)->setTipsFileAvailableOnHitranServer(false);
            }
        }
    }

    return splitStr.count();  // Maximum index for the TIPS files (this is for the TIPS downloader)
}

// Methods to get and set the total internal partition sums temperature values
QVector<double> Params::getTipsTempArray() { return this->tipsTempValues; }
void Params::setTipsTempArray(QVector<double> newTempArray) { this->tipsTempValues = this->tipsTempValues = newTempArray; }
double Params::getTipsTempValueAtIndex(int index) { return this->tipsTempValues[index]; }
void Params::setTipsTempValueAtIndex(int index, double tempValue) { this->tipsTempValues[index] = tempValue; }

// Method to initialize the molecular parameters from internal variables
// To generate the default colors swatchspot.com was used with manual adjustments
// Need to take into account that the molparam.txt does not contain the Global ID values
void Params::initMolParams()
{
    int i;  // Loop variable
    int j;  // Loop variable


    // Resizing the molecules array
    mol.resize(49);

    // "Molecule number"    "Iso Abundance"    "Q(296K)"    "gj"    "Molar Mass(g)"
    // H2O (1)
    mol[0].setMolName("H2O");
    mol[0].setChemForm("H2O");
    mol[0].setColor("#3399ff");
    mol[0].getIso()->resize(7);
    mol[0].setSelected(true);
    // 1 isotope
    mol[0].getIsoAt(0)->setIsoLog(161);
    mol[0].getIsoAt(0)->setTerrAbund(0.997317E+00);
    mol[0].getIsoAt(0)->setQ296K(1.7458E+02);
    mol[0].getIsoAt(0)->setGj(1);
    mol[0].getIsoAt(0)->setMolarMass(18.010565);
    mol[0].getIsoAt(0)->setGlobalId(1);
    // 2 isotope
    mol[0].getIsoAt(1)->setIsoLog(181);
    mol[0].getIsoAt(1)->setTerrAbund(1.99983E-03);
    mol[0].getIsoAt(1)->setQ296K(1.7605E+02);
    mol[0].getIsoAt(1)->setGj(1);
    mol[0].getIsoAt(1)->setMolarMass(20.014811);
    mol[0].getIsoAt(1)->setGlobalId(2);
    // 3 isotope
    mol[0].getIsoAt(2)->setIsoLog(171);
    mol[0].getIsoAt(2)->setTerrAbund(3.71884E-04);
    mol[0].getIsoAt(2)->setQ296K(1.0521E+03);
    mol[0].getIsoAt(2)->setGj(6);
    mol[0].getIsoAt(2)->setMolarMass(19.014780);
    mol[0].getIsoAt(2)->setGlobalId(3);
    // 4 isotope
    mol[0].getIsoAt(3)->setIsoLog(162);
    mol[0].getIsoAt(3)->setTerrAbund(3.10693E-04);
    mol[0].getIsoAt(3)->setQ296K(8.6474E+02);
    mol[0].getIsoAt(3)->setGj(6);
    mol[0].getIsoAt(3)->setMolarMass(19.016740);
    mol[0].getIsoAt(3)->setGlobalId(4);
    // 5 isotope
    mol[0].getIsoAt(4)->setIsoLog(182);
    mol[0].getIsoAt(4)->setTerrAbund(6.23003E-07);
    mol[0].getIsoAt(4)->setQ296K(8.7557E+02);
    mol[0].getIsoAt(4)->setGj(6);
    mol[0].getIsoAt(4)->setMolarMass(21.020985);
    mol[0].getIsoAt(4)->setGlobalId(5);
    // 6 isotope
    mol[0].getIsoAt(5)->setIsoLog(172);
    mol[0].getIsoAt(5)->setTerrAbund(1.15853E-07);
    mol[0].getIsoAt(5)->setQ296K(5.2268E+03);
    mol[0].getIsoAt(5)->setGj(36);
    mol[0].getIsoAt(5)->setMolarMass(20.020956);
    mol[0].getIsoAt(5)->setGlobalId(6);
    // 7 isotope
    mol[0].getIsoAt(6)->setIsoLog(262);
    mol[0].getIsoAt(6)->setTerrAbund(2.41970E-08);
    mol[0].getIsoAt(6)->setQ296K(1.0278E+03);
    mol[0].getIsoAt(6)->setGj(1);
    mol[0].getIsoAt(6)->setMolarMass(20.022915);
    mol[0].getIsoAt(6)->setGlobalId(129);

    // CO2 (2)
    mol[1].setMolName("CO2");
    mol[1].setChemForm("CO2");
    mol[1].setColor("#33cc33");
    mol[1].getIso()->resize(11);
    mol[1].setSelected(true);
    // 1 isotope
    mol[1].getIsoAt(0)->setIsoLog(626);
    mol[1].getIsoAt(0)->setTerrAbund(0.984204E+00);
    mol[1].getIsoAt(0)->setQ296K(2.8609E+02);
    mol[1].getIsoAt(0)->setGj(1);
    mol[1].getIsoAt(0)->setMolarMass(43.989830);
    mol[1].getIsoAt(0)->setGlobalId(7);
    // 2 isotope
    mol[1].getIsoAt(1)->setIsoLog(636);
    mol[1].getIsoAt(1)->setTerrAbund(1.10574E-02);
    mol[1].getIsoAt(1)->setQ296K(5.7664E+02);
    mol[1].getIsoAt(1)->setGj(2);
    mol[1].getIsoAt(1)->setMolarMass(44.993185);
    mol[1].getIsoAt(1)->setGlobalId(8);
    // 3 isotope
    mol[1].getIsoAt(2)->setIsoLog(628);
    mol[1].getIsoAt(2)->setTerrAbund(3.94707E-03);
    mol[1].getIsoAt(2)->setQ296K(6.0781E+02);
    mol[1].getIsoAt(2)->setGj(1);
    mol[1].getIsoAt(2)->setMolarMass(45.994076);
    mol[1].getIsoAt(2)->setGlobalId(9);
    // 4 isotope
    mol[1].getIsoAt(3)->setIsoLog(627);
    mol[1].getIsoAt(3)->setTerrAbund(7.33989E-04);
    mol[1].getIsoAt(3)->setQ296K(3.5426E+03);
    mol[1].getIsoAt(3)->setGj(6);
    mol[1].getIsoAt(3)->setMolarMass(44.994045);
    mol[1].getIsoAt(3)->setGlobalId(10);
    // 5 isotope
    mol[1].getIsoAt(4)->setIsoLog(638);
    mol[1].getIsoAt(4)->setTerrAbund(4.43446E-05);
    mol[1].getIsoAt(4)->setQ296K(1.2255E+03);
    mol[1].getIsoAt(4)->setGj(2);
    mol[1].getIsoAt(4)->setMolarMass(46.997431);
    mol[1].getIsoAt(4)->setGlobalId(11);
    // 6 isotope
    mol[1].getIsoAt(5)->setIsoLog(637);
    mol[1].getIsoAt(5)->setTerrAbund(8.24623E-06);
    mol[1].getIsoAt(5)->setQ296K(7.1413E+03);
    mol[1].getIsoAt(5)->setGj(12);
    mol[1].getIsoAt(5)->setMolarMass(45.997400);
    mol[1].getIsoAt(5)->setGlobalId(12);
    // 7 isotope
    mol[1].getIsoAt(6)->setIsoLog(828);
    mol[1].getIsoAt(6)->setTerrAbund(3.95734E-06);
    mol[1].getIsoAt(6)->setQ296K(3.2342E+02);
    mol[1].getIsoAt(6)->setGj(1);
    mol[1].getIsoAt(6)->setMolarMass(47.998322);
    mol[1].getIsoAt(6)->setGlobalId(13);
    // 8 isotope
    mol[1].getIsoAt(7)->setIsoLog(827);
    mol[1].getIsoAt(7)->setTerrAbund(1.47180E-06);
    mol[1].getIsoAt(7)->setQ296K(3.7666E+03);
    mol[1].getIsoAt(7)->setGj(6);
    mol[1].getIsoAt(7)->setMolarMass(46.998291);
    mol[1].getIsoAt(7)->setGlobalId(14);
    // 9 isotope
    mol[1].getIsoAt(8)->setIsoLog(727);
    mol[1].getIsoAt(8)->setTerrAbund(1.36847E-07);
    mol[1].getIsoAt(8)->setQ296K(1.0972E+04);
    mol[1].getIsoAt(8)->setGj(1);
    mol[1].getIsoAt(8)->setMolarMass(45.998262);
    mol[1].getIsoAt(8)->setGlobalId(121);
    // 10 isotope
    mol[1].getIsoAt(9)->setIsoLog(838);
    mol[1].getIsoAt(9)->setTerrAbund(4.44600E-08);
    mol[1].getIsoAt(9)->setQ296K(6.5224E+02);
    mol[1].getIsoAt(9)->setGj(2);
    mol[1].getIsoAt(9)->setMolarMass(49.001675);
    mol[1].getIsoAt(9)->setGlobalId(15);
    // 11 isotope
    mol[1].getIsoAt(10)->setIsoLog(837);
    mol[1].getIsoAt(10)->setTerrAbund(1.65354E-08);
    mol[1].getIsoAt(10)->setQ296K(7.5950E+03);
    mol[1].getIsoAt(10)->setGj(12);
    mol[1].getIsoAt(10)->setMolarMass(48.001646);
    mol[1].getIsoAt(10)->setGlobalId(120);
    // 12 isotope

    // O3 (3)
    mol[2].setMolName("O3");
    mol[2].setChemForm("O3");
    mol[2].setColor("#ff9900");
    mol[2].getIso()->resize(5);
    mol[2].setSelected(true);
    // 1 isotope
    mol[2].getIsoAt(0)->setIsoLog(666);
    mol[2].getIsoAt(0)->setTerrAbund(0.992901E+00);
    mol[2].getIsoAt(0)->setQ296K(3.4837E+03);
    mol[2].getIsoAt(0)->setGj(1);
    mol[2].getIsoAt(0)->setMolarMass(47.984745);
    mol[2].getIsoAt(0)->setGlobalId(16);
    // 2 isotope
    mol[2].getIsoAt(1)->setIsoLog(668);
    mol[2].getIsoAt(1)->setTerrAbund(3.98194E-03);
    mol[2].getIsoAt(1)->setQ296K(7.4657E+03);
    mol[2].getIsoAt(1)->setGj(1);
    mol[2].getIsoAt(1)->setMolarMass(49.988991);
    mol[2].getIsoAt(1)->setGlobalId(17);
    // 3 isotope
    mol[2].getIsoAt(2)->setIsoLog(686);
    mol[2].getIsoAt(2)->setTerrAbund(1.99097E-03);
    mol[2].getIsoAt(2)->setQ296K(3.6471E+03);
    mol[2].getIsoAt(2)->setGj(1);
    mol[2].getIsoAt(2)->setMolarMass(49.988991);
    mol[2].getIsoAt(2)->setGlobalId(18);
    // 4 isotope
    mol[2].getIsoAt(3)->setIsoLog(667);
    mol[2].getIsoAt(3)->setTerrAbund(7.40475E-04);
    mol[2].getIsoAt(3)->setQ296K(4.3331E+04);
    mol[2].getIsoAt(3)->setGj(6);
    mol[2].getIsoAt(3)->setMolarMass(48.988960);
    mol[2].getIsoAt(3)->setGlobalId(19);
    // 5 isotope
    mol[2].getIsoAt(4)->setIsoLog(676);
    mol[2].getIsoAt(4)->setTerrAbund(3.70237E-04);
    mol[2].getIsoAt(4)->setQ296K(2.1405E+04);
    mol[2].getIsoAt(4)->setGj(6);
    mol[2].getIsoAt(4)->setMolarMass(48.988960);
    mol[2].getIsoAt(4)->setGlobalId(20);

    // N2O (4)
    mol[3].setMolName("N2O");
    mol[3].setChemForm("N2O");
    mol[3].setColor("#ff00ff");
    mol[3].getIso()->resize(5);
    mol[3].setSelected(true);
    // 1 isotope
    mol[3].getIsoAt(0)->setIsoLog(446);
    mol[3].getIsoAt(0)->setTerrAbund(0.990333E+00);
    mol[3].getIsoAt(0)->setQ296K(4.9849E+03);
    mol[3].getIsoAt(0)->setGj(9);
    mol[3].getIsoAt(0)->setMolarMass(44.001062);
    mol[3].getIsoAt(0)->setGlobalId(21);
    // 2 isotope
    mol[3].getIsoAt(1)->setIsoLog(456);
    mol[3].getIsoAt(1)->setTerrAbund(3.3620E+03);
    mol[3].getIsoAt(1)->setQ296K(3.3619E+03);
    mol[3].getIsoAt(1)->setGj(6);
    mol[3].getIsoAt(1)->setMolarMass(44.998096);
    mol[3].getIsoAt(1)->setGlobalId(22);
    // 3 isotope
    mol[3].getIsoAt(2)->setIsoLog(546);
    mol[3].getIsoAt(2)->setTerrAbund(3.64093E-03);
    mol[3].getIsoAt(2)->setQ296K(3.4586E+03);
    mol[3].getIsoAt(2)->setGj(6);
    mol[3].getIsoAt(2)->setMolarMass(44.998096);
    mol[3].getIsoAt(2)->setGlobalId(23);
    // 4 isotope
    mol[3].getIsoAt(3)->setIsoLog(448);
    mol[3].getIsoAt(3)->setTerrAbund(1.98582E-03);
    mol[3].getIsoAt(3)->setQ296K(5.3147E+03);
    mol[3].getIsoAt(3)->setGj(9);
    mol[3].getIsoAt(3)->setMolarMass(46.005308);
    mol[3].getIsoAt(3)->setGlobalId(24);
    // 5 isotope
    mol[3].getIsoAt(4)->setIsoLog(447);
    mol[3].getIsoAt(4)->setTerrAbund(3.69280E-04);
    mol[3].getIsoAt(4)->setQ296K(3.0972E+04);
    mol[3].getIsoAt(4)->setGj(54);
    mol[3].getIsoAt(4)->setMolarMass(45.005278);
    mol[3].getIsoAt(4)->setGlobalId(25);

    // CO (5)
    mol[4].setMolName("CO");
    mol[4].setChemForm("CO");
    mol[4].setColor("#ff0000");
    mol[4].getIso()->resize(6);
    mol[4].setSelected(true);
    // 1 isotope
    mol[4].getIsoAt(0)->setIsoLog(26);
    mol[4].getIsoAt(0)->setTerrAbund(0.986544E+00);
    mol[4].getIsoAt(0)->setQ296K(1.0742E+02);
    mol[4].getIsoAt(0)->setGj(1);
    mol[4].getIsoAt(0)->setMolarMass(27.994915);
    mol[4].getIsoAt(0)->setGlobalId(26);
    // 2 isotope
    mol[4].getIsoAt(1)->setIsoLog(36);
    mol[4].getIsoAt(1)->setTerrAbund(1.10836E-02);
    mol[4].getIsoAt(1)->setQ296K(2.2469E+02);
    mol[4].getIsoAt(1)->setGj(2);
    mol[4].getIsoAt(1)->setMolarMass(28.998270);
    mol[4].getIsoAt(1)->setGlobalId(27);
    // 3 isotope
    mol[4].getIsoAt(2)->setIsoLog(28);
    mol[4].getIsoAt(2)->setTerrAbund(1.97822E-03);
    mol[4].getIsoAt(2)->setQ296K(1.1277E+02);
    mol[4].getIsoAt(2)->setGj(1);
    mol[4].getIsoAt(2)->setMolarMass(29.999161);
    mol[4].getIsoAt(2)->setGlobalId(28);
    // 4 isotope
    mol[4].getIsoAt(3)->setIsoLog(27);
    mol[4].getIsoAt(3)->setTerrAbund(3.67867E-04);
    mol[4].getIsoAt(3)->setQ296K(6.6117E+02);
    mol[4].getIsoAt(3)->setGj(6);
    mol[4].getIsoAt(3)->setMolarMass(28.999130);
    mol[4].getIsoAt(3)->setGlobalId(29);
    // 5 isotope
    mol[4].getIsoAt(4)->setIsoLog(38);
    mol[4].getIsoAt(4)->setTerrAbund(2.22250E-05);
    mol[4].getIsoAt(4)->setQ296K(2.3644E+02);
    mol[4].getIsoAt(4)->setGj(2);
    mol[4].getIsoAt(4)->setMolarMass(31.002516);
    mol[4].getIsoAt(4)->setGlobalId(30);
    // 6 isotope
    mol[4].getIsoAt(5)->setIsoLog(37);
    mol[4].getIsoAt(5)->setTerrAbund(4.13292E-06);
    mol[4].getIsoAt(5)->setQ296K(1.3847E+03);
    mol[4].getIsoAt(5)->setGj(12);
    mol[4].getIsoAt(5)->setMolarMass(30.002485);
    mol[4].getIsoAt(5)->setGlobalId(31);

    // CH4 (6)
    mol[5].setMolName("CH4");
    mol[5].setChemForm("CH4");
    mol[5].setColor("#cc6600");
    mol[5].getIso()->resize(4);
    mol[5].setSelected(true);
    // 1 isotope
    mol[5].getIsoAt(0)->setIsoLog(211);
    mol[5].getIsoAt(0)->setTerrAbund(0.988274E+00);
    mol[5].getIsoAt(0)->setQ296K(5.9048E+02);
    mol[5].getIsoAt(0)->setGj(1);
    mol[5].getIsoAt(0)->setMolarMass(16.031300);
    mol[5].getIsoAt(0)->setGlobalId(32);
    // 2 isotope
    mol[5].getIsoAt(1)->setIsoLog(311);
    mol[5].getIsoAt(1)->setTerrAbund(1.1808E+03);
    mol[5].getIsoAt(1)->setQ296K(1.1808E+03);
    mol[5].getIsoAt(1)->setGj(2);
    mol[5].getIsoAt(1)->setMolarMass(17.034655);
    mol[5].getIsoAt(1)->setGlobalId(33);
    // 3 isotope
    mol[5].getIsoAt(2)->setIsoLog(212);
    mol[5].getIsoAt(2)->setTerrAbund(6.15751E-04);
    mol[5].getIsoAt(2)->setQ296K(4.7947E+03);
    mol[5].getIsoAt(2)->setGj(3);
    mol[5].getIsoAt(2)->setMolarMass(17.037475);
    mol[5].getIsoAt(2)->setGlobalId(34);
    // 4 isotope
    mol[5].getIsoAt(3)->setIsoLog(312);
    mol[5].getIsoAt(3)->setTerrAbund(6.91785E-06);
    mol[5].getIsoAt(3)->setQ296K(9.5992E+03);
    mol[5].getIsoAt(3)->setGj(6);
    mol[5].getIsoAt(3)->setMolarMass(18.040830);
    mol[5].getIsoAt(3)->setGlobalId(35);

    // O2 (7)
    mol[6].setMolName("O2");
    mol[6].setChemForm("O2");
    mol[6].setColor("#e6d300");
    mol[6].getIso()->resize(3);
    mol[6].setSelected(true);
    // 1 isotope
    mol[6].getIsoAt(0)->setIsoLog(66);
    mol[6].getIsoAt(0)->setTerrAbund(0.995262E+00);
    mol[6].getIsoAt(0)->setQ296K(2.1573E+02);
    mol[6].getIsoAt(0)->setGj(1);
    mol[6].getIsoAt(0)->setMolarMass(31.989830);
    mol[6].getIsoAt(0)->setGlobalId(36);
    // 2 isotope
    mol[6].getIsoAt(1)->setIsoLog(68);
    mol[6].getIsoAt(1)->setTerrAbund(3.99141E-03);
    mol[6].getIsoAt(1)->setQ296K(4.5523E+02);
    mol[6].getIsoAt(1)->setGj(1);
    mol[6].getIsoAt(1)->setMolarMass(33.994076);
    mol[6].getIsoAt(1)->setGlobalId(37);
    // 3 isotope
    mol[6].getIsoAt(2)->setIsoLog(67);
    mol[6].getIsoAt(2)->setTerrAbund(7.42235E-04);
    mol[6].getIsoAt(2)->setQ296K(2.6581E+03);
    mol[6].getIsoAt(2)->setGj(6);
    mol[6].getIsoAt(2)->setMolarMass(32.994045);
    mol[6].getIsoAt(2)->setGlobalId(38);

    // NO (8)
    mol[7].setMolName("NO");
    mol[7].setChemForm("NO");
    mol[7].setColor("#b3b3b3");
    mol[7].getIso()->resize(3);
    mol[7].setSelected(true);
    // 1 isotope
    mol[7].getIsoAt(0)->setIsoLog(46);
    mol[7].getIsoAt(0)->setTerrAbund(0.993974E+00);
    mol[7].getIsoAt(0)->setQ296K(1.1421E+03);
    mol[7].getIsoAt(0)->setGj(3);
    mol[7].getIsoAt(0)->setMolarMass(29.997989);
    mol[7].getIsoAt(0)->setGlobalId(39);
    // 2 isotope
    mol[7].getIsoAt(1)->setIsoLog(56);
    mol[7].getIsoAt(1)->setTerrAbund(3.65431E-03);
    mol[7].getIsoAt(1)->setQ296K(7.8926E+02);
    mol[7].getIsoAt(1)->setGj(2);
    mol[7].getIsoAt(1)->setMolarMass(30.995023);
    mol[7].getIsoAt(1)->setGlobalId(40);
    // 3 isotope
    mol[7].getIsoAt(2)->setIsoLog(48);
    mol[7].getIsoAt(2)->setTerrAbund(1.99312E-03);
    mol[7].getIsoAt(2)->setQ296K(1.2044E+03);
    mol[7].getIsoAt(2)->setGj(3);
    mol[7].getIsoAt(2)->setMolarMass(32.002234);
    mol[7].getIsoAt(2)->setGlobalId(41);

    // SO2 (9)
    mol[8].setMolName("SO2");
    mol[8].setChemForm("SO2");
    mol[8].setColor("#0025e0");
    mol[8].getIso()->resize(2);
    mol[8].setSelected(true);
    // 1 isotope
    mol[8].getIsoAt(0)->setIsoLog(626);
    mol[8].getIsoAt(0)->setTerrAbund(0.945678E+00);
    mol[8].getIsoAt(0)->setQ296K(6.3403E+03);
    mol[8].getIsoAt(0)->setGj(1);
    mol[8].getIsoAt(0)->setMolarMass(63.961901);
    mol[8].getIsoAt(0)->setGlobalId(42);
    // 2 isotope
    mol[8].getIsoAt(1)->setIsoLog(646);
    mol[8].getIsoAt(1)->setTerrAbund(4.19503E-02);
    mol[8].getIsoAt(1)->setQ296K(6.3690E+03);
    mol[8].getIsoAt(1)->setGj(1);
    mol[8].getIsoAt(1)->setMolarMass(65.957695);
    mol[8].getIsoAt(1)->setGlobalId(43);

    // NO2 (10)
    mol[9].setMolName("NO2");
    mol[9].setChemForm("NO2");
    mol[9].setColor("#ff9f5b");
    mol[9].getIso()->resize(1);
    mol[9].setSelected(true);
    // 1 isotope
    mol[9].getIsoAt(0)->setIsoLog(646);
    mol[9].getIsoAt(0)->setTerrAbund(0.991616E+00);
    mol[9].getIsoAt(0)->setQ296K(1.3577E+04);
    mol[9].getIsoAt(0)->setGj(3);
    mol[9].getIsoAt(0)->setMolarMass(45.992904);
    mol[9].getIsoAt(0)->setGlobalId(44);

    // NH3 (11)
    mol[10].setMolName("NH3");
    mol[10].setChemForm("NH3");
    mol[10].setColor("#ff7d9e");
    mol[10].getIso()->resize(2);
    mol[10].setSelected(true);
    // 1 isotope
    mol[10].getIsoAt(0)->setIsoLog(4111);
    mol[10].getIsoAt(0)->setTerrAbund(0.995872E+00);
    mol[10].getIsoAt(0)->setQ296K(1.7252E+03);
    mol[10].getIsoAt(0)->setGj(3);
    mol[10].getIsoAt(0)->setMolarMass(17.026549);
    mol[10].getIsoAt(0)->setGlobalId(45);
    // 2 isotope
    mol[10].getIsoAt(1)->setIsoLog(5111);
    mol[10].getIsoAt(1)->setTerrAbund(3.66129E-03);
    mol[10].getIsoAt(1)->setQ296K(1.1533E+03);
    mol[10].getIsoAt(1)->setGj(2);
    mol[10].getIsoAt(1)->setMolarMass(18.023583);
    mol[10].getIsoAt(1)->setGlobalId(46);

    // HNO3 (12)
    mol[11].setMolName("HNO3");
    mol[11].setChemForm("HNO3");
    mol[11].setColor("#1f9b34");
    mol[11].getIso()->resize(2);
    mol[11].setSelected(true);
    // 1 isotope
    mol[11].getIsoAt(0)->setIsoLog(146);
    mol[11].getIsoAt(0)->setTerrAbund(0.989110E+00);
    mol[11].getIsoAt(0)->setQ296K(2.1393E+05);
    mol[11].getIsoAt(0)->setGj(6);
    mol[11].getIsoAt(0)->setMolarMass(62.995644);
    mol[11].getIsoAt(0)->setGlobalId(47);
    // 2 isotope
    mol[11].getIsoAt(1)->setIsoLog(156);
    mol[11].getIsoAt(1)->setTerrAbund(3.63600E-03);
    mol[11].getIsoAt(1)->setQ296K(1.4313E+05);
    mol[11].getIsoAt(1)->setGj(4);
    mol[11].getIsoAt(1)->setMolarMass(63.992680);
    mol[11].getIsoAt(1)->setGlobalId(117);

    // OH (13)
    mol[12].setMolName("OH");
    mol[12].setChemForm("OH");
    mol[12].setColor("#a84519");
    mol[12].getIso()->resize(3);
    mol[12].setSelected(true);
    // 1 isotope
    mol[12].getIsoAt(0)->setIsoLog(61);
    mol[12].getIsoAt(0)->setTerrAbund(0.997473E+00);
    mol[12].getIsoAt(0)->setQ296K(8.0348E+01);
    mol[12].getIsoAt(0)->setGj(2);
    mol[12].getIsoAt(0)->setMolarMass(17.002740);
    mol[12].getIsoAt(0)->setGlobalId(48);
    // 2 isotope
    mol[12].getIsoAt(1)->setIsoLog(81);
    mol[12].getIsoAt(1)->setTerrAbund(2.00014E-03);
    mol[12].getIsoAt(1)->setQ296K(8.0882E+01);
    mol[12].getIsoAt(1)->setGj(2);
    mol[12].getIsoAt(1)->setMolarMass(19.006986);
    mol[12].getIsoAt(1)->setGlobalId(49);
    // 3 isotope
    mol[12].getIsoAt(2)->setIsoLog(62);
    mol[12].getIsoAt(2)->setTerrAbund(1.55371E-04);
    mol[12].getIsoAt(2)->setQ296K(2.0932E+02);
    mol[12].getIsoAt(2)->setGj(3);
    mol[12].getIsoAt(2)->setMolarMass(18.008915);
    mol[12].getIsoAt(2)->setGlobalId(50);

    // HF (14)
    mol[13].setMolName("HF");
    mol[13].setChemForm("HF");
    mol[13].setColor("#d0ab31");
    mol[13].getIso()->resize(2);
    mol[13].setSelected(true);
    // 1 isotope
    mol[13].getIsoAt(0)->setIsoLog(19);
    mol[13].getIsoAt(0)->setTerrAbund(0.999844E+00);
    mol[13].getIsoAt(0)->setQ296K(4.1469E+01);
    mol[13].getIsoAt(0)->setGj(4);
    mol[13].getIsoAt(0)->setMolarMass(20.006229);
    mol[13].getIsoAt(0)->setGlobalId(51);
    // 2 isotope
    mol[13].getIsoAt(1)->setIsoLog(29);
    mol[13].getIsoAt(1)->setTerrAbund(1.55741E-04);
    mol[13].getIsoAt(1)->setQ296K(1.1591E+02);
    mol[13].getIsoAt(1)->setGj(6);
    mol[13].getIsoAt(1)->setMolarMass(21.012404);
    mol[13].getIsoAt(1)->setGlobalId(110);

    // HCl (15)
    mol[14].setMolName("HCl");
    mol[14].setChemForm("HCl");
    mol[14].setColor("#cf6f82");
    mol[14].getIso()->resize(4);
    mol[14].setSelected(true);
    // 1 isotope
    mol[14].getIsoAt(0)->setIsoLog(15);
    mol[14].getIsoAt(0)->setTerrAbund(0.757587E+00);
    mol[14].getIsoAt(0)->setQ296K(1.6065E+02);
    mol[14].getIsoAt(0)->setGj(8);
    mol[14].getIsoAt(0)->setMolarMass(35.976678);
    mol[14].getIsoAt(0)->setGlobalId(52);
    // 2 isotope
    mol[14].getIsoAt(1)->setIsoLog(17);
    mol[14].getIsoAt(1)->setTerrAbund(0.242257E+00);
    mol[14].getIsoAt(1)->setQ296K(1.6089E+02);
    mol[14].getIsoAt(1)->setGj(8);
    mol[14].getIsoAt(1)->setMolarMass(37.973729);
    mol[14].getIsoAt(1)->setGlobalId(53);
    // 3 isotope
    mol[14].getIsoAt(2)->setIsoLog(25);
    mol[14].getIsoAt(2)->setTerrAbund(1.18005E-04);
    mol[14].getIsoAt(2)->setQ296K(4.6278E+02);
    mol[14].getIsoAt(2)->setGj(12);
    mol[14].getIsoAt(2)->setMolarMass(36.982853);
    mol[14].getIsoAt(2)->setGlobalId(107);
    // 4 isotope
    mol[14].getIsoAt(3)->setIsoLog(27);
    mol[14].getIsoAt(3)->setTerrAbund(3.77350E-05);
    mol[14].getIsoAt(3)->setQ296K(4.6413E+02);
    mol[14].getIsoAt(3)->setGj(12);
    mol[14].getIsoAt(3)->setMolarMass(38.979904);
    mol[14].getIsoAt(3)->setGlobalId(108);

    // HBr (16)
    mol[15].setMolName("HBr");
    mol[15].setChemForm("HBr");
    mol[15].setColor("#7d6580");
    mol[15].getIso()->resize(4);
    mol[15].setSelected(true);
    // 1 isotope
    mol[15].getIsoAt(0)->setIsoLog(19);
    mol[15].getIsoAt(0)->setTerrAbund(0.506781E+00);
    mol[15].getIsoAt(0)->setQ296K(2.0017E+02);
    mol[15].getIsoAt(0)->setGj(8);
    mol[15].getIsoAt(0)->setMolarMass(79.926160);
    mol[15].getIsoAt(0)->setGlobalId(54);
    // 2 isotope
    mol[15].getIsoAt(1)->setIsoLog(11);
    mol[15].getIsoAt(1)->setTerrAbund(0.493063E+00);
    mol[15].getIsoAt(1)->setQ296K(2.0023E+02);
    mol[15].getIsoAt(1)->setGj(8);
    mol[15].getIsoAt(1)->setMolarMass(81.924115);
    mol[15].getIsoAt(1)->setGlobalId(55);
    // 3 isotope
    mol[15].getIsoAt(2)->setIsoLog(29);
    mol[15].getIsoAt(2)->setTerrAbund(7.89384E-05);
    mol[15].getIsoAt(2)->setQ296K(5.8640E+02);
    mol[15].getIsoAt(2)->setGj(12);
    mol[15].getIsoAt(2)->setMolarMass(80.932336);
    mol[15].getIsoAt(2)->setGlobalId(111);
    // 4 isotope
    mol[15].getIsoAt(3)->setIsoLog(21);
    mol[15].getIsoAt(3)->setTerrAbund(7.68016E-05);
    mol[15].getIsoAt(3)->setQ296K(5.8676E+02);
    mol[15].getIsoAt(3)->setGj(12);
    mol[15].getIsoAt(3)->setMolarMass(82.930289);
    mol[15].getIsoAt(3)->setGlobalId(112);

    // HI (17)
    mol[16].setMolName("HI");
    mol[16].setChemForm("HI");
    mol[16].setColor("#7b1ee5");
    mol[16].getIso()->resize(2);
    mol[16].setSelected(true);
    // 1 isotope
    mol[16].getIsoAt(0)->setIsoLog(17);
    mol[16].getIsoAt(0)->setTerrAbund(0.999844E+00);
    mol[16].getIsoAt(0)->setQ296K(3.8899E+02);
    mol[16].getIsoAt(0)->setGj(12);
    mol[16].getIsoAt(0)->setMolarMass(127.912297);
    mol[16].getIsoAt(0)->setGlobalId(56);
    // 2 isotope
    mol[16].getIsoAt(1)->setIsoLog(27);
    mol[16].getIsoAt(1)->setTerrAbund(1.55741E-04);
    mol[16].getIsoAt(1)->setQ296K(1.1471E+03);
    mol[16].getIsoAt(1)->setGj(18);
    mol[16].getIsoAt(1)->setMolarMass(128.918472);
    mol[16].getIsoAt(1)->setGlobalId(113);

    // ClO (18)
    mol[17].setMolName("ClO");
    mol[17].setChemForm("ClO");
    mol[17].setColor("#0e9feb");
    mol[17].getIso()->resize(2);
    mol[17].setSelected(true);
    // 1 isotope
    mol[17].getIsoAt(0)->setIsoLog(56);
    mol[17].getIsoAt(0)->setTerrAbund(0.755908E+00);
    mol[17].getIsoAt(0)->setQ296K(3.2746E+03);
    mol[17].getIsoAt(0)->setGj(4);
    mol[17].getIsoAt(0)->setMolarMass(50.963768);
    mol[17].getIsoAt(0)->setGlobalId(57);
    // 2 isotope
    mol[17].getIsoAt(1)->setIsoLog(76);
    mol[17].getIsoAt(1)->setTerrAbund(0.241720E+00);
    mol[17].getIsoAt(1)->setQ296K(3.3323E+03);
    mol[17].getIsoAt(1)->setGj(4);
    mol[17].getIsoAt(1)->setMolarMass(52.960819);
    mol[17].getIsoAt(1)->setGlobalId(58);

    // OCS (19)
    mol[18].setMolName("OCS");
    mol[18].setChemForm("OCS");
    mol[18].setColor("#689fa8");
    mol[18].getIso()->resize(5);
    mol[18].setSelected(true);
    // 1 isotope
    mol[18].getIsoAt(0)->setIsoLog(622);
    mol[18].getIsoAt(0)->setTerrAbund(0.937395E+00);
    mol[18].getIsoAt(0)->setQ296K(1.2210E+03);
    mol[18].getIsoAt(0)->setGj(1);
    mol[18].getIsoAt(0)->setMolarMass(59.966986);
    mol[18].getIsoAt(0)->setGlobalId(59);
    // 2 isotope
    mol[18].getIsoAt(1)->setIsoLog(624);
    mol[18].getIsoAt(1)->setTerrAbund(4.15828E-02);
    mol[18].getIsoAt(1)->setQ296K(1.2535E+03);
    mol[18].getIsoAt(1)->setGj(1);
    mol[18].getIsoAt(1)->setMolarMass(61.962780);
    mol[18].getIsoAt(1)->setGlobalId(60);
    // 3 isotope
    mol[18].getIsoAt(2)->setIsoLog(632);
    mol[18].getIsoAt(2)->setTerrAbund(1.05315E-02);
    mol[18].getIsoAt(2)->setQ296K(2.4841E+03);
    mol[18].getIsoAt(2)->setGj(2);
    mol[18].getIsoAt(2)->setMolarMass(60.970341);
    mol[18].getIsoAt(2)->setGlobalId(61);
    // 4 isotope
    mol[18].getIsoAt(3)->setIsoLog(623);
    mol[18].getIsoAt(3)->setTerrAbund(7.39908E-03);
    mol[18].getIsoAt(3)->setQ296K(4.9501E+03);
    mol[18].getIsoAt(3)->setGj(4);
    mol[18].getIsoAt(3)->setMolarMass(60.966371);
    mol[18].getIsoAt(3)->setGlobalId(62);
    // 5 isotope
    mol[18].getIsoAt(4)->setIsoLog(822);
    mol[18].getIsoAt(4)->setTerrAbund(1.87967E-03);
    mol[18].getIsoAt(4)->setQ296K(1.3138E+03);
    mol[18].getIsoAt(4)->setGj(1);
    mol[18].getIsoAt(4)->setMolarMass(61.971231);
    mol[18].getIsoAt(4)->setGlobalId(63);

    // H2CO (20)
    mol[19].setMolName("H2CO");
    mol[19].setChemForm("H2CO");
    mol[19].setColor("#ce0000");
    mol[19].getIso()->resize(3);
    mol[19].setSelected(true);
    // 1 isotope
    mol[19].getIsoAt(0)->setIsoLog(126);
    mol[19].getIsoAt(0)->setTerrAbund(0.986237E+00);
    mol[19].getIsoAt(0)->setQ296K(2.8445E+03);
    mol[19].getIsoAt(0)->setGj(1);
    mol[19].getIsoAt(0)->setMolarMass(30.010565);
    mol[19].getIsoAt(0)->setGlobalId(64);
    // 2 isotope
    mol[19].getIsoAt(1)->setIsoLog(136);
    mol[19].getIsoAt(1)->setTerrAbund(1.10802E-02);
    mol[19].getIsoAt(1)->setQ296K(5.8377E+03);
    mol[19].getIsoAt(1)->setGj(2);
    mol[19].getIsoAt(1)->setMolarMass(31.013920);
    mol[19].getIsoAt(1)->setGlobalId(65);
    // 3 isotope
    mol[19].getIsoAt(2)->setIsoLog(128);
    mol[19].getIsoAt(2)->setTerrAbund(1.97761E-03);
    mol[19].getIsoAt(2)->setQ296K(2.9864E+03);
    mol[19].getIsoAt(2)->setGj(1);
    mol[19].getIsoAt(2)->setMolarMass(32.014811);
    mol[19].getIsoAt(2)->setGlobalId(66);

    // HOCl (21)
    mol[20].setMolName("HOCl");
    mol[20].setChemForm("HOCl");
    mol[20].setColor("#13ba92");
    mol[20].getIso()->resize(2);
    mol[20].setSelected(true);
    // 1 isotope
    mol[20].getIsoAt(0)->setIsoLog(165);
    mol[20].getIsoAt(0)->setTerrAbund(0.755790E+00);
    mol[20].getIsoAt(0)->setQ296K(1.9275E+04);
    mol[20].getIsoAt(0)->setGj(8);
    mol[20].getIsoAt(0)->setMolarMass(51.971593);
    mol[20].getIsoAt(0)->setGlobalId(67);
    // 2 isotope
    mol[20].getIsoAt(1)->setIsoLog(167);
    mol[20].getIsoAt(1)->setTerrAbund(0.241683E+00);
    mol[20].getIsoAt(1)->setQ296K(1.9616E+04);
    mol[20].getIsoAt(1)->setGj(8);
    mol[20].getIsoAt(1)->setMolarMass(53.968644);
    mol[20].getIsoAt(1)->setGlobalId(68);

    // N2 (22)
    mol[21].setMolName("N2");
    mol[21].setChemForm("N2");
    mol[21].setColor("#ef9e62");
    mol[21].getIso()->resize(2);
    mol[21].setSelected(true);
    // 1 isotope
    mol[21].getIsoAt(0)->setIsoLog(44);
    mol[21].getIsoAt(0)->setTerrAbund(0.992687E+00);
    mol[21].getIsoAt(0)->setQ296K(4.6710E+02);
    mol[21].getIsoAt(0)->setGj(1);
    mol[21].getIsoAt(0)->setMolarMass(28.006148);
    mol[21].getIsoAt(0)->setGlobalId(69);
    // 2 isotope
    mol[21].getIsoAt(1)->setIsoLog(45);
    mol[21].getIsoAt(1)->setTerrAbund(7.47809E-03);
    mol[21].getIsoAt(1)->setQ296K(6.4410E+02);
    mol[21].getIsoAt(1)->setGj(6);
    mol[21].getIsoAt(1)->setMolarMass(29.003182);
    mol[21].getIsoAt(1)->setGlobalId(118);

    // HCN (23)
    mol[22].setMolName("HCN");
    mol[22].setChemForm("HCN");
    mol[22].setColor("#fd2f70");
    mol[22].getIso()->resize(3);
    mol[22].setSelected(true);
    // 1 isotope
    mol[22].getIsoAt(0)->setIsoLog(124);
    mol[22].getIsoAt(0)->setTerrAbund(0.985114E+00);
    mol[22].getIsoAt(0)->setQ296K(8.9220E+02);
    mol[22].getIsoAt(0)->setGj(6);
    mol[22].getIsoAt(0)->setMolarMass(27.010899);
    mol[22].getIsoAt(0)->setGlobalId(70);
    // 2 isotope
    mol[22].getIsoAt(1)->setIsoLog(134);
    mol[22].getIsoAt(1)->setTerrAbund(1.10676E-02);
    mol[22].getIsoAt(1)->setQ296K(1.8310E+03);
    mol[22].getIsoAt(1)->setGj(12);
    mol[22].getIsoAt(1)->setMolarMass(28.014254);
    mol[22].getIsoAt(1)->setGlobalId(71);
    // 3 isotope
    mol[22].getIsoAt(2)->setIsoLog(125);
    mol[22].getIsoAt(2)->setTerrAbund(3.62174E-03);
    mol[22].getIsoAt(2)->setQ296K(6.1528E+02);
    mol[22].getIsoAt(2)->setGj(4);
    mol[22].getIsoAt(2)->setMolarMass(28.007933);
    mol[22].getIsoAt(2)->setGlobalId(72);

    // CH3Cl (24)
    mol[23].setMolName("CH3Cl");
    mol[23].setChemForm("CH3Cl");
    mol[23].setColor("#5f0e8a");
    mol[23].getIso()->resize(2);
    mol[23].setSelected(true);
    // 1 isotope
    mol[23].getIsoAt(0)->setIsoLog(215);
    mol[23].getIsoAt(0)->setTerrAbund(0.748937E+00);
    mol[23].getIsoAt(0)->setQ296K(5.7916E+04);
    mol[23].getIsoAt(0)->setGj(4);
    mol[23].getIsoAt(0)->setMolarMass(49.992328);
    mol[23].getIsoAt(0)->setGlobalId(73);
    // 2 isotope
    mol[23].getIsoAt(1)->setIsoLog(217);
    mol[23].getIsoAt(1)->setTerrAbund(0.239491E+00);
    mol[23].getIsoAt(1)->setQ296K(5.8834E+04);
    mol[23].getIsoAt(1)->setGj(4);
    mol[23].getIsoAt(1)->setMolarMass(51.989379);
    mol[23].getIsoAt(1)->setGlobalId(74);

    // H2O2 (25)
    mol[24].setMolName("H2O2");
    mol[24].setChemForm("H2O2");
    mol[24].setColor("#91505c");
    mol[24].getIso()->resize(1);
    mol[24].setSelected(true);
    // 1 isotope
    mol[24].getIsoAt(0)->setIsoLog(1661);
    mol[24].getIsoAt(0)->setTerrAbund(0.994952E+00);
    mol[24].getIsoAt(0)->setQ296K(9.8480E+03);
    mol[24].getIsoAt(0)->setGj(1);
    mol[24].getIsoAt(0)->setMolarMass(34.005480);
    mol[24].getIsoAt(0)->setGlobalId(75);

    // C2H2 (26)
    mol[25].setMolName("C2H2");
    mol[25].setChemForm("C2H2");
    mol[25].setColor("#5ead7b");
    mol[25].getIso()->resize(3);
    mol[25].setSelected(true);
    // 1 isotope
    mol[25].getIsoAt(0)->setIsoLog(1221);
    mol[25].getIsoAt(0)->setTerrAbund(0.977599E+00);
    mol[25].getIsoAt(0)->setQ296K(4.1245E+02);
    mol[25].getIsoAt(0)->setGj(1);
    mol[25].getIsoAt(0)->setMolarMass(26.015650);
    mol[25].getIsoAt(0)->setGlobalId(76);
    // 2 isotope
    mol[25].getIsoAt(1)->setIsoLog(1231);
    mol[25].getIsoAt(1)->setTerrAbund(2.19663E-02);
    mol[25].getIsoAt(1)->setQ296K(1.6562E+03);
    mol[25].getIsoAt(1)->setGj(8);
    mol[25].getIsoAt(1)->setMolarMass(27.019005);
    mol[25].getIsoAt(1)->setGlobalId(77);
    // 3 isotope
    mol[25].getIsoAt(2)->setIsoLog(1222);
    mol[25].getIsoAt(2)->setTerrAbund(3.04550E-04);
    mol[25].getIsoAt(2)->setQ296K(1.5818E+03);
    mol[25].getIsoAt(2)->setGj(6);
    mol[25].getIsoAt(2)->setMolarMass(27.021825);
    mol[25].getIsoAt(2)->setGlobalId(105);

    // C2H6 (27)
    mol[26].setMolName("C2H6");
    mol[26].setChemForm("C2H6");
    mol[26].setColor("#d17337");
    mol[26].getIso()->resize(2);
    mol[26].setSelected(true);
    // 1 isotope
    mol[26].getIsoAt(0)->setIsoLog(1221);
    mol[26].getIsoAt(0)->setTerrAbund(0.976990E+00);
    mol[26].getIsoAt(0)->setQ296K(7.0883E+04);
    mol[26].getIsoAt(0)->setGj(1);
    mol[26].getIsoAt(0)->setMolarMass(30.046950);
    mol[26].getIsoAt(0)->setGlobalId(78);
    // 2 isotope
    mol[26].getIsoAt(1)->setIsoLog(1231);
    mol[26].getIsoAt(1)->setTerrAbund(2.19526E-02);
    mol[26].getIsoAt(1)->setQ296K(3.6192E+04);
    mol[26].getIsoAt(1)->setGj(2);
    mol[26].getIsoAt(1)->setMolarMass(31.050305);
    mol[26].getIsoAt(1)->setGlobalId(106);

    // PH3 (28)
    mol[27].setMolName("PH3");
    mol[27].setChemForm("PH3");
    mol[27].setColor("#1568c8");
    mol[27].getIso()->resize(1);
    mol[27].setSelected(true);
    // 1 isotope
    mol[27].getIsoAt(0)->setIsoLog(1111);
    mol[27].getIsoAt(0)->setTerrAbund(0.999533E+00);
    mol[27].getIsoAt(0)->setQ296K(3.2494E+03);
    mol[27].getIsoAt(0)->setGj(2);
    mol[27].getIsoAt(0)->setMolarMass(33.997238);
    mol[27].getIsoAt(0)->setGlobalId(79);

    // COF2 (29)
    mol[28].setMolName("COF2");
    mol[28].setChemForm("COF2");
    mol[28].setColor("#af8d00");
    mol[28].getIso()->resize(2);
    mol[28].setSelected(true);
    // 1 isotope
    mol[28].getIsoAt(0)->setIsoLog(269);
    mol[28].getIsoAt(0)->setTerrAbund(0.986544E+00);
    mol[28].getIsoAt(0)->setQ296K(7.0028E+04);
    mol[28].getIsoAt(0)->setGj(1);
    mol[28].getIsoAt(0)->setMolarMass(65.991722);
    mol[28].getIsoAt(0)->setGlobalId(80);
    // 2 isotope
    mol[28].getIsoAt(1)->setIsoLog(369);
    mol[28].getIsoAt(1)->setTerrAbund(1.10834E-02);
    mol[28].getIsoAt(1)->setQ296K(1.4006E+05);
    mol[28].getIsoAt(1)->setGj(2);
    mol[28].getIsoAt(1)->setMolarMass(66.995083);
    mol[28].getIsoAt(1)->setGlobalId(119);

    // SF6 (30)
    mol[29].setMolName("SF6");
    mol[29].setChemForm("SF6");
    mol[29].setColor("#1ab248");
    mol[29].getIso()->resize(1);
    mol[29].setSelected(true);
    // 1 isotope
    mol[29].getIsoAt(0)->setIsoLog(29);
    mol[29].getIsoAt(0)->setTerrAbund(0.950180E+00);
    mol[29].getIsoAt(0)->setQ296K(1.6233E+06);
    mol[29].getIsoAt(0)->setGj(1);
    mol[29].getIsoAt(0)->setMolarMass(145.962492);
    mol[29].getIsoAt(0)->setGlobalId(-1);

    // H2S (31)
    mol[30].setMolName("H2S");
    mol[30].setChemForm("H2S");
    mol[30].setColor("#cc1958");
    mol[30].getIso()->resize(3);
    mol[30].setSelected(true);
    // 1 isotope
    mol[30].getIsoAt(0)->setIsoLog(121);
    mol[30].getIsoAt(0)->setTerrAbund(0.949884E+00);
    mol[30].getIsoAt(0)->setQ296K(5.0579E+02);
    mol[30].getIsoAt(0)->setGj(1);
    mol[30].getIsoAt(0)->setMolarMass(33.987721);
    mol[30].getIsoAt(0)->setGlobalId(81);
    // 1 isotope
    mol[30].getIsoAt(1)->setIsoLog(141);
    mol[30].getIsoAt(1)->setTerrAbund(4.21369E-02);
    mol[30].getIsoAt(1)->setQ296K(5.0435E+02);
    mol[30].getIsoAt(1)->setGj(1);
    mol[30].getIsoAt(1)->setMolarMass(35.983515);
    mol[30].getIsoAt(1)->setGlobalId(82);
    // 1 isotope
    mol[30].getIsoAt(2)->setIsoLog(131);
    mol[30].getIsoAt(2)->setTerrAbund(7.49766E-03);
    mol[30].getIsoAt(2)->setQ296K(2.0149E+03);
    mol[30].getIsoAt(2)->setGj(4);
    mol[30].getIsoAt(2)->setMolarMass(34.987105);
    mol[30].getIsoAt(2)->setGlobalId(83);

    // HCOOH (32)
    mol[31].setMolName("HCOOH");
    mol[31].setChemForm("HCOOH");
    mol[31].setColor("#174e26");
    mol[31].getIso()->resize(1);
    mol[31].setSelected(true);
    // 1 isotope
    mol[31].getIsoAt(0)->setIsoLog(126);
    mol[31].getIsoAt(0)->setTerrAbund(0.983898E+00);
    mol[31].getIsoAt(0)->setQ296K(3.9133E+04);
    mol[31].getIsoAt(0)->setGj(4);
    mol[31].getIsoAt(0)->setMolarMass(46.005480);
    mol[31].getIsoAt(0)->setGlobalId(84);

    // HO2 (33)
    mol[32].setMolName("HO2");
    mol[32].setChemForm("HO2");
    mol[32].setColor("#b9c5ff");
    mol[32].getIso()->resize(1);
    mol[32].setSelected(true);
    // 1 isotope
    mol[32].getIsoAt(0)->setIsoLog(166);
    mol[32].getIsoAt(0)->setTerrAbund(0.995107E+00);
    mol[32].getIsoAt(0)->setQ296K(4.3004E+03);
    mol[32].getIsoAt(0)->setGj(2);
    mol[32].getIsoAt(0)->setMolarMass(32.997655);
    mol[32].getIsoAt(0)->setGlobalId(85);

    // O (34)
    mol[33].setMolName("O");
    mol[33].setChemForm("O");
    mol[33].setColor("#c84bf2");
    mol[33].getIso()->resize(1);
    mol[33].setSelected(true);
    // 1 isotope
    mol[33].getIsoAt(0)->setIsoLog(6);
    mol[33].getIsoAt(0)->setTerrAbund(0.997628E+00);
    mol[33].getIsoAt(0)->setQ296K(6.7212E+00);
    mol[33].getIsoAt(0)->setGj(1);
    mol[33].getIsoAt(0)->setMolarMass(15.994915);
    mol[33].getIsoAt(0)->setGlobalId(86);

    // ClONO2 (35)
    mol[34].setMolName("ClONO2");
    mol[34].setChemForm("ClONO2");
    mol[34].setColor("#5fbf28");
    mol[34].getIso()->resize(2);
    mol[34].setSelected(true);
    // 1 isotope
    mol[34].getIsoAt(0)->setIsoLog(5646);
    mol[34].getIsoAt(0)->setTerrAbund(0.749570E+00);
    mol[34].getIsoAt(0)->setQ296K(4.7884E+06);
    mol[34].getIsoAt(0)->setGj(12);
    mol[34].getIsoAt(0)->setMolarMass(96.956672);
    mol[34].getIsoAt(0)->setGlobalId(127);  // Used to be unavailable, before HITRAN 2016
    // 2 isotope
    mol[34].getIsoAt(1)->setIsoLog(7646);
    mol[34].getIsoAt(1)->setTerrAbund(0.239694E+00);
    mol[34].getIsoAt(1)->setQ296K(4.9102E+06);
    mol[34].getIsoAt(1)->setGj(12);
    mol[34].getIsoAt(1)->setMolarMass(98.953723);
    mol[34].getIsoAt(1)->setGlobalId(128);  // Used to be unavailable, before HITRAN 2016

    // NO+ (36)
    mol[35].setMolName("NO+");
    mol[35].setChemForm("NO+");
    mol[35].setColor("#0f32f7");
    mol[35].getIso()->resize(1);
    mol[35].setSelected(true);
    // 1 isotope
    mol[35].getIsoAt(0)->setIsoLog(46);
    mol[35].getIsoAt(0)->setTerrAbund(0.993974E+00);
    mol[35].getIsoAt(0)->setQ296K(3.1169E+02);
    mol[35].getIsoAt(0)->setGj(3);
    mol[35].getIsoAt(0)->setMolarMass(29.997989);
    mol[35].getIsoAt(0)->setGlobalId(87);

    // HOBr (37)
    mol[36].setMolName("HOBr");
    mol[36].setChemForm("HOBr");
    mol[36].setColor("#e0982b");
    mol[36].getIso()->resize(2);
    mol[36].setSelected(true);
    // 1 isotope
    mol[36].getIsoAt(0)->setIsoLog(169);
    mol[36].getIsoAt(0)->setTerrAbund(0.505579E+00);
    mol[36].getIsoAt(0)->setQ296K(2.8339E+04);
    mol[36].getIsoAt(0)->setGj(8);
    mol[36].getIsoAt(0)->setMolarMass(95.921076);
    mol[36].getIsoAt(0)->setGlobalId(88);
    // 2 isotope
    mol[36].getIsoAt(1)->setIsoLog(161);
    mol[36].getIsoAt(1)->setTerrAbund(0.491894E+00);
    mol[36].getIsoAt(1)->setQ296K(2.8238E+04);
    mol[36].getIsoAt(1)->setGj(8);
    mol[36].getIsoAt(1)->setMolarMass(97.919027);
    mol[36].getIsoAt(1)->setGlobalId(89);

    // C2H4 (38)
    mol[37].setMolName("C2H4");
    mol[37].setChemForm("C2H4");
    mol[37].setColor("#cd1967");
    mol[37].getIso()->resize(2);
    mol[37].setSelected(true);
    // 1 isotope
    mol[37].getIsoAt(0)->setIsoLog(221);
    mol[37].getIsoAt(0)->setTerrAbund(0.977294E+00);
    mol[37].getIsoAt(0)->setQ296K(1.1042E+04);
    mol[37].getIsoAt(0)->setGj(1);
    mol[37].getIsoAt(0)->setMolarMass(28.031300);
    mol[37].getIsoAt(0)->setGlobalId(90);
    // 2 isotope
    mol[37].getIsoAt(1)->setIsoLog(231);
    mol[37].getIsoAt(1)->setTerrAbund(2.19595E-02);
    mol[37].getIsoAt(1)->setQ296K(4.5197E+04);
    mol[37].getIsoAt(1)->setGj(2);
    mol[37].getIsoAt(1)->setMolarMass(29.034655);
    mol[37].getIsoAt(1)->setGlobalId(91);

    // CH3OH (39)
    mol[38].setMolName("CH3OH");
    mol[38].setChemForm("CH3OH");
    mol[38].setColor("#51ca78");
    mol[38].getIso()->resize(1);
    mol[38].setSelected(true);
    // 1 isotope
    mol[38].getIsoAt(0)->setIsoLog(2161);
    mol[38].getIsoAt(0)->setTerrAbund(0.985930E+00);
    mol[38].getIsoAt(0)->setQ296K(7.0570E+04);
    mol[38].getIsoAt(0)->setGj(2);
    mol[38].getIsoAt(0)->setMolarMass(32.026215);
    mol[38].getIsoAt(0)->setGlobalId(92);

    // CH3Br (40)
    mol[39].setMolName("CH3Br");
    mol[39].setChemForm("CH3Br");
    mol[39].setColor("#eb1d3a");
    mol[39].getIso()->resize(2);
    mol[39].setSelected(true);
    // 1 isotope
    mol[39].getIsoAt(0)->setIsoLog(219);
    mol[39].getIsoAt(0)->setTerrAbund(0.500995E+00);
    mol[39].getIsoAt(0)->setQ296K(8.3052E+04);
    mol[39].getIsoAt(0)->setGj(4);
    mol[39].getIsoAt(0)->setMolarMass(93.941811);
    mol[39].getIsoAt(0)->setGlobalId(93);
    // 2 isotope
    mol[39].getIsoAt(1)->setIsoLog(211);
    mol[39].getIsoAt(1)->setTerrAbund(0.487433E+00);
    mol[39].getIsoAt(1)->setQ296K(8.3395E+04);
    mol[39].getIsoAt(1)->setGj(4);
    mol[39].getIsoAt(1)->setMolarMass(95.939764);
    mol[39].getIsoAt(1)->setGlobalId(94);

    // CH3CN (41)
    mol[40].setMolName("CH3CN");
    mol[40].setChemForm("CH3CN");
    mol[40].setColor("#7a9d45");
    mol[40].getIso()->resize(1);
    mol[40].setSelected(true);
    // 1 isotope
    mol[40].getIsoAt(0)->setIsoLog(2124);
    mol[40].getIsoAt(0)->setTerrAbund(0.973866E+00);
    mol[40].getIsoAt(0)->setQ296K(8.8672E+04);
    mol[40].getIsoAt(0)->setGj(3);
    mol[40].getIsoAt(0)->setMolarMass(41.026549);
    mol[40].getIsoAt(0)->setGlobalId(95);

    // CF4 (42)
    mol[41].setMolName("CF4");
    mol[41].setChemForm("CF4");
    mol[41].setColor("#da7c95");
    mol[41].getIso()->resize(1);
    mol[41].setSelected(true);
    // 1 isotope
    mol[41].getIsoAt(0)->setIsoLog(29);
    mol[41].getIsoAt(0)->setTerrAbund(0.988890E+00);
    mol[41].getIsoAt(0)->setQ296K(1.2127E+05);
    mol[41].getIsoAt(0)->setGj(1);
    mol[41].getIsoAt(0)->setMolarMass(87.993616);
    mol[41].getIsoAt(0)->setGlobalId(96);

    // C4H2 (43)
    mol[42].setMolName("C4H2");
    mol[42].setChemForm("C4H2");
    mol[42].setColor("#406cb8");
    mol[42].getIso()->resize(1);
    mol[42].setSelected(true);
    // 1 isotope
    mol[42].getIsoAt(0)->setIsoLog(2211);
    mol[42].getIsoAt(0)->setTerrAbund(0.955998E+00);
    mol[42].getIsoAt(0)->setQ296K(9.8190E+03);
    mol[42].getIsoAt(0)->setGj(1);
    mol[42].getIsoAt(0)->setMolarMass(50.015650);
    mol[42].getIsoAt(0)->setGlobalId(116);

    // HC3N (44)
    mol[43].setMolName("HC3N");
    mol[43].setChemForm("HC3N");
    mol[43].setColor("#c27eec");
    mol[43].getIso()->resize(1);
    mol[43].setSelected(true);
    // 1 isotope
    mol[43].getIsoAt(0)->setIsoLog(1224);
    mol[43].getIsoAt(0)->setTerrAbund(0.963346E+00);
    mol[43].getIsoAt(0)->setQ296K(2.4787E+04);
    mol[43].getIsoAt(0)->setGj(6);
    mol[43].getIsoAt(0)->setMolarMass(51.010899);
    mol[43].getIsoAt(0)->setGlobalId(109);

    // H2 (45)
    mol[44].setMolName("H2");
    mol[44].setChemForm("H2");
    mol[44].setColor("#edf52a");
    mol[44].getIso()->resize(2);
    mol[44].setSelected(true);
    // 1 isotope
    mol[44].getIsoAt(0)->setIsoLog(11);
    mol[44].getIsoAt(0)->setTerrAbund(0.999688E+00);
    mol[44].getIsoAt(0)->setQ296K(7.6712E+00);
    mol[44].getIsoAt(0)->setGj(1);
    mol[44].getIsoAt(0)->setMolarMass(2.0156500);
    mol[44].getIsoAt(0)->setGlobalId(103);
    // 2 isotope
    mol[44].getIsoAt(1)->setIsoLog(12);
    mol[44].getIsoAt(1)->setTerrAbund(3.11432E-04);
    mol[44].getIsoAt(1)->setQ296K(2.9874E+01);
    mol[44].getIsoAt(1)->setGj(6);
    mol[44].getIsoAt(1)->setMolarMass(3.0218250);
    mol[44].getIsoAt(1)->setGlobalId(115);

    // CS (46)
    mol[45].setMolName("CS");
    mol[45].setChemForm("CS");
    mol[45].setColor("#1cdc17");
    mol[45].getIso()->resize(4);
    mol[45].setSelected(true);
    // 1 isotope
    mol[45].getIsoAt(0)->setIsoLog(22);
    mol[45].getIsoAt(0)->setTerrAbund(0.939624E+00);
    mol[45].getIsoAt(0)->setQ296K(2.5362E+02);
    mol[45].getIsoAt(0)->setGj(1);
    mol[45].getIsoAt(0)->setMolarMass(43.971036);
    mol[45].getIsoAt(0)->setGlobalId(97);
    // 2 isotope
    mol[45].getIsoAt(1)->setIsoLog(24);
    mol[45].getIsoAt(1)->setTerrAbund(0.416817E-01);
    mol[45].getIsoAt(1)->setQ296K(2.5777E+02);
    mol[45].getIsoAt(1)->setGj(1);
    mol[45].getIsoAt(1)->setMolarMass(45.966787);
    mol[45].getIsoAt(1)->setGlobalId(98);
    // 3 isotope
    mol[45].getIsoAt(2)->setIsoLog(32);
    mol[45].getIsoAt(2)->setTerrAbund(0.105565E-01);
    mol[45].getIsoAt(2)->setQ296K(5.3750E+02);
    mol[45].getIsoAt(2)->setGj(2);
    mol[45].getIsoAt(2)->setMolarMass(44.974368);
    mol[45].getIsoAt(2)->setGlobalId(99);
    // 4 isotope
    mol[45].getIsoAt(3)->setIsoLog(23);
    mol[45].getIsoAt(3)->setTerrAbund(0.741668E-02);
    mol[45].getIsoAt(3)->setQ296K(1.0230E+03);
    mol[45].getIsoAt(3)->setGj(4);
    mol[45].getIsoAt(3)->setMolarMass(44.970399);
    mol[45].getIsoAt(3)->setGlobalId(100);

    // SO3 (47)
    mol[46].setMolName("SO3");
    mol[46].setChemForm("SO3");
    mol[46].setColor("#5f3546");
    mol[46].getIso()->resize(1);
    mol[46].setSelected(true);
    // 1 isotope
    mol[46].getIsoAt(0)->setIsoLog(26);
    mol[46].getIsoAt(0)->setTerrAbund(0.943400E+00);
    mol[46].getIsoAt(0)->setQ296K(7.7833E+03);
    mol[46].getIsoAt(0)->setGj(1);
    mol[46].getIsoAt(0)->setMolarMass(79.956820);
    mol[46].getIsoAt(0)->setGlobalId(114);

    // C2N2 (48)
    mol[47].setMolName("C2N2");
    mol[47].setChemForm("C2N2");
    mol[47].setColor("#1f3546");
    mol[47].getIso()->resize(1);
    mol[47].setSelected(true);
    // 1 isotope
    mol[47].getIsoAt(0)->setIsoLog(4224);
    mol[47].getIsoAt(0)->setTerrAbund(9.70752E-01);
    mol[47].getIsoAt(0)->setQ296K(1.5582E+04);
    mol[47].getIsoAt(0)->setGj(1);
    mol[47].getIsoAt(0)->setMolarMass(52.006148);
    mol[47].getIsoAt(0)->setGlobalId(123);

    // COCl2 (49)
    mol[48].setMolName("COCl2");
    mol[48].setChemForm("COCl2");
    mol[48].setColor("#3f3546");
    mol[48].getIso()->resize(2);
    mol[48].setSelected(true);
    // 1 isotope
    mol[48].getIsoAt(0)->setIsoLog(2655);
    mol[48].getIsoAt(0)->setTerrAbund(5.66392E-01);
    mol[48].getIsoAt(0)->setQ296K(1.4800E+06);
    mol[48].getIsoAt(0)->setGj(1);
    mol[48].getIsoAt(0)->setMolarMass(97.932620);
    mol[48].getIsoAt(0)->setGlobalId(124);
    // 2 isotope
    mol[48].getIsoAt(1)->setIsoLog(2657);
    mol[48].getIsoAt(1)->setTerrAbund(3.62235E-01);
    mol[48].getIsoAt(1)->setQ296K(3.0435E+06);
    mol[48].getIsoAt(1)->setGj(1);
    mol[48].getIsoAt(1)->setMolarMass(99.929670);
    mol[48].getIsoAt(1)->setGlobalId(125);

    // Populating the abundances with the terrestrial abundnces
    for (i = 0; i < mol.count(); i++)
    {
        for (j = 0; j < mol[i].getIso()->count(); j++)
        {
            mol[i].getIsoAt(j)->setAbund(mol[i].getIsoAt(j)->getTerrAbund());
        }
    }

    // Initializing colors
    initColorsAndGlobalIds();
}

// Method to initialize colors for molecules
void Params::initColorsAndGlobalIds()
{
    // Add - Initialize all molecules with random colors first just in case some are not manually assigned here
    // Or else come up with a consistent color assignment scheme which would result in the same color upon each load

    // Initializing the isotopes global ids
    // H2O (1)
    // 1 isotope
    mol[0].getIsoAt(0)->setGlobalId(1);
    // 2 isotope
    mol[0].getIsoAt(1)->setGlobalId(2);
    // 3 isotope
    mol[0].getIsoAt(2)->setGlobalId(3);
    // 4 isotope
    mol[0].getIsoAt(3)->setGlobalId(4);
    // 5 isotope
    mol[0].getIsoAt(4)->setGlobalId(5);
    // 6 isotope
    mol[0].getIsoAt(5)->setGlobalId(6);
    // 7 isotope
    mol[0].getIsoAt(6)->setGlobalId(129);

    // CO2 (2)
    // 1 isotope
    mol[1].getIsoAt(0)->setGlobalId(7);
    // 2 isotope
    mol[1].getIsoAt(1)->setGlobalId(8);
    // 3 isotope
    mol[1].getIsoAt(2)->setGlobalId(9);
    // 4 isotope
    mol[1].getIsoAt(3)->setGlobalId(10);
    // 5 isotope
    mol[1].getIsoAt(4)->setGlobalId(11);
    // 6 isotope
    mol[1].getIsoAt(5)->setGlobalId(12);
    // 7 isotope
    mol[1].getIsoAt(6)->setGlobalId(13);
    // 8 isotope
    mol[1].getIsoAt(7)->setGlobalId(14);
    // 9 isotope
    mol[1].getIsoAt(8)->setGlobalId(121);
    // 10 isotope
    mol[1].getIsoAt(9)->setGlobalId(15);
    // 11 isotope
    mol[1].getIsoAt(10)->setGlobalId(120);

    // O3 (3)
    // 1 isotope
    mol[2].getIsoAt(0)->setGlobalId(16);
    // 2 isotope
    mol[2].getIsoAt(1)->setGlobalId(17);
    // 3 isotope
    mol[2].getIsoAt(2)->setGlobalId(18);
    // 4 isotope
    mol[2].getIsoAt(3)->setGlobalId(19);
    // 5 isotope
    mol[2].getIsoAt(4)->setGlobalId(20);

    // N2O (4)
    // 1 isotope
    mol[3].getIsoAt(0)->setGlobalId(21);
    // 2 isotope
    mol[3].getIsoAt(1)->setGlobalId(22);
    // 3 isotope
    mol[3].getIsoAt(2)->setGlobalId(23);
    // 4 isotope
    mol[3].getIsoAt(3)->setGlobalId(24);
    // 5 isotope
    mol[3].getIsoAt(4)->setGlobalId(25);

    // CO (5)
    // 1 isotope
    mol[4].getIsoAt(0)->setGlobalId(26);
    // 2 isotope
    mol[4].getIsoAt(1)->setGlobalId(27);
    // 3 isotope
    mol[4].getIsoAt(2)->setGlobalId(28);
    // 4 isotope
    mol[4].getIsoAt(3)->setGlobalId(29);
    // 5 isotope
    mol[4].getIsoAt(4)->setGlobalId(30);
    // 6 isotope
    mol[4].getIsoAt(5)->setGlobalId(31);

    // CH4 (6)
    // 1 isotope
    mol[5].getIsoAt(0)->setGlobalId(32);
    // 2 isotope
    mol[5].getIsoAt(1)->setGlobalId(33);
    // 3 isotope
    mol[5].getIsoAt(2)->setGlobalId(34);
    // 4 isotope
    mol[5].getIsoAt(3)->setGlobalId(35);

    // O2 (7)
    // 1 isotope
    mol[6].getIsoAt(0)->setGlobalId(36);
    // 2 isotope
    mol[6].getIsoAt(1)->setGlobalId(37);
    // 3 isotope
    mol[6].getIsoAt(2)->setGlobalId(38);

    // NO (8)
    // 1 isotope
    mol[7].getIsoAt(0)->setGlobalId(39);
    // 2 isotope
    mol[7].getIsoAt(1)->setGlobalId(40);
    // 3 isotope
    mol[7].getIsoAt(2)->setGlobalId(41);

    // SO2 (9)
    // 1 isotope
    mol[8].getIsoAt(0)->setGlobalId(42);
    // 2 isotope
    mol[8].getIsoAt(1)->setGlobalId(43);

    // NO2 (10)
    // 1 isotope
    mol[9].getIsoAt(0)->setGlobalId(44);

    // NH3 (11)
    // 1 isotope
    mol[10].getIsoAt(0)->setGlobalId(45);
    // 2 isotope
    mol[10].getIsoAt(1)->setGlobalId(46);

    // HNO3 (12)
    // 1 isotope
    mol[11].getIsoAt(0)->setGlobalId(47);
    // 2 isotope
    mol[11].getIsoAt(1)->setGlobalId(117);

    // OH (13)
    // 1 isotope
    mol[12].getIsoAt(0)->setGlobalId(48);
    // 2 isotope
    mol[12].getIsoAt(1)->setGlobalId(49);
    // 3 isotope
    mol[12].getIsoAt(2)->setGlobalId(50);

    // HF (14)
    // 1 isotope
    mol[13].getIsoAt(0)->setGlobalId(51);
    // 2 isotope
    mol[13].getIsoAt(1)->setGlobalId(110);

    // HCl (15)
    // 1 isotope
    mol[14].getIsoAt(0)->setGlobalId(52);
    // 2 isotope
    mol[14].getIsoAt(1)->setGlobalId(53);
    // 3 isotope
    mol[14].getIsoAt(2)->setGlobalId(107);
    // 4 isotope
    mol[14].getIsoAt(3)->setGlobalId(108);

    // HBr (16)
    // 1 isotope
    mol[15].getIsoAt(0)->setGlobalId(54);
    // 2 isotope
    mol[15].getIsoAt(1)->setGlobalId(55);
    // 3 isotope
    mol[15].getIsoAt(2)->setGlobalId(111);
    // 4 isotope
    mol[15].getIsoAt(3)->setGlobalId(112);

    // HI (17)
    // 1 isotope
    mol[16].getIsoAt(0)->setGlobalId(56);
    // 2 isotope
    mol[16].getIsoAt(1)->setGlobalId(113);

    // ClO (18)
    // 1 isotope
    mol[17].getIsoAt(0)->setGlobalId(57);
    // 2 isotope
    mol[17].getIsoAt(1)->setGlobalId(58);

    // OCS (19)
    // 1 isotope
    mol[18].getIsoAt(0)->setGlobalId(59);
    // 2 isotope
    mol[18].getIsoAt(1)->setGlobalId(60);
    // 3 isotope
    mol[18].getIsoAt(2)->setGlobalId(61);
    // 4 isotope
    mol[18].getIsoAt(3)->setGlobalId(62);
    // 5 isotope
    mol[18].getIsoAt(4)->setGlobalId(63);

    // H2CO (20)
    // 1 isotope
    mol[19].getIsoAt(0)->setGlobalId(64);
    // 2 isotope
    mol[19].getIsoAt(1)->setGlobalId(65);
    // 3 isotope
    mol[19].getIsoAt(2)->setGlobalId(66);

    // HOCl (21)
    // 1 isotope
    mol[20].getIsoAt(0)->setGlobalId(67);
    // 2 isotope
    mol[20].getIsoAt(1)->setGlobalId(68);

    // N2 (22)
    // 1 isotope
    mol[21].getIsoAt(0)->setGlobalId(69);
    // 2 isotope
    mol[21].getIsoAt(1)->setGlobalId(118);

    // HCN (23)
    // 1 isotope
    mol[22].getIsoAt(0)->setGlobalId(70);
    // 2 isotope
    mol[22].getIsoAt(1)->setGlobalId(71);
    // 3 isotope
    mol[22].getIsoAt(2)->setGlobalId(72);

    // CH3Cl (24)
    // 1 isotope
    mol[23].getIsoAt(0)->setGlobalId(73);
    // 2 isotope
    mol[23].getIsoAt(1)->setGlobalId(74);

    // H2O2 (25)
    // 1 isotope
    mol[24].getIsoAt(0)->setGlobalId(75);

    // C2H2 (26)
    // 1 isotope
    mol[25].getIsoAt(0)->setGlobalId(76);
    // 2 isotope
    mol[25].getIsoAt(1)->setGlobalId(77);
    // 3 isotope
    mol[25].getIsoAt(2)->setGlobalId(105);

    // C2H6 (27)
    // 1 isotope
    mol[26].getIsoAt(0)->setGlobalId(78);
    // 2 isotope
    mol[26].getIsoAt(1)->setGlobalId(106);

    // PH3 (28)
    // 1 isotope
    mol[27].getIsoAt(0)->setGlobalId(79);

    // COF2 (29)
    // 1 isotope
    mol[28].getIsoAt(0)->setGlobalId(80);
    // 2 isotope
    mol[28].getIsoAt(1)->setGlobalId(119);

    // SF6 (30)
    // 1 isotope
    mol[29].getIsoAt(0)->setGlobalId(-1);

    // H2S (31)
    // 1 isotope
    mol[30].getIsoAt(0)->setGlobalId(81);
    // 1 isotope
    mol[30].getIsoAt(1)->setGlobalId(82);
    // 1 isotope
    mol[30].getIsoAt(2)->setGlobalId(83);

    // HCOOH (32)
    // 1 isotope
    mol[31].getIsoAt(0)->setGlobalId(84);

    // HO2 (33)
    // 1 isotope
    mol[32].getIsoAt(0)->setGlobalId(85);

    // O (34)
    // 1 isotope
    mol[33].getIsoAt(0)->setGlobalId(86);

    // ClONO2 (35)
    // 1 isotope
    mol[34].getIsoAt(0)->setGlobalId(127);  // Used to be unavailable, before HITRAN 2016
    // 2 isotope
    mol[34].getIsoAt(1)->setGlobalId(128);  // Used to be unavailable, before HITRAN 2016

    // NO+ (36)
    // 1 isotope
    mol[35].getIsoAt(0)->setGlobalId(87);

    // HOBr (37)
    // 1 isotope
    mol[36].getIsoAt(0)->setGlobalId(88);
    // 2 isotope
    mol[36].getIsoAt(1)->setGlobalId(89);

    // C2H4 (38)
    // 1 isotope
    mol[37].getIsoAt(0)->setGlobalId(90);
    // 2 isotope
    mol[37].getIsoAt(1)->setGlobalId(91);

    // CH3OH (39)
    // 1 isotope
    mol[38].getIsoAt(0)->setGlobalId(92);

    // CH3Br (40)
    // 1 isotope
    mol[39].getIsoAt(0)->setGlobalId(93);
    // 2 isotope
    mol[39].getIsoAt(1)->setGlobalId(94);

    // CH3CN (41)
    // 1 isotope
    mol[40].getIsoAt(0)->setGlobalId(95);

    // CF4 (42)
    // 1 isotope
    mol[41].getIsoAt(0)->setGlobalId(96);

    // C4H2 (43)
    // 1 isotope
    mol[42].getIsoAt(0)->setGlobalId(116);

    // HC3N (44)
    // 1 isotope
    mol[43].getIsoAt(0)->setGlobalId(109);

    // H2 (45)
    // 1 isotope
    mol[44].getIsoAt(0)->setGlobalId(103);
    // 2 isotope
    mol[44].getIsoAt(1)->setGlobalId(115);

    // CS (46)
    // 1 isotope
    mol[45].getIsoAt(0)->setGlobalId(97);
    // 2 isotope
    mol[45].getIsoAt(1)->setGlobalId(98);
    // 3 isotope
    mol[45].getIsoAt(2)->setGlobalId(99);
    // 4 isotope
    mol[45].getIsoAt(3)->setGlobalId(100);

    // SO3 (47)
    // 1 isotope
    mol[46].getIsoAt(0)->setGlobalId(114);

    // C2N2 (48)
    // 1 isotope
    mol[47].getIsoAt(0)->setGlobalId(123);

    // COCl2 (49)
    // 1 isotope
    mol[48].getIsoAt(0)->setGlobalId(124);
    // 2 isotope
    mol[48].getIsoAt(1)->setGlobalId(125);


    // Generating random colors for all isotopes (just in case the molparam file is modified to add new molecules)
    // Maybe do this later when the updates in the global id are automatically taken into account.  As of right now they are not in the molparam.txt
//    QColor color;  // Color variable
//    int i;  // Loop variable
//    int h;  // Hue
//    h = 0;
//    for (i = 0; i < mol.count(); i++)
//    {
//        color.fromHsl(h, 255, 255, 255);
//        h = h + 35;
//        mol[i].setColor(color.name());
//    }

    // Initializing colors
    // H2O (1)
    mol[0].setColor("#3399ff");

    // CO2 (2)
    mol[1].setColor("#33cc33");

    // O3 (3)
    mol[2].setColor("#ff9d09");

    // N2O (4)
    mol[3].setColor("#ff00ff");

    // CO (5)
    mol[4].setColor("#ff0000");

    // CH4 (6)
    mol[5].setColor("#ca6500");

    // O2 (7)
    mol[6].setColor("#e8d500");

    // NO (8)
    mol[7].setColor("#b3b3b3");

    // SO2 (9)
    mol[8].setColor("#0025e2");

    // NO2 (10)
    mol[9].setColor("#ff9c59");

    // NH3 (11)
    mol[10].setColor("#ff7b9e");

    // HNO3 (12)
    mol[11].setColor("#007a12");

    // OH (13)
    mol[12].setColor("#9a2400");

    // HF (14)
    mol[13].setColor("#ce9e00");

    // HCl (15)
    mol[14].setColor("#ff375f");

    // HBr (16)
    mol[15].setColor("#c600e4");

    // HI (17)
    mol[16].setColor("#7c09ff");

    // ClO (18)
    mol[17].setColor("#00a0ea");

    // OCS (19)
    mol[18].setColor("#4febff");

    // H2CO (20)
    mol[19].setColor("#be0000");

    // HOCl (21)
    mol[20].setColor("#00ca98");

    // N2 (22)
    mol[21].setColor("#ff9b53");

    // HCN (23)
    mol[22].setColor("#ff296d");

    // CH3Cl (24)
    mol[23].setColor("#630098");

    // H2O2 (25)
    mol[24].setColor("#625f00");

    // C2H2 (26)
    mol[25].setColor("#a4ff2d");

    // C2H6 (27)
    mol[26].setColor("#ff6505");

    // PH3 (28)
    mol[27].setColor("#0067dc");

    // COF2 (29)
    mol[28].setColor("#b08d00");

    // SF6 (30)
    mol[29].setColor("#00b837");

    // H2S (31)
    mol[30].setColor("#d6004e");

    // HCOOH (32)
    mol[31].setColor("#00621a");

    // HO2 (33)
    mol[32].setColor("#bbc8ff");

    // O (34)
    mol[33].setColor("#a000da");

    // ClONO2 (35)
    mol[34].setColor("#53e400");

    // NO+ (36)
    mol[35].setColor("#0b33ff");

    // HOBr (37)
    mol[36].setColor("#ff9d09");

    // C2H4 (38)
    mol[37].setColor("#ff0ba6");

    // CH3OH (39)
    mol[38].setColor("#6becff");

    // CH3Br (40)
    mol[39].setColor("#ff092e");

    // CH3CN (41)
    mol[40].setColor("#619e00");

    // CF4 (42)
    mol[41].setColor("#ff83a4");

    // C4H2 (43)
    mol[42].setColor("#004aca");

    // HC3N (44)
    mol[43].setColor("#c567ff");

    // H2 (45)
    mol[44].setColor("#f4f800");

    // CS (46)
    mol[45].setColor("#07ea00");

    // SO3 (47)
    mol[46].setColor("#94003d");

    // C2N2 (48)
    mol[47].setColor("#1f5546");

    // COCl2 (49)
    mol[48].setColor("#7f5776");

}
