Index: trunk/UTIL/corrk_exo_k/Exomol_species.dat
===================================================================
--- trunk/UTIL/corrk_exo_k/Exomol_species.dat	(revision 3670)
+++ trunk/UTIL/corrk_exo_k/Exomol_species.dat	(revision 3671)
@@ -1,2 +1,4 @@
+K/               39K                      39K__Kurucz-Allard-K             K//39K/Kurucz-Allard-K                          0        1        0
+Na/              23Na                     23Na__Kurucz-Allard-Na           Na//23Na/Kurucz-Allard-Na                       0        1        0
 MgH/             24Mg-1H                  24Mg-1H__Yadin                   MgH//24Mg-1H/Yadin                              0        1        0
 MgH/             24Mg-1H                  24Mg-1H__UGAMOP                  MgH//24Mg-1H/UGAMOP                             0        1        0
Index: trunk/UTIL/corrk_exo_k/dace_to_corrk.py
===================================================================
--- trunk/UTIL/corrk_exo_k/dace_to_corrk.py	(revision 3670)
+++ trunk/UTIL/corrk_exo_k/dace_to_corrk.py	(revision 3671)
@@ -3,14 +3,16 @@
 import matplotlib.pyplot as plt
 import astropy.units as u
+import astropy.constants as cst
 import glob
 from chemistry import isotopologue_to_species, species_name_to_common_isotopologue_name
 
 ### choose spectral resolution for corrk
-R=20000
+R=10000
 wnedges=xk.wavenumber_grid_R(10000/100, 10000/.3, R)
 print("Spectral resolution asked: wn=", wnedges.min(), wnedges.max(), ", R =", R)
 
 ### set data paths
-dace_path = "datadir/dace/"
+# dace_path = "datadir/cold/"
+dace_path = "datadir/hot/"
 corrk_dir = "datadir/corrk_data/"
 dir_out = corrk_dir+f"/R{R}_from_dace/"
@@ -26,11 +28,12 @@
 
 ### select (output) molecules and their corresponding (input) isotopologues
+### set value to 'None' to get common isotopologue
 molecules = {
-    # "CO":  "12C-16O",
-    # "CO2":  "12C-16O2",
+    "CO":  "12C-16O",
+    "CO2":  None,
     # "H2O":  "1H2-16O",
     # # "C2H2":"12C2-1H2",
     # # "C2H4":"12C2-1H4",
-    "CH4": "12C-1H4",
+    # "CH4": "12C-1H4",
     # "TiO": "48Ti-16O",
     # "VO": "51V-16O",
@@ -61,5 +64,5 @@
     tmp_ktab=xk.hires_to_ktable(path=mol_corrk, helios=True, wnedges=wnedges, mol=molecule, order=order) # test conversion from a whole folder to tmp
 
-    tmp_ktab.kdata = tmp_ktab.kdata * 10 * xk.Molar_mass().fetch(molecule) / xk.N_A
+    tmp_ktab.kdata = tmp_ktab.kdata * 10 * xk.Molar_mass().fetch(molecule) / cst.N_A
     # cm^2/g * 10000/1000 * kg/mol / (molecule/mol) -> m^2/molecule
     tmp_ktab.kdata_unit = "m^2/molecule"
Index: trunk/UTIL/corrk_exo_k/download_dace.py
===================================================================
--- trunk/UTIL/corrk_exo_k/download_dace.py	(revision 3670)
+++ trunk/UTIL/corrk_exo_k/download_dace.py	(revision 3671)
@@ -1,6 +1,11 @@
 from dace import *
 
+# output_dir = "datadir/hot"
+# temperature_range=[50,3000]
+# pressure_range=[-8,5]
+
+output_dir = "datadir/cold"
 temperature_range=[50,300]
-pressure_range=[1e-8,1e2]
+pressure_range=[-8,2]
 
 ### select linelist for each molecule
@@ -9,9 +14,9 @@
 
 molecules = {
-# "C2H2": default_linelist,
-# "C2H4": default_linelist,
+"C2H2": default_linelist,
+"C2H4": default_linelist,
 "CH4":  default_linelist,
+"CO":   default_linelist,
 # "CO2":  default_linelist,
-# "CO":   default_linelist,
 # "H2O":  default_linelist,
 # "H2S":  default_linelist,
@@ -33,5 +38,5 @@
 }
 for mol in molecules:
-    download_molecule(molecule=mol,temperature_range=temperature_range,pressure_range=pressure_range, line_list=molecules[mol], output_dir="datadir/dace")
+    download_molecule(molecule=mol,temperature_range=temperature_range,pressure_range=pressure_range, line_list=molecules[mol], output_dir=output_dir)
 
 
Index: trunk/UTIL/corrk_exo_k/exomol2.py
===================================================================
--- trunk/UTIL/corrk_exo_k/exomol2.py	(revision 3671)
+++ trunk/UTIL/corrk_exo_k/exomol2.py	(revision 3671)
@@ -0,0 +1,150 @@
+# **********************************************************************************************
+# This code scans the EXOMOL webiste, and lists all available molecules and linelists.
+# It writes to files: "Exomol_species.dat" and "Exomol_xsec_species.dat", and lists the
+# corresponding file names
+
+# Date: May 2019
+# Author: Simon Grimm
+#
+# *********************************************************************************************
+
+from bs4 import BeautifulSoup
+import requests
+import sys
+
+#this function extracts the ranges of the .trans files
+#it returns the ranges, or -1 when the ranges are not equal
+#it returns the number of transition files
+#it returns the number of digits of the ranges
+def transitionRanges(url):
+    #url="http://exomol.com/data/molecules/H2O/1H2-16O/BT2/"
+
+    page = requests.get(url).text
+    soup = BeautifulSoup(page, "html.parser")
+    List = soup.find_all('li', attrs={"class" : "list-group-item link-list-group-item"})
+
+    #print(List[4].a)
+    #print(List[4].a.get('href'))
+
+    transList = []
+
+    #write a list with all transition file ranges
+    for i in range(len(List)):
+        el = List[i].a.get('href')
+        #print(el)
+        el1 = el.split('__')[-1]        #split at __ and take right part of it
+        el2 = el1.split('.trans')[0]
+        if(len(el1.split('.trans')) > 1):
+            #print(el2)
+            transList.append(el2)
+
+    rangesList = []
+    if(len(transList) > 1):
+        #check range of files
+        for x in transList:
+            #print(x)
+            try:
+                x0 = float(x.split('-')[0])
+                x1 = float(x.split('-')[1])
+                dg = len(x.split('-')[0])
+                #print(x1-x0)
+                rangesList.append(x1-x0)
+            except:
+                print("error", url, x)
+                return(0, 0, 0)
+
+        s = rangesList[0]
+        for r in rangesList:
+            if(r != s):
+                s=-1
+        n = len(rangesList)
+    else:
+        s = 0
+        n = 1
+        dg = 0
+    #print(s, n)
+    return(s, n, dg)
+
+
+def main():
+
+    print("Scan Exomol webiste for file names")
+
+    url="http://exomol.com/data/atoms/"
+    page = requests.get(url).text
+    soup = BeautifulSoup(page, "html.parser")
+
+    List = soup.find_all('a', attrs={"class" : "list-group-item link-list-group-item molecule_link"})
+
+    url="http://exomol.com/data/molecules/"
+    page = requests.get(url).text
+    soup = BeautifulSoup(page, "html.parser")
+
+    List += soup.find_all('a', attrs={"class" : "list-group-item link-list-group-item molecule_link"})
+
+    efile = open("Exomol_species.dat", "w", buffering=1)
+    exfile = open("Exomol_xsec_species.dat", "w", buffering=1)
+
+    if(len(List) == 0):
+        print("Error, no molecules found, maybe the Exomol homepage has changed")
+        sys.exit(100)
+
+    #Molecule
+    for i in range(len(List)):
+    #for i in range(20):
+        el = List[i].get('href').split('data/molecules/')[1]
+        print(el)
+
+        url1 = url + el + "/"
+        page1 = requests.get(url1).text
+        soup1 = BeautifulSoup(page1, "html.parser")
+
+        List1 = soup1.find_all('a', attrs={"class" : "list-group-item link-list-group-item"})
+
+        #Isotopologue
+        for j in range(len(List1)):
+            el1 = List1[j].get('href')
+
+            print("    ", el1)
+
+            url2 = url1 + el1 + "/"
+            page2 = requests.get(url2).text
+            soup2 = BeautifulSoup(page2, "html.parser")
+            #print(soup2)
+
+            List2 = soup2.find_all('a', attrs={"class" : "list-group-item link-list-group-item "})
+            List2 += soup2.find_all('a', attrs={"class" : "list-group-item link-list-group-item"})
+            List2 += soup2.find_all('a', attrs={"class" : "list-group-item link-list-group-item recommended"})
+
+            #Line list
+            for k in range(len(List2)):
+                el2 = List2[k].get('href')
+
+                el3 = el2.replace("HITEMP", "HITEMP2010")
+
+                if(el2.find("xsec-") >= 0):
+
+                    #change HITEMP to HITEMP2010, but only in the prints
+
+                    name = el2.split("xsec-")[1]
+                    p3 = el1 + "__" + name
+                    print("%-16s %-24s %-32s %-32s" % (el, el1, el3, p3), file=exfile)
+
+                else:
+                    print("        ", el1 + "__" + el3, el + "/" + el1 + "/" + el2 )
+
+                    p2 = el1 + "__" + el3
+                    p3 = el + "/" + el1 + "/" + el2
+
+                    url3 = url2 + el2
+                    #print(url3)
+                    s, n, dg = transitionRanges(url3)
+                    print(s, n, dg)
+                    print("%-16s %-24s %-32s %-40s %8g %8g %8g" % (el, el1, p2, p3, s, n, dg), file=efile)
+
+
+    efile.close()
+    print("Scan complete")
+
+if __name__ == '__main__':
+    main()
Index: trunk/UTIL/corrk_exo_k/lmdz_corrk_using_exo_k.py
===================================================================
--- trunk/UTIL/corrk_exo_k/lmdz_corrk_using_exo_k.py	(revision 3670)
+++ trunk/UTIL/corrk_exo_k/lmdz_corrk_using_exo_k.py	(revision 3671)
@@ -1,4 +1,5 @@
 import exo_k as xk
 import numpy as np
+import matplotlib.pyplot as plt
 
 ### folder with corrk data for each molecule (see 'xsec_to_corrk.py' to convert cross-sections to correlated-k tables)
@@ -42,4 +43,6 @@
 
 VI_grid = np.array([ 1670.,  2080.,  2220.,  2450.,  2750.,  2920.,  3200.,  3750., 4000.,  4180.,  4260.,  4460.,  4700.,  5000.,  5400.,  5730., 5930.,  6300.,  6700.,  7700.,  8200.,  8750.,  9250., 35000.])
+res=f"{len(IR_grid)-1}x{len(VI_grid)-1}"
+print(res)
 
 wnedges = np.unique(np.concatenate([IR_grid,VI_grid]))
@@ -62,9 +65,21 @@
 xk.Settings().set_case_sensitive(True)
 
-kdata = xk.Kdatabase(gases)
-for gas in kdata.ktables:
-    # convert Xtables to Ktables
-    if type(kdata.ktables[gas]) is xk.Xtable:
-        kdata.ktables[gas] = xk.Ktable(wnedges=wnedges, xtable=kdata.ktables[gas])
+### select pressure, temperature, and mixing ratio to plot
+p=1
+t=300
+x=1e-4
+
+fig, ax = plt.subplots()
+kdata = xk.Kdatabase(molecules=None)
+ktables = []
+for gas in gases:
+    try:
+        ktable = xk.Ktable(mol=gas)
+    except:
+        ktable = xk.Ktable(wnedges=wnedges, xtable=xk.Xtable(mol=gas))
+    ktable.plot_spectrum(ax=ax,p=p,t=t,x=x,g=1,label=gas)
+    ktable.bin_down(wnedges)
+    ktables.append(ktable)
+kdata.add_ktables(*ktables)
 
 mix_var_gas=kdata.create_mix_ktable5d(vgas_comp=vgas,bg_comp=bg_gas,x_array=x_array)
