Beispiel #1
0
 public void add_2(EnergyLevel d)
 {
     energy_level_2.Add(d);
 }
Beispiel #2
0
        // ファイルからテキストを読み出し。
        //          1         2         3         4         5         6         7         8         9         0         1         1         2 
        //01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
        //-------------------------------------------------------------------------------
        //Configuration          | Term   |   J |                   Level    | Reference
        //-----------------------|--------|-----|----------------------------|-----------
        //                       |        |     |                            |           
        //2s2.2p4                | 3P     |   2 |              0.000000      |     L7288
        //                       |        |   1 |              0.0196224     |          
        //                       |        |   0 |              0.0281416     |          
        //                       |        |     |                            |           
        //2s2.2p4                | 1D     |   2 |              1.9673641     |          
        //-----------------------|--------|-----|----------------------------|----------- ///END
        //                       |        |     |                            |           
        //2s2.2p4                | 1D     |   2 |              1.9673641     |          
 
        private void ReadEnergyLevel(string fn, int atomic_num, int state)
        {

            using (StreamReader r = new StreamReader(fn))            //@"O_ii_level.txt"
            using (StreamWriter w = new StreamWriter(fn + ".txt"))   //@"O_ii_level.txt.txt"
            {
                double d;
                string line = "", s;

                string[] stArrayData = line.Split(' ');

                // 先頭4行スキップ
                for (int i = 0; i < 4; i++)
                {
                    line = r.ReadLine();
                    //richTextBox1.AppendText(line);
                }
                while ((line = r.ReadLine()) != null && line.IndexOf("---") < 0 ) // 1行ずつ読み出し。
                {
                    EnergyLevel el = new EnergyLevel();
                    string[] linesp = line.Replace("[", " ").Replace("]", " ").Replace("?", " ").Split('|');
                    // energy level
                    s = linesp[3];
                    //s1 = s.Replace("[", " ").Replace("]", " ");
                    if (double.TryParse(s, out d))
                    {
                        el.Ei = d;
                    }
                    else
                    {
                        continue;
                    }
                    // gi
                    if (linesp[2].IndexOf("/") >= 0)
                    {
                        // 分数の場合
                        string[] linesp1 = linesp[2].Split('/');
                        int a1, a2;
                        int.TryParse(linesp1[0], out a1);
                        int.TryParse(linesp1[1], out a2);
                        d = 1 + 2.0 * (double)a1 / (double)a2;
                    }
                    else
                    {
                        if (double.TryParse(linesp[2], out d))
                        {
                            d = (int)(d * 2 + 1);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    el.gi = (int)d;
                    // 
                    if (state == 0)
                    {
                        atomdata[atomic_num].add_1(el);
                    }
                    else if (state == 1)
                    {
                        atomdata[atomic_num].add_2(el);
                    }

                    w.WriteLine(el.Print());   //richTextBox1.AppendText(line);
                }
                foreach ( EnergyLevel el1 in atomdata[atomic_num].energy_level_1 )
                {
                //    w.WriteLine(el1.Print());   //richTextBox1.AppendText(line);
                }
                richTextBox1.AppendText(atomic_num.ToString() + ": " + atomdata[atomic_num].leveldata[0].Print() + "\n");
            }
        }
Beispiel #3
0
 public void add_1(EnergyLevel d)
 {
     energy_level_1.Add(d);
 }