Cloudy
Spectral Synthesis Code for Astrophysics
Loading...
Searching...
No Matches
species.cpp File Reference
#include "cddefines.h"
#include "species.h"
#include "taulines.h"
#include "input.h"
#include "dense.h"
#include "atmdat.h"
#include "elementnames.h"
#include "version.h"
#include "save.h"
#include "mole.h"
#include "service.h"
#include "parser.h"
#include "parse_species.h"
#include "prt.h"
#include "warnings.h"
Include dependency graph for species.cpp:

Functions

STATIC void states_popfill (void)
 
STATIC void states_nelemfill (void)
 
STATIC void database_prep (int)
 
STATIC void trim_levels (long)
 
STATIC void set_fractionation (species *sp)
 
STATIC void states_propprint (void)
 
void db_basename_to_spectral (const string &chBasename, string &chElement, char *chSpecLabel)
 
void database_readin (void)
 
void parsespect (const char *chLabel, long &nelem, long &IonStg)
 
bool isAtomicIonValid (const long element_index, const long spCharge)
 
bool isBareNucleus (const long element_index, const long spCharge)
 
string makeChemical (long nelem, long ion)
 
void makeChemical (char *chLabelChemical, long nelem, long ion)
 
STATIC void spectral_to_chemical (char *chLabelChemical, const char *chLabel, long &nelem, long &IonStg)
 
void spectral_to_chemical (char *chLabelChemical, const char *chLabel)
 
void spectral_to_chemical (string &chemicalLabel, const char *chLabel)
 
bool parse_chemical (const string &chLabelChem, string &chElemMol, long &spCharge)
 
void chemical_to_spectral (const string &chLabelChem, string &chLabelSpec)
 
bool isSpeciesActive (const string &chLabelChem)
 

Variables

static const bool DEBUGSTATE = false
 

Function Documentation

◆ chemical_to_spectral()

void chemical_to_spectral ( const string & chLabelChem,
string & chLabelSpec )

chemical_to_spectral - Convert a chemical label to spectral.

Parameters
chLabelChem[in]Chemical label, e.g., "C+"
chLabelSpec[out]Spectral label, e.g., "C 2"

References DEBUG_ENTRY, elem_symbol_to_index(), isAtomicIonValid(), isBareNucleus(), isElementSym(), and parse_chemical().

Referenced by SaveAllSpeciesLabelsLevels(), SaveSpeciesLines(), and band_emission::setup().

Here is the call graph for this function:

◆ database_prep()

STATIC void database_prep ( int intSpIndex)

◆ database_readin()

◆ db_basename_to_spectral()

void db_basename_to_spectral ( const string & chBasename,
string & chElement,
char * chSpecLabel )

db_basename_to_spectral - Convert the species basename in Stout or Chianti to a spectral label.

Parameters
chBasename[in]File basename, e.g., "c_2"
chElement[out]Extracted element name, e.g., "C"
chSpecLabel[out]Spectral label, e.g., "C 2"

References ASSERT, DEBUG_ENTRY, toupper(), and uncaps().

Referenced by database_readin().

Here is the call graph for this function:

◆ isAtomicIonValid()

bool isAtomicIonValid ( const long element_index,
const long spCharge )

isAtomicIonValid - Tell if an atomic ion is has a charge consistent with its atomic number.

Parameters
element_index[in]Zero-offset index for element; 0 for H, 29 for Zn
spCharge[in]Species charge
Returns
bool True, if ion is valid; false, otherwise.

References ASSERT, and DEBUG_ENTRY.

Referenced by cdTemp(), and chemical_to_spectral().

◆ isBareNucleus()

bool isBareNucleus ( const long element_index,
const long spCharge )

isBareNucleus - Tell if the given ion is a bare nucleus.

Parameters
element_index[in]Zero-offset index for element; 0 for H, 29 for Zn
spCharge[in]Species charge
Returns
bool True, if ion is bare nucleus; false, otherwise.

References ASSERT, and DEBUG_ENTRY.

Referenced by chemical_to_spectral().

◆ isSpeciesActive()

bool isSpeciesActive ( const string & chSpecLabel)

isSpeciesActive - Tell if the species is enabled

An atomic/ionic species may be inactive if the relevant element is disabled. Likewise, a molecular species may be inactive if one of its constituents elements is disabled. This function reports on the given species. If not found, the result is false.

Parameters
chLabelChem[in] Chemical label, e.g., "C+2", or "HCl"
Returns
bool True, if species active; false, otherwise.

References DEBUG_ENTRY, mole, mole_global, and NULL.

Referenced by SpeciesBandsCreate().

◆ makeChemical() [1/2]

void makeChemical ( char * chLabelChemical,
long nelem,
long ion )

References CHARS_SPECIES, DEBUG_ENTRY, and makeChemical().

Here is the call graph for this function:

◆ makeChemical() [2/2]

◆ parse_chemical()

bool parse_chemical ( const string & chLabelChem,
string & chElemMol,
long & spCharge )

parse_chemical - Parse the element and charge of a chemical label.

Parameters
chLabelChem[in]Chemical label, e.g., "C+2", or "HCl"
chElemMol[out]Element or molecule, e.g., "C", or "HCl"
spCharge[out]Species charge, e.g., 2, or 0
Returns
bool True, if successful; false, otherwise.

References DEBUG_ENTRY, fprintf(), and ioQQQ.

Referenced by cdTemp(), and chemical_to_spectral().

Here is the call graph for this function:

◆ parsespect()

void parsespect ( const char * chLabel,
long & nelem,
long & IonStg )

◆ set_fractionation()

STATIC void set_fractionation ( species * sp)

◆ spectral_to_chemical() [1/3]

void spectral_to_chemical ( char * chLabelSpec,
const char * chLabelChem )

spectral_to_chemical - Convert a spectral label to chemical.

Parameters
chLabelSpec[in]Spectral label, e.g., "C 2"
chLabelChem[out]Chemical label, e.g., "C+"

References DEBUG_ENTRY, and spectral_to_chemical().

Here is the call graph for this function:

◆ spectral_to_chemical() [2/3]

STATIC void spectral_to_chemical ( char * chLabelChemical,
const char * chLabel,
long & nelem,
long & IonStg )

◆ spectral_to_chemical() [3/3]

void spectral_to_chemical ( string & chLabelSpec,
const char * chLabelChem )

spectral_to_chemical - Convert a spectral label to chemical.

Parameters
chLabelSpec[in]Spectral label, e.g., "C 2"
chLabelChem[out]Chemical label, e.g., "C+"

References DEBUG_ENTRY, NCHLAB, and spectral_to_chemical().

Here is the call graph for this function:

◆ states_nelemfill()

STATIC void states_nelemfill ( void )

◆ states_popfill()

STATIC void states_popfill ( void )

◆ states_propprint()

STATIC void states_propprint ( void )

References dBaseSpecies, dBaseStates, DEBUG_ENTRY, energy(), nSpecies, and STATIC.

Referenced by database_readin().

Here is the call graph for this function:

◆ trim_levels()

STATIC void trim_levels ( long ipSpecies)

trim_levels: Trim the highest energy levels until there is a transition out of the highest level with an Aul value that is not the default. The default value of 1e-30 is used when no Aul is given in the database.

References atmdat, EmissionProxy::Aul(), cdEXIT, dBaseSpecies, dBaseStates, dBaseTrans, DEBUG_ENTRY, DEBUGSTATE, TransitionProxy::Emis(), EXIT_FAILURE, fprintf(), ioQQQ, ipdBaseTrans, and STATIC.

Referenced by database_readin().

Here is the call graph for this function:

Variable Documentation

◆ DEBUGSTATE

const bool DEBUGSTATE = false
static