def getK(Ints,D): "Form the exchange operator corresponding to a density matrix D" nbf = D.shape[0] D1d = reshape(D,(nbf*nbf,)) #1D version of Dens K = zeros((nbf,nbf),'d') for i in xrange(nbf): for j in xrange(i+1): if sorted: temp = kints[i,j] else: temp = fetch_kints(Ints,i,j,nbf) K[i,j] = dot(temp,D1d) K[j,i] = K[i,j] return K
def get2JmK(Ints,D): "Form the 2J-K integrals corresponding to a density matrix D" nbf = D.shape[0] D1d = reshape(D,(nbf*nbf,)) #1D version of Dens G = zeros((nbf,nbf),'d') for i in xrange(nbf): for j in xrange(i+1): if sorted: temp = 2*jints[i,j]-kints[i,j] else: temp = 2*fetch_jints(Ints,i,j,nbf)-fetch_kints(Ints,i,j,nbf) G[i,j] = dot(temp,D1d) G[j,i] = G[i,j] return G
def getJ(Ints,D): "Form the Coulomb operator corresponding to a density matrix D" nbf = D.shape[0] D1d = reshape(D,(nbf*nbf,)) #1D version of Dens J = zeros((nbf,nbf),'d') for i in xrange(nbf): for j in xrange(i+1): if sorted: temp = jints[i,j] else: temp = fetch_jints(Ints,i,j,nbf) J[i,j] = dot(temp,D1d) J[j,i] = J[i,j] return J