2018-02-23 18:44:31 +01:00
|
|
|
(** Number of alpha and beta electrons *)
|
|
|
|
|
|
|
|
type t = {
|
|
|
|
n_alpha : int ;
|
|
|
|
n_beta : int ;
|
|
|
|
multiplicity : int;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let make ?multiplicity:(multiplicity=1) ?charge:(charge=0) nuclei =
|
|
|
|
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
|
|
|
|
let n_alpha = n_elec - n_beta in
|
|
|
|
let result = { n_alpha ; n_beta ; multiplicity } in
|
|
|
|
if multiplicity <> (n_alpha - 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
|
|
|
|
|