mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-24 21:41:46 +02:00
qp_edit fails better
This commit is contained in:
parent
7db57da1fd
commit
a700718078
@ -17,7 +17,7 @@ module Bielec_integrals : sig
|
||||
val write : t -> unit
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
val of_rst : Rst_string.t -> t
|
||||
val of_rst : Rst_string.t -> t option
|
||||
end = struct
|
||||
type t =
|
||||
{ read_ao_integrals : bool;
|
||||
@ -220,20 +220,8 @@ Direct calculation of integrals ::
|
||||
|> Rst_string.of_string
|
||||
;;
|
||||
|
||||
let of_rst s =
|
||||
let s = Rst_string.to_string s
|
||||
|> 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
|
||||
;;
|
||||
include Generic_input_of_rst;;
|
||||
let of_rst = of_rst t_of_sexp;;
|
||||
|
||||
end
|
||||
|
||||
|
@ -15,6 +15,7 @@ module Cis_dressed : sig
|
||||
val read : unit -> t
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
val of_rst : Rst_string.t -> t option
|
||||
end = struct
|
||||
type t =
|
||||
{ n_state_cis : States_number.t;
|
||||
@ -145,6 +146,10 @@ Epstein-Nesbet 2x2 diagonalization ::
|
||||
|
||||
|> Rst_string.of_string
|
||||
;;
|
||||
|
||||
include Generic_input_of_rst;;
|
||||
let of_rst = of_rst t_of_sexp;;
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ module Cisd_sc2 : sig
|
||||
val write : t -> unit
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
val of_rst : Rst_string.t -> t
|
||||
val of_rst : Rst_string.t -> t option
|
||||
end = struct
|
||||
type t =
|
||||
{ n_det_max_cisd_sc2 : Det_number_max.t;
|
||||
@ -118,22 +118,8 @@ Compute E(PT2) at the end ::
|
||||
|> Rst_string.of_string
|
||||
;;
|
||||
|
||||
let of_rst s =
|
||||
let s = Rst_string.to_string s
|
||||
|> 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
|
||||
;;
|
||||
|
||||
|
||||
include Generic_input_of_rst;;
|
||||
let of_rst = of_rst t_of_sexp;;
|
||||
|
||||
end
|
||||
|
||||
|
@ -23,7 +23,7 @@ module Determinants : sig
|
||||
val write : t -> unit
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
val of_rst : Rst_string.t -> t
|
||||
val of_rst : Rst_string.t -> t option
|
||||
end = struct
|
||||
type 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
|
||||
let s = String.concat [ header ; bitkind ; n_int ; psi_coef ; psi_det]
|
||||
in
|
||||
Sexp.of_string ("("^s^")")
|
||||
|> t_of_sexp
|
||||
|
||||
Generic_input_of_rst.evaluate_sexp t_of_sexp s
|
||||
;;
|
||||
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ module Electrons : sig
|
||||
val read_elec_num : unit -> Elec_number.t
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
val of_rst : Rst_string.t -> t
|
||||
val of_rst : Rst_string.t -> t option
|
||||
end = struct
|
||||
type t =
|
||||
{ elec_alpha_num : Elec_alpha_number.t;
|
||||
@ -91,20 +91,8 @@ elec_num = %s
|
||||
(Elec_number.to_string (read_elec_num ()))
|
||||
;;
|
||||
|
||||
let of_rst s =
|
||||
let s = Rst_string.to_string s
|
||||
|> 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
|
||||
;;
|
||||
include Generic_input_of_rst;;
|
||||
let of_rst = of_rst t_of_sexp;;
|
||||
|
||||
end
|
||||
|
||||
|
@ -13,7 +13,7 @@ module Full_ci : sig
|
||||
val write : t-> unit
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
val of_rst : Rst_string.t -> t
|
||||
val of_rst : Rst_string.t -> t option
|
||||
end = struct
|
||||
type t =
|
||||
{ n_det_max_fci : Det_number_max.t;
|
||||
@ -117,20 +117,8 @@ Compute E(PT2) at the end ::
|
||||
|> Rst_string.of_string
|
||||
;;
|
||||
|
||||
let of_rst s =
|
||||
let s = Rst_string.to_string s
|
||||
|> 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
|
||||
;;
|
||||
include Generic_input_of_rst;;
|
||||
let of_rst = of_rst t_of_sexp;;
|
||||
|
||||
|
||||
end
|
||||
|
@ -12,7 +12,7 @@ module Hartree_fock : sig
|
||||
val write : t -> unit
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
val of_rst : Rst_string.t -> t
|
||||
val of_rst : Rst_string.t -> t option
|
||||
end = struct
|
||||
type t =
|
||||
{ n_it_scf_max : Strictly_positive_int.t;
|
||||
@ -93,21 +93,8 @@ SCF convergence criterion (on energy) ::
|
||||
|> Rst_string.of_string
|
||||
;;
|
||||
|
||||
let of_rst s =
|
||||
let s = Rst_string.to_string s
|
||||
|> 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
|
||||
;;
|
||||
|
||||
include Generic_input_of_rst;;
|
||||
let of_rst = of_rst t_of_sexp;;
|
||||
|
||||
end
|
||||
|
||||
|
@ -14,7 +14,7 @@ module Nuclei : sig
|
||||
val write : t -> unit
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
val of_rst : Rst_string.t -> t
|
||||
val of_rst : Rst_string.t -> t option
|
||||
end = struct
|
||||
type t =
|
||||
{ nucl_num : Nucl_number.t ;
|
||||
@ -203,6 +203,7 @@ Nuclear coordinates in xyz format (Angstroms) ::
|
||||
| _ -> failwith "Error in xyz format"
|
||||
in
|
||||
(* Create the Nuclei.t data structure *)
|
||||
let result =
|
||||
{ nucl_num = List.length atom_list
|
||||
|> Nucl_number.of_int ~max:nmax;
|
||||
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 ->
|
||||
x.Atom.coord ) |> Array.of_list ;
|
||||
}
|
||||
in Some result
|
||||
;;
|
||||
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ endif
|
||||
|
||||
LIBS=
|
||||
PKGS=
|
||||
OCAMLCFLAGS="-g"
|
||||
OCAMLCFLAGS="-g -warn-error A"
|
||||
OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS)
|
||||
MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml
|
||||
MLIFILES=$(wildcard *.mli)
|
||||
|
@ -23,9 +23,8 @@ of the block.
|
||||
;;
|
||||
val read : unit -> t
|
||||
val write : t -> unit
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
val of_rst : Rst_string.t -> t
|
||||
val of_rst : Rst_string.t -> t option
|
||||
end = struct
|
||||
type t =
|
||||
{ r_x : Type_of_x.t
|
||||
@ -42,12 +41,14 @@ of the block.
|
||||
|
||||
end
|
||||
|
||||
The following functions need to be defined::
|
||||
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
|
||||
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`.
|
||||
@ -135,26 +136,12 @@ Finally, create the functions to write an RST string as
|
||||
;;
|
||||
|
||||
|
||||
and you can use this function to read it back:
|
||||
and you can use the generic `of_rst` function to read it back:
|
||||
|
||||
.. code-block:: ocaml
|
||||
|
||||
let of_rst s =
|
||||
let s = Rst_string.to_string s
|
||||
|> 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
|
||||
;;
|
||||
|
||||
|
||||
include Generic_input_of_rst;;
|
||||
let of_rst = of_rst t_of_sexp;;
|
||||
|
||||
|
||||
|
||||
@ -201,10 +188,11 @@ vim search strings are given in brackets.
|
||||
|
||||
let get s =
|
||||
let header = (make_header s)
|
||||
and rst = match s with
|
||||
and rst = let open Input in
|
||||
match s with
|
||||
...
|
||||
| New_keyword ->
|
||||
Input.New_keyword.(to_rst (read ()))
|
||||
New_keyword.(to_rst (read ()))
|
||||
...
|
||||
|
||||
|
||||
@ -212,9 +200,10 @@ vim search strings are given in brackets.
|
||||
|
||||
.. code-block:: ocaml
|
||||
|
||||
let open Input in
|
||||
match s with
|
||||
...
|
||||
| New_keyword ->
|
||||
Input.New_keyword.(write (of_rst str))
|
||||
| New_keyword -> write New_keyword.(of_rst, write)
|
||||
...
|
||||
;;
|
||||
|
||||
|
@ -44,25 +44,26 @@ let make_header kw =
|
||||
|
||||
let get s =
|
||||
let header = (make_header s)
|
||||
and rst = match s with
|
||||
and rst = let open Input in
|
||||
match s with
|
||||
| Full_ci ->
|
||||
Input.Full_ci.(to_rst (read ()))
|
||||
Full_ci.(to_rst (read ()))
|
||||
| Hartree_fock ->
|
||||
Input.Hartree_fock.(to_rst (read ()))
|
||||
Hartree_fock.(to_rst (read ()))
|
||||
| Mo_basis ->
|
||||
Input.Mo_basis.(to_rst (read ()))
|
||||
Mo_basis.(to_rst (read ()))
|
||||
| Electrons ->
|
||||
Input.Electrons.(to_rst (read ()))
|
||||
Electrons.(to_rst (read ()))
|
||||
| Determinants ->
|
||||
Input.Determinants.(to_rst (read ()))
|
||||
Determinants.(to_rst (read ()))
|
||||
| Cisd_sc2 ->
|
||||
Input.Cisd_sc2.(to_rst (read ()))
|
||||
Cisd_sc2.(to_rst (read ()))
|
||||
| Nuclei ->
|
||||
Input.Nuclei.(to_rst (read ()))
|
||||
Nuclei.(to_rst (read ()))
|
||||
| Ao_basis ->
|
||||
Input.Ao_basis.(to_rst (read ()))
|
||||
Ao_basis.(to_rst (read ()))
|
||||
| Bielec_integrals ->
|
||||
Input.Bielec_integrals.(to_rst (read ()))
|
||||
Bielec_integrals.(to_rst (read ()))
|
||||
|
||||
in header^(Rst_string.to_string rst)
|
||||
;;
|
||||
@ -81,27 +82,22 @@ let set str s =
|
||||
let str = String.sub ~pos:index_begin ~len:l str
|
||||
|> Rst_string.of_string
|
||||
in
|
||||
let write (of_rst,w) =
|
||||
match of_rst str with
|
||||
| Some data -> w data
|
||||
| None -> ()
|
||||
in
|
||||
let open Input in
|
||||
match s with
|
||||
(*
|
||||
| Mo_basis ->
|
||||
*)
|
||||
| Hartree_fock ->
|
||||
Input.Hartree_fock.(write (of_rst str ))
|
||||
| Full_ci ->
|
||||
Input.Full_ci.(write (of_rst str))
|
||||
| Electrons ->
|
||||
Input.Electrons.(write (of_rst str))
|
||||
| Determinants ->
|
||||
Input.Determinants.(write (of_rst str))
|
||||
| Cisd_sc2 ->
|
||||
Input.Cisd_sc2.(write (of_rst str))
|
||||
| Nuclei ->
|
||||
Input.Nuclei.(write (of_rst str))
|
||||
| Bielec_integrals ->
|
||||
Input.Bielec_integrals.(write (of_rst str))
|
||||
(*
|
||||
| Ao_basis ->
|
||||
*)
|
||||
| Hartree_fock -> write Hartree_fock.(of_rst, write)
|
||||
| Full_ci -> write Full_ci.(of_rst, write)
|
||||
| Electrons -> write Electrons.(of_rst, write)
|
||||
| Cisd_sc2 -> write Cisd_sc2.(of_rst, write)
|
||||
| Bielec_integrals -> write Bielec_integrals.(of_rst, write)
|
||||
| Determinants -> write Determinants.(of_rst, write)
|
||||
| Nuclei -> write Nuclei.(of_rst, write)
|
||||
| Ao_basis -> () (* TODO *)
|
||||
| Mo_basis -> () (* TODO *)
|
||||
|
||||
;;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user