Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"spt single and double exctitation function fixed" #197

Closed
wants to merge 10 commits into from
97 changes: 43 additions & 54 deletions examples/tetracene_dimer/spt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,65 +7,54 @@ using RDM
using JLD2

@load "data_cmf_TD_12.jld2"
M = 100
M = 50
#@load "cmf_op_TD_with_ops.jld2"
display(clusters)
display(init_fspace)
ref_fspace = FockConfig(init_fspace)
ecore = ints.h0

cluster_bases = FermiCG.compute_cluster_eigenbasis_spin(ints, clusters, d1, [5,5], ref_fspace, max_roots=M, verbose=1);

cluster_bases = FermiCG.compute_cluster_eigenbasis_spin(ints, clusters, d1, [3,3], ref_fspace, max_roots=M, verbose=1);

clustered_ham = FermiCG.extract_ClusteredTerms(ints, clusters)
cluster_ops = FermiCG.compute_cluster_ops(cluster_bases, ints);

FermiCG.add_cmf_operators!(cluster_ops, cluster_bases, ints, d1.a, d1.b);
@save "cmf_op_TD_with_ops.jld2" clusters init_fspace ints cluster_bases cluster_ops clustered_ham
nroots = 8
ci_vector = BSTstate(clusters,FermiCG.FockConfig(init_fspace), cluster_bases, R=nroots);
#ci_vector = FermiCG.TPSCIstate(clusters, FermiCG.FockConfig(init_fspace), R=nroots);
#ci_vector = FermiCG.add_spin_focksectors(ci_vector)

# Add the lowest energy single exciton and biexciton to basis
#ci_vector=FermiCG.bst_single_excitonic_basis(FermiCG.FockConfig(init_fspace),ci_vector,R=nroots)
#ci_vector=FermiCG.bst_biexcitonic_basis(FermiCG.FockConfig(init_fspace),ci_vector,R=nroots)
ci_vector[FermiCG.FockConfig(init_fspace)][FermiCG.TuckerConfig((1:1,1:1))] =
FermiCG.Tucker(tuple([zeros(Float64, 1, 1) for _ in 1:nroots]...))
ci_vector[FermiCG.FockConfig(init_fspace)][FermiCG.TuckerConfig((2:2,1:1))] =
FermiCG.Tucker(tuple([zeros(Float64, 1, 1) for _ in 1:nroots]...))
ci_vector[FermiCG.FockConfig(init_fspace)][FermiCG.TuckerConfig((1:1,2:2))] =
FermiCG.Tucker(tuple([zeros(Float64, 1, 1) for _ in 1:nroots]...))
ci_vector[FermiCG.FockConfig(init_fspace)][FermiCG.TuckerConfig((1:1,3:3))] =
FermiCG.Tucker(tuple([zeros(Float64, 1, 1) for _ in 1:nroots]...))
ci_vector[FermiCG.FockConfig(init_fspace)][FermiCG.TuckerConfig((3:3,1:1))] =
FermiCG.Tucker(tuple([zeros(Float64, 1, 1) for _ in 1:nroots]...))
ci_vector[FermiCG.FockConfig(init_fspace)][FermiCG.TuckerConfig((2:2,2:2))] =
FermiCG.Tucker(tuple([zeros(Float64, 1, 1) for _ in 1:nroots]...))


# Spin-flip states
fspace_0 = FermiCG.FockConfig(init_fspace)

## ba
tmp_fspace = FermiCG.replace(fspace_0, (1,2), ([6,4],[4,6]))
FermiCG.add_fockconfig!(ci_vector, tmp_fspace)
ci_vector[tmp_fspace][FermiCG.TuckerConfig((1:1,1:1))]=FermiCG.Tucker(tuple([zeros(Float64, 1, 1) for _ in 1:nroots]...))

## ab
tmp_fspace = FermiCG.replace(fspace_0, (1,2), ([4,6],[6,4]))
FermiCG.add_fockconfig!(ci_vector, tmp_fspace)
ci_vector[tmp_fspace][FermiCG.TuckerConfig((1:1,1:1))]=FermiCG.Tucker(tuple([zeros(Float64, 1, 1) for _ in 1:nroots]...))
FermiCG.eye!(ci_vector)
display(ci_vector)


e_ci, v = FermiCG.ci_solve(ci_vector, cluster_ops, clustered_ham);
@save "data_ci.jld2" v e_ci


σ = FermiCG.build_compressed_1st_order_state(v, cluster_ops, clustered_ham, thresh=1e-8)
σ = FermiCG.compress(σ, thresh=1e-2)
FermiCG.nonorth_add!(v, σ)

e_ci, v = FermiCG.ci_solve(σ, cluster_ops, clustered_ham);


v = FermiCG.BSstate(clusters, FermiCG.FockConfig(init_fspace), cluster_bases, R=10)
FermiCG.add_single_excitons_upto_L!(v,4)
FermiCG.add_double_excitons_upto_L!(v,4)
# FermiCG.add_1electron_transfers!(v)
FermiCG.add_spin_flip_states!(v,init_fspace)
FermiCG.eye!(v)

display(v)
# e_ci, v_ci = FermiCG.ci_solve(v, cluster_ops, clustered_ham, solver="davidson");
e_ci, v_ci = FermiCG.ci_solve(v, cluster_ops, clustered_ham, solver="krylovkit", verbose=2);

v_bst = FermiCG.BSTstate(v_ci, thresh=1e-5)

display(v_bst)
FermiCG.randomize!(v_bst)
FermiCG.orthonormalize!(v_bst)
# FermiCG.eye!(v_bst)
display(v_bst)
σ = FermiCG.build_compressed_1st_order_state(v_bst, cluster_ops, clustered_ham,
nbody=4,
thresh=1e-3)
σ = FermiCG.compress(σ, thresh=1e-5)
v2 = BSTstate(σ,R=10)
FermiCG.eye!(v2)
e_ci, v2 = FermiCG.ci_solve(v2, cluster_ops, clustered_ham);
e_var, v_var = FermiCG.block_sparse_tucker(v2, cluster_ops, clustered_ham,
max_iter = 20,
nbody = 4,
H0 = "Hcmf",
thresh_var = 1e-2,
thresh_foi = 1e-4,
thresh_pt = 1e-3,
ci_conv = 1e-5,
do_pt = true,
resolve_ss = false,
tol_tucker = 1e-4,
solver = "davidson")
# e_ci2, v_ci2 = FermiCG.ci_solve(v_bst, cluster_ops, clustered_ham, solver="davidson");
# e_ci2, v_ci2 = FermiCG.ci_solve(v_bst, cluster_ops, clustered_ham, solver="krylovkit", verbose=2);
Loading
Loading