10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-19 04:22:21 +01:00
QCaml/SCF/Fock.ml

61 lines
1.4 KiB
OCaml
Raw Normal View History

2018-02-23 18:44:31 +01:00
open Lacaml.D
open Simulation
2018-03-13 18:24:00 +01:00
open Constants
2018-02-23 18:44:31 +01:00
2018-03-26 16:47:08 +02:00
2018-05-30 18:07:05 +02:00
type t =
{
fock : Mat.t ;
core : Mat.t ;
coulomb : Mat.t ;
exchange : Mat.t ;
}
2018-02-23 18:44:31 +01:00
let make ~density simulation =
let m_P = density
and m_T = Lazy.force simulation.kin_ints
and m_V = Lazy.force simulation.eN_ints
and m_G = Lazy.force simulation.ee_ints
in
let nBas = Mat.dim1 m_T
in
2018-05-30 18:07:05 +02:00
let m_Hc = Mat.add m_T m_V
and m_J = Mat.make0 nBas nBas
and m_K = Mat.make0 nBas nBas
in
2018-02-23 18:44:31 +01:00
for sigma = 1 to nBas do
for nu = 1 to nBas do
for lambda = 1 to nBas do
let p = m_P.{lambda,sigma} in
2018-03-13 18:24:00 +01:00
if abs_float p > epsilon then
for mu = 1 to nu do
2018-05-30 18:07:05 +02:00
m_J.{mu,nu} <- m_J.{mu,nu} +. p *.
ERI.get_phys m_G mu lambda nu sigma
done
done
done
done;
for nu = 1 to nBas do
for sigma = 1 to nBas do
for lambda = 1 to nBas do
let p = 0.5 *. m_P.{lambda,sigma} in
if abs_float p > epsilon then
for mu = 1 to nu do
m_K.{mu,nu} <- m_K.{mu,nu} -. p *.
ERI.get_phys m_G mu lambda sigma nu
2018-03-13 18:24:00 +01:00
done
2018-02-23 18:44:31 +01:00
done
done
done;
for nu = 1 to nBas do
for mu = 1 to nu do
2018-05-30 18:07:05 +02:00
m_J.{nu,mu} <- m_J.{mu,nu};
m_K.{nu,mu} <- m_K.{mu,nu};
2018-02-23 18:44:31 +01:00
done
done;
2018-05-30 18:07:05 +02:00
{ fock = Mat.add m_Hc @@ Mat.add m_J m_K ;
core = m_Hc ; coulomb = m_J ; exchange = m_K }
2018-02-23 18:44:31 +01:00