Package ComboCode :: Package cc :: Package modeling :: Package objects :: Module Molecule :: Class Molecule
[hide private]
[frames] | no frames]

Class Molecule

source code

A class to deal with molecules in GASTRoNOoM.

Instance Methods [hide private]
 
__init__(self, molecule, ny_up=0, ny_low=0, nline=0, n_impact=0, n_impact_extra=0, abun_molec=1e-10, abun_molec_rinner=1e-10, abun_molec_re=1e-10, rmax_molec=1.0, itera=0, lte_request=None, use_collis_radiat_switch=0, dust_to_gas_change_ml_sp=0, use_no_maser_option=0, use_maser_in_sphinx=1, fehler=0.0001, xdex=2.0, n_freq=30, start_approx=0, use_fraction_level_corr=1, fraction_level_corr=0.8, number_level_max_corr=1e-12, ratio_12c_to_13c=0, ratio_16o_to_17o=0, ratio_16o_to_18o=0, opr=0, r_outer=0, outer_r_mode='MAMON', abundance_filename=None, change_fraction_filename=None, set_keyword_change_abundance=0, set_keyword_change_temperature=0, enhance_abundance_factor=0, new_temperature_filename=None, linelist=0, starfile='', path_gastronoom=None)
Initiate a Molecule class, setting all values for the allowed transition parameters to zero (by default).
source code
 
__str__(self)
Printing a molecule as it should appear in the GASTRoNOoM input file.
source code
bool
__eq__(self, other)
Compare two molecules and return true if equal.
source code
bool
__ne__(self, other)
Compare two molecules and return true if not equal.
source code
int
__hash__(self)
Return a hash number based on the string of the molecule.
source code
 
updateParameters(self, pardict)
Update parameters.
source code
dict()
makeDict(self, path=None, in_progress=0)
Return a dict with molecule string, and other relevant parameters.
source code
string
makeMlineFilename(self, number='*', include_path=0)
Return an mline filename for this object.
source code
 
readMline(self)
Read the mline output if the model id is valid.
source code
 
setModelId(self, model_id)
Set a model_id for the molecule, which identifies model_id for MLINE!
source code
string
makeLabel(self)
Return a short-hand label for this particular molecule, taken from the molecule.dat file.
source code
string
getModelId(self)
Return the model_id associated with this molecule.
source code
bool
isMolecule(self)
Return True to help the codes know that this is a molecule and not a transition.
source code
 
getAbunFactor(self)
Return the abundance factor of the molecule, with respect to its main isotope/ortho version.
source code
bool
isWater(self)
Is this molecule a water molecule?
source code
Method Details [hide private]

__init__(self, molecule, ny_up=0, ny_low=0, nline=0, n_impact=0, n_impact_extra=0, abun_molec=1e-10, abun_molec_rinner=1e-10, abun_molec_re=1e-10, rmax_molec=1.0, itera=0, lte_request=None, use_collis_radiat_switch=0, dust_to_gas_change_ml_sp=0, use_no_maser_option=0, use_maser_in_sphinx=1, fehler=0.0001, xdex=2.0, n_freq=30, start_approx=0, use_fraction_level_corr=1, fraction_level_corr=0.8, number_level_max_corr=1e-12, ratio_12c_to_13c=0, ratio_16o_to_17o=0, ratio_16o_to_18o=0, opr=0, r_outer=0, outer_r_mode='MAMON', abundance_filename=None, change_fraction_filename=None, set_keyword_change_abundance=0, set_keyword_change_temperature=0, enhance_abundance_factor=0, new_temperature_filename=None, linelist=0, starfile='', path_gastronoom=None)
(Constructor)

source code 

Initiate a Molecule class, setting all values for the allowed transition parameters to zero (by default).

Parameters:
  • molecule (string) - shorthand name of the molecule
  • ny_up (int) - number of levels in first vibration state v=1

    (default: 0)

  • ny_low (int) - number of levels in the ground vibration state v=0

    (default: 0)

  • nline (int) - number of allowed transitions in molecule

    (default: 0)

  • n_impact (int) - number of depth points in radius mesh

    (default: 0)

  • n_impact_extra (int) - number of depth points in radius_mesh (< n_impact) used for variable mass-loss (0 if constant mdot)

    (default: 0)

  • itera (string) - number of iterations in mline for molecule, LTE approximation if zero

    (default: 0)

  • abun_molec (float) - molecular abundance at the stellar radius. Default is arbitrary, and used if molecule is co or h2o.

    (default: 1.0e-10)

  • abun_molec_rinner (float) - molecular abundance at inner shell radius. Default is arbitrary, and used if molecule is co or h2o.

    (default: 1.0e-10)

  • abun_molec_re (float) - molecular abundance at rmax_molec. Default is arbitrary, and used if molecule is co or h2o.

    (default: 1.0e-10)

  • rmax_molec (float) - The radius from which the Willacy abundance profiles are used. They are rescaled to abun_molec_re. Default is arbitrary, and used if molecule is co or h2o.

    (default: 1.)

  • use_collis_radiat_switch (bool) - in case of unstable mline, such as for para h2o sometimes

    (default: 0)

  • fehler (float) - convergence criterium in mline

    (default: 1e-4)

  • xdex (float) - Controls the distribution of the impact parameters in the interval between R_STAR and R_OUTER.

    (default: 2.)

  • n_freq (int) - Number of frequency points in line profile

    (default: 30)

  • start_approx (bool) - set to 0 when one wants to start with LTE-approx as starting n(NY,N_IMPACT); set to 1 when starting from another model - with same NY, N_IMPACT, ...

    (default: 0)

  • use_fraction_level_corr (bool) - set to 1 if one wants to put a limit on the level-population correction (BES3).

    (default: 1)

  • fraction_level_corr (float) - user-defined fraction for maximum change in level-population correction; useful in case of H2O

    (default: 0.8)

  • number_level_max_corr (float) - user-defined level population. Only the level corrections for levels with a higher level population will be used to determine convergence criterion

    (default: 1e-12)

  • ratio_12c_to_13c (int) - 12c/13c ratio, only relevant for 13co and other molecules with that isotope

    (default: 0)

  • ratio_16o_to_17o (int) - 16o/17o ratio, only relevant for h2_17o and other molecules with that isotope

    (default: 0)

  • ratio_16o_to_18o (int) - 16o/18o ratio, only relevant for h2_18o and other molecules with that isotope

    (default: 0)

  • opr (int) - ortho-to-para water ratio, only relevant for ph2o, ph2_17o,ph2_18o and other molecules with para h2o

    (default: 0)

  • r_outer (float) - the outer radius of the shell for this molecule, 0 if MAMON

    (default: 0)

  • lte_request (bool) - using LTE in mline only (with or without collision rates: determined by itera), if default lte_request is 0 if itera != 0 and 1 if itera ==0

    (default: 0)

  • outer_r_mode (string) - the mode used for calculating r_outer (FIXED or MAMON)

    (default: 'MAMON')

  • dust_to_gas_change_ml_sp (float) - if 0 not used, otherwise this is an alternative value for the dust-to-gas ratio in mline/sphinx for this molecule and its transitions.

    (default: 0)

  • abundance_filename (string) - if enhance_abundance_factor is not zero, this includes the filename and/or path to the file that includes the profile.

    (default: None)

  • enhance_abundance_factor (float) - if 0 the Willacy abundance profiles are uses, if not zero the abundance_filename is used and scaled with the factor given here. THIS DOES NOT RESCALE ABUNDANCES BY WILLACY! Only used for filename abundances, hence why this parameter also turns this feature on/off

    (default: 0)

  • set_keyword_change_abundance (bool) - Change the abundance calculated in cooling by a radius dependent factor

    (default: 0)

  • change_fraction_filename (string) - the filename of the enhancement factors if set_keyword_change_abundance != 0

    (default: None)

  • set_keyword_change_temperature (bool) - Use a different temperature structure in mline and sphinx

    (default: 0)

  • new_temperature_filename (string) - the filename for the temperature structure if set_keyword_change_temperature != 0

    (default: None)

  • use_no_maser_option (bool) - Do not allow masers (neg opacs) in mline RT by setting negative line opacs to 1e-60 If use_maser_in_sphinx is on, mline will do a final run including masers anyway to see what would happen if they were inluded by allowing negative opacs for the line profile calculations in sphinx (but not for the convergence in mline).

    (default: 0)

  • use_maser_in_sphinx (bool) - When on, does a final mline run including masers, allowing negative opacities. When off, sets the masing line opacities to 1e-60 when writing out the ml3 file.

    (default: 1)

  • linelist (bool) - The molecule is created for the LineList module. No radiative information is read from GASTRoNOoM input files.

    (default: 0)

  • starfile (str) - input filename for a stellar input spectrum (either user defined or from a model atmosphere spectrum)

    (default: '')

  • path_gastronoom (string) - model output folder in the GASTRoNOoM home

    (default: None)

__eq__(self, other)
(Equality operator)

source code 

Compare two molecules and return true if equal.

The condition is the string representation of this Molecule(). Note that the other properties included in the self.makeDict() dictionary are not compared. Those properties do not determine whether a molecule is equal or not.

In this sense equal refers to the spectroscopy included for this molecule, the number of impact parameters, and the molecule itself, of course.

Returns: bool
The comparison

__ne__(self, other)

source code 

Compare two molecules and return true if not equal.

The condition is the string representation of this Molecule(). Note that the other properties included in the self.makeDict() dictionary are not compared. Those properties do not determine whether a molecule is equal or not.

In this sense equal refers to the spectroscopy included for this molecule, the number of impact parameters, and the molecule itself, of course.

Returns: bool
The negative comparison

__hash__(self)
(Hashing function)

source code 

Return a hash number based on the string of the molecule.

The condition is the string representation of this Molecule(). Note that the other properties included in the self.makeDict() dictionary are not compared. Those properties do not determine whether a molecule is equal or not.

In this sense equal refers to the spectroscopy included for this molecule, the number of impact parameters, and the molecule itself, of course.

Returns: int
The hash number:

updateParameters(self, pardict)

source code 

Update parameters.

Parameters:
  • pardict (dict()) - the parameters with respective values for the update

makeDict(self, path=None, in_progress=0)

source code 

Return a dict with molecule string, and other relevant parameters.

Parameters:
  • path (string) - If a different path is needed, it can be passed here, for files. For instance, when making dictionaries for Molecule() objects in the case of supercomputer copies.

    (default: None)

  • in_progress (bool) - add an extra dict entry "IN_PROGRESS" if the molecule is still being calculated somewhere.

    (default: 0)

Returns: dict()
The molecule dictionary including all relevant, defining information

makeMlineFilename(self, number='*', include_path=0)

source code 

Return an mline filename for this object.

Parameters:
  • number (string) - the number in the filename (ml*, ml1, ml2, ml3. Hence can be *, 1, 2, 3)

    (default: '*')

  • include_path (bool) - Include the full filepath.

    (default: 0)

Returns: string
The sphinx filename for this transition

readMline(self)

source code 

Read the mline output if the model id is valid.

The mline output is available in the MlineReader object mline, as a property of Molecule().

setModelId(self, model_id)

source code 

Set a model_id for the molecule, which identifies model_id for MLINE!

Parameters:
  • model_id (string) - The model_d to be associated with this molecule

makeLabel(self)

source code 

Return a short-hand label for this particular molecule, taken from the molecule.dat file.

Returns: string
The label associated with this molecule

getModelId(self)

source code 

Return the model_id associated with this molecule. None if not yet set.

Returns: string
the model id is returned.

isMolecule(self)

source code 

Return True to help the codes know that this is a molecule and not a transition.

Returns: bool
True if molecule or False if transition

isWater(self)

source code 

Is this molecule a water molecule?

(ortho, para, isotopologue thereof included)

Returns: bool
True or False