2019-02-20 19:43:16 +01:00
|
|
|
(** Number of {% $\alpha$ %} and {% $\beta$ %} electrons *)
|
2018-02-23 18:44:31 +01:00
|
|
|
|
2020-10-09 09:47:57 +02:00
|
|
|
open Common
|
2020-09-26 12:02:53 +02:00
|
|
|
|
2018-02-23 18:44:31 +01:00
|
|
|
type t = {
|
2019-02-20 19:43:16 +01:00
|
|
|
n_alfa : int ;
|
|
|
|
n_beta : int ;
|
2018-02-23 18:44:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-26 12:02:53 +02:00
|
|
|
let make n_alfa n_beta =
|
|
|
|
{ n_alfa ; n_beta }
|
|
|
|
|
|
|
|
|
|
|
|
let of_atoms ?multiplicity:(multiplicity=1) ?charge:(charge=0) nuclei =
|
2018-02-23 18:44:31 +01:00
|
|
|
let positive_charges =
|
|
|
|
Array.fold_left (fun accu (e, _) -> accu + Charge.to_int (Element.to_charge e) )
|
|
|
|
0 nuclei
|
|
|
|
in
|
|
|
|
let negative_charges = charge - positive_charges in
|
|
|
|
let n_elec = - negative_charges in
|
|
|
|
let n_beta = ((n_elec - multiplicity)+1)/2 in
|
2019-02-20 19:43:16 +01:00
|
|
|
let n_alfa = n_elec - n_beta in
|
2020-09-26 12:02:53 +02:00
|
|
|
let result = { n_alfa ; n_beta } in
|
2019-02-20 19:43:16 +01:00
|
|
|
if multiplicity <> (n_alfa - n_beta)+1 then
|
2018-02-25 00:53:09 +01:00
|
|
|
invalid_arg (__FILE__^": make");
|
2018-02-23 18:44:31 +01:00
|
|
|
result
|
|
|
|
|
2020-09-26 12:02:53 +02:00
|
|
|
|
2018-03-03 22:13:14 +01:00
|
|
|
let charge e =
|
2019-02-20 19:43:16 +01:00
|
|
|
- (e.n_alfa + e.n_beta)
|
2018-03-03 22:13:14 +01:00
|
|
|
|> Charge.of_int
|
|
|
|
|
2020-09-26 12:02:53 +02:00
|
|
|
|
2019-02-20 19:43:16 +01:00
|
|
|
let n_alfa t = t.n_alfa
|
|
|
|
let n_beta t = t.n_beta
|
2019-12-03 12:25:31 +01:00
|
|
|
let n_elec t = t.n_alfa + t.n_beta
|
2020-09-26 12:02:53 +02:00
|
|
|
let multiplicity t = t.n_alfa - t.n_beta + 1
|