예제 #1
0
파일: expect.py 프로젝트: vahtras/dalmisc
def value(*args, **kwargs):
    """Calculate expectation of operator with label"""
    tmpdir = kwargs.get('tmpdir', '/tmp')
    aoproper = os.path.join(tmpdir, 'AOPROPER')
    sirifc = os.path.join(tmpdir, 'SIRIFC')
    A = prop.read(*args, filename=aoproper, unpack=True)
    dc, do = dens.ifc(filename=sirifc)
    return tuple([a & (dc + do) for a in A])
예제 #2
0
파일: core.py 프로젝트: vahtras/loprop
    def getprop(self, *args):
        """Read general property matrices to blocked loprop basis"""

        T = self.T
        cpa = self.cpa
        prp = os.path.join(self.tmpdir,"AOPROPER")

        return [
            (T.T*p*T).subblocked(cpa, cpa) for p in
            prop.read(*args, filename=prp, unpack=True)
            ]
예제 #3
0
파일: dalton.py 프로젝트: robertodr/loprop
    def getprop(self, *args):
        """
        Read general property matrices to blocked loprop basis
        """

        T = self.T
        cpa = self.cpa
        prp = os.path.join(self.tmpdir, "AOPROPER")

        return [(T.T * p * T).subblocked(cpa, cpa)
                for p in prop.read(*args, filename=prp, unpack=True)]
예제 #4
0
def main(*args, **kwargs):

    labs = args
    tmpdir = kwargs.get("tmpdir", ".")
    ranks = kwargs.get('rank', (0, 0, 0))
    pars = [ (-1)**r for r in ranks]

    ifc = sirifc.sirifc(os.path.join(tmpdir, "SIRIFC"))
    cmo = ifc.cmo.unblock()

    AOONEINT = os.path.join(tmpdir, "AOONEINT")
    AOPROPER = os.path.join(tmpdir, "AOPROPER")
    RSPVEC   = os.path.join(tmpdir, "RSPVEC")

    vecs = rspvec.read(*labs, propfile=RSPVEC)[0]
    kappa = [rspvec.tomat(vec, ifc).T for vec in vecs]
    kappa[0] = kappa[0].T
    a, b, c = [cmo.T*x*cmo for x in prop.read(*labs, filename=AOPROPER)]

    NA = vecs[0]
    kA, kB, kC = kappa
    pA, pB, pC = [{ "lab":lab, "rank":rank, 'kappa':k} for lab, rank, k in zip(labs, ranks, kappa)]

    da, db = dens.Dab(ifc_=ifc)
    d = da + db
    
    S = one.read(label = "OVERLAP", filename = AOONEINT).unblock().unpack()
    D = cmo.T*S*d*S*cmo

    E3BC = E3(pB, pC, ifc, tmpdir=tmpdir)
    AE3BC = -NA&E3BC
    B2C = (-(kA^(kC^b))&D)
    C2B = (-(kA^(kB^c))&D)
    A2B = (.5*(kC^(kB^a))&D)
    A2C = (.5*(kB^(kC^a))&D)
    #print "E3BC",E3BC
    val = AE3BC
    print("E3  %14.8f %14.8f" % (AE3BC, val))
    val += B2C
    print("B2C %14.8f %14.8f" % (B2C, val))
    val += C2B
    print("C2B %14.8f %14.8f" % (C2B, val))
    val += A2B
    print("A2B %14.8f %14.8f" % (A2B, val))
    val += A2C
    print("A2C %14.8f %14.8f" % (A2C, val))
    
    return val
예제 #5
0
    def setUp(self):
        n, e = os.path.splitext(__file__)
        self.suppdir = n + ".d"

        self.A = "XDIPLEN"
        self.B = "YDIPLEN"
        self.C = "XDIPLEN"

        AOONEINT = os.path.join(self.suppdir, 'AOONEINT')
        S = one.read(label="OVERLAP", filename=AOONEINT).unblock().unpack()

        SIRIFC = os.path.join(self.suppdir, 'SIRIFC')
        self.ifc = sirifc.sirifc(SIRIFC)
        cmo = self.ifc.cmo.unblock()
        da, db = dens.Dab(ifc_=self.ifc)
        self.D = cmo.T * S * (da + db) * S * cmo

        RSPVEC = os.path.join(self.suppdir, 'RSPVEC')
        rspvecs = rspvec.read(self.A, self.B, self.C, propfile=RSPVEC)
        self.NA = rspvecs[(self.A, 0)]
        self.NB = rspvecs[(self.B, 0)]
        self.NC = rspvecs[(self.C, 0)]

        self.kA = rspvec.tomat(self.NA, self.ifc, tmpdir=self.suppdir)
        self.kB = rspvec.tomat(self.NB, self.ifc, tmpdir=self.suppdir).T
        self.kC = rspvec.tomat(self.NC, self.ifc, tmpdir=self.suppdir).T

        AOPROPER = os.path.join(self.suppdir, 'AOPROPER')
        #a, b, c = [cmo.T*x*cmo for x in prop.read(A, B, C, filename=AOPROPER, unpack=True)]
        global pmat
        pmat = prop.read(self.A,
                         self.B,
                         self.C,
                         filename=AOPROPER,
                         unpack=True)
        self.a, self.b, self.c = [cmo.T * x * cmo for x in pmat]
예제 #6
0
def a2bc(A, B, C):

    AOONEINT = os.path.join(tmp, "AOONEINT")
    AOPROPER = os.path.join(tmp, "AOPROPER")
    RSPVEC   = os.path.join(tmp, "RSPVEC")
    SIRIFC   = os.path.join(tmp, "SIRIFC")

    NB = rspvec.read(B, RSPVEC)
    NC = rspvec.read(C, RSPVEC)

    ifc = sirifc.sirifc(SIRIFC)
    cmo = ifc.cmo.unblock()
    dc,do = dens.ifc(ifc=ifc)
    d = dc+do
    a = cmo.T*prop.read(A, AOPROPER).unpack()*cmo
    kB = rspvec.tomat(NB, ifc, tmpdir = tmp).T
    kC = rspvec.tomat(NC, ifc, tmpdir = tmp).T

    S = one.read(label = "OVERLAP", filename = AOONEINT).unblock().unpack()
    D = cmo.T*S*d*S*cmo
    A2B = (.5*(kC^(kB^a))&D)
    A2C = (.5*(kB^(kC^a))&D)

    return A2B + A2C
예제 #7
0
 def get_dipole(self):
     """Get dipole integrals"""
     return prop.read("XDIPLEN",
                      "YDIPLEN",
                      "ZDIPLEN",
                      filename=os.path.join(self.get_workdir(), "AOPROPER"))
예제 #8
0
 def test_zdiplen(self):
     _ref = [
         -1.14582446,
         -0.28457970,
         -1.14582446,
         0.00000000,
         0.00000000,
         -1.14582446,
         -0.00000000,
         0.00000000,
         -0.00000000,
         -1.14582446,
         0.07185549,
         0.83874358,
         -0.00000000,
         -0.00000000,
         -1.14582446,
         0.00000042,
         0.03960604,
         -0.00000049,
         0.00000023,
         0.06644414,
         1.13941835,
         -0.03517114,
         0.09678743,
         -0.00000039,
         0.00000018,
         0.26304148,
         0.26970481,
         1.13941835,
         -0.00000043,
         0.00000079,
         0.04273779,
         0.00000000,
         0.00000217,
         0.00000000,
         0.00000000,
         1.13941835,
         0.00000020,
         -0.00000036,
         0.00000000,
         0.04273779,
         -0.00000100,
         -0.00000000,
         0.00000000,
         0.00000000,
         1.13941835,
         0.05971628,
         0.14458398,
         -0.00000151,
         0.00000070,
         0.04288205,
         0.05079193,
         0.64117284,
         0.00000000,
         0.00000000,
         1.13941835,
         -0.07377362,
         -0.83292247,
         0.00003362,
         -0.67200176,
         0.76434327,
         0.00510998,
         0.00045345,
         0.00000004,
         -0.00098917,
         0.05241089,
         -2.23969756,
         -0.07300170,
         -0.81945232,
         0.00003256,
         0.67188009,
         0.74090119,
         0.00524496,
         0.00124665,
         0.00000003,
         0.00064587,
         0.05278446,
         -0.31647999,
         -2.20056359,
     ]
     z, = prop.read("ZDIPLEN", filename=self.propfile, unpack=False)
     np.testing.assert_almost_equal(np.array(z), _ref)
예제 #9
0
    def test_zanglon(self):
        _ref = full.init([
            [
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                -0.00000000,
                -0.00000022,
                -0.00000047,
                0.00000000,
                0.00000000,
                0.00000000,
            ],
            [
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                -0.00000000,
                -0.00000113,
                -0.00000246,
                0.00000000,
                0.00000000,
                0.00000000,
            ],
            [
                0.00000000,
                0.00000000,
                0.00000000,
                -1.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                -0.21189133,
                0.00000000,
                0.00000000,
                0.00000000,
            ],
            [
                -0.00000000,
                -0.00000000,
                1.00000000,
                -0.00000000,
                -0.00000000,
                0.00000000,
                0.00000000,
                0.21189133,
                -0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
            ],
            [
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                -0.00000184,
                -0.00000400,
                -0.00000000,
                -0.00000000,
                -0.00000000,
            ],
            [
                0.00000000,
                0.00000000,
                0.00000022,
                0.00000048,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
            ],
            [
                0.00000000,
                -0.00000000,
                0.00000155,
                0.00000338,
                -0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
            ],
            [
                -0.00000000,
                -0.00000000,
                0.00000000,
                -0.21189133,
                -0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                -1.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
            ],
            [
                0.00000000,
                -0.00000000,
                0.21189133,
                -0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                1.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
            ],
            [
                -0.00000000,
                0.00000000,
                -0.00000184,
                -0.00000400,
                -0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
                0.00000000,
            ],
            [
                -0.00000000,
                -0.00000000,
                0.39427368,
                0.00001972,
                -0.00000000,
                0.00000000,
                -0.00000000,
                0.03771757,
                0.00000152,
                -0.00000000,
                -0.00000000,
                -0.00000000,
            ],
            [
                -0.00000000,
                -0.00000000,
                -0.39890626,
                0.00001933,
                0.00000000,
                0.00000000,
                0.00000000,
                -0.03934100,
                0.00000153,
                0.00000000,
                0.00000000,
                0.00000000,
            ],
        ])

        z, = prop.read("ZANGLON", filename=str(self.propfile), unpack=False)
        np.testing.assert_allclose(z, _ref, atol=1e-5)