10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-22 20:35:19 +01:00

Merge branch 'master' of github.com:LCPQ/quantum_package

This commit is contained in:
Manu 2014-11-13 10:43:30 +01:00
commit c8a24f1080
20 changed files with 446 additions and 167 deletions

View File

@ -28,13 +28,14 @@ EZFIO: bin/irpf90
bin/irpf90:
$(info $(BLUE)===== Fetching IRPF90 from the web ===== $(BLACK))
@sleep 1
@$(FETCH_FROM_WEB) "$(WWW_SERVER)/$(IRPF90_TGZ)" $(IRPF90_TGZ) || \
(echo Unable to download IRPF90 : $(WWW_SERVER)/$(IRPF90_TGZ) ; exit 1)
tar -zxf $(IRPF90_TGZ) && rm $(IRPF90_TGZ)
$(MAKE) -C irpf90 | tee install_irpf90.log
rm -rf -- $$PWD/bin/irpf90 $$PWD/bin/irpman
ln -s $$PWD/irpf90/bin/irpf90 $$PWD/bin/irpf90
ln -s $$PWD/irpf90/bin/irpman $$PWD/bin/irpman
#@$(FETCH_FROM_WEB) "$(WWW_SERVER)/$(IRPF90_TGZ)" $(IRPF90_TGZ) || \
# (echo Unable to download IRPF90 : $(WWW_SERVER)/$(IRPF90_TGZ) ; exit 1)
#tar -zxf $(IRPF90_TGZ) && rm $(IRPF90_TGZ)
#$(MAKE) -C irpf90 | tee install_irpf90.log
#rm -rf -- $$PWD/bin/irpf90 $$PWD/bin/irpman
echo $$PWD/irpf90/bin/irpf90 $$\@ > $$PWD/bin/irpf90
echo $$PWD/irpf90/bin/irpman $$\@ > $$PWD/bin/irpman
chmod +x $$PWD/bin/irpf90 $$PWD/bin/irpman
doc:
$(MAKE) -C doc

8
README.md Normal file
View 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>)

View File

@ -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>`_

View File

@ -0,0 +1,60 @@
open Core.Std;;
open Qptypes;;
let fail_msg str (ex,range) =
let msg = match ex with
| Failure msg -> msg
| _ -> raise ex
in
let range = match range with
| Sexp.Annotated.Atom (range,_) -> range
| Sexp.Annotated.List (range,_,_) -> range
in
let open Sexp.Annotated in
let start_pos = range.start_pos.offset
and end_pos = range.end_pos.offset
in
let pre = String.sub ~pos:0 ~len:start_pos str
and mid = String.sub ~pos:start_pos ~len:(end_pos-start_pos) str
and post = String.sub ~pos:(end_pos)
~len:((String.length str)-(end_pos)) str
in
let str = Printf.sprintf "%s ## %s ## %s" pre mid post
in
let str = String.tr str ~target:'(' ~replacement:' '
|> String.split ~on:')'
|> List.map ~f:String.strip
|> List.filter ~f:(fun x ->
match String.substr_index x ~pos:0 ~pattern:"##" with
| None -> false
| Some _ -> true
)
|> String.concat ~sep:"\n"
in
Printf.eprintf "Error: (%s)\n\n %s\n\n" msg str;
;;
let evaluate_sexp t_of_sexp s =
let sexp = ("("^s^")") in
match ( Sexp.of_string_conv sexp t_of_sexp ) with
| `Result r -> Some r
| `Error ex -> ( fail_msg sexp ex; None)
;;
let of_rst t_of_sexp 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
|> evaluate_sexp t_of_sexp
;;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -9,10 +9,11 @@ module Full_ci : sig
do_pt2_end : bool;
} with sexp
;;
val read : unit -> t
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 =
{ n_det_max_fci : Det_number_max.t;
@ -33,6 +34,11 @@ end = struct
|> 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 () =
if not (Ezfio.has_full_ci_pt2_max ()) then
get_default "pt2_max"
@ -43,6 +49,11 @@ end = struct
|> 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 () =
if not (Ezfio.has_full_ci_do_pt2_end ()) then
get_default "do_pt2_end"
@ -52,6 +63,10 @@ end = struct
Ezfio.get_full_ci_do_pt2_end ()
;;
let write_do_pt2_end =
Ezfio.set_full_ci_do_pt2_end
;;
let read () =
{ 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 =
Printf.sprintf "
n_det_max_fci = %s
@ -92,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

View File

@ -8,10 +8,11 @@ module Hartree_fock : sig
thresh_scf : Threshold.t;
} with sexp
;;
val read : unit -> t
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 =
{ n_it_scf_max : Strictly_positive_int.t;
@ -31,14 +32,25 @@ end = struct
|> 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
get_default "thresh_scf"
|> Float.of_string
|> Ezfio.set_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 () =
@ -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 =
Printf.sprintf "
n_it_scf_max = %s
@ -72,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

View File

@ -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,15 +203,17 @@ Nuclear coordinates in xyz format (Angstroms) ::
| _ -> failwith "Error in xyz format"
in
(* Create the Nuclei.t data structure *)
{ nucl_num = List.length atom_list
|> Nucl_number.of_int ~max:nmax;
nucl_label = List.map atom_list ~f:(fun x ->
x.Atom.element) |> Array.of_list ;
nucl_charge = List.map atom_list ~f:(fun x ->
x.Atom.charge ) |> Array.of_list ;
nucl_coord = List.map atom_list ~f:(fun x ->
x.Atom.coord ) |> Array.of_list ;
}
let result =
{ nucl_num = List.length atom_list
|> Nucl_number.of_int ~max:nmax;
nucl_label = List.map atom_list ~f:(fun x ->
x.Atom.element) |> Array.of_list ;
nucl_charge = List.map atom_list ~f:(fun x ->
x.Atom.charge ) |> Array.of_list ;
nucl_coord = List.map atom_list ~f:(fun x ->
x.Atom.coord ) |> Array.of_list ;
}
in Some result
;;
end

View File

@ -10,8 +10,8 @@ endif
LIBS=
PKGS=
OCAMLCFLAGS="-g"
OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS)
OCAMLCFLAGS="-g -warn-error A"
OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) -ocamlopt ocamlc.opt
MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml
MLIFILES=$(wildcard *.mli)
ALL_TESTS=$(patsubst %.ml,%.byte,$(wildcard test_*.ml))

View File

@ -4,3 +4,10 @@ Ocaml scripts
This directory contains all the scripts that control the input/output
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
View 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)
...
;;

View File

@ -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,30 +82,22 @@ let set str s =
let str = String.sub ~pos:index_begin ~len:l str
|> Rst_string.of_string
in
match s with
(*
| Full_ci ->
| Hartree_fock ->
| Mo_basis ->
*)
| Electrons ->
Input.Electrons.of_rst str
|> Input.Electrons.write
| Determinants ->
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 ->
*)
let write (of_rst,w) =
match of_rst str with
| Some data -> w data
| None -> ()
in
let open Input in
match s with
| 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 *)
;;
@ -132,8 +125,6 @@ let run ezfio_filename =
List.map ~f:get [
Ao_basis ;
Mo_basis ;
Full_ci ;
Hartree_fock ;
])
in
String.concat output
@ -144,7 +135,9 @@ let run ezfio_filename =
Nuclei ;
Electrons ;
Bielec_integrals ;
Hartree_fock ;
Cisd_sc2 ;
Full_ci ;
Determinants ;
]
in

View File

@ -228,9 +228,9 @@ let parse_input_ezfio input=
and (min, max) = String.lsplit2_exn ~on:':' c
and msg = d
in
let name :: typ :: ezfio_func :: min :: max :: msg :: [] =
match (name :: typ :: ezfio_func :: min :: max :: msg :: []) with
| l -> List.map ~f:String.strip l
let (name, typ, ezfio_func, min, max, msg) =
match (List.map [ name ; typ ; ezfio_func ; min ; max ; msg ] ~f:String.strip) with
| [ name ; typ ; ezfio_func ; min ; max ; msg ] -> (name, typ, ezfio_func, min, max, msg)
| _ -> assert false
in
Printf.sprintf ezfio_template

View File

@ -9,12 +9,12 @@ let test_module () =
In_channel.create (Qpackage.root^"/data/basis/"^(String.lowercase b))
in
(*
let molecule =
let xyz_file = "F2.xyz" in
Molecule.of_xyz_file xyz_file
in
let nuclei = molecule.Molecule.nuclei in
*)
let basis =
(Basis.read_element basis_channel (Nucl_number.of_int 1) Element.F) @

View File

@ -16,7 +16,10 @@ let test_bielec_intergals () =
in
print_endline output;
let rst = Input.Bielec_integrals.to_rst b in
let b2 = Input.Bielec_integrals.of_rst rst in
let b2 = match Input.Bielec_integrals.of_rst rst with
| Some x -> x
| None -> assert false
in
if (b = b2) then
print_endline "OK"
else
@ -43,8 +46,11 @@ let test_dets () =
in
print_endline (Input.Determinants.to_rst b |> Rst_string.to_string ) ;
print_endline (Input.Determinants.sexp_of_t b |> Sexplib.Sexp.to_string ) ;
let r = Input.Determinants.to_rst b in
let b2 = Input.Determinants.of_rst r in
let rst = Input.Determinants.to_rst b in
let b2 = match Input.Determinants.of_rst rst with
| Some x -> x
| None -> assert false
in
if (b2 = b) then
print_endline "OK"
else
@ -57,7 +63,10 @@ let test_cisd_sc2 () =
in
print_endline (Input.Cisd_sc2.to_string b);
let rst = Input.Cisd_sc2.to_rst b in
let b2 = Input.Cisd_sc2.of_rst rst in
let b2 = match Input.Cisd_sc2.of_rst rst with
| Some x -> x
| None -> assert false
in
if (b = b2) then
print_endline "OK"
else
@ -71,8 +80,11 @@ let test_electrons () =
in
print_endline (Input.Electrons.to_string b);
let rst = Input.Electrons.to_rst b in
let new_b = Input.Electrons.of_rst rst in
if (b = new_b) then
let b2 = match Input.Electrons.of_rst rst with
| Some x -> x
| None -> assert false
in
if (b = b2) then
print_endline "OK"
else
print_endline "Failed in rst"
@ -84,9 +96,12 @@ let test_fci () =
in
print_endline (Input.Full_ci.to_string b);
let rst = Input.Full_ci.to_rst b in
let new_b = Input.Full_ci.of_rst rst in
let b2 = match Input.Full_ci.of_rst rst with
| Some x -> x
| None -> assert false
in
print_endline (Input.Full_ci.to_string b);
if (b = new_b) then
if (b = b2) then
print_endline "OK"
else
print_endline "Failed in rst"
@ -98,9 +113,12 @@ let test_hf () =
in
print_endline (Input.Hartree_fock.to_string b);
let rst = Input.Hartree_fock.to_rst b in
let new_b = Input.Hartree_fock.of_rst rst in
let b2 = match Input.Hartree_fock.of_rst rst with
| Some x -> x
| None -> assert false
in
print_endline (Input.Hartree_fock.to_string b);
if (b = new_b) then
if (b = b2) then
print_endline "OK"
else
print_endline "Failed in rst"
@ -117,9 +135,12 @@ let test_nucl () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Nuclei.read () in
let rst = Input.Nuclei.to_rst b in
let new_b = Input.Nuclei.of_rst rst in
let b2 = match Input.Nuclei.of_rst rst with
| Some x -> x
| None -> assert false
in
print_endline (Input.Nuclei.to_string b);
if (b = new_b) then
if (b = b2) then
print_endline "OK"
else
print_endline "Failed in rst"

View File

@ -148,7 +148,6 @@ subroutine make_s2_eigenfunction
integer, parameter :: bufsze = 1000
logical, external :: is_in_wavefunction
print *, irp_here
! !TODO DEBUG
! do i=1,N_det
! do j=i+1,N_det