Skip to content

Commit

Permalink
added test script
Browse files Browse the repository at this point in the history
  • Loading branch information
nmayhall-vt committed Feb 9, 2024
1 parent 014bd1d commit bff3292
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 7 deletions.
30 changes: 30 additions & 0 deletions examples/tetracene_dimer/del.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
e_ci, v = FermiCG.ci_solve(ci_vector, cluster_ops, clustered_ham);
@save "data_ci.jld2" v e_ci

#v = BSTstate(v,R=2)

v1 = BSTstate(v,R=1)
v2 = BSTstate(v,R=1)
FermiCG.set_vector!(v2, FermiCG.get_vector(v)[:,8])
σ1 = FermiCG.build_compressed_1st_order_state(v1, cluster_ops, clustered_ham,
nbody=4,
thresh=1e-7,
compress_twice=false)

σ2 = FermiCG.build_compressed_1st_order_state(v2, cluster_ops, clustered_ham,
nbody=4,
thresh=1e-7,
compress_twice=false)

e_ci, v = FermiCG.ci_solve(v1, cluster_ops, clustered_ham);
e_ci, v = FermiCG.ci_solve(v2, cluster_ops, clustered_ham);
display(FermiCG.nonorth_overlap(σ1,v1))
display(FermiCG.nonorth_overlap(σ2,v2))

#σ = FermiCG.compress(σ, thresh=1e-2)
#
#FermiCG.zero!(σ)
#FermiCG.nonorth_add!(v, σ)
#
#e_ci, v = FermiCG.ci_solve(v, cluster_ops, clustered_ham);
#
54 changes: 54 additions & 0 deletions examples/tetracene_dimer/del2.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

using QCBase
using Printf
using FermiCG
using NPZ
using InCoreIntegrals
using RDM
using JLD2

if false
@load "data_cmf_TD_12.jld2"
M = 100
#@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);

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

vcmf = BSTstate(clusters,FermiCG.FockConfig(init_fspace), cluster_bases, R=1);
end

σ = FermiCG.build_compressed_1st_order_state(vcmf, cluster_ops, clustered_ham,
nbody=4,
thresh=1e-3)
σ = FermiCG.compress(σ, thresh=1e-3)
v2 = BSTstate(σ,R=3)
FermiCG.eye!(v2)
e_ci, v2 = FermiCG.ci_solve(v2, cluster_ops, clustered_ham);

σ = FermiCG.build_compressed_1st_order_state(v2, cluster_ops, clustered_ham,
nbody=4,
thresh=1e-3)
σ = FermiCG.compress(σ, thresh=1e-4)
FermiCG.zero!(σ)
FermiCG.nonorth_add!(v2, σ)
e_ci, v2 = FermiCG.ci_solve(v2, cluster_ops, clustered_ham);

σ = FermiCG.build_compressed_1st_order_state(v2, cluster_ops, clustered_ham,
nbody=4,
thresh=1e-3)
σ = FermiCG.compress(σ, thresh=1e-2)
FermiCG.zero!(σ)
FermiCG.nonorth_add!(v2, σ)
e_ci, v2 = FermiCG.ci_solve(v2, cluster_ops, clustered_ham);

14 changes: 10 additions & 4 deletions examples/tetracene_dimer/spt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ M = 100
#@load "cmf_op_TD_with_ops.jld2"
display(clusters)
display(init_fspace)
ints = deepcopy(ints_cmf)
ref_fspace = FockConfig(init_fspace)
ecore = ints.h0

Expand Down Expand Up @@ -58,8 +57,15 @@ 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.compute_pt2_energy(v, cluster_ops, clustered_ham, thresh_foi=1e-5)
bst_energy, v = FermiCG.block_sparse_tucker(v, cluster_ops, clustered_ham,max_iter =2000, thresh_var=1e-2, thresh_foi=1e-4,thresh_pt=1e-3,thresh_spin=1e-3,do_pt=false);
@save "data_bst_1e2.jld2" clusters init_fspace ints cluster_bases v bst_energy


σ = 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);

4 changes: 2 additions & 2 deletions src/tucker_form_sigma_block_expand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ function form_sigma_block_expand(term::ClusteredTerm1B,
# this means that all the overlaps and the operator is a scalar
bra_cores[r] .= coeffs_ket.core[r] .* s
else
bra_cores[r] .= @ncon(tensors, indices)
bra_cores[r] .= bra_cores[r] .* s
bra_cores[r] .= @ncon(tensors, indices) .* s
#bra_cores[r] .= bra_cores[r] .* s
end
deleteat!(tensors,length(tensors))
end
Expand Down
2 changes: 1 addition & 1 deletion src/tucker_outer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ function _build_compressed_1st_order_state_job(fock_σ, jobs, σ::BSTstate{T,N,R
fock_ψ, tconfig_ψ, tuck_ψ,
max_number=max_number,
prescreen=thresh)

length(tuck_σ) > 0 || continue
# norm(tuck_σ) > thresh || continue

Expand Down

0 comments on commit bff3292

Please sign in to comment.