# Providing your own database

LINEDB accepts building a local database with a custom list of lines. This can be achieved through two ASCII files:

1. the line “catalog” e.g.

            29005   NNH+
          93171.8800   .0400 -2.7844 2    0.0000  9 -29005 102 1 1         0 1
          93173.7000   .0400 -2.5625 2    0.0000 15 -29005 102 1 2         0 1
          93176.1300   .2200 -3.2614 2    0.0000  3 -29005 102 1 0         0 1
            30002   HC-13-O+
          86754.2884  0.0046 -2.2835 2    0.0000  3 -30002 101 1           0

   This catalog must follow the JPL convention (in particular, column alignment) described in Appendix A. The lines must be gathered by species. Each group is identified by a first line providing the tag value and the species name. The latter should be limited to 32 characters because of internal limitations of the LINEDB databases. There can be no blank nor comment lines in this file.

2. the partition function file. It must be named partfunc.cat and must use the following format e.g.:

       species      NNH+      29005
       temperatures 300.   225.   150.   75.    37.5   18.75  9.375
       qpart        3.0831 2.9586 2.7832 2.4842 2.1875 1.8952 1.6116

       species      HC-13-O+  30002
       temperatures 300.   225.   150.   75.    37.5   18.75  9.375
       qpart        2.1599 2.0353 1.8598 1.5607 1.2637 0.9707 0.6859

   The tag and species name should match the catalog ones. The number of temperatures/qpart pairs are free. Those three lines must be consecutive in the file, with one set of lines per species. There can be a custom number of blank and comment (!) lines between each set of lines.

Given those files, importing them in LINEDB is as easy as:

    SIC> use in mybase.dat
    I-USE,  mybase.dat (offline) selected with /(partfunc.json|partfunc.cat) for partition functions
    SIC> select
    I-SELECT,  4 lines found in the frequency range 0 to infinity MHz
    SIC> list
      # Species        Freq[MHz] Err[MHz] Eup[K]  Gup  Aij[s-1]    Upper level -- Lower level    Origin
      1 HC-13-O+       86754.288   0.005     4.2    3  1.21e-05              1 -- 0              mybase.dat
      2 NNH+           93171.880   0.040     4.5    9  3.63e-05            1 1 -- 0 1            mybase.dat
      3 NNH+           93173.700   0.040     4.5   15  2.18e-05            1 2 -- 0 1            mybase.dat
      4 NNH+           93176.130   0.220     4.5    3  1.09e-04            1 0 -- 0 1            mybase.dat

It is advised to save this catalog in the LINEDB binary format, i.e. after the previous steps:

    SIC> use out mybase.db
    SIC> insert