mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-12-22 12:23:31 +01:00
Improved Huckel guess
This commit is contained in:
parent
0f2285b557
commit
c9c039c2fe
@ -153,13 +153,12 @@ let fci_of_mo_basis ?(frozen_core=true) mo_basis =
|
|||||||
let n_det_beta = Array.length det_beta in
|
let n_det_beta = Array.length det_beta in
|
||||||
let n_det_alfa = Array.length det_alfa in
|
let n_det_alfa = Array.length det_alfa in
|
||||||
|
|
||||||
(*
|
|
||||||
let ndet = n_det_alfa * n_det_beta in
|
let ndet = n_det_alfa * n_det_beta in
|
||||||
Format.printf "Number of determinants : %d %d %d\n%!"
|
Format.printf "Number of determinants : %d %d %d\n%!"
|
||||||
n_det_alfa n_det_beta ndet;
|
n_det_alfa n_det_beta ndet;
|
||||||
Spin (det_alfa, det_beta)
|
Spin (det_alfa, det_beta)
|
||||||
*)
|
|
||||||
|
|
||||||
|
(*
|
||||||
let det = Array.make n_det_alfa
|
let det = Array.make n_det_alfa
|
||||||
(Array.init n_det_beta (fun i -> i))
|
(Array.init n_det_beta (fun i -> i))
|
||||||
in
|
in
|
||||||
@ -171,6 +170,7 @@ let fci_of_mo_basis ?(frozen_core=true) mo_basis =
|
|||||||
Arbitrary {
|
Arbitrary {
|
||||||
det_alfa ; det_beta ; det ; index_start
|
det_alfa ; det_beta ; det ; index_start
|
||||||
}
|
}
|
||||||
|
*)
|
||||||
in
|
in
|
||||||
{ n_alfa ; n_beta ; mo_class ; mo_basis ; determinants }
|
{ n_alfa ; n_beta ; mo_class ; mo_basis ; determinants }
|
||||||
|
|
||||||
|
30
SCF/Guess.ml
30
SCF/Guess.ml
@ -21,29 +21,31 @@ let hcore_guess ao_basis =
|
|||||||
|
|
||||||
let huckel_guess ao_basis =
|
let huckel_guess ao_basis =
|
||||||
let c = 0.5 *. 1.75 in
|
let c = 0.5 *. 1.75 in
|
||||||
let ao_num = Ao.basis ao_basis |> Basis.size in
|
|
||||||
let eN_ints = Ao.eN_ints ao_basis |> NucInt.matrix
|
let eN_ints = Ao.eN_ints ao_basis |> NucInt.matrix
|
||||||
and kin_ints = Ao.kin_ints ao_basis |> KinInt.matrix
|
and kin_ints = Ao.kin_ints ao_basis |> KinInt.matrix
|
||||||
and overlap = Ao.overlap ao_basis |> Ov.matrix
|
|
||||||
and m_X = Ao.ortho ao_basis
|
|
||||||
in
|
in
|
||||||
let diag = Array.init (ao_num+1) (fun i -> if i=0 then 0. else
|
let m_F =
|
||||||
eN_ints.{i,i} +. kin_ints.{i,i})
|
Mat.add eN_ints kin_ints
|
||||||
|
in
|
||||||
|
let ao_num = Ao.basis ao_basis |> Basis.size
|
||||||
|
and overlap = Ao.overlap ao_basis |> Ov.matrix
|
||||||
|
in
|
||||||
|
let diag = Vec.init ao_num (fun i ->
|
||||||
|
m_F.{i,i} )
|
||||||
in
|
in
|
||||||
|
|
||||||
function
|
function
|
||||||
| 0 -> invalid_arg "Huckel guess needs a non-zero number of occupied MOs."
|
| 0 -> invalid_arg "Huckel guess needs a non-zero number of occupied MOs."
|
||||||
| nocc ->
|
| nocc ->
|
||||||
let density = gemm ~alpha:2. ~transb:`T ~k:nocc m_X m_X in
|
Mat.init_cols ao_num ao_num (fun i j ->
|
||||||
let f = Fock.make_rhf ~density ao_basis in
|
|
||||||
let m_F = Fock.fock f in
|
|
||||||
for j=1 to ao_num do
|
|
||||||
for i=1 to ao_num do
|
|
||||||
if (i<>j) then
|
if (i<>j) then
|
||||||
m_F.{i,j} <- c *. overlap.{i,j} *. (diag.(i) +. diag.(j)) (*TODO Pseudo *)
|
if (diag.{i} +. diag.{j}) < 5. then
|
||||||
done;
|
c *. overlap.{i,j} *. (diag.{i} +. diag.{j}) +. m_F.{i,j} (*TODO Pseudo *)
|
||||||
done;
|
else
|
||||||
m_F
|
m_F.{i,j} (*TODO Pseudo *)
|
||||||
|
else
|
||||||
|
diag.{i}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
let make ?(nocc=0) ~guess ao_basis =
|
let make ?(nocc=0) ~guess ao_basis =
|
||||||
|
Loading…
Reference in New Issue
Block a user