Ejemplo n.º 1
0
Archivo: sos.py Proyecto: binggu56/lime
def TPA2D(E, dip, omegaps, omega1s, g_idx, e_idx, f_idx, gamma):
    """
    2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1
    """

    g = 0

    signal = np.zeros((len(omegaps), len(omega1s)))

    for i, omegap in enumerate(omegaps):

        for j, omega1 in enumerate(omega1s):

            omega2 = omegap - omega1

            for f in f_idx:

                tmp = 0.

                for m in e_idx:

                    tmp += dip[f, m] * dip[m, g] * ( 1./(omega1 - (E[m] - E[g]) + 1j * gamma[m])\
                     + 1./(omega2 - (E[m] - E[g]) + 1j * gamma[m]) )

                signal[i,
                       j] += np.abs(tmp)**2 * lorentzian(omegap - E[f] + E[g],
                                                         width=gamma[f])

    return signal
Ejemplo n.º 2
0
Archivo: sos.py Proyecto: binggu56/lime
def TPA2D_time_order(E, dip, omegaps, omega1s, g_idx, e_idx, f_idx, gamma):
    """
    2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1
    """

    g = 0

    signal = np.zeros((len(omegaps), len(omega1s)))

    for i in range(len(omegaps)):
        omegap = omegaps[i]

        for j in range(len(omega1s)):
            omega1 = omega1s[j]

            omega2 = omegap - omega1

            for f in f_idx:

                tmp = 0.
                for m in e_idx:
                    tmp += dip[f, m] * dip[m, g] * 1. / (omega1 -
                                                         (E[m] - E[g]) +
                                                         1j * gamma[m])

                signal[i,
                       j] += np.abs(tmp)**2 * lorentzian(omegap - E[f] + E[g],
                                                         width=gamma[f])

    return signal
Ejemplo n.º 3
0
Archivo: sos.py Proyecto: binggu56/lime
def TPA(E, dip, omegap, g_idx, e_idx, f_idx, gamma, degenerate=True):
    """
    TPA signal with classical light
    """
    if degenerate:
        omega1 = omegap * 0.5
        omega2 = omegap - omega1

    i = 0

    signal = 0

    for f in f_idx:

        tmp = 0.0

        for m in e_idx:

            p1 = dip[f, m] * dip[m, i] / (omega1 -
                                          (E[m] - E[i]) + 1j * gamma[m])
            p2 = dip[f, m] * dip[m, i] / (omega2 -
                                          (E[m] - E[i]) + 1j * gamma[m])
            # if abs(p1) > 10:
            #      print('0 -> photon a -> {} -> photon b -> {}'.format(m, f), p1)
            #      print('0 -> photon b -> {} -> photon a -> {}'.format(m, f), p2)

            tmp += (p1 + p2)

        signal += np.abs(tmp)**2 * lorentzian(omegap - E[f] + E[i],
                                              width=gamma[f])

    return signal
Ejemplo n.º 4
0
def ETPA(omegap, E, edip, Te, g_idx=[0], e_idx=[], f_idx=[]):
    """
    ETPA signal with SOS formula
    """
    N = len(E)
    tdm = edip
    # gamma = np.zeros(nstates)
    # for j in range(1, N):
    #    gamma[j] = sum(tdm[:j, j]**2) * 0.0005
    # gamma[1:] = 0.0001

    # print('lifetimes of polariton states =  {} eV'.format(gamma * au2ev))

    omega1 = omegap * 0.5
    omega2 = omegap - omega1
    # flist = [3, 4] # final states list
    i = g_idx[0]

    A = np.zeros(N, dtype=complex)

    signal = 0.0

    for f in f_idx:
        for m in e_idx:
            A[f] += tdm[f, m] * tdm[m, i] * \
                    ((exp(1j * (omega1 - (en[m] - en[i]) + 1j * gamma[m]) * T) - 1.) / (omega1 - (en[m] - en[i]) + 1j * gamma[m]) \
                     + (exp(1j * (omega2 - (en[m] - en[i])) * T) - 1.)/(omega2 - (en[m] - en[i]) + 1j * gamma[m]))

        signal += np.abs(A[f])**2 * lorentzian(omegap - en[f] + en[i],
                                               gamma[f])

    return signal
Ejemplo n.º 5
0
Archivo: sos.py Proyecto: binggu56/lime
def linear_absorption(omegas, transition_energies, dip, output=None, \
                      gamma=1./au2ev, normalize=False):
    '''
    SOS for linear absorption signal S = 2 pi |mu_{fg}|^2 delta(omega - omega_{fg}).
    The delta function is replaced with a Lorentzian function.

    Parameters
    ----------
    omegas : 1d array
        the frequency range for the signal
    transition_energies : TYPE
        DESCRIPTION.
    edip : 1d array
        transtion dipole moment
    output : TYPE, optional
        DESCRIPTION. The default is None.
    gamma : float, optional
        Lifetime broadening. The default is 1./au2ev.
    normalize : TYPE, optional
        Normalize the maximum intensity of the signal as 1. The default is False.

    Returns
    -------
    signal : 1d array
        linear absorption signal at omegas

    '''

    signal = 0.0

    for j, transition_energy in enumerate(transition_energies):

        signal += dip[j]**2 * lorentzian(omegas - transition_energy, gamma)

    if normalize:
        signal /= max(signal)

    if output is not None:

        fig, ax = plt.subplots(figsize=(4, 3))

        ax.plot(omegas * au2ev, signal)

        #scale = 1./np.sum(dip**2)

        for j, transition_energy in enumerate(transition_energies):
            ax.axvline(transition_energy * au2ev, 0., dip[j]**2, color='grey')

        ax.set_xlim(min(omegas) * au2ev, max(omegas) * au2ev)
        ax.set_xlabel('Energy (keV)')
        ax.set_ylabel('Absorption')
        #ax.set_yscale('log')
        # ax.set_ylim(0, 1)

        # fig.subplots_adjust(wspace=0, hspace=0, bottom=0.15, \
        # left=0.17, top=0.96, right=0.96)
        fig.savefig(output, dpi=1200, transparent=True)

    return signal
Ejemplo n.º 6
0
Archivo: sos.py Proyecto: binggu56/lime
def cars(E, edip, shift, omega1, t2=0, gamma=10 / au2mev):
    '''
    two pump pulses followed by a stimulated raman probe.

    The first, second, and fourth pulses are assumed impulse,
    the thrid pulse is cw.


    S = \sum_{b,a = e} 2 * pi * delta(Eshift - omega_{ba}) * mu_{bg} *
        mu_{ag} * alpha_{ba}

    Parameters
    ----------
    E : TYPE
        DESCRIPTION.
    edip : TYPE
        DESCRIPTION.
    t1 : TYPE
        time decay between pulses 1 and 2
    t2 : TYPE, optional
        time delay between pulse 2 and 4 (stokes beam). The default is 0.

    Returns
    -------
    S : TYPE
        DESCRIPTION.

    '''

    N = len(E)
    g = 0
    S = 0
    alpha = np.ones((N, N))
    np.fill_diagonal(alpha, 0)

    for a in range(1, N):
        for b in range(1, N):
            S += edip[b, g] * edip[a, g] * alpha[b, a] * np.outer(lorentzian(shift - (E[b] - E[a]), gamma), \
                1./(omega1 - (E[a] - E[g]) + 1j * gamma))

    return S
Ejemplo n.º 7
0
Archivo: sos.py Proyecto: binggu56/lime
def mcd(mol, omegas):
    '''
    magentic circular dichroism signal with SOS

    The electronic structure data should contain the B field ready,
    not the bare quantities.

    B = (0, 0, Bz)

    Reference:
        Shichao Sun, David Williams-Young, and Xiaosong Li, JCTC, 2019, 15, 3162-3169

    Parameters
    ----------
    mol : TYPE
        DESCRIPTION.
    omegas : TYPE
        DESCRIPTION.

    Returns
    -------
    signal : TYPE
        DESCRIPTION.

    '''
    signal = 0.

    mu = mol.edip[0, :, :]

    E = mol.eigvals()
    gamma = mol.gamma

    nstates = mol.nstates

    for nst in range(1, nstates):
        signal += np.imag(mu[nst, 0] * conj(mu[nst, 1]) - mu[nst, 1] * conj(mu[nst, 0]))\
             * lorentzian(omegas - E[nst], gamma[nst])

    return signal
Ejemplo n.º 8
0
Archivo: sos.py Proyecto: binggu56/lime
def absorption(mol,
               omegas,
               plt_signal=False,
               fname=None,
               normalize=False,
               scale=1.,
               yscale=None):
    '''
    SOS for linear absorption signal S = 2 pi |mu_{fg}|^2 delta(omega - omega_{fg}).
    The delta function is replaced with a Lorentzian function.

    Parameters
    ----------
    omegas : 1d array
        detection frequency window for the signal
    H : 2D array
        Hamiltonian
    edip : 2d array
        electric dipole moment
    output : TYPE, optional
        DESCRIPTION. The default is None.
    gamma : float, optional
        Lifetime broadening. The default is 1./au2ev.
    normalize : TYPE, optional
        Normalize the maximum intensity of the signal as 1. The default is False.

    Returns
    -------
    signal : 1d array
        linear absorption signal at omegas

    '''

    edip = mol.edip_rms

    gamma = mol.gamma
    eigenergies = mol.eigvals()

    # set the ground state energy to 0
    eigenergies = eigenergies - eigenergies[0]

    # assume the initial state is from the ground state 0
    signal = 0.0
    for j in range(1, mol.nstates):
        e = eigenergies[j]
        signal += abs(edip[j, 0])**2 * lorentzian(omegas - e, gamma[j])

    if normalize:
        signal /= max(signal)

    if plt_signal:

        fig, ax = plt.subplots(figsize=(4, 3))

        ax.plot(omegas * au2ev, signal)

        for j, e in enumerate(eigenergies):
            ax.axvline(e * au2ev, 0., abs(edip[0, j])**2 * scale, color='grey')

        ax.set_xlim(min(omegas) * au2ev, max(omegas) * au2ev)
        ax.set_xlabel('Energy (eV)')
        ax.set_ylabel('Absorption')
        if yscale:
            ax.set_yscale(yscale)

        # ax.set_ylim(0, 1)

        # fig.subplots_adjust(wspace=0, hspace=0, bottom=0.15, \
        # left=0.17, top=0.96, right=0.96)

        if fname is not None:
            fig.savefig(fname, dpi=1200, transparent=True)

        return signal, fig, ax
    else:
        return signal