mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-07 06:33:39 +01:00
Open-shell FCI OK
This commit is contained in:
parent
b83b23913e
commit
56e146f790
@ -4,12 +4,12 @@ open Constants
|
|||||||
type t = {
|
type t = {
|
||||||
expo : float array array;
|
expo : float array array;
|
||||||
coef : float array array;
|
coef : float array array;
|
||||||
center : Coordinate.t;
|
|
||||||
ang_mom : AngularMomentum.t;
|
|
||||||
norm_coef : float array array;
|
norm_coef : float array array;
|
||||||
norm_coef_scale : float array;
|
norm_coef_scale : float array;
|
||||||
index : int;
|
|
||||||
contr : ContractedShell.t array;
|
contr : ContractedShell.t array;
|
||||||
|
index : int;
|
||||||
|
center : Coordinate.t;
|
||||||
|
ang_mom : AngularMomentum.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
module Am = AngularMomentum
|
module Am = AngularMomentum
|
||||||
|
@ -5,9 +5,9 @@ exception Null_contribution
|
|||||||
|
|
||||||
type t =
|
type t =
|
||||||
{
|
{
|
||||||
|
contracted_shell_pairs : ContractedShellPair.t list;
|
||||||
atomic_shell_a : AtomicShell.t;
|
atomic_shell_a : AtomicShell.t;
|
||||||
atomic_shell_b : AtomicShell.t;
|
atomic_shell_b : AtomicShell.t;
|
||||||
contracted_shell_pairs : ContractedShellPair.t list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ open Util
|
|||||||
|
|
||||||
type t =
|
type t =
|
||||||
{
|
{
|
||||||
|
contracted_shell_pair_couples : ContractedShellPairCouple.t list ;
|
||||||
atomic_shell_pair_p: AtomicShellPair.t ;
|
atomic_shell_pair_p: AtomicShellPair.t ;
|
||||||
atomic_shell_pair_q: AtomicShellPair.t ;
|
atomic_shell_pair_q: AtomicShellPair.t ;
|
||||||
atomic_shell_a : AtomicShell.t ;
|
atomic_shell_a : AtomicShell.t ;
|
||||||
@ -9,7 +10,6 @@ type t =
|
|||||||
atomic_shell_c : AtomicShell.t ;
|
atomic_shell_c : AtomicShell.t ;
|
||||||
atomic_shell_d : AtomicShell.t ;
|
atomic_shell_d : AtomicShell.t ;
|
||||||
ang_mom : AngularMomentum.t ;
|
ang_mom : AngularMomentum.t ;
|
||||||
contracted_shell_pair_couples : ContractedShellPairCouple.t list ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module Am = AngularMomentum
|
module Am = AngularMomentum
|
||||||
|
@ -4,12 +4,12 @@ open Constants
|
|||||||
type t = {
|
type t = {
|
||||||
expo : float array;
|
expo : float array;
|
||||||
coef : float array;
|
coef : float array;
|
||||||
center : Coordinate.t;
|
|
||||||
ang_mom : AngularMomentum.t;
|
|
||||||
norm_coef : float array;
|
norm_coef : float array;
|
||||||
norm_coef_scale : float array;
|
norm_coef_scale : float array;
|
||||||
index : int;
|
|
||||||
prim : PrimitiveShell.t array;
|
prim : PrimitiveShell.t array;
|
||||||
|
center : Coordinate.t;
|
||||||
|
ang_mom : AngularMomentum.t;
|
||||||
|
index : int;
|
||||||
}
|
}
|
||||||
|
|
||||||
module Am = AngularMomentum
|
module Am = AngularMomentum
|
||||||
|
@ -5,9 +5,9 @@ exception Null_contribution
|
|||||||
|
|
||||||
type t =
|
type t =
|
||||||
{
|
{
|
||||||
|
coefs_and_shell_pairs : (float * PrimitiveShellPair.t) list;
|
||||||
shell_a : ContractedShell.t;
|
shell_a : ContractedShell.t;
|
||||||
shell_b : ContractedShell.t;
|
shell_b : ContractedShell.t;
|
||||||
coefs_and_shell_pairs : (float * PrimitiveShellPair.t) list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ open Util
|
|||||||
|
|
||||||
type t =
|
type t =
|
||||||
{
|
{
|
||||||
|
coefs_and_shell_pair_couples : (float * PrimitiveShellPairCouple.t) list ;
|
||||||
shell_pair_p: ContractedShellPair.t ;
|
shell_pair_p: ContractedShellPair.t ;
|
||||||
shell_pair_q: ContractedShellPair.t ;
|
shell_pair_q: ContractedShellPair.t ;
|
||||||
shell_a : ContractedShell.t ;
|
shell_a : ContractedShell.t ;
|
||||||
@ -9,7 +10,6 @@ type t =
|
|||||||
shell_c : ContractedShell.t ;
|
shell_c : ContractedShell.t ;
|
||||||
shell_d : ContractedShell.t ;
|
shell_d : ContractedShell.t ;
|
||||||
ang_mom : AngularMomentum.t ;
|
ang_mom : AngularMomentum.t ;
|
||||||
coefs_and_shell_pair_couples : (float * PrimitiveShellPairCouple.t) list ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module Am = AngularMomentum
|
module Am = AngularMomentum
|
||||||
|
@ -3,9 +3,9 @@ open Constants
|
|||||||
open Coordinate
|
open Coordinate
|
||||||
|
|
||||||
type t = {
|
type t = {
|
||||||
|
norm_scales : float array lazy_t;
|
||||||
exponent : float;
|
exponent : float;
|
||||||
normalization : float;
|
normalization : float;
|
||||||
norm_scales : float array lazy_t;
|
|
||||||
center : Coordinate.t;
|
center : Coordinate.t;
|
||||||
ang_mom : AngularMomentum.t;
|
ang_mom : AngularMomentum.t;
|
||||||
}
|
}
|
||||||
|
@ -3,15 +3,15 @@ open Constants
|
|||||||
|
|
||||||
|
|
||||||
type t = {
|
type t = {
|
||||||
|
norm_scales : float array lazy_t;
|
||||||
exponent : float; (* {% $\alpha + \beta$ %} *)
|
exponent : float; (* {% $\alpha + \beta$ %} *)
|
||||||
exponent_inv : float; (* {% $1/(\alpha + \beta)$ %} *)
|
exponent_inv : float; (* {% $1/(\alpha + \beta)$ %} *)
|
||||||
|
a_minus_b_sq : float; (* {% $|A-B|^2$ %} *)
|
||||||
|
normalization : float; (* [norm_coef_a * norm_coef_b * g], with
|
||||||
|
{% $g = (\pi/(\alpha+\beta))^(3/2) \exp (-|A-B|^2 \alpha\beta/(\alpha+\beta))$ %} *)
|
||||||
center : Coordinate.t; (* {% $P = (\alpha A + \beta B)/(\alpha+\beta)$ %} *)
|
center : Coordinate.t; (* {% $P = (\alpha A + \beta B)/(\alpha+\beta)$ %} *)
|
||||||
center_minus_a : Coordinate.t; (* {% $P - A$ %} *)
|
center_minus_a : Coordinate.t; (* {% $P - A$ %} *)
|
||||||
a_minus_b : Coordinate.t; (* {% $A - B$ %} *)
|
a_minus_b : Coordinate.t; (* {% $A - B$ %} *)
|
||||||
a_minus_b_sq : float; (* {% $|A-B|^2$ %} *)
|
|
||||||
norm_scales : float array lazy_t;
|
|
||||||
normalization : float; (* [norm_coef_a * norm_coef_b * g], with
|
|
||||||
{% $g = (\pi/(\alpha+\beta))^(3/2) \exp (-|A-B|^2 \alpha\beta/(\alpha+\beta))$ %} *)
|
|
||||||
ang_mom : AngularMomentum.t;
|
ang_mom : AngularMomentum.t;
|
||||||
shell_a : PrimitiveShell.t;
|
shell_a : PrimitiveShell.t;
|
||||||
shell_b : PrimitiveShell.t;
|
shell_b : PrimitiveShell.t;
|
||||||
|
@ -2,6 +2,7 @@ exception NullContribution
|
|||||||
|
|
||||||
type t =
|
type t =
|
||||||
{
|
{
|
||||||
|
zkey_array : Zkey.t array lazy_t;
|
||||||
shell_pair_p: PrimitiveShellPair.t ;
|
shell_pair_p: PrimitiveShellPair.t ;
|
||||||
shell_pair_q: PrimitiveShellPair.t ;
|
shell_pair_q: PrimitiveShellPair.t ;
|
||||||
shell_a : PrimitiveShell.t ;
|
shell_a : PrimitiveShell.t ;
|
||||||
@ -9,7 +10,6 @@ type t =
|
|||||||
shell_c : PrimitiveShell.t ;
|
shell_c : PrimitiveShell.t ;
|
||||||
shell_d : PrimitiveShell.t ;
|
shell_d : PrimitiveShell.t ;
|
||||||
ang_mom : AngularMomentum.t ;
|
ang_mom : AngularMomentum.t ;
|
||||||
zkey_array : Zkey.t array lazy_t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module Am = AngularMomentum
|
module Am = AngularMomentum
|
||||||
|
@ -157,52 +157,25 @@ let make ~simulation ~mo_type ~mo_occupation ~mo_coef () =
|
|||||||
|
|
||||||
|
|
||||||
let of_rhf hf =
|
let of_rhf hf =
|
||||||
let mo_num = Vec.dim hf.HF.eigenvalues in
|
|
||||||
let mo_coef = hf.HF.eigenvectors in
|
let mo_coef = hf.HF.eigenvectors in
|
||||||
let simulation = hf.HF.simulation in
|
let simulation = hf.HF.simulation in
|
||||||
let mo_type = RHF in
|
let mo_type = RHF in
|
||||||
let nocc = hf.HF.nocc in
|
let mo_occupation = hf.HF.occupation in
|
||||||
let mo_occupation =
|
|
||||||
Array.init mo_num (fun i ->
|
|
||||||
if i < nocc then 2. else 0.)
|
|
||||||
|> Vec.of_array
|
|
||||||
in
|
|
||||||
let result =
|
|
||||||
make ~simulation ~mo_type ~mo_occupation ~mo_coef ()
|
make ~simulation ~mo_type ~mo_occupation ~mo_coef ()
|
||||||
in
|
|
||||||
|
|
||||||
(*
|
|
||||||
let () =
|
let of_rohf hf =
|
||||||
let e = ref 0. in
|
let mo_coef = hf.HF.eigenvectors in
|
||||||
let t = KinInt.matrix (Lazy.force result.kin_ints) in
|
let simulation = hf.HF.simulation in
|
||||||
let v = NucInt.matrix (Lazy.force result.eN_ints) in
|
let mo_type = ROHF in
|
||||||
let g = Lazy.force result.ee_ints in
|
let mo_occupation = hf.HF.occupation in
|
||||||
for i = 1 to 5 do
|
make ~simulation ~mo_type ~mo_occupation ~mo_coef ()
|
||||||
e := !e +. 2. *. (t.{i,i} +. v.{i,i})
|
|
||||||
done;
|
|
||||||
Printf.printf "Energy one-e = %20.15f\n" !e;
|
|
||||||
let e2 = ref 0. in
|
|
||||||
for i = 1 to 5 do
|
|
||||||
for j = i+1 to 5 do
|
|
||||||
e2 := !e2 +. 2. *. (ERI.get_phys g i j i j -.
|
|
||||||
ERI.get_phys g i j j i)
|
|
||||||
done;
|
|
||||||
done;
|
|
||||||
for i = 1 to 5 do
|
|
||||||
for j = 1 to 5 do
|
|
||||||
e2 := !e2 +. ERI.get_phys g i j i j
|
|
||||||
done;
|
|
||||||
done;
|
|
||||||
Printf.printf "Energy two-e = %20.15f\n" !e2;
|
|
||||||
Printf.printf "Energy = %20.15f\n" (Si.nuclear_repulsion simulation +. !e +. !e2)
|
|
||||||
in
|
|
||||||
*)
|
|
||||||
result
|
|
||||||
|
|
||||||
|
|
||||||
let of_hartree_fock = function
|
let of_hartree_fock = function
|
||||||
| HF.RHF hf -> of_rhf hf
|
| HF.RHF hf -> of_rhf hf
|
||||||
| _ -> assert false
|
| HF.ROHF hf -> of_rohf hf
|
||||||
|
| HF.UHF _ -> assert false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,16 +5,17 @@ type s =
|
|||||||
{
|
{
|
||||||
simulation : Simulation.t;
|
simulation : Simulation.t;
|
||||||
guess : Guess.t;
|
guess : Guess.t;
|
||||||
eigenvectors : Lacaml.D.Mat.t ;
|
eigenvectors : Mat.t ;
|
||||||
eigenvalues : Lacaml.D.Vec.t ;
|
eigenvalues : Vec.t ;
|
||||||
nocc : int;
|
occupation : Vec.t ;
|
||||||
|
iterations : (float * float * float) array;
|
||||||
energy : float ;
|
energy : float ;
|
||||||
nuclear_repulsion : float ;
|
nuclear_repulsion : float ;
|
||||||
kin_energy : float ;
|
kin_energy : float ;
|
||||||
eN_energy : float ;
|
eN_energy : float ;
|
||||||
coulomb_energy : float ;
|
coulomb_energy : float ;
|
||||||
exchange_energy : float ;
|
exchange_energy : float ;
|
||||||
iterations : (float * float * float) array;
|
nocc : int;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
|
open Lacaml.D
|
||||||
|
|
||||||
(** Data structure representing the output of a Hartree-Fock caculation *)
|
(** Data structure representing the output of a Hartree-Fock caculation *)
|
||||||
|
|
||||||
type s =
|
type s =
|
||||||
{
|
{
|
||||||
simulation : Simulation.t; (** Simulation which was used for HF calculation *)
|
simulation : Simulation.t; (** Simulation which was used for HF calculation *)
|
||||||
guess : Guess.t; (** Initial guess *)
|
guess : Guess.t; (** Initial guess *)
|
||||||
eigenvectors : Lacaml.D.Mat.t ; (** Final eigenvectors *)
|
eigenvectors : Mat.t ; (** Final eigenvectors *)
|
||||||
eigenvalues : Lacaml.D.Vec.t ; (** Final eigenvalues *)
|
eigenvalues : Vec.t ; (** Final eigenvalues *)
|
||||||
nocc : int ; (** Number of occupied MOs *)
|
occupation : Vec.t ; (** Diagonal of the density matrix *)
|
||||||
|
iterations : (float * float * float) array;
|
||||||
energy : float ; (** Final energy *)
|
energy : float ; (** Final energy *)
|
||||||
nuclear_repulsion : float ; (** Nucleus-Nucleus potential energy *)
|
nuclear_repulsion : float ; (** Nucleus-Nucleus potential energy *)
|
||||||
kin_energy : float ; (** Kinetic energy *)
|
kin_energy : float ; (** Kinetic energy *)
|
||||||
eN_energy : float ; (** Electron-nucleus potential energy *)
|
eN_energy : float ; (** Electron-nucleus potential energy *)
|
||||||
coulomb_energy : float ; (** Electron-Electron potential energy *)
|
coulomb_energy : float ; (** Electron-Electron potential energy *)
|
||||||
exchange_energy : float ; (** Exchange energy *)
|
exchange_energy : float ; (** Exchange energy *)
|
||||||
iterations : (float * float * float) array;
|
nocc : int ; (** Number of occupied MOs *)
|
||||||
(** Energy, convergence and HOMO-LUMO gap of all iterations *)
|
(** Energy, convergence and HOMO-LUMO gap of all iterations *)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,6 +174,7 @@ let make ?guess:(guess=`Huckel) ?max_scf:(max_scf=64) ?level_shift:(level_shift=
|
|||||||
eN_energy = Mat.gemm_trace m_P m_V;
|
eN_energy = Mat.gemm_trace m_P m_V;
|
||||||
coulomb_energy = 0.5 *. Mat.gemm_trace m_P m_J;
|
coulomb_energy = 0.5 *. Mat.gemm_trace m_P m_J;
|
||||||
exchange_energy = 0.5 *. Mat.gemm_trace m_P m_K;
|
exchange_energy = 0.5 *. Mat.gemm_trace m_P m_K;
|
||||||
|
occupation = Mat.copy_diag m_P;
|
||||||
})
|
})
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -265,6 +265,7 @@ let make ?guess:(guess=`Huckel) ?max_scf:(max_scf=64) ?level_shift:(level_shift=
|
|||||||
0.5 *. (Mat.gemm_trace m_P_b m_J_b);
|
0.5 *. (Mat.gemm_trace m_P_b m_J_b);
|
||||||
exchange_energy = 0.5 *. (Mat.gemm_trace m_P_a m_K_a) +.
|
exchange_energy = 0.5 *. (Mat.gemm_trace m_P_a m_K_a) +.
|
||||||
0.5 *. (Mat.gemm_trace m_P_b m_K_b);
|
0.5 *. (Mat.gemm_trace m_P_b m_K_b);
|
||||||
|
occupation = Mat.copy_diag m_P;
|
||||||
})
|
})
|
||||||
in
|
in
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user