diff --git a/src/type_BSTstate.jl b/src/type_BSTstate.jl index 88ea99a..e6d5682 100644 --- a/src/type_BSTstate.jl +++ b/src/type_BSTstate.jl @@ -565,73 +565,6 @@ end #=}}}=# -""" - function add_single_excitons!(ts::BSTstate{T,N,R}, - fock::FockConfig{N}, - cluster_bases::Vector{ClusterBasis}) where {T,N,R} - -Modify the current state by adding the "single excitonic" basis for the specified `FockConfig`. -This basically, starts from a reference state where only the p-spaces are included, -and then adds the excited states. E.g., - |PPPP> += |QPPP> + |PQPP> + |PPQP> + |PPPQ> -""" -function add_single_excitons!(ts::BSTstate{T,N,R}, - fock::FockConfig{N}) where {T,N,R} - #={{{=# - #length(size(v)) == 1 || error(" Only takes vectors", size(v)) - - ref_config = [ts.p_spaces[ci.idx][fock[ci.idx]] for ci in ts.clusters] - - - println(ref_config) - println(TuckerConfig(ref_config)) - for ci in ts.clusters - conf_i = deepcopy(ref_config) - - # Check to make sure there is a q space for this fock sector (e.g., (0,0) fock sector only has a P space - # since it is 1 dimensional) - fock[ci.idx] in keys(ts.q_spaces[ci.idx].data) || continue - - conf_i[ci.idx] = ts.q_spaces[ci.idx][fock[ci.idx]] - tconfig_i = TuckerConfig(conf_i) - - #factors = tuple([cluster_bases[j.idx][fock[j.idx]][:,tconfig_i[j.idx]] for j in ts.clusters]...) - core = tuple([zeros(length.(tconfig_i)...) for r in 1:R]...) - factors = tuple([Matrix{T}(I, length(tconfig_i[j.idx]), length(tconfig_i[j.idx])) for j in ts.clusters]...) - ts.data[fock][tconfig_i] = Tucker(core, factors) - end - return -end -#=}}}=# -function add_double_excitons!(ts::BSTstate{T,N,R}, fock::FockConfig{N}) where {T,N,R} - ref_config = [ts.p_spaces[ci.idx][fock[ci.idx]] for ci in ts.clusters] - - for ci in ts.clusters - conf_i = deepcopy(ref_config) - - # Check if there is a q space for this fock sector - fock[ci.idx] in keys(ts.q_spaces[ci.idx].data) || continue - - conf_i[ci.idx] = ts.q_spaces[ci.idx][fock[ci.idx]] - # Loop over clusters to set factors for double excitations - for cj in ts.clusters - # Skip if the cluster is the same as ci - if ci.idx == cj.idx - continue - end - - # Check if there is a q space for this fock sector - fock[cj.idx] in keys(ts.q_spaces[cj.idx].data) || continue - conf_i[cj.idx] = ts.q_spaces[cj.idx][fock[cj.idx]] - tconfig_j = TuckerConfig(conf_i) - core = tuple([zeros(length.(tconfig_j)...) for r in 1:R]...) - factors = tuple([Matrix{T}(I, length(tconfig_j[j.idx]), length(tconfig_j[j.idx])) for j in ts.clusters]...) - ts.data[fock][tconfig_j] = Tucker(core, factors) - end - end - return -end - """ """ function randomize!(s::BSTstate{T,N,R}; seed=nothing) where {T,N,R} diff --git a/src/type_BSstate.jl b/src/type_BSstate.jl index 7c931f0..624567a 100644 --- a/src/type_BSstate.jl +++ b/src/type_BSstate.jl @@ -66,7 +66,6 @@ function BSstate(clusters::Vector{MOCluster}, tss[fconfig[ci.idx]] = 1:1 push!(p_spaces, tss) end - # define q spaces for tssp in p_spaces tss = get_ortho_compliment(tssp, cluster_bases[tssp.cluster.idx]) @@ -75,6 +74,11 @@ function BSstate(clusters::Vector{MOCluster}, data = OrderedDict{FockConfig{N},OrderedDict{TuckerConfig{N},Array{T,2}} }() state = BSstate{T,N,R}(clusters, data, p_spaces, q_spaces) + add_fockconfig!(state, fconfig) + + tconfig = TuckerConfig([p_spaces[ci.idx].data[fconfig[ci.idx]] for ci in clusters]) + + state[fconfig][tconfig] = zeros(T,dim(tconfig),R) return state end #=}}}=#