Skip to content

Commit

Permalink
cleaned cepa in tpsci and spt pt2 version and qdpt pt2 functions are…
Browse files Browse the repository at this point in the history
… ready to commit and pull request
  • Loading branch information
arnab82 committed Aug 16, 2024
1 parent 58d9eb3 commit f50fab4
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tpsci_pt2_energy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ end
threaded = true,
verbose=1) where {T,N,R}
this function computes the second-order energy correction using the Quasidegenerate perturbation theory
Approximation: Taking ∂S=0 in denominator of the perturbation theory expression
args::
TPSCIstate{T,N,R} : TPSCIstate object
cluster_ops::Dict{Int64,Dict{String,Any}} : cluster operators
Expand Down
Binary file added test/_testdata_cmf_cr2_19.jld2
Binary file not shown.
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ Random.seed!(1234567)
include("test_bs.jl")
include("test_schmidt.jl")
include("test_openshell.jl")
include("test_qdpt.jl")
end

41 changes: 41 additions & 0 deletions test/test_qdpt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using QCBase
using RDM
using FermiCG
using Printf
using Test
using LinearAlgebra
using Profile
using JLD2

# load data
@load "_testdata_cmf_cr2_19.jld2"

M=20
init_fspace = FockConfig(init_fspace)

cluster_bases = FermiCG.compute_cluster_eigenbasis_spin(ints, clusters, d1, [3,3,3,3,3], init_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);

nroots=4


ci_vector = FermiCG.TPSCIstate(clusters, init_fspace, R=nroots)

ci_vector = FermiCG.add_spin_focksectors(ci_vector)

eci, v = FermiCG.tps_ci_direct(ci_vector, cluster_ops, clustered_ham);


e2a = FermiCG.compute_pt2_energy(v, cluster_ops, clustered_ham)
e_qdpt=FermiCG.compute_qdpt_energy(v, cluster_ops, clustered_ham, nbody=4, H0="Hcmf", thresh_foi=1e-8, verbose=1, threaded=true)

println(" PT2 - ROCMF-PT2")
display(e2a)
println(" PT2 - ROCMF-QDPT")
display(e_qdpt)
@test isapprox(e_qdpt, [-108.13989647019216, -108.13975457069576, -108.1394893503325, -108.1390882840833], atol=1e-12)

0 comments on commit f50fab4

Please sign in to comment.