Example #1
0
 def test_tovec(self):
     Nx = rspvec.read("XDIPLEN", propfile=self.RSPVEC)["XDIPLEN"]
     kx = rspvec.tomat(Nx, self.ifc, tmpdir=self.tmpdir)
     Nx = rspvec.tovec(kx, self.ifc, tmpdir=self.tmpdir)
     this = Nx[44]
     ref = 0.75732690
     assert this == approx(ref)
Example #2
0
 def test_read_e3_w(self):
     Nx = rspvec.read("XDIPLEN XDIPLEN", freqs=(0.5,), propfile=self.E3VEC)[
         ("XDIPLEN XDIPLEN", 0.5)
     ]
     this = Nx[1]
     ref = 0.05668560
     assert this == approx(ref)
Example #3
0
 def test_read_w(self):
     Nx = rspvec.read("XDIPLEN", freqs=(0.5,), propfile=self.RSPVEC)[
         ("XDIPLEN", 0.5)
     ]
     this = Nx[12]
     ref = -2.242435
     assert this == approx(ref)
Example #4
0
 def test_number_vecs(self):
     vecs = read(
         "XDIPLEN",
         "YDIPLEN",
         "ZDIPLEN",
         freqs=(0.4425, 0.49),
         propfile=self.tmpdir / "ABSVECS",
         lr_vecs=True,
     )
     assert len(vecs) == 6
Example #5
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
Example #6
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
Example #7
0
 def test_first_xvec(self):
     vecs = read("XDIPLEN",
                 freqs=(0.4425, ),
                 propfile=self.tmpdir / "ABSVECS")
     npt.assert_allclose(
         vecs[("XDIPLEN", 0.4425, 0.0)][:10],
         [
             -1.7563977677089527e-09,
             0.0015755554234863397,
             -5.504742822192291e-10,
             0.002779217059896619,
             -0.0034886672773900523,
             7.051844231481651e-10,
             -0.005062366558336546,
             -0.006285259584578197,
             -0.008674385885382397,
             -7.986196390011771e-11,
         ],
     )
Example #8
0
 def test_first_yvec(self):
     vecs = read("XDIPLEN",
                 "YDIPLEN",
                 freqs=(0.4425, ),
                 propfile=self.tmpdir / "ABSVECS")
     npt.assert_allclose(
         vecs[("YDIPLEN", 0.4425, 0.0)][:10],
         [
             -3.062472422126098e-08,
             0.0027792414636958196,
             -1.1898942484099601e-07,
             -0.0015755667065659468,
             -0.005062426714257009,
             1.0479887117851179e-07,
             0.00348869833460343,
             -0.008674366708527649,
             0.006285236842617945,
             2.145201913436897e-07,
         ],
     )
Example #9
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]
Example #10
0
 def test_read_missing(self):
     with raises(rspvec.RspVecError):
         rspvec.read("WRONGLAB", propfile=self.RSPVEC)
Example #11
0
 def test_read_e3(self):
     Nx = rspvec.read("XDIPLEN XDIPLEN", propfile=self.E3VEC)["XDIPLEN XDIPLEN"]
     this = Nx[1]
     ref = 0.03874785
     assert this == approx(ref)
Example #12
0
 def test_read(self):
     Nx = rspvec.read("XDIPLEN", propfile=self.RSPVEC)["XDIPLEN"]
     this = Nx[12]
     ref = -0.75732690
     assert this == approx(ref)
Example #13
0
 def test_tovec(self):
     ref = rspvec.read("XDIPLEN", propfile=self.RSPVEC)["XDIPLEN"]
     kx = rspvec.tomat(ref, self.ifc, tmpdir=self.tmpdir)
     this = rspvec.tovec(kx, self.ifc, tmpdir=self.tmpdir)
     np.testing.assert_almost_equal(this, ref)
Example #14
0
 def test_tomat(self):
     Nx = rspvec.read("XDIPLEN", propfile=self.RSPVEC)["XDIPLEN"]
     kx = rspvec.tomat(Nx, self.ifc, tmpdir=self.tmpdir)
     this = kx[5, 7]
     ref = -2.34009730
     assert this == approx(ref)
Example #15
0
 def test_read(self):
     Nx = rspvec.read("XDIPLEN", propfile=self.RSPVEC)["XDIPLEN"]
     this = Nx[5]
     ref = -2.34009730
     assert this == approx(ref)