2024-02-28 11:17:20 +01:00
|
|
|
(** Simulation *)
|
|
|
|
|
2020-10-09 10:02:18 +02:00
|
|
|
open Common
|
|
|
|
open Particles
|
|
|
|
open Operators
|
2021-01-01 11:46:11 +01:00
|
|
|
|
2024-02-28 11:17:20 +01:00
|
|
|
|
|
|
|
(** Type *)
|
|
|
|
|
2020-10-09 10:02:18 +02:00
|
|
|
type t = {
|
|
|
|
charge : Charge.t;
|
|
|
|
electrons : Electrons.t;
|
|
|
|
nuclei : Nuclei.t;
|
|
|
|
ao_basis : Ao.Basis.t;
|
|
|
|
operators : Operator.t list;
|
|
|
|
}
|
|
|
|
|
2021-01-01 11:46:11 +01:00
|
|
|
|
2024-02-28 11:17:20 +01:00
|
|
|
(** Access *)
|
2021-01-01 11:46:11 +01:00
|
|
|
|
2020-10-09 10:02:18 +02:00
|
|
|
let nuclei t = t.nuclei
|
|
|
|
let charge t = t.charge
|
|
|
|
let electrons t = t.electrons
|
|
|
|
let ao_basis t = t.ao_basis
|
|
|
|
let nuclear_repulsion t = Nuclei.repulsion @@ nuclei t
|
|
|
|
let operators t = t.operators
|
2021-01-01 11:46:11 +01:00
|
|
|
|
2020-10-09 10:02:18 +02:00
|
|
|
|
2024-02-28 11:17:20 +01:00
|
|
|
(** Creation *)
|
2021-01-01 11:46:11 +01:00
|
|
|
|
|
|
|
let make
|
|
|
|
?(multiplicity=1)
|
|
|
|
?(charge=0)
|
|
|
|
?(operators=[])
|
|
|
|
~nuclei
|
|
|
|
ao_basis
|
2020-10-09 10:02:18 +02:00
|
|
|
=
|
|
|
|
|
|
|
|
(* Tune Garbage Collector *)
|
|
|
|
let gc = Gc.get () in
|
|
|
|
Gc.set { gc with space_overhead = 1000 };
|
|
|
|
|
|
|
|
let electrons =
|
|
|
|
Electrons.of_atoms ~multiplicity ~charge nuclei
|
|
|
|
in
|
|
|
|
|
2024-02-28 11:17:20 +01:00
|
|
|
let charge =
|
2020-10-09 10:02:18 +02:00
|
|
|
Charge.(Nuclei.charge nuclei + Electrons.charge electrons)
|
|
|
|
in
|
|
|
|
|
2021-01-01 11:46:11 +01:00
|
|
|
{ charge ; nuclei ; electrons ; ao_basis ; operators}
|
2020-10-09 10:02:18 +02:00
|
|
|
|
2024-02-28 11:17:20 +01:00
|
|
|
|
|
|
|
(** Printers *)
|
|
|
|
|
2021-01-01 11:46:11 +01:00
|
|
|
let pp ppf t =
|
|
|
|
let formula = Nuclei.formula t.nuclei in
|
|
|
|
let n_aos = Ao.Basis.size t.ao_basis in
|
|
|
|
let n_ops = List.length t.operators in
|
|
|
|
Format.fprintf ppf "@[@[%s@], @[%a@], @[%d AOs@], @[%d operators@]@]"
|
|
|
|
formula Electrons.pp t.electrons n_aos n_ops
|
2024-02-28 11:17:20 +01:00
|
|
|
|