Ejemplo n.º 1
0
 def EF12(self):
     if self.mat is None:
         self.mat = matrices(self.xmol)
     if self.eF12 is None:
         x = self.xmol.no
         v = self.xmol.nv
         c = self.xmol.nc
         eps = np.array(self.xmol._vhf.mo_energy).reshape(x + v, 1)
         eij = eps[:x] + eps[:x].T
         ef12 = sumdiag(self.mat.B, x * x) + 2.0 * sumdiag(self.mat.V, x * x) - sumdiag(self.mat.V.transpose(1,0,2,3), x * x) + np.einsum('abij,ijab,abij', self.mat.ieps, self.mat.C, self.mat.C.transpose(2,3,0,1).conj() + 2.0 * self.mat.g - self.mat.g.transpose(1,0,2,3)) - np.einsum('ij,ijij', eij, self.mat.X)
         self.eF12 = ef12 + self.E1()
     return self.eF12
Ejemplo n.º 2
0
 def E1(self):
     if self.mat is None:
         self.mat = matrices(self.xmol)
     Fcx = self.mat.TF.Fcx
     Fcv = self.mat.TF.Fca
     Fcc = self.mat.TF.Fcc
     e1 = 0
     for i in xrange(self.xmol.no):
         ei = self.xmol._vhf.mo_energy[i]
         ie = np.empty((self.xmol.nv, 1))
         for a in xrange(self.xmol.nv):
             ie[a] = 1.0 / (ei - self.xmol._vhf.mo_energy[a + self.xmol.no])
         A = Fcc - ei * np.eye(self.xmol.nc) + np.einsum('a,pa,aq->pq', ie.reshape(-1), Fcv, HerConj(Fcv))
         b = -Fcx[:, i]
         ti = sp.linalg.solve(A, b, overwrite_a = True, overwrite_b = True)
         e1 += np.dot(ti.reshape(-1), Fcx.conj().reshape(-1))
     return e1 * 2.0
Ejemplo n.º 3
0
 def EF12(self):
     if self.mat is None:
         self.mat = matrices(self.xmol)
     if self.eF12 is None:
         x = self.xmol.no
         v = self.xmol.nv
         c = self.xmol.nc
         eps = np.array(self.xmol._vhf.mo_energy).reshape(x + v, 1)
         eij = eps[:x] + eps[:x].T
         ef12 = 0
         for i in xrange(x):
             for j in xrange(x):
                 # c^ij
                 tB = self.mat.B - eij[i, j] * self.mat.X + np.einsum('ab,xyab,abvw->xyvw', self.mat.ieps[:, :, i, j], self.mat.C, self.mat.C.transpose(2,3,0,1).conj())
                 tV = self.mat.V[:, :, i, j] + np.einsum('ab,xyab,ab->xy', self.mat.ieps[:, :, i, j], self.mat.C, self.mat.g[:, :, i, j])
                 cij = sp.linalg.solve(-tB.reshape(x * x, -1), tV.reshape(-1), overwrite_a = True)
                 ef12 += np.dot(np.conj(2.0 * tV - tV.T).reshape(-1), cij.reshape(-1))
         
         
         
         # TODO
         self.eF12 = ef12# + self.E1()
     return self.eF12