2017-08-18 18:28:33 +02:00
|
|
|
open Core ;;
|
2014-08-24 20:00:26 +02:00
|
|
|
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) ;
|
2014-10-26 17:29:11 +01:00
|
|
|
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
|
2014-10-26 17:29:11 +01:00
|
|
|
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
|
|
|
|
2015-11-17 22:25:26 +01:00
|
|
|
print_string "\nDistance matrix\n";
|
|
|
|
print_string "---------------\n";
|
|
|
|
let d =
|
|
|
|
Molecule.distance_matrix m
|
|
|
|
in
|
|
|
|
Array.iter d ~f:(fun x ->
|
|
|
|
Array.iter x ~f:(fun y -> Printf.printf "%12.8f " y);
|
|
|
|
print_newline ();
|
|
|
|
)
|
2014-08-24 20:00:26 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
test_molecule ();;
|