Ejemplo n.º 1
0
def test_lambda_imds(mycc, ref):
    t1 = mycc.t1
    t2 = mycc.t2
    eris = getattr(mycc, '_eris', None)
    if eris is None:
        mycc.ao2mo()
        eris = mycc._eris
    
    imds = gccsd_lambda.make_intermediates(mycc, t1, t2, eris)
    imds.v1 = np.asarray(imds.v1)
    imds.v2 = np.asarray(imds.v2)
    imds.w3 = np.asarray(imds.w3)
    imds.woooo = np.asarray(imds.woooo)
    imds.wovvo = mpi.gather_new(np.asarray(imds.wovvo).transpose(1, 0, 2, 3)).transpose(1, 0, 2, 3)
    imds.wovoo = mpi.gather_new(np.asarray(imds.wovoo).transpose(1, 0, 2, 3)).transpose(1, 0, 2, 3)
    imds.wvvvo = mpi.gather_new(np.asarray(imds.wvvvo))
    return imds
Ejemplo n.º 2
0
def gather_lambda(mycc, l1=None, l2=None):
    '''Reconstruct the l1, l2 amplitudes from the distributed l2 tensors
    '''
    if l1 is None:
        l1 = mycc.l1
    if l2 is None:
        l2 = mycc.l2
    l2 = mpi.gather_new(l2.transpose(2, 3, 0, 1)).transpose(2, 3, 0, 1)
    return l1, l2
Ejemplo n.º 3
0
def gather_amplitudes(mycc, t1=None, t2=None):
    '''Reconstruct the t1, t2 amplitudes from the distributed t2 tensors
    '''
    if t1 is None:
        t1 = mycc.t1
    if t2 is None:
        t2 = mycc.t2
    t2 = mpi.gather_new(t2.transpose(2, 3, 0, 1)).transpose(2, 3, 0, 1)
    return t1, t2
Ejemplo n.º 4
0
def test_cc_Wvvvv(mycc, t1T=None, t2T=None, ref=None):
    if t1T is None:
        t1T = mycc.t1.T
    if t2T is None:
        t2T = mycc.t2.transpose(2, 3, 0, 1)
    eris = getattr(mycc, '_eris', None)
    if eris is None:
        mycc.ao2mo()
        eris = mycc._eris
    Wvvvv = mpi.gather_new(cc_Wvvvv(t1T, t2T, eris))
    if rank == 0:
        assert la.norm(Wvvvv - ref) < 1e-10
Ejemplo n.º 5
0
def test_cc_Wovvo(mycc, t1T=None, t2T=None, ref=None):
    if t1T is None:
        t1T = mycc.t1.T
    if t2T is None:
        t2T = mycc.t2.transpose(2, 3, 0, 1)
    eris = getattr(mycc, '_eris', None)
    if eris is None:
        mycc.ao2mo()
        eris = mycc._eris
    Wovvo = cc_Wovvo(t1T, t2T, eris)
    Wovvo = mpi.gather_new(Wovvo.transpose(2, 0, 1, 3)).transpose(1, 2, 0, 3)
    if rank == 0:
        assert la.norm(Wovvo - ref) < 1e-10
Ejemplo n.º 6
0
def test_make_tau(mycc, t1T=None, t2T=None, fac=1, ref=None):
    """
    Make effective t2T (abij) using t2T and t1T.

    Args:
        mycc: GCCSD object.
        t1T: ai
        t2T: abij, a is segmented.
        fac: factor

    Returns:
        tauT: abij, a is segmented.
    """
    if t1T is None:
        t1T = mycc.t1.T
    if t2T is None:
        t2T = mycc.t2.transpose(2, 3, 0, 1)
    tauT = make_tauT(t1T, t2T, fac=fac)
    tau = mpi.gather_new(tauT).transpose(2, 3, 0, 1)
    if rank == 0:
        tau_diff = la.norm(tau - ref)
        assert tau_diff < 1e-10