def iteration(C): # Form the Fock matrix F = self.H + einsum('ijkl,j,l', self.Q, C, C) # savemat('F.mat', {'F': F}) self.eigvals, self.eigvecs = eigh(F, self.S) C = self.eigvecs[:, 0] E0 = self.energy(1) print E0, C return E0, C
def iteration(C): # Form the Fock matrix F = self.H + einsum("ijkl,j,l", self.Q, C, C) # savemat('F.mat', {'F': F}) self.eigvals, self.eigvecs = eigh(F, self.S) C = self.eigvecs[:, 0] E0 = self.energy(1) print E0, C return E0, C
def variational(self, wfs=5): self.wfs = wfs H = empty([wfs, wfs]) S = empty([wfs, wfs]) for m in range(0, wfs): for n in range(0, wfs): H[m, n] = (self.kinetic(m, n)).evalf(15) S[m, n] = (self.overlap(m, n)).evalf(15) # print('S') # print(S) # print('H') # print(H) self.eigvals, self.eigvecs = eigh(H, S) # sortlist = argsort(eigvals) # self.eigvals = eigvals[sortlist] print self.eigvals print self.eigvecs # self.eigvecs = eigvecs[sortlist]
def variational(self): self.eigvals, self.eigvecs = eigh(self.H, self.S)