QCaml/Utils/Units.ml

26 lines
346 B
OCaml

type units =
| Bohr
| Angstrom
type angle_units =
| Degree
| Radian
let pi = acos (-1.)
let to_degree x =
assert (x <= 2.*.pi);
assert (x >= -2.*.pi);
x *. 180. /. pi
let to_radian x =
assert (x <= 360.);
assert (x >= -360.);
x *. pi /. 180.
let angstrom_to_bohr = 1. /. 0.52917721092
let bohr_to_angstrom = 0.52917721092
;;