10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-19 20:42:22 +01:00
QCaml/common/lib/coordinate.mli

133 lines
2.5 KiB
OCaml
Raw Normal View History

2020-12-27 17:23:47 +01:00
(* Type
*
* #+NAME: types *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::types][types]] *)
type bohr
type angstrom
type xyz = {
x : float ;
y : float ;
z : float ;
}
type 'a point = xyz
type t = bohr point
2020-12-27 17:23:47 +01:00
type axis = X | Y | Z
(* types ends here *)
2020-12-27 17:23:47 +01:00
(* ~make~
*
* Creates a point in atomic units. *)
2018-02-13 17:36:25 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*~make~][~make~:1]] *)
val make : 'a point -> t
(* ~make~:1 ends here *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* ~make_angstrom~
*
* Creates a point in angstrom. *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*~make_angstrom~][~make_angstrom~:1]] *)
val make_angstrom : 'a point -> angstrom point
(* ~make_angstrom~:1 ends here *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* ~bohr_to_angstrom~
*
* Converts a point in bohr to angstrom. *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*~bohr_to_angstrom~][~bohr_to_angstrom~:1]] *)
val bohr_to_angstrom : bohr point -> angstrom point
(* ~bohr_to_angstrom~:1 ends here *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* ~angstrom_to_bohr~
*
* Converts a point in angstrom to bohr. *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*~angstrom_to_bohr~][~angstrom_to_bohr~:1]] *)
val angstrom_to_bohr : angstrom point -> bohr point
(* ~angstrom_to_bohr~:1 ends here *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* ~zero~
*
* ~zero~ = (0., 0., 0.) *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*~zero~][~zero~:1]] *)
val zero : bohr point
(* ~zero~:1 ends here *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* ~get~
*
* Extracts the projection of the coordinate on an axis.
*
* #+begin_example
* Coordinate.(get Y { x=1. ; y=2. ; z=3. })
* - float: 2.
* #+end_example *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*~get~][~get~:1]] *)
val get : axis -> bohr point -> float
(* ~get~:1 ends here *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* Scale *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*Scale][Scale:1]] *)
val ( |. ) : float -> t -> t
(* Scale:1 ends here *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* Add *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*Add][Add:1]] *)
val ( |+ ) : t -> t -> t
(* Add:1 ends here *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* Subtract *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*Subtract][Subtract:1]] *)
val ( |- ) : t -> t -> t
(* Subtract:1 ends here *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* Negative *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*Negative][Negative:1]] *)
val neg : t -> t
2020-12-27 17:23:47 +01:00
(* Negative:1 ends here *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* Dot product *)
2018-02-26 10:43:21 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*Dot product][Dot product:1]] *)
val dot : t -> t -> float
2020-12-27 17:23:47 +01:00
(* Dot product:1 ends here *)
2018-02-13 17:36:25 +01:00
2020-12-27 17:23:47 +01:00
(* Norm *)
2018-02-13 17:36:25 +01:00
2018-01-17 18:19:38 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*Norm][Norm:1]] *)
val norm : t -> float
(* Norm:1 ends here *)
2018-03-15 15:25:49 +01:00
2020-12-27 17:23:47 +01:00
(* Printers
*
* Coordinates can be printed in bohr or angstrom. *)
2018-03-15 15:25:49 +01:00
2018-03-16 00:23:47 +01:00
2020-12-27 17:23:47 +01:00
(* [[file:../coordinate.org::*Printers][Printers:1]] *)
val pp : Format.formatter -> t -> unit
val pp_bohr: Format.formatter -> t -> unit
val pp_angstrom : Format.formatter -> t -> unit
2020-12-27 17:23:47 +01:00
(* Printers:1 ends here *)