10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-27 06:43:48 +01:00
quantum_package/ocaml/test_molecule.ml

45 lines
1.2 KiB
OCaml
Raw Normal View History

2014-08-24 20:00:26 +02:00
open Core.Std ;;
open Qptypes ;;
let test_molecule () =
let xyz =
"
H 1.0 0.54386314 0.00000000 -3.78645152
O 8.0 1.65102147 0.00000000 -2.35602344
H 1.0 0.54386314 0.00000000 -0.92559535
"
in
2014-08-26 14:39:23 +02:00
print_string "---\n";
begin
try (
ignore (Molecule.of_xyz_string xyz ~multiplicity:(Multiplicity.of_int 2)) ;
print_string "Failed in MultiplicityError\n" )
2014-08-24 20:00:26 +02:00
with
2014-08-26 14:39:23 +02:00
| Molecule.MultiplicityError _ -> print_string "MultiplicityError OK\n"
end ;
2014-08-24 20:00:26 +02:00
print_string "---\n";
2014-08-26 14:39:23 +02:00
let m = Molecule.of_xyz_string xyz
2014-08-24 20:00:26 +02:00
in print_endline (Molecule.name m) ;
let m = Molecule.of_xyz_string xyz ~charge:(Charge.of_int 1) ~multiplicity:(Multiplicity.of_int 2)
2014-08-24 20:00:26 +02:00
in print_endline (Molecule.name m) ;
let xyz =
"
H 0.54386314 0.00000000 -3.78645152
O 1.65102147 0.00000000 -2.35602344
H 0.54386314 0.00000000 -0.92559535
"
in
let m = Molecule.of_xyz_string xyz ~charge:(Charge.of_int (-2))
2014-08-24 20:00:26 +02:00
in print_endline (Molecule.name m) ;
2014-08-26 14:39:23 +02:00
print_endline (Molecule.to_string m);
print_string "---------\n";
let m = Molecule.of_xyz_file "c2h6.xyz" in
2014-08-24 20:00:26 +02:00
print_string (Molecule.to_string m);
2014-08-26 14:39:23 +02:00
2014-08-24 20:00:26 +02:00
;;
test_molecule ();;