10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-23 04:43:32 +01:00
QCaml/mo/lib/guess.ml

55 lines
1.3 KiB
OCaml
Raw Normal View History

2020-10-18 01:58:22 +02:00
open Linear_algebra
type ao = Ao.Ao_dim.t
type mo = Mo_dim.t
type guess =
| Hcore of (ao,ao) Matrix.t
2023-06-26 15:31:35 +02:00
| GWH of (ao,ao) Matrix.t
2020-10-18 01:58:22 +02:00
| Huckel of (ao,ao) Matrix.t
| Matrix of (ao,mo) Matrix.t
type t = guess
module El = Particles.Electrons
2023-06-26 15:31:35 +02:00
let hcore_guess ao_basis =
2020-10-18 01:58:22 +02:00
let eN_ints = Ao.Basis.eN_ints ao_basis
and kin_ints = Ao.Basis.kin_ints ao_basis
in
Matrix.add eN_ints kin_ints
2023-06-26 15:31:35 +02:00
let gwh_guess ao_basis =
2020-10-18 01:58:22 +02:00
let c = 0.5 *. 1.75 in
let ao_num = Ao.Basis.size ao_basis
and overlap = Ao.Basis.overlap ao_basis
in
2023-06-26 15:31:35 +02:00
let m_F = hcore_guess ao_basis in
2020-10-18 01:58:22 +02:00
let diag = Vector.init ao_num (fun i -> m_F%:(i,i) ) in
2023-06-26 15:31:35 +02:00
Matrix.init_cols ao_num ao_num (fun i j ->
2020-10-18 01:58:22 +02:00
if (i<>j) then
2023-06-26 15:31:35 +02:00
c *. (overlap%:(i,j)) /. ((overlap%:(i,i)) *. (overlap%:(j,j)) ) *. (diag%.(i) +. diag%.(j))
2020-10-18 01:58:22 +02:00
else
2023-06-26 15:31:35 +02:00
diag%.(i)
2020-10-18 01:58:22 +02:00
)
2023-06-26 15:31:35 +02:00
let huckel_guess ao_basis =
function
| 0 -> invalid_arg "Huckel guess needs a non-zero number of occupied MOs."
| _nocc ->
let m_F = gwh_guess ao_basis in
(*TODO: F(l,l) = F_gwh(l,l) + \sum{mu,nu} P_{mu,nu} (mu nu| l l) *)
m_F
let make ?(nocc=0) ~guess ao_basis =
2020-10-18 01:58:22 +02:00
match guess with
| `Hcore -> Hcore (hcore_guess ao_basis)
2023-06-26 15:31:35 +02:00
| `GWH -> Hcore (gwh_guess ao_basis)
2020-10-18 01:58:22 +02:00
| `Huckel -> Huckel (huckel_guess ao_basis nocc)
| `Matrix m -> Matrix m