mirror of
https://github.com/LCPQ/quantum_package
synced 2025-01-05 11:00:10 +01:00
Merge branch 'master' of github.com:LCPQ/quantum_package
This commit is contained in:
commit
ed0e5ffdf4
8
README.md
Normal file
8
README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Quantum package
|
||||||
|
===============
|
||||||
|
|
||||||
|
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/LCPQ/quantum_package?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
|
Set of quantum chemistry programs and libraries.
|
||||||
|
|
||||||
|
For more information, you can visit the [wiki of the project](http://github.com/LCPQ/quantum_package/wiki>)
|
@ -1,9 +0,0 @@
|
|||||||
===============
|
|
||||||
Quantum package
|
|
||||||
===============
|
|
||||||
|
|
||||||
Set of quantum chemistry programs and libraries.
|
|
||||||
|
|
||||||
For more information, you can visit the
|
|
||||||
`wiki of the project <http://github.com/LCPQ/quantum_package/wiki>`_
|
|
||||||
|
|
@ -17,7 +17,7 @@ module Bielec_integrals : sig
|
|||||||
val write : t -> unit
|
val write : t -> unit
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
val to_rst : t -> Rst_string.t
|
val to_rst : t -> Rst_string.t
|
||||||
val of_rst : Rst_string.t -> t
|
val of_rst : Rst_string.t -> t option
|
||||||
end = struct
|
end = struct
|
||||||
type t =
|
type t =
|
||||||
{ read_ao_integrals : bool;
|
{ read_ao_integrals : bool;
|
||||||
@ -220,20 +220,8 @@ Direct calculation of integrals ::
|
|||||||
|> Rst_string.of_string
|
|> Rst_string.of_string
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let of_rst s =
|
include Generic_input_of_rst;;
|
||||||
let s = Rst_string.to_string s
|
let of_rst = of_rst t_of_sexp;;
|
||||||
|> String.split ~on:'\n'
|
|
||||||
|> List.filter ~f:(fun line ->
|
|
||||||
String.contains line '=')
|
|
||||||
|> List.map ~f:(fun line ->
|
|
||||||
"("^(
|
|
||||||
String.tr line ~target:'=' ~replacement:' '
|
|
||||||
)^")" )
|
|
||||||
|> String.concat
|
|
||||||
in
|
|
||||||
Sexp.of_string ("("^s^")")
|
|
||||||
|> t_of_sexp
|
|
||||||
;;
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ module Cis_dressed : sig
|
|||||||
val read : unit -> t
|
val read : unit -> t
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
val to_rst : t -> Rst_string.t
|
val to_rst : t -> Rst_string.t
|
||||||
|
val of_rst : Rst_string.t -> t option
|
||||||
end = struct
|
end = struct
|
||||||
type t =
|
type t =
|
||||||
{ n_state_cis : States_number.t;
|
{ n_state_cis : States_number.t;
|
||||||
@ -145,6 +146,10 @@ Epstein-Nesbet 2x2 diagonalization ::
|
|||||||
|
|
||||||
|> Rst_string.of_string
|
|> Rst_string.of_string
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
include Generic_input_of_rst;;
|
||||||
|
let of_rst = of_rst t_of_sexp;;
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ module Cisd_sc2 : sig
|
|||||||
val write : t -> unit
|
val write : t -> unit
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
val to_rst : t -> Rst_string.t
|
val to_rst : t -> Rst_string.t
|
||||||
val of_rst : Rst_string.t -> t
|
val of_rst : Rst_string.t -> t option
|
||||||
end = struct
|
end = struct
|
||||||
type t =
|
type t =
|
||||||
{ n_det_max_cisd_sc2 : Det_number_max.t;
|
{ n_det_max_cisd_sc2 : Det_number_max.t;
|
||||||
@ -118,22 +118,8 @@ Compute E(PT2) at the end ::
|
|||||||
|> Rst_string.of_string
|
|> Rst_string.of_string
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let of_rst s =
|
include Generic_input_of_rst;;
|
||||||
let s = Rst_string.to_string s
|
let of_rst = of_rst t_of_sexp;;
|
||||||
|> String.split ~on:'\n'
|
|
||||||
|> List.filter ~f:(fun line ->
|
|
||||||
String.contains line '=')
|
|
||||||
|> List.map ~f:(fun line ->
|
|
||||||
"("^(
|
|
||||||
String.tr line ~target:'=' ~replacement:' '
|
|
||||||
)^")" )
|
|
||||||
|> String.concat
|
|
||||||
in
|
|
||||||
Sexp.of_string ("("^s^")")
|
|
||||||
|> t_of_sexp
|
|
||||||
;;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ module Determinants : sig
|
|||||||
val write : t -> unit
|
val write : t -> unit
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
val to_rst : t -> Rst_string.t
|
val to_rst : t -> Rst_string.t
|
||||||
val of_rst : Rst_string.t -> t
|
val of_rst : Rst_string.t -> t option
|
||||||
end = struct
|
end = struct
|
||||||
type t =
|
type t =
|
||||||
{ n_int : N_int_number.t;
|
{ n_int : N_int_number.t;
|
||||||
@ -538,8 +538,8 @@ psi_det = %s
|
|||||||
and n_int = Printf.sprintf "(n_int %d)" (N_int_number.get_max ()) in
|
and n_int = Printf.sprintf "(n_int %d)" (N_int_number.get_max ()) in
|
||||||
let s = String.concat [ header ; bitkind ; n_int ; psi_coef ; psi_det]
|
let s = String.concat [ header ; bitkind ; n_int ; psi_coef ; psi_det]
|
||||||
in
|
in
|
||||||
Sexp.of_string ("("^s^")")
|
|
||||||
|> t_of_sexp
|
Generic_input_of_rst.evaluate_sexp t_of_sexp s
|
||||||
;;
|
;;
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -13,7 +13,7 @@ module Electrons : sig
|
|||||||
val read_elec_num : unit -> Elec_number.t
|
val read_elec_num : unit -> Elec_number.t
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
val to_rst : t -> Rst_string.t
|
val to_rst : t -> Rst_string.t
|
||||||
val of_rst : Rst_string.t -> t
|
val of_rst : Rst_string.t -> t option
|
||||||
end = struct
|
end = struct
|
||||||
type t =
|
type t =
|
||||||
{ elec_alpha_num : Elec_alpha_number.t;
|
{ elec_alpha_num : Elec_alpha_number.t;
|
||||||
@ -91,20 +91,8 @@ elec_num = %s
|
|||||||
(Elec_number.to_string (read_elec_num ()))
|
(Elec_number.to_string (read_elec_num ()))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let of_rst s =
|
include Generic_input_of_rst;;
|
||||||
let s = Rst_string.to_string s
|
let of_rst = of_rst t_of_sexp;;
|
||||||
|> String.split ~on:'\n'
|
|
||||||
|> List.filter ~f:(fun line ->
|
|
||||||
String.contains line '=')
|
|
||||||
|> List.map ~f:(fun line ->
|
|
||||||
"("^(
|
|
||||||
String.tr line ~target:'=' ~replacement:' '
|
|
||||||
)^")" )
|
|
||||||
|> String.concat
|
|
||||||
in
|
|
||||||
Sexp.of_string ("("^s^")")
|
|
||||||
|> t_of_sexp
|
|
||||||
;;
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -10,9 +10,10 @@ module Full_ci : sig
|
|||||||
} with sexp
|
} with sexp
|
||||||
;;
|
;;
|
||||||
val read : unit -> t
|
val read : unit -> t
|
||||||
|
val write : t-> unit
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
val to_rst : t -> Rst_string.t
|
val to_rst : t -> Rst_string.t
|
||||||
val of_rst : Rst_string.t -> t
|
val of_rst : Rst_string.t -> t option
|
||||||
end = struct
|
end = struct
|
||||||
type t =
|
type t =
|
||||||
{ n_det_max_fci : Det_number_max.t;
|
{ n_det_max_fci : Det_number_max.t;
|
||||||
@ -33,6 +34,11 @@ end = struct
|
|||||||
|> Det_number_max.of_int
|
|> Det_number_max.of_int
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
let write_n_det_max_fci ndet =
|
||||||
|
Det_number_max.to_int ndet
|
||||||
|
|> Ezfio.set_full_ci_n_det_max_fci
|
||||||
|
;;
|
||||||
|
|
||||||
let read_pt2_max () =
|
let read_pt2_max () =
|
||||||
if not (Ezfio.has_full_ci_pt2_max ()) then
|
if not (Ezfio.has_full_ci_pt2_max ()) then
|
||||||
get_default "pt2_max"
|
get_default "pt2_max"
|
||||||
@ -43,6 +49,11 @@ end = struct
|
|||||||
|> PT2_energy.of_float
|
|> PT2_energy.of_float
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
let write_pt2_max pt2_max =
|
||||||
|
PT2_energy.to_float pt2_max
|
||||||
|
|> Ezfio.set_full_ci_pt2_max
|
||||||
|
;;
|
||||||
|
|
||||||
let read_do_pt2_end () =
|
let read_do_pt2_end () =
|
||||||
if not (Ezfio.has_full_ci_do_pt2_end ()) then
|
if not (Ezfio.has_full_ci_do_pt2_end ()) then
|
||||||
get_default "do_pt2_end"
|
get_default "do_pt2_end"
|
||||||
@ -52,6 +63,10 @@ end = struct
|
|||||||
Ezfio.get_full_ci_do_pt2_end ()
|
Ezfio.get_full_ci_do_pt2_end ()
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
let write_do_pt2_end =
|
||||||
|
Ezfio.set_full_ci_do_pt2_end
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
let read () =
|
let read () =
|
||||||
{ n_det_max_fci = read_n_det_max_fci ();
|
{ n_det_max_fci = read_n_det_max_fci ();
|
||||||
@ -60,6 +75,16 @@ end = struct
|
|||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
let write { n_det_max_fci ;
|
||||||
|
pt2_max ;
|
||||||
|
do_pt2_end ;
|
||||||
|
} =
|
||||||
|
write_n_det_max_fci n_det_max_fci;
|
||||||
|
write_pt2_max pt2_max;
|
||||||
|
write_do_pt2_end do_pt2_end;
|
||||||
|
;;
|
||||||
|
|
||||||
let to_string b =
|
let to_string b =
|
||||||
Printf.sprintf "
|
Printf.sprintf "
|
||||||
n_det_max_fci = %s
|
n_det_max_fci = %s
|
||||||
@ -92,20 +117,8 @@ Compute E(PT2) at the end ::
|
|||||||
|> Rst_string.of_string
|
|> Rst_string.of_string
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let of_rst s =
|
include Generic_input_of_rst;;
|
||||||
let s = Rst_string.to_string s
|
let of_rst = of_rst t_of_sexp;;
|
||||||
|> String.split ~on:'\n'
|
|
||||||
|> List.filter ~f:(fun line ->
|
|
||||||
String.contains line '=')
|
|
||||||
|> List.map ~f:(fun line ->
|
|
||||||
"("^(
|
|
||||||
String.tr line ~target:'=' ~replacement:' '
|
|
||||||
)^")" )
|
|
||||||
|> String.concat
|
|
||||||
in
|
|
||||||
Sexp.of_string ("("^s^")")
|
|
||||||
|> t_of_sexp
|
|
||||||
;;
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -9,9 +9,10 @@ module Hartree_fock : sig
|
|||||||
} with sexp
|
} with sexp
|
||||||
;;
|
;;
|
||||||
val read : unit -> t
|
val read : unit -> t
|
||||||
|
val write : t -> unit
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
val to_rst : t -> Rst_string.t
|
val to_rst : t -> Rst_string.t
|
||||||
val of_rst : Rst_string.t -> t
|
val of_rst : Rst_string.t -> t option
|
||||||
end = struct
|
end = struct
|
||||||
type t =
|
type t =
|
||||||
{ n_it_scf_max : Strictly_positive_int.t;
|
{ n_it_scf_max : Strictly_positive_int.t;
|
||||||
@ -31,14 +32,25 @@ end = struct
|
|||||||
|> Strictly_positive_int.of_int
|
|> Strictly_positive_int.of_int
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let read_thresh_scf() =
|
let write_n_it_scf_max n_it_scf_max =
|
||||||
|
Strictly_positive_int.to_int n_it_scf_max
|
||||||
|
|> Ezfio.set_hartree_fock_n_it_scf_max
|
||||||
|
;;
|
||||||
|
|
||||||
|
let read_thresh_scf () =
|
||||||
if not (Ezfio.has_hartree_fock_thresh_scf()) then
|
if not (Ezfio.has_hartree_fock_thresh_scf()) then
|
||||||
get_default "thresh_scf"
|
get_default "thresh_scf"
|
||||||
|> Float.of_string
|
|> Float.of_string
|
||||||
|> Ezfio.set_hartree_fock_thresh_scf
|
|> Ezfio.set_hartree_fock_thresh_scf
|
||||||
;
|
;
|
||||||
Ezfio.get_hartree_fock_thresh_scf ()
|
Ezfio.get_hartree_fock_thresh_scf ()
|
||||||
|> Threshold.of_float ;;
|
|> Threshold.of_float
|
||||||
|
;;
|
||||||
|
|
||||||
|
let write_thresh_scf thresh_scf =
|
||||||
|
Threshold.to_float thresh_scf
|
||||||
|
|> Ezfio.set_hartree_fock_thresh_scf
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
let read () =
|
let read () =
|
||||||
@ -47,6 +59,15 @@ end = struct
|
|||||||
}
|
}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
let write { n_it_scf_max ;
|
||||||
|
thresh_scf ;
|
||||||
|
} =
|
||||||
|
write_n_it_scf_max n_it_scf_max;
|
||||||
|
write_thresh_scf thresh_scf
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
let to_string b =
|
let to_string b =
|
||||||
Printf.sprintf "
|
Printf.sprintf "
|
||||||
n_it_scf_max = %s
|
n_it_scf_max = %s
|
||||||
@ -72,21 +93,8 @@ SCF convergence criterion (on energy) ::
|
|||||||
|> Rst_string.of_string
|
|> Rst_string.of_string
|
||||||
;;
|
;;
|
||||||
|
|
||||||
let of_rst s =
|
include Generic_input_of_rst;;
|
||||||
let s = Rst_string.to_string s
|
let of_rst = of_rst t_of_sexp;;
|
||||||
|> String.split ~on:'\n'
|
|
||||||
|> List.filter ~f:(fun line ->
|
|
||||||
String.contains line '=')
|
|
||||||
|> List.map ~f:(fun line ->
|
|
||||||
"("^(
|
|
||||||
String.tr line ~target:'=' ~replacement:' '
|
|
||||||
)^")" )
|
|
||||||
|> String.concat
|
|
||||||
in
|
|
||||||
Sexp.of_string ("("^s^")")
|
|
||||||
|> t_of_sexp
|
|
||||||
;;
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ module Nuclei : sig
|
|||||||
val write : t -> unit
|
val write : t -> unit
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
val to_rst : t -> Rst_string.t
|
val to_rst : t -> Rst_string.t
|
||||||
val of_rst : Rst_string.t -> t
|
val of_rst : Rst_string.t -> t option
|
||||||
end = struct
|
end = struct
|
||||||
type t =
|
type t =
|
||||||
{ nucl_num : Nucl_number.t ;
|
{ nucl_num : Nucl_number.t ;
|
||||||
@ -203,6 +203,7 @@ Nuclear coordinates in xyz format (Angstroms) ::
|
|||||||
| _ -> failwith "Error in xyz format"
|
| _ -> failwith "Error in xyz format"
|
||||||
in
|
in
|
||||||
(* Create the Nuclei.t data structure *)
|
(* Create the Nuclei.t data structure *)
|
||||||
|
let result =
|
||||||
{ nucl_num = List.length atom_list
|
{ nucl_num = List.length atom_list
|
||||||
|> Nucl_number.of_int ~max:nmax;
|
|> Nucl_number.of_int ~max:nmax;
|
||||||
nucl_label = List.map atom_list ~f:(fun x ->
|
nucl_label = List.map atom_list ~f:(fun x ->
|
||||||
@ -212,6 +213,7 @@ Nuclear coordinates in xyz format (Angstroms) ::
|
|||||||
nucl_coord = List.map atom_list ~f:(fun x ->
|
nucl_coord = List.map atom_list ~f:(fun x ->
|
||||||
x.Atom.coord ) |> Array.of_list ;
|
x.Atom.coord ) |> Array.of_list ;
|
||||||
}
|
}
|
||||||
|
in Some result
|
||||||
;;
|
;;
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -10,7 +10,7 @@ endif
|
|||||||
|
|
||||||
LIBS=
|
LIBS=
|
||||||
PKGS=
|
PKGS=
|
||||||
OCAMLCFLAGS="-g"
|
OCAMLCFLAGS="-g -warn-error A"
|
||||||
OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS)
|
OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS)
|
||||||
MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml
|
MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml
|
||||||
MLIFILES=$(wildcard *.mli)
|
MLIFILES=$(wildcard *.mli)
|
||||||
|
@ -4,3 +4,10 @@ Ocaml scripts
|
|||||||
|
|
||||||
This directory contains all the scripts that control the input/output
|
This directory contains all the scripts that control the input/output
|
||||||
with the user.
|
with the user.
|
||||||
|
|
||||||
|
All executables start with `qp_` and all tests start with `test_`. Modules
|
||||||
|
file names start with a capital letter.
|
||||||
|
|
||||||
|
Info on how to extend the `qp_edit` tool is given in
|
||||||
|
`README_qp_edit.rst <https://github.com/LCPQ/quantum_package/blob/master/ocaml/README_qp_edit.rst>`_.
|
||||||
|
|
||||||
|
209
ocaml/README_qp_edit.rst
Normal file
209
ocaml/README_qp_edit.rst
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
Adding a new block
|
||||||
|
==================
|
||||||
|
|
||||||
|
In this section, we assume we will add the `New_keyword` keyword.
|
||||||
|
|
||||||
|
Create the `Input_new_keyword.ml` file
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
Copy for example the `Input_full_ci.ml` file as a starting point.
|
||||||
|
|
||||||
|
The template is the following, where `r_x`, `r_y`, ..., `last_r` are the records
|
||||||
|
of the block.
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
module New_keyword : sig
|
||||||
|
type t =
|
||||||
|
{ r_x : Type_of_x.t
|
||||||
|
r_y : Y_type.t
|
||||||
|
...
|
||||||
|
last_r : bool
|
||||||
|
} with sexp
|
||||||
|
;;
|
||||||
|
val read : unit -> t
|
||||||
|
val write : t -> unit
|
||||||
|
val to_rst : t -> Rst_string.t
|
||||||
|
val of_rst : Rst_string.t -> t option
|
||||||
|
end = struct
|
||||||
|
type t =
|
||||||
|
{ r_x : Type_of_x.t
|
||||||
|
r_y : Y_type.t
|
||||||
|
...
|
||||||
|
last_r : bool
|
||||||
|
} with sexp
|
||||||
|
;;
|
||||||
|
|
||||||
|
let get_default = Qpackage.get_ezfio_default "new_keyword";;
|
||||||
|
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
The following functions need to be defined
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
val read : unit -> t
|
||||||
|
val write : t -> unit
|
||||||
|
val to_rst : t -> Rst_string.t
|
||||||
|
val of_rst : Rst_string.t -> t option
|
||||||
|
|
||||||
|
|
||||||
|
The type `t` has to be defined in a same way in the `sig` and the `struct`.
|
||||||
|
|
||||||
|
For each record of the type `t`, use types defined in the `Qptypes.ml` file as
|
||||||
|
much as possible.
|
||||||
|
|
||||||
|
The `get_default` function will fetch the default values in the `ezfio_defaults` file
|
||||||
|
in the `new_keyword` block.
|
||||||
|
|
||||||
|
For each record `r_x` of the type `t`, create a `read_r_x ()` function
|
||||||
|
and a `write_r_x r_x` function that performs the I/O in the EZFIO.
|
||||||
|
To set a default value in the `read_r_x` function, use the following template
|
||||||
|
(assuming that the `Type_of_x` is built from a `double precision` value in
|
||||||
|
the EZFIO file).
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
let read_r_x () =
|
||||||
|
if not (Ezfio.has_new_keyword_r_x ()) then
|
||||||
|
get_default "r_x"
|
||||||
|
|> Float.of_string
|
||||||
|
|> Ezfio.set_new_keyword_r_x
|
||||||
|
;
|
||||||
|
Ezfio.get_new_keyword_r_x ()
|
||||||
|
|> Type_of_x.of_float
|
||||||
|
;;
|
||||||
|
|
||||||
|
let write_r_x r_x =
|
||||||
|
Type_of_x.to_float r_x
|
||||||
|
|> Ezfio.set_new_keyword_r_x
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
Then, create a `read` and a `write` function as
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
let read () =
|
||||||
|
{ r_x = read_r_x () ;
|
||||||
|
r_y = read_r_y () ;
|
||||||
|
...
|
||||||
|
last_r = read_last_r () ;
|
||||||
|
}
|
||||||
|
;;
|
||||||
|
|
||||||
|
let write { r_x ;
|
||||||
|
r_y
|
||||||
|
...
|
||||||
|
last_r ;
|
||||||
|
} =
|
||||||
|
write_r_x r_x;
|
||||||
|
write_r_y r_y;
|
||||||
|
...
|
||||||
|
write_last_r last_r;
|
||||||
|
;;
|
||||||
|
|
||||||
|
Finally, create the functions to write an RST string as
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
let to_rst b =
|
||||||
|
Printf.sprintf "
|
||||||
|
You can put here some documentation as long as there is no equal sign.
|
||||||
|
The record entries should be indented on the right with a blank line
|
||||||
|
before and a blank line after, as they would be in a rst file.
|
||||||
|
|
||||||
|
Here is the text for r_x
|
||||||
|
|
||||||
|
r_x = %s
|
||||||
|
|
||||||
|
And here is the text for r_y
|
||||||
|
|
||||||
|
r_y = %s
|
||||||
|
|
||||||
|
...
|
||||||
|
Finally, the text for last_r
|
||||||
|
|
||||||
|
last_r = %s
|
||||||
|
"
|
||||||
|
(Type_of_x.to_string b.r_x)
|
||||||
|
(Y_type.to_string b.r_y)
|
||||||
|
...
|
||||||
|
(Bool.to_string b.last_r)
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
and you can use the generic `of_rst` function to read it back:
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
include Generic_input_of_rst;;
|
||||||
|
let of_rst = of_rst t_of_sexp;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Add module to `Input.ml` file
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Append module to the `Input.ml` file. Use the name of the `Input_new_keyword.ml` without the
|
||||||
|
`.ml` suffix.
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
include Input_new_keyword;;
|
||||||
|
|
||||||
|
|
||||||
|
In the `qp_edit.ml` file
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
vim search strings are given in brackets.
|
||||||
|
|
||||||
|
1. (`/type keyword`) : Add a new entry to the keyword type corresponding to the block to add:
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
type keyword =
|
||||||
|
...
|
||||||
|
| New_keyword
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2. (`/keyword_to_string`) : Add a new entry to the `keyword_to_string` function for the title of the block
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
let keyword_to_string = function
|
||||||
|
...
|
||||||
|
| New_keyword -> "My new keyword"
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
3. (`/let get s`) : Add a new call to the to_rst function of the `Input.New_keyword` module
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
let get s =
|
||||||
|
let header = (make_header s)
|
||||||
|
and rst = let open Input in
|
||||||
|
match s with
|
||||||
|
...
|
||||||
|
| New_keyword ->
|
||||||
|
New_keyword.(to_rst (read ()))
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
4. (`/let set s`) : Add a new call to the of_rst function of the `Input.New_keyword` module
|
||||||
|
|
||||||
|
.. code-block:: ocaml
|
||||||
|
|
||||||
|
let open Input in
|
||||||
|
match s with
|
||||||
|
...
|
||||||
|
| New_keyword -> write New_keyword.(of_rst, write)
|
||||||
|
...
|
||||||
|
;;
|
||||||
|
|
@ -44,25 +44,26 @@ let make_header kw =
|
|||||||
|
|
||||||
let get s =
|
let get s =
|
||||||
let header = (make_header s)
|
let header = (make_header s)
|
||||||
and rst = match s with
|
and rst = let open Input in
|
||||||
|
match s with
|
||||||
| Full_ci ->
|
| Full_ci ->
|
||||||
Input.Full_ci.(to_rst (read ()))
|
Full_ci.(to_rst (read ()))
|
||||||
| Hartree_fock ->
|
| Hartree_fock ->
|
||||||
Input.Hartree_fock.(to_rst (read ()))
|
Hartree_fock.(to_rst (read ()))
|
||||||
| Mo_basis ->
|
| Mo_basis ->
|
||||||
Input.Mo_basis.(to_rst (read ()))
|
Mo_basis.(to_rst (read ()))
|
||||||
| Electrons ->
|
| Electrons ->
|
||||||
Input.Electrons.(to_rst (read ()))
|
Electrons.(to_rst (read ()))
|
||||||
| Determinants ->
|
| Determinants ->
|
||||||
Input.Determinants.(to_rst (read ()))
|
Determinants.(to_rst (read ()))
|
||||||
| Cisd_sc2 ->
|
| Cisd_sc2 ->
|
||||||
Input.Cisd_sc2.(to_rst (read ()))
|
Cisd_sc2.(to_rst (read ()))
|
||||||
| Nuclei ->
|
| Nuclei ->
|
||||||
Input.Nuclei.(to_rst (read ()))
|
Nuclei.(to_rst (read ()))
|
||||||
| Ao_basis ->
|
| Ao_basis ->
|
||||||
Input.Ao_basis.(to_rst (read ()))
|
Ao_basis.(to_rst (read ()))
|
||||||
| Bielec_integrals ->
|
| Bielec_integrals ->
|
||||||
Input.Bielec_integrals.(to_rst (read ()))
|
Bielec_integrals.(to_rst (read ()))
|
||||||
|
|
||||||
in header^(Rst_string.to_string rst)
|
in header^(Rst_string.to_string rst)
|
||||||
;;
|
;;
|
||||||
@ -81,30 +82,22 @@ let set str s =
|
|||||||
let str = String.sub ~pos:index_begin ~len:l str
|
let str = String.sub ~pos:index_begin ~len:l str
|
||||||
|> Rst_string.of_string
|
|> Rst_string.of_string
|
||||||
in
|
in
|
||||||
|
let write (of_rst,w) =
|
||||||
|
match of_rst str with
|
||||||
|
| Some data -> w data
|
||||||
|
| None -> ()
|
||||||
|
in
|
||||||
|
let open Input in
|
||||||
match s with
|
match s with
|
||||||
(*
|
| Hartree_fock -> write Hartree_fock.(of_rst, write)
|
||||||
| Full_ci ->
|
| Full_ci -> write Full_ci.(of_rst, write)
|
||||||
| Hartree_fock ->
|
| Electrons -> write Electrons.(of_rst, write)
|
||||||
| Mo_basis ->
|
| Cisd_sc2 -> write Cisd_sc2.(of_rst, write)
|
||||||
*)
|
| Bielec_integrals -> write Bielec_integrals.(of_rst, write)
|
||||||
| Electrons ->
|
| Determinants -> write Determinants.(of_rst, write)
|
||||||
Input.Electrons.of_rst str
|
| Nuclei -> write Nuclei.(of_rst, write)
|
||||||
|> Input.Electrons.write
|
| Ao_basis -> () (* TODO *)
|
||||||
| Determinants ->
|
| Mo_basis -> () (* TODO *)
|
||||||
Input.Determinants.of_rst str
|
|
||||||
|> Input.Determinants.write
|
|
||||||
| Cisd_sc2 ->
|
|
||||||
Input.Cisd_sc2.of_rst str
|
|
||||||
|> Input.Cisd_sc2.write
|
|
||||||
| Nuclei ->
|
|
||||||
Input.Nuclei.of_rst str
|
|
||||||
|> Input.Nuclei.write
|
|
||||||
| Bielec_integrals ->
|
|
||||||
Input.Bielec_integrals.of_rst str
|
|
||||||
|> Input.Bielec_integrals.write
|
|
||||||
(*
|
|
||||||
| Ao_basis ->
|
|
||||||
*)
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -132,8 +125,6 @@ let run ezfio_filename =
|
|||||||
List.map ~f:get [
|
List.map ~f:get [
|
||||||
Ao_basis ;
|
Ao_basis ;
|
||||||
Mo_basis ;
|
Mo_basis ;
|
||||||
Full_ci ;
|
|
||||||
Hartree_fock ;
|
|
||||||
])
|
])
|
||||||
in
|
in
|
||||||
String.concat output
|
String.concat output
|
||||||
@ -144,7 +135,9 @@ let run ezfio_filename =
|
|||||||
Nuclei ;
|
Nuclei ;
|
||||||
Electrons ;
|
Electrons ;
|
||||||
Bielec_integrals ;
|
Bielec_integrals ;
|
||||||
|
Hartree_fock ;
|
||||||
Cisd_sc2 ;
|
Cisd_sc2 ;
|
||||||
|
Full_ci ;
|
||||||
Determinants ;
|
Determinants ;
|
||||||
]
|
]
|
||||||
in
|
in
|
||||||
|
Loading…
Reference in New Issue
Block a user