Beispiel #1
0
    def test_FiniteT_spectra_emi(self, value):
        print "data", value
        nexciton = 1
        procedure = [[10, 0.4], [20, 0.2], [30, 0.1], [40, 0], [40, 0]]
        mol = construct_mol(*value[3])

        iMPS, iMPSdim, iMPSQN, HMPO, HMPOdim, HMPOQN, HMPOQNidx, HMPOQNtot, ephtable, pbond = \
            MPSsolver.construct_MPS_MPO_2(mol, J, procedure[0][0], nexciton)

        # if in the EX space, MPO minus E_e to reduce osillation
        for ibra in xrange(pbond[0]):
            HMPO[0][0, ibra, ibra, 0] -= 2.28614053 / constant.au2ev

        if value[2] != None:
            QNargs = [ephtable, False]
            HMPO = [HMPO, HMPOQN, HMPOQNidx, HMPOQNtot]
        else:
            QNargs = None

        dipoleMPO, dipoleMPOdim = MPSsolver.construct_onsiteMPO(mol,
                                                                pbond,
                                                                "a",
                                                                dipole=True,
                                                                QNargs=QNargs)
        nsteps = 30
        dt = 30.0
        EXMPO, EXMPOdim = tMPS.Max_Entangled_EX_MPO(mol,
                                                    pbond,
                                                    norm=True,
                                                    QNargs=QNargs)
        EXMPO = mpslib.MPSdtype_convert(EXMPO, QNargs=QNargs)

        insteps = 50
        autocorr = tMPS.FiniteT_spectra("emi",
                                        mol,
                                        pbond,
                                        EXMPO,
                                        HMPO,
                                        dipoleMPO,
                                        nsteps,
                                        dt,
                                        ephtable,
                                        insteps,
                                        thresh=1.0e-3,
                                        temperature=298,
                                        algorithm=value[0],
                                        compress_method=value[1],
                                        QNargs=QNargs)

        autocorr = np.array(autocorr)
        with open(
                "std_data/tMPS/TTemi_" + str(value[0]) + str(value[1]) +
                ".npy", 'rb') as f:
            TTemi_std = np.load(f)
        self.assertTrue(
            np.allclose(autocorr, TTemi_std[0:nsteps], rtol=value[4]))
Beispiel #2
0
    def test_FiniteT_spectra_emi(self, value):
        nexciton = 1
        procedure = [[10, 0.4], [20, 0.2], [30, 0.1], [40, 0], [40, 0]]

        iMPS, iMPSdim, iMPSQN, HMPO, HMPOdim, HMPOQN, HMPOQNidx, HMPOQNtot, ephtable, pbond = \
            MPSsolver.construct_MPS_MPO_2(mol, J, procedure[0][0], nexciton)

        # if in the EX space, MPO minus E_e to reduce osillation
        for ibra in xrange(pbond[0]):
            HMPO[0][0, ibra, ibra, 0] -= 2.28614053 / constant.au2ev

        dipoleMPO, dipoleMPOdim = MPSsolver.construct_onsiteMPO(mol,
                                                                pbond,
                                                                "a",
                                                                dipole=True)
        nsteps = value[1]
        dt = value[2]
        EXMPO, EXMPOdim = tMPS.Max_Entangled_EX_MPO(mol, pbond, norm=True)
        EXMPO = mpslib.MPSdtype_convert(EXMPO)

        for f in glob.glob("TDVP_PS*.npy"):
            os.remove(f)

        insteps = 50
        autocorr = tMPS.FiniteT_spectra("emi",
                                        mol,
                                        pbond,
                                        EXMPO,
                                        HMPO,
                                        dipoleMPO,
                                        nsteps,
                                        dt,
                                        ephtable,
                                        insteps,
                                        thresh=1.0e-3,
                                        temperature=298,
                                        compress_method="variational",
                                        scheme=value[0])

        with open("std_data/tMPS/TTemi_2svd" + value[4] + ".npy", 'rb') as f:
            TTemi_std = np.load(f)
        self.assertTrue(
            np.allclose(autocorr, TTemi_std[0:nsteps], rtol=value[3]))
Beispiel #3
0
def FT_DM_hybrid_TDDMRG_TDH(mol, J, nexciton, T, nsteps, pbond, ephtable, \
        thresh=0., TDDMRG_prop_method="C_RK4", cleanexciton=None, QNargs=None, space=None):
    '''
    construct the finite temperature density matrix by hybrid TDDMRG/TDH method
    '''
    # initial state infinite T density matrix
    # TDDMRG
    if nexciton == 0:
        DMMPS, DMMPSdim = tMPS.Max_Entangled_GS_MPS(mol,
                                                    pbond,
                                                    norm=True,
                                                    QNargs=QNargs)
        DMMPO = tMPS.hilbert_to_liouville(DMMPS, QNargs=QNargs)
    elif nexciton == 1:
        DMMPO, DMMPOdim = tMPS.Max_Entangled_EX_MPO(mol,
                                                    pbond,
                                                    norm=True,
                                                    QNargs=QNargs)
    DMMPO = mpslib.MPSdtype_convert(DMMPO, QNargs=QNargs)

    # TDH
    DMH = []

    nmols = len(mol)
    for imol in xrange(nmols):
        for iph in xrange(mol[imol].nphs_hybrid):
            dim = mol[imol].ph_hybrid[iph].H_vib_indep.shape[0]
            DMH.append(np.diag([1.0] * dim, k=0))
    # the coefficent a
    DMH.append(1.0)

    mflib.normalize(DMH)

    beta = constant.T2beta(T) / 2.0
    dbeta = beta / float(nsteps)

    for istep in xrange(nsteps):
        if space is None:
            DMMPO, DMH = hybrid_TDDMRG_TDH(mol, J, DMMPO, DMH, dbeta/1.0j, ephtable, \
                    thresh=thresh, cleanexciton=cleanexciton, QNargs=QNargs, \
                    TDDMRG_prop_method=TDDMRG_prop_method, normalize=1.0)
        else:
            MPOprop, HAM, Etot = ExactPropagator_hybrid_TDDMRG_TDH(mol, J, \
                    DMMPO, DMH, -1.0*dbeta, space=space, QNargs=QNargs)
            DMH[-1] *= np.exp(-1.0 * Etot * dbeta)
            TDH.unitary_propagation(HAM, DMH, dbeta / 1.0j)

            DMMPO = mpslib.mapply(MPOprop, DMMPO, QNargs=QNargs)
            # DMMPO is not normalize in the imaginary time domain
            MPOnorm = mpslib.norm(DMMPO, QNargs=QNargs)
            DMMPO = mpslib.scale(DMMPO, 1. / MPOnorm, QNargs=QNargs)

            DMH[-1] *= MPOnorm

        # normlize the dm (physical \otimes ancilla)
        mflib.normalize(DMH)

    # divided by np.sqrt(partition function)
    DMH[-1] = 1.0

    return DMMPO, DMH