mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-19 04:22:21 +01:00
4.8 KiB
4.8 KiB
Coordinate
Coordinates in 3D space.
All operations on points are done in atomic units. Therefore, all coordinates are given in bohr and manipulated with this module.
Type
type bohr
type angstrom
type xyz = {
x : float ;
y : float ;
z : float ;
}
type 'a point = xyz
type t = bohr point
type axis = X | Y | Z
Creation
val make : 'a point -> t
val make_angstrom : 'a point -> angstrom point
val zero : bohr point
make |
Creates a point in atomic units |
make_angstrom |
Creates a point in angstrom |
zero |
$(0., 0., 0.)$ |
Conversion
val bohr_to_angstrom : bohr point -> angstrom point
val angstrom_to_bohr : angstrom point -> bohr point
bohr_to_angstrom |
Converts a point in bohr to angstrom |
angstrom_to_bohr |
Converts a point in angstrom to bohr |
Vector operations
val neg : t -> t
val get : axis -> bohr point -> float
val dot : t -> t -> float
val norm : t -> float
val ( |. ) : float -> t -> t
val ( |+ ) : t -> t -> t
val ( |- ) : t -> t -> t
neg |
Negative of a point |
get |
Extracts the projection of the coordinate on an axis |
dot |
Dot product |
norm |
$\ell{^2}$ norm of the vector |
¦. |
Scales the vector by a constant |
¦+ |
Adds two vectors |
¦- |
Subtracts two vectors |
Coordinate.neg { x=1. ; y=2. ; z=3. } ;; - : Coordinate.t = {Qcaml.Common.Coordinate.x = -1.; y = -2.; z = -3.} Coordinate.(get Y { x=1. ; y=2. ; z=3. }) ;; - : float = 2. Coordinate.( 2. |. { x=1. ; y=2. ; z=3. } ) ;; - : Coordinate.t = {Qcaml.Common.Coordinate.x = 2.; y = 4.; z = 6.} Coordinate.( { x=1. ; y=2. ; z=3. } |+ { x=2. ; y=3. ; z=1. } );; - : Coordinate.t = {Qcaml.Common.Coordinate.x = 3.; y = 5.; z = 4.} Coordinate.( { x=1. ; y=2. ; z=3. } |- { x=2. ; y=3. ; z=1. } );; - : Coordinate.t = {Qcaml.Common.Coordinate.x = -1.; y = -1.; z = 2.}
Printers
val pp : Format.formatter -> t -> unit
val pp_bohr: Format.formatter -> t -> unit
val pp_angstrom : Format.formatter -> t -> unit
Coordinates can be printed in bohr or angstrom.