Beispiel #1
0
def get_asym_calc(units, angmoms=None, tot_spin=None, targ_spins=None):
    """
    Returns an AsymCalc for converting from momentum to energy.

    Parameters
    ----------
    units : int
        Specification of the energy units. Available options are
        reskit.rydbergs, reskit.hartrees and reskit.eVs.
    angmoms : list of ints, optional
        Specification of the angular momenta in each of the channels. Defaults 
        to zero in all channels.
    tot_spin : float, optional
        Specification of the total spin of the system. Defaults to 0.5. Only
        required for calculation of cross sections.
    targ_spins : float or list of floats, optional
        Specification of the spin of the target (e.g. electronic) state
        associated with each of the channels. Defaults to zero in all channels.
        Only required for calculation of cross sections.

    Returns
    -------
    asymcalc : AsymCalc
    """
    return cu.AsymCalc(units, angmoms, tot_spin, targ_spins)
Beispiel #2
0
    def runTest(self):
        asymcalc = chanutil.AsymCalc(chanutil.hartrees, thresholds=[0.,2.])
        fun = radwell.get_Smat_fun(1., 2., 2., asymcalc, 1.)

        expect_mat = radwell.nw.matrix([[1., 0.],[0., -13.56891277]])
        got_mat = fun(0.)
        self.assertTrue(radwell.nw.np.allclose(got_mat,expect_mat))

        expect_mat = radwell.nw.matrix(\
          [[-0.92934972-0.36920061j, 3.95429415+5.82581759j],
           [3.95429415+5.82581759j, -22.30580611-24.7882964j]])
        got_mat = fun(1.8)
        self.assertTrue(radwell.nw.np.allclose(got_mat,expect_mat))

        expect_mat = radwell.nw.matrix(\
          [[0.17030364+0.94186257j, -0.26879527-0.10789196j],
           [-0.26879527-0.10789196j, -0.77423472+0.56273353j]])
        got_mat = fun(3.0)
        self.assertTrue(radwell.nw.np.allclose(got_mat,expect_mat))
    def runTest(self):
        asymcalc = chanutil.AsymCalc(chanutil.hartrees, [0, 0])
        fun = radwell.get_Smat_fun(1., 2., 2., asymcalc, 1.)

        expect_mat = radwell.nw.matrix([[1., 0.], [0., 1.]])
        got_mat = fun(0.)
        self.assertTrue(radwell.nw.np.allclose(got_mat, expect_mat))

        expect_mat = radwell.nw.matrix(\
          [[-0.31507906+0.89937359j, -0.28602697-0.10020431j],
           [-0.28602697-0.10020431j, -0.31507906+0.89937359j]])
        got_mat = fun(1.8)
        self.assertTrue(radwell.nw.np.allclose(got_mat, expect_mat))

        expect_mat = radwell.nw.matrix(\
          [[0.1665721+0.95554805j, -0.23965872+0.04177755j],
           [-0.23965872+0.04177755j, 0.1665721+0.95554805j]])
        got_mat = fun(3.0)
        self.assertTrue(radwell.nw.np.allclose(got_mat, expect_mat))
Beispiel #4
0
rk.safe_mode = False
import channelutil as cu
import twochanradialwell as rw

if len(sys.argv) > 1 and sys.argv[1] == "mpmath":
    cu.use_mpmath_types()
    print "mpmath"
else:
    print "python"

TEST_ROOT = "chart"
if os.path.isdir(TEST_ROOT):
    shutil.rmtree(TEST_ROOT)

cal = cu.AsymCalc(cu.hartrees, [0, 0])
csmat = rw.get_Smat_fun(1.0, 2.0, 2.0, cal, 1.0)

print "Plot all data as S-matrix, direct from continuous data. No archive."
chart = rk.get_tool(rk.chart, csmat)
chart.plot_Smatrix()

print "Use discretised data."
dsmat = csmat.discretise(1., 8., 100)
chart = rk.get_tool(rk.chart, dsmat)

print "Plot all data as S-matrix. No archive. Row."
chart.plot_Smatrix(i=0)

print "Archive created"
chart = rk.get_tool(rk.chart, dsmat, TEST_ROOT)
 def calculate_coefficients(self, thres, smatdata):
     psm.use_python_types()
     asymcalc = chanutil.AsymCalc(chanutil.hartrees, thresholds=thres)
     return psm.calculate_coefficients(smatdata, asymcalc), asymcalc
Beispiel #6
0
def row_offset_col_gain_posImag_Tmat(sz=100):
    d = tu.dTmat(asymcalc=cu.AsymCalc(tu.rydbergs, [0, 0]))
    _row_offset_col_gain_posImag(d, sz)
    return d
Beispiel #7
0
def row_offset_col_gain_posNegImag(rg=10):
    d = tu.dSmat(asymcalc=cu.AsymCalc(tu.rydbergs, [0, 0]))
    _row_offset_col_gain_posNegImag(d, rg)
    return d
Beispiel #8
0
def row_offset_col_gain_zeroimag(sz=100):
    d = tu.dSmat(asymcalc=cu.AsymCalc(tu.rydbergs, [0, 0]))
    _row_offset_col_gain_zeroimag(d, sz)
    return d
Beispiel #9
0
 def calculate_coefficients(self, dat, thres, smatdata):
     psm.use_mpmath_types(dat.TESTDPS)
     chanutil.use_mpmath_types(dat.TESTDPS)
     asymcalc = chanutil.AsymCalc(chanutil.hartrees, thresholds=thres)
     return psm.calculate_coefficients(smatdata, asymcalc), asymcalc