Пример #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
         # here C_amp is with a negative sign
         #V = self.mat.V.reshape(x * x, -1)
         Camp = sp.linalg.solve(self.mat.B.reshape(x * x, -1), self.mat.V.reshape(x * x, -1))
         ef12 = np.dot(np.conj(self.mat.V.transpose(0,1,3,2) - 2.0 * self.mat.V).reshape(-1), Camp.reshape(-1))
         self.eF12 = ef12# + self.E1()
     return self.eF12
Пример #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