Skip to content

Commit

Permalink
Merge pull request #7 from arnab82/bst-tucker
Browse files Browse the repository at this point in the history
charge_transfer table computation function added
  • Loading branch information
arnab82 authored Apr 5, 2024
2 parents c0174ed + 74846ee commit 5dd0e0c
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion src/type_BSTstate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -947,4 +947,46 @@ function project_into_new_basis(v1::BSTstate{T,N,R}, v2::BSTstate{T,N,R}) where
end
end
return out
end
end

"""
ct_table(s::BSTstate; ne_cluster=10, nroots=1)
Prints total weight of charge transfer in each root in table formate
# Arguments
- `s::BSTstate`
- `ne_cluster`: Int, number of total electrons in each cluster
- `nroots`: Total number of roots
"""
function ct_table(s::BSTstate{T,N,R}; ne_cluster=10, nroots=1) where {T,N,R}
@printf(" -----------------------\n")
@printf(" --- CHARGE TRANSFER ---\n")
@printf(" -----------------------\n")
@printf(" %-15s%-10s\n", "Root", "Total CT")
@printf(" %-15s%-10s\n", "-------", "---------")
for root in 1:nroots
ct = 0
for (fock,configs) in s.data
# println(fock)
prob = 0
is_ct = false

for cluster in 1:length(s.clusters)
if sum(fock[cluster]) != ne_cluster
is_ct = true
end
end
if is_ct
prob = 0
for (tconfig, tucker) in configs
# println(tucker.core)
# println(tucker.factors)
prob += sum(tucker.core[root] .^ 2)
end
end
ct += prob
end
@printf(" %-15i%-10.5f", root, ct)
println()
end
end

0 comments on commit 5dd0e0c

Please sign in to comment.