Skip to content

Commit

Permalink
added full_dim function to compute dimension of subspace defined by M
Browse files Browse the repository at this point in the history
  • Loading branch information
nmayhall-vt committed Feb 27, 2024
1 parent 925e583 commit 85506f6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
43 changes: 43 additions & 0 deletions src/tpsci_helpers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,46 @@ function correlation_functions(v::TPSCIstate{T,N,R}, cluster_ops::Vector{Cluster
return cf
end



"""
full_dim(clusters::Vector{MOCluster}, bases::Vector{ClusterBasis{A,T}}, na, nb) where {A,T}
Compute the total dimension of the Hilbert space defined by our current basis.
- `basis::Vector{ClusterBasis}`
- `na`: Number of alpha electrons total
- `nb`: Number of alpha electrons total
"""
function full_dim(clusters::Vector{MOCluster}, bases::Vector{ClusterBasis{A,T}}, na, nb) where {A,T}
# {{{
println("\n Expand to full space")
ns = []

dim_tot = 0
for c in clusters
nsi = []
for (fspace,basis) in bases[c.idx]
push!(nsi,fspace)
end
push!(ns,nsi)
end
for newfock in Iterators.product(ns...)
nacurr = 0
nbcurr = 0
for c in newfock
nacurr += c[1]
nbcurr += c[2]
end
if (nacurr == na) && (nbcurr == nb)
config = FockConfig(collect(newfock))
dim_tot += dim(config, clusters)
#add_fockconfig!(s,config)
end
end
#expand_each_fock_space!(bases)

return dim_tot
end
# }}}


2 changes: 1 addition & 1 deletion src/type_FockConfig.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Return total dimension of space indexed by `fc` on `no` orbitals
function dim(fc::FockConfig, clusters)
dim = 1
for ci in clusters
dim *= binomial(length(ci), fc[ci.idx][1]) * binomial(length(ci), fc[ci.idx][2])
dim *= binomial(BigInt(length(ci)), fc[ci.idx][1]) * binomial(BigInt(length(ci)), fc[ci.idx][2])
end
return dim
end
Expand Down

0 comments on commit 85506f6

Please sign in to comment.