10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-26 15:12:14 +02:00

Printing of xyz in qp_edit

This commit is contained in:
Anthony Scemama 2014-10-29 18:55:31 +01:00
parent 23695b4edb
commit 62d3de35a2
4 changed files with 27 additions and 3 deletions

View File

@ -82,7 +82,26 @@ nucl_coord = %s
~f:(Point3d.to_string Units.Bohr) |> String.concat ~sep:"\n" )
;;
let to_string = debug
let to_string b =
let nucl_num = Nucl_number.to_int b.nucl_num in
let text =
( Printf.sprintf " %d\n "
nucl_num
) :: (
List.init nucl_num ~f:(fun i->
Printf.sprintf " %-3s %d %s"
(b.nucl_label.(i) |> Element.to_string)
(b.nucl_charge.(i) |> Charge.to_int )
(b.nucl_coord.(i) |> Point3d.to_string Units.Angstrom) )
) |> String.concat ~sep:"\n"
in
Printf.sprintf "
Nuclear coordinates in xyz format (Angstroms) ::
%s
" text
;;
end

View File

@ -41,6 +41,6 @@ let to_string u p =
| Units.Angstrom -> Units.bohr_to_angstrom
in
let { x=x ; y=y ; z=z } = p in
Printf.sprintf "%f %f %f" (x*.f) (y*.f) (z*.f)
Printf.sprintf "%16.8f %16.8f %16.8f" (x*.f) (y*.f) (z*.f)
;;

View File

@ -21,6 +21,7 @@ type keyword =
| Full_ci
| Hartree_fock
| Mo_basis
| Nuclei
;;
let keyword_to_string = function
@ -32,6 +33,7 @@ let keyword_to_string = function
| Full_ci -> "Selected Full-CI"
| Hartree_fock -> "Hartree-Fock"
| Mo_basis -> "MO basis"
| Nuclei -> "Molecule"
;;
let make_header kw =
@ -59,6 +61,8 @@ let get s =
Input.Hartree_fock.(to_string (read ()))
| Mo_basis ->
Input.Mo_basis.(to_string (read ()))
| Nuclei ->
Input.Nuclei.(to_string (read ()))
)
;;
@ -82,6 +86,7 @@ let run ezfio_filename =
let output = (instructions ezfio_filename) :: (
List.map ~f:get [
Nuclei ;
Electrons ;
Ao_basis ;
Mo_basis ;

View File

@ -96,5 +96,5 @@ test_hf ();;
test_mo ();;
test_nucl ();
*)
test_mo();;
test_nucl();;