      real function energy (iz,ik,il)                                   ENER001
c ----------------------------------------------------------------------ENER002
c     returns energy of the edges (eV) of atom with number N            ENER003
c     M - edges are currently not included                              ENER004
c ----------------------------------------------------------------------ENER005
c     This program module is part of the PhysiSoft X-ray Library        ENER006
c     and may not be sold or reproduced for commercial purposes.        ENER007
c     Although it has been tested carefully, there is no warranty       ENER008
c     regarding accuracy or freedom from side-effects.                  ENER009
c                   (C) 1986-1990 Bernhard Rupp                         ENER010
c ----------------------------------------------------------------------ENER011
      parameter (nel=103)                                               ENER012
      dimension ek(nel),el(3,nel)                                       ENER013
c --- K-edges ---                                                       ENER014
      data(ek(k),k=1,nel)/.01359,.024587,.05475,.1110,.1880,.2838,.4016,ENER015
     &  .5320, .6854,0.8669,1.0721,1.3050,1.5596,1.8389,2.1455,2.4720,  ENER016
     & 2.8224,3.2029,3.6074,4.0381,4.4928,4.9664,5.4651,5.9892,6.5390,  ENER017
     & 7.1120,7.7089,8.3328,8.9789,9.6586,10.3671,11.1031,11.8667,      ENER018
     & 12.6578,13.4737,14.3256,15.1997,16.1046,17.0384,17.9976,18.9856, ENER019
     & 19.9995,21.0440,22.1172,23.2199,24.3503,25.5140,26.7112,27.9399, ENER020
     & 29.2001,30.4912,31.8138,33.1694,34.5614,35.9846,37.4406,38.9246, ENER021
     & 40.4430,41.9906,43.5689,45.1840,46.8342,48.5190,50.2391,51.9957, ENER022
     & 53.7885,55.6177,57.4855,59.3896,61.3323,63.3138,65.3508,67.4164, ENER023
     & 69.5250,71.6764,73.8708,76.1110,78.3948,80.7249,83.1023,85.5304, ENER024
     & 88.0045,90.5259,93.1050,95.7299,98.4040,101.1370,103.9219,       ENER025
     & 106.7553,109.6509,112.6014,115.6061,118.6780,121.8180,125.0270,  ENER026
     & 128.200,131.590,135.960,139.490,143.090,146.780,150.540,154.380/ ENER027
c --- L1-edges ---                                                      ENER028
      data (el(1,k),k=1,nel)/7*0.0,0.0237,0.0310,0.045,.0633, 0.0894,   ENER029
     & 0.1177,0.1487,0.1893,0.2292,0.2702,0.3200,0.3771,0.4378,0.5004,  ENER030
     & 0.5637,0.6282,0.6946,0.7690,0.8461,0.9256,1.0081,1.0961,1.1936,  ENER031
     & 1.2977,1.4143,1.5265,1.6539,1.7820,1.9210,2.0651,2.2163,2.3725,  ENER032
     & 2.5316,2.6977,2.8656,3.0425,3.2240,3.4119,3.6043,3.8058,4.0180,  ENER033
     & 4.2375,4.4647,4.6983,4.9392,5.1881,5.4528,5.7143,5.9888,6.2663,  ENER034
     & 6.5488,6.8348,7.1260,7.4279,7.7368,8.0520,8.3756,8.7080,9.0458,  ENER035
     & 9.3942,9.7513,10.1157,10.4864,10.8704,11.2707,11.6815,12.0998,   ENER036
     & 12.5267,12.9680,13.4185,13.8799,14.3528,14.8393,15.3467,15.8608, ENER037
     & 16.3876,16.9393,17.4930,18.0490,18.6390,19.2367,19.840,20.4721,  ENER038
     & 21.1046,21.7574,22.4268,23.0972,23.7729,24.460,25.275,26.110,    ENER039
     & 26.9,27.7,28.53,29.38,30.24/                                     ENER040
c --- L2-edges ---                                                      ENER041
      data (el(2,k),k=1,nel)/4*0.0,0.0047,0.0064,0.0092, 0.0071,        ENER042
     & 0.0086,0.0183,0.0311,0.0514,0.0731,0.0992,0.1322,0.1648,0.2016,  ENER043
     & 0.2473,0.2963,0.3500,0.4067,0.4615,0.5205,0.5837,0.6514,0.7211,  ENER044
     & 0.7938,0.8719,0.9510,1.0428,1.1423,1.2478,1.3586,1.4762,1.5960,  ENER045
     & 1.7272,1.8639,2.0068,2.1555,2.3067,2.4647,2.6251,2.7932,2.9669,  ENER046
     & 3.1461,3.3303,3.5237,3.7270,3.9380,4.1561,4.3804,4.6120,4.8521,  ENER047
     & 5.1037,5.3594,5.6236,5.8906,6.1642,6.4404,6.7215,7.0128,7.3118,  ENER048
     & 7.6171,7.9303,8.2516,8.5806,8.9178,9.2643,9.6169,9.9782,10.3486, ENER049
     & 10.7394,11.1361,11.5440,11.9587,12.3850,12.8241,13.2726,13.7336, ENER050
     & 14.2087,14.6979,15.2000,15.7111,16.2443,16.7847,17.3371,17.9065, ENER051
     & 18.4843,19.0832,19.6932,20.3137,20.9476,21.6005,22.2662,22.9440, ENER052
     & 23.779,24.385,25.250,26.020,26.810,27.610,28.440,29.280/         ENER053
c --- L3-edges ---                                                      ENER054
      data (el(3,k),k=1,nel)/4*0.0,0.0047,0.0064,0.0092, 0.0071,        ENER055
     & 0.0086,0.0183,0.0311,0.0514,0.0731,0.0992,0.1322,0.1648,0.2000,  ENER056
     & 0.2452,0.2936,0.3464,0.4022,0.4555,0.5129,0.5745,0.6403,0.7081,  ENER057
     & 0.7786,0.8547,0.9311,1.0197,1.1154,1.2167,1.3231,1.4358,1.5499,  ENER058
     & 1.6749,1.8044,1.9396,2.0800,2.2223,2.3705,2.5202,2.6769,2.8379,  ENER059
     & 3.0038,3.1733,3.3511,3.5375,3.7301,3.9288,4.1322,4.3414,4.5571,  ENER060
     & 4.7822,5.0119,5.2470,5.4827,5.7234,5.9643,6.2079,6.4593,6.7162,  ENER061
     & 6.9769,7.2428,7.5140,7.7901,8.0711,8.3579,8.6480,8.9436,9.2441,  ENER062
     & 9.5607,9.8811,10.2068,10.5353,10.8709,11.2152,11.5637,11.9187,   ENER063
     & 12.2839,12.6575,13.0352,13.4186,13.8138,14.2135,14.6194,15.0312, ENER064
     & 15.4444, 15.8710,16.3003,16.7331,17.1663,17.610,18.0568,18.5041, ENER065
     & 18.930,19.452,19.930,20.41,20.9,21.39,21.88,22.36/               ENER066
                                                                        ENER067
      energy=0                                                          ENER068
      if (iz.le.nel.and.iz.ge.1) then                                   ENER069
         if (ik.eq.1) then                                              ENER070
            energy=ek(iz)                                               ENER071
         elseif (ik.eq.2) then                                          ENER072
            energy=el(il,iz)                                            ENER073
         end if                                                         ENER074
      end if                                                            ENER075
      return                                                            ENER076
      end                                                               ENER077
                                                                        ENER078
                                                                        ENER079
