mirror of
https://github.com/LCPQ/quantum_package
synced 2025-04-25 01:35:04 +02:00
Cleaning
This commit is contained in:
parent
3fd80125e4
commit
ff30a9d501
@ -52,10 +52,9 @@ let read_one in_channel =
|
||||
match buffer with
|
||||
| [ j ; expo ; coef ] ->
|
||||
begin
|
||||
let p = { Primitive.sym = sym ;
|
||||
Primitive.expo = AO_expo.of_float
|
||||
(Float.of_string expo)
|
||||
}
|
||||
let p =
|
||||
Primitive.of_sym_expo sym
|
||||
(AO_expo.of_float (Float.of_string expo) )
|
||||
and c = AO_coef.of_float (Float.of_string coef) in
|
||||
read_lines ( (p,c)::result) (i-1)
|
||||
end
|
||||
|
@ -1,5 +1,3 @@
|
||||
#TODO : Opam auto-installer in makefile
|
||||
|
||||
# Check if QPACKAGE_ROOT is defined
|
||||
|
||||
ifndef QPACKAGE_ROOT
|
||||
@ -12,8 +10,8 @@ endif
|
||||
|
||||
LIBS=
|
||||
PKGS=
|
||||
OCAMLCFLAGS=-g
|
||||
OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags -g
|
||||
OCAMLCFLAGS=-g
|
||||
OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags -g
|
||||
MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml
|
||||
MLIFILES=$(wildcard *.mli)
|
||||
ALL_TESTS=$(patsubst %.ml,%.byte,$(wildcard test_*.ml))
|
||||
@ -26,6 +24,9 @@ default: $(ALL_TESTS) $(ALL_EXE)
|
||||
executables:
|
||||
$(MAKE) -C $(QPACKAGE_ROOT)/data executables
|
||||
|
||||
%.odoc: $(MLFILES)
|
||||
$(OCAMLBUILD) $*.odoc -use-ocamlfind $(PKGS)
|
||||
|
||||
%.inferred.mli: $(MLFILES)
|
||||
$(OCAMLBUILD) $*.inferred.mli -use-ocamlfind $(PKGS)
|
||||
mv _build/$*.inferred.mli .
|
||||
|
@ -1,4 +1,5 @@
|
||||
open Core.Std;;
|
||||
open Qptypes;;
|
||||
|
||||
type t = {
|
||||
x : float ;
|
||||
@ -28,9 +29,10 @@ let distance2 p1 p2 =
|
||||
let { x=x1 ; y=y1 ; z=z1 } = p1
|
||||
and { x=x2 ; y=y2 ; z=z2 } = p2 in
|
||||
(x2-.x1)*.(x2-.x1) +. (y2-.y1)*.(y2-.y1) +. (z2-.z1)*.(z2-.z1)
|
||||
|> Positive_float.of_float
|
||||
;;
|
||||
|
||||
let distance p1 p2 = sqrt (distance2 p1 p2)
|
||||
let distance p1 p2 = sqrt (Positive_float.to_float (distance2 p1 p2))
|
||||
;;
|
||||
|
||||
let to_string u p =
|
||||
|
@ -13,3 +13,6 @@ let to_string p =
|
||||
(AO_expo.to_float e)
|
||||
;;
|
||||
|
||||
let of_sym_expo s e =
|
||||
{ sym=s ; expo=e}
|
||||
;;
|
||||
|
11
ocaml/Primitive.mli
Normal file
11
ocaml/Primitive.mli
Normal file
@ -0,0 +1,11 @@
|
||||
type t =
|
||||
{ sym : Symmetry.t;
|
||||
expo : Qptypes.AO_expo.t;
|
||||
} with sexp
|
||||
|
||||
(** Conversion to string for printing *)
|
||||
val to_string : t -> string
|
||||
|
||||
(** Creation *)
|
||||
val of_sym_expo : Symmetry.t -> Qptypes.AO_expo.t -> t
|
||||
|
10
ocaml/Range.mli
Normal file
10
ocaml/Range.mli
Normal file
@ -0,0 +1,10 @@
|
||||
type t = int list with sexp
|
||||
|
||||
(** A range is a sorted list of ints in an interval.
|
||||
It is created using a string :
|
||||
"[a-b]" : range between a and b (included)
|
||||
"[a]" : the list with only one integer a
|
||||
"a" : equivalent to "[a]"
|
||||
*)
|
||||
val of_string : string -> t
|
||||
val to_string : t -> string
|
@ -74,16 +74,7 @@ let of_l i =
|
||||
type st = t
|
||||
;;
|
||||
|
||||
module Xyz : sig
|
||||
type t = { x: Positive_int.t ;
|
||||
y: Positive_int.t ;
|
||||
z: Positive_int.t } with sexp
|
||||
val of_string : string -> t
|
||||
val to_string : t -> string
|
||||
val get_l : t -> Positive_int.t
|
||||
val of_symmetry : st -> t list
|
||||
val to_symmetry : t -> st
|
||||
end = struct
|
||||
module Xyz = struct
|
||||
type t = { x: Positive_int.t ;
|
||||
y: Positive_int.t ;
|
||||
z: Positive_int.t } with sexp
|
||||
@ -187,9 +178,10 @@ end = struct
|
||||
in
|
||||
create_x [] { x=(to_l sym) ; y=Positive_int.of_int 0 ;
|
||||
z=Positive_int.of_int 0 }
|
||||
;;
|
||||
;;
|
||||
|
||||
let to_symmetry sym = of_l (get_l sym)
|
||||
;;
|
||||
(** Returns the symmetry corresponding to the XYZ triplet *)
|
||||
let to_symmetry sym = of_l (get_l sym)
|
||||
;;
|
||||
end
|
||||
|
||||
|
36
ocaml/Symmetry.mli
Normal file
36
ocaml/Symmetry.mli
Normal file
@ -0,0 +1,36 @@
|
||||
type t = S | P | D | F | G | H | I | J | K | L with sexp
|
||||
|
||||
(** Creatio from strings *)
|
||||
val to_string : t -> string
|
||||
val of_string : string -> t
|
||||
val of_char : char -> t
|
||||
|
||||
(** Connexion with l quantum number *)
|
||||
val to_l : t -> Qptypes.Positive_int.t
|
||||
val of_l : Qptypes.Positive_int.t -> t
|
||||
|
||||
type st = t
|
||||
module Xyz :
|
||||
sig
|
||||
type t = {
|
||||
x : Qptypes.Positive_int.t;
|
||||
y : Qptypes.Positive_int.t;
|
||||
z : Qptypes.Positive_int.t;
|
||||
} with sexp
|
||||
|
||||
(** The string format contains the powers of x,y and z in a
|
||||
format like "x2z3" *)
|
||||
|
||||
val of_string : string -> t
|
||||
val to_string : t -> string
|
||||
|
||||
(** Returns the quantum number l *)
|
||||
val get_l : t -> Qptypes.Positive_int.t
|
||||
|
||||
(** Returns a list of XYZ powers for a given symmetry *)
|
||||
val of_symmetry : st -> t list
|
||||
|
||||
(** Returns the symmetry corresponding to the XYZ powers *)
|
||||
val to_symmetry : t -> st
|
||||
|
||||
end
|
7
ocaml/Units.mli
Normal file
7
ocaml/Units.mli
Normal file
@ -0,0 +1,7 @@
|
||||
type units = Bohr | Angstrom
|
||||
|
||||
(** Conversion functions *)
|
||||
val angstrom_to_bohr : float
|
||||
val bohr_to_angstrom : float
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user