10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-22 12:23:31 +01:00
QCaml/Utils/Coordinate.mli

93 lines
1.6 KiB
OCaml
Raw Normal View History

2018-02-26 10:43:21 +01:00
(** Type for coordinates in 3D space.
All operations on points are done in atomic units. Therefore,
all coordinates are given in {!Bohr.t} and manipulated with this
module.
*)
type t = Bohr.t
2018-02-13 17:36:25 +01:00
type axis = X | Y | Z
2018-02-26 10:43:21 +01:00
val bohr_to_angstrom : Bohr.t -> Angstrom.t
(** Converts a point in Bohr to Angstrom. *)
val angstrom_to_bohr : Angstrom.t -> Bohr.t
(** Converts a point in Angstrom to Bohr. *)
val zero : Bohr.t
(** [zero = { Bohr.x = 0. ; y=0. ; z=0. }] *)
val get : axis -> Bohr.t -> float
(** Extracts the projection of the coordinate on an axis.
Example:
[Coordinate.(get Y) { Bohr.x=1. ; y=2. ; z=3. } -> 2.]
*)
(** {1 Vector operations} *)
val ( |. ) : float -> Bohr.t -> Bohr.t
(** Scale by a float.
Example:
[ 2. |. { Bohr.x=1. ; y=2. ; z=3. } -> { Bohr.x=2. ; y=4. ; z=6. } ]
*)
val ( |+ ) : Bohr.t -> Bohr.t -> Bohr.t
(** Add two vectors.
Example:
{[{ Bohr.x=1. ; y=2. ; z=3. } |+ { Bohr.x=2. ; y=3. ; z=1. } ->
{ Bohr.x=3. ; y=5. ; z=4. }]}
*)
val ( |- ) : Bohr.t -> Bohr.t -> Bohr.t
(** Subtract two vectors.
Example:
{[{ Bohr.x=1. ; y=2. ; z=3. } |- { Bohr.x=2. ; y=3. ; z=1. } ->
{ Bohr.x=-1. ; y=-1. ; z=2. }]}
*)
val neg : Bohr.t -> Bohr.t
(** Example:
{[Coordinate.neg { Bohr.x=1. ; y=2. ; z=-3. } ->
{ Bohr.x=-1. ; y=-2. ; z=3. }]}
*)
val dot : Bohr.t -> Bohr.t -> float
(** Dot product. *)
2018-02-13 17:36:25 +01:00
2018-02-26 10:43:21 +01:00
val norm : Bohr.t -> float
(** L{^2} norm of the vector. *)
2018-01-17 18:19:38 +01:00
2018-03-15 15:25:49 +01:00
(** {2 Printers} *)
2018-03-16 00:23:47 +01:00
val pp: Format.formatter -> Bohr.t -> unit
2018-03-15 15:25:49 +01:00
val pp_bohr: Format.formatter -> Bohr.t -> unit
val pp_angstrom : Format.formatter -> Bohr.t -> unit