Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more generalization, for real, get rid of the 2's in the loops

  • Loading branch information...
commit cd14a1e34e07945489faf6e5898a016e8b333eca 1 parent 0f42d17
@SamChill authored
Showing with 9 additions and 8 deletions.
  1. +9 −8 hf.jl
View
17 hf.jl
@@ -240,10 +240,10 @@ function hartree_fock(R, Z)
#calculate all of the two-electron integrals
K = length(phi)
two_electron = zeros(K,K,K,K)
- for mu = 1:2
- for v = 1:2
- for lambda = 1:2
- for sigma = 1:2
+ for mu = 1:K
+ for v = 1:K
+ for lambda = 1:K
+ for sigma = 1:K
coulomb = two_electron_integral(phi[mu], phi[v],
phi[sigma], phi[lambda])
two_electron[mu,v,sigma,lambda] = coulomb
@@ -266,10 +266,11 @@ function hartree_fock(R, Z)
for scf_iter = 1:100
#calculate the two electron part of the Fock matrix
G = zeros(size(Hcore))
- for mu = 1:2
- for v = 1:2
- for lambda = 1:2
- for sigma = 1:2
+ K = length(phi)
+ for mu = 1:K
+ for v = 1:K
+ for lambda = 1:K
+ for sigma = 1:K
coulomb = two_electron[mu,v,sigma,lambda]
exchange = two_electron[mu,lambda,sigma,v]
G[mu,v] += P[lambda,sigma]*(coulomb - 0.5*exchange)
Please sign in to comment.
Something went wrong with that request. Please try again.