mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-07 22:53:41 +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_alfa = Array.length det_alfa in
|
||||
|
||||
(*
|
||||
let ndet = n_det_alfa * n_det_beta in
|
||||
Format.printf "Number of determinants : %d %d %d\n%!"
|
||||
n_det_alfa n_det_beta ndet;
|
||||
Spin (det_alfa, det_beta)
|
||||
*)
|
||||
|
||||
(*
|
||||
let det = Array.make n_det_alfa
|
||||
(Array.init n_det_beta (fun i -> i))
|
||||
in
|
||||
@ -171,6 +170,7 @@ let fci_of_mo_basis ?(frozen_core=true) mo_basis =
|
||||
Arbitrary {
|
||||
det_alfa ; det_beta ; det ; index_start
|
||||
}
|
||||
*)
|
||||
in
|
||||
{ n_alfa ; n_beta ; mo_class ; mo_basis ; determinants }
|
||||
|
||||
|
32
SCF/Guess.ml
32
SCF/Guess.ml
@ -21,29 +21,31 @@ let hcore_guess ao_basis =
|
||||
|
||||
let huckel_guess ao_basis =
|
||||
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
|
||||
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
|
||||
let diag = Array.init (ao_num+1) (fun i -> if i=0 then 0. else
|
||||
eN_ints.{i,i} +. kin_ints.{i,i})
|
||||
let m_F =
|
||||
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
|
||||
|
||||
function
|
||||
| 0 -> invalid_arg "Huckel guess needs a non-zero number of occupied MOs."
|
||||
| nocc ->
|
||||
let density = gemm ~alpha:2. ~transb:`T ~k:nocc m_X m_X in
|
||||
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
|
||||
m_F.{i,j} <- c *. overlap.{i,j} *. (diag.(i) +. diag.(j)) (*TODO Pseudo *)
|
||||
done;
|
||||
done;
|
||||
m_F
|
||||
Mat.init_cols ao_num ao_num (fun i j ->
|
||||
if (i<>j) then
|
||||
if (diag.{i} +. diag.{j}) < 5. then
|
||||
c *. overlap.{i,j} *. (diag.{i} +. diag.{j}) +. m_F.{i,j} (*TODO Pseudo *)
|
||||
else
|
||||
m_F.{i,j} (*TODO Pseudo *)
|
||||
else
|
||||
diag.{i}
|
||||
)
|
||||
|
||||
|
||||
let make ?(nocc=0) ~guess ao_basis =
|
||||
|
Loading…
Reference in New Issue
Block a user