Esempio n. 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]))
Esempio n. 2
0
    def test_FiniteT_spectra_abs_eiHt(self, value):
        print "data", value
        nexciton = 0
        procedure = [[1, 0], [1, 0], [1, 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^\dagger",
                                                                dipole=True,
                                                                QNargs=QNargs)
        GSMPS, GSMPSdim = tMPS.Max_Entangled_GS_MPS(mol, pbond, QNargs=QNargs)
        GSMPO = tMPS.hilbert_to_liouville(GSMPS, QNargs=QNargs)
        GSMPO = mpslib.MPSdtype_convert(GSMPO, QNargs=QNargs)

        nsteps = 100
        dt = 5.0

        autocorr0 = tMPS.FiniteT_spectra("abs", mol, pbond, GSMPO, HMPO,
                dipoleMPO, nsteps, dt, ephtable, thresh=1.0e-3,
                temperature=298, algorithm=value[0], compress_method=value[1],\
                QNargs=QNargs, approxeiHt=None)
        autocorr0 = np.array(autocorr0)

        autocorr1 = tMPS.FiniteT_spectra("abs", mol, pbond, GSMPO, HMPO,
                dipoleMPO, nsteps, dt, ephtable, thresh=1.0e-3,
                temperature=298, algorithm=value[0], compress_method=value[1],\
                QNargs=QNargs, approxeiHt=1e-6)
        autocorr1 = np.array(autocorr1)

        self.assertTrue(np.allclose(autocorr0, autocorr1, rtol=value[4]))
Esempio n. 3
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]))