10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-30 00:44:37 +02:00

Merge branch 'dev' into csf_verified

This commit is contained in:
Anthony Scemama 2022-09-15 11:06:02 +02:00 committed by GitHub
commit 4ebe39aaa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 125 additions and 50 deletions

View File

@ -1,6 +1,7 @@
# Quantum Package 2.2 # Quantum Package 2.2
<img src="https://raw.githubusercontent.com/QuantumPackage/qp2/master/data/qp2.png" width="250"> <!--- img src="https://raw.githubusercontent.com/QuantumPackage/qp2/master/data/qp2.png" width="250" --->
<img src="https://trex-coe.eu/sites/default/files/styles/responsive_no_crop/public/2021-12/Risorsa%2014_0.png" width="250">
[![DOI](https://zenodo.org/badge/167513335.svg)](https://zenodo.org/badge/latestdoi/167513335) [![DOI](https://zenodo.org/badge/167513335.svg)](https://zenodo.org/badge/latestdoi/167513335)
@ -34,6 +35,12 @@ https://arxiv.org/abs/1902.08154
* [Download the latest release](http://github.com/QuantumPackage/qp2/releases) * [Download the latest release](http://github.com/QuantumPackage/qp2/releases)
* [Read the documentation](https://quantum-package.readthedocs.io) * [Read the documentation](https://quantum-package.readthedocs.io)
# Discussion list
For any questions or announcements regarding QuantumPackage, you can join our discussion list by registering [here](https://groupes.renater.fr/sympa/subscribe/quantum_package) or by sending an email to `quantum_package-request@groupes.renater.fr` .
You can also look over its [archives](https://groupes.renater.fr/sympa/arc/quantum_package).
# Build status # Build status
* Master [![master build status](https://travis-ci.com/QuantumPackage/qp2.svg?branch=master)](https://travis-ci.org/QuantumPackage/qp2) * Master [![master build status](https://travis-ci.com/QuantumPackage/qp2.svg?branch=master)](https://travis-ci.org/QuantumPackage/qp2)
@ -44,9 +51,19 @@ https://arxiv.org/abs/1902.08154
# Credits # Credits
* [TREX Center of Excellence](https://trex-coe.eu)
* [ERC PTEROSOR](https://lcpq.github.io/PTEROSOR)
* [CNRS](http://www.cnrs.fr) * [CNRS](http://www.cnrs.fr)
* [Laboratoire de Chimie et Physique Quantiques](http://lcpq.ups-tlse.fr) * [Laboratoire de Chimie et Physique Quantiques](http://lcpq.ups-tlse.fr)
* [Laboratoire de Chimie Théorique](http://www.lct.jussieu.fr) * [Laboratoire de Chimie Théorique](http://www.lct.jussieu.fr)
* [Argonne Leadership Computing Facility](http://alcf.anl.gov) * [Argonne Leadership Computing Facility](http://alcf.anl.gov)
* [CALMIP](https://www.calmip.univ-toulouse.fr) * [CALMIP](https://www.calmip.univ-toulouse.fr)
------------------------------
<img src="https://lcpq.github.io/PTEROSOR/img/ERC.png" width="200" />
[TREX: Targeting Real Chemical Accuracy at the Exascale](https://trex-coe.eu) project has received funding from the European Unions Horizon 2020 - Research and Innovation program - under grant agreement no. 952165. The content of this document does not represent the opinion of the European Union, and the European Union is not responsible for any use that might be made of such content.
[PTEROSOR](https://lcpq.github.io/PTEROSOR) project has received funding from the European Research Council (ERC) under the European Unions Horizon 2020 research and innovation programme (Grant agreement No. 863481).

View File

@ -146,6 +146,17 @@ def write_ezfio(res, filename):
ezfio.set_ao_basis_ao_nucl(at) ezfio.set_ao_basis_ao_nucl(at)
ezfio.set_ao_basis_ao_prim_num(num_prim) ezfio.set_ao_basis_ao_prim_num(num_prim)
ezfio.set_ao_basis_ao_power(power_x + power_y + power_z) ezfio.set_ao_basis_ao_power(power_x + power_y + power_z)
try:
normf = res.normf
if normf == 0:
ezfio.set_ao_basis_ao_normalized(True)
elif normf == 1:
ezfio.set_ao_basis_ao_normalized(False)
else:
print("BUG in NORMF")
sys.exit(0)
except AttributeError:
ezfio.set_ao_basis_ao_normalized(True)
# ~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~ #
# P a r s i n g # # P a r s i n g #

8
configure vendored
View File

@ -180,7 +180,7 @@ if [[ "${PACKAGES}.x" != ".x" ]] ; then
fi fi
if [[ ${PACKAGES} = all ]] ; then if [[ ${PACKAGES} = all ]] ; then
PACKAGES="zlib ninja zeromq f77zmq gmp ocaml docopt resultsFile bats" PACKAGES="zlib ninja zeromq f77zmq gmp ocaml docopt resultsFile bats bse"
fi fi
@ -354,12 +354,6 @@ echo " ||----w | "
echo " || || " echo " || || "
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "" echo ""
echo "If you have PIP, you can install the Basis Set Exchange command-line tool:"
echo ""
echo " ./configure -i bse"
echo ""
echo "This will enable the usage of qp_basis to install extra basis sets."
echo ""
echo "" echo ""
printf "\e[m\n" printf "\e[m\n"

View File

@ -555,7 +555,7 @@ g 1 1.00
g 1 1.00 g 1 1.00
1 0.457496 1.000000 1 0.457496 1.000000
MAGNESIUM MAGNESIUM
s 9 1.00 s 9 1.00
1 0.030975 0.165290 1 0.030975 0.165290
2 0.062959 0.506272 2 0.062959 0.506272

View File

@ -80,8 +80,6 @@ function qp()
if [[ -d $NAME ]] ; then if [[ -d $NAME ]] ; then
[[ -d $EZFIO_FILE ]] && ezfio unset_file [[ -d $EZFIO_FILE ]] && ezfio unset_file
ezfio set_file $NAME ezfio set_file $NAME
else
qp_create_ezfio -h | more
fi fi
unset _ARGS unset _ARGS
;; ;;

View File

@ -1,3 +1,5 @@
exception Error of string
type short_opt = char type short_opt = char
type long_opt = string type long_opt = string
type optional = Mandatory | Optional type optional = Mandatory | Optional
@ -181,15 +183,16 @@ let set_specs specs_in =
Getopt.parse_cmdline cmd_specs (fun x -> anon_args := !anon_args @ [x]); Getopt.parse_cmdline cmd_specs (fun x -> anon_args := !anon_args @ [x]);
if show_help () then if show_help () then
(help () ; exit 0); help ()
else
(* Check that all mandatory arguments are set *)
List.filter (fun x -> x.short <> ' ' && x.opt = Mandatory) !specs
|> List.iter (fun x ->
match get x.long with
| Some _ -> ()
| None -> raise (Error ("--"^x.long^" option is missing."))
)
(* Check that all mandatory arguments are set *)
List.filter (fun x -> x.short <> ' ' && x.opt = Mandatory) !specs
|> List.iter (fun x ->
match get x.long with
| Some _ -> ()
| None -> failwith ("Error: --"^x.long^" option is missing.")
)
;; ;;

View File

@ -59,6 +59,8 @@ let () =
*) *)
exception Error of string
type short_opt = char type short_opt = char
type long_opt = string type long_opt = string

View File

@ -101,7 +101,7 @@ let to_string_general ~f m =
|> String.concat "\n" |> String.concat "\n"
let to_string = let to_string =
to_string_general ~f:(fun x -> Atom.to_string Units.Angstrom x) to_string_general ~f:(fun x -> Atom.to_string ~units:Units.Angstrom x)
let to_xyz = let to_xyz =
to_string_general ~f:Atom.to_xyz to_string_general ~f:Atom.to_xyz
@ -113,7 +113,7 @@ let of_xyz_string
s = s =
let l = String_ext.split s ~on:'\n' let l = String_ext.split s ~on:'\n'
|> List.filter (fun x -> x <> "") |> List.filter (fun x -> x <> "")
|> list_map (fun x -> Atom.of_string units x) |> list_map (fun x -> Atom.of_string ~units x)
in in
let ne = ( get_charge { let ne = ( get_charge {
nuclei=l ; nuclei=l ;

View File

@ -677,6 +677,7 @@ let run ?o b au c d m p cart xyz_file =
let () = let () =
try (
let open Command_line in let open Command_line in
begin begin
@ -734,7 +735,7 @@ If a file with the same name as the basis set exists, this file will be read. O
let basis = let basis =
match Command_line.get "basis" with match Command_line.get "basis" with
| None -> assert false | None -> ""
| Some x -> x | Some x -> x
in in
@ -773,10 +774,14 @@ If a file with the same name as the basis set exists, this file will be read. O
let xyz_filename = let xyz_filename =
match Command_line.anon_args () with match Command_line.anon_args () with
| [x] -> x | [] -> failwith "input file is missing"
| _ -> (Command_line.help () ; failwith "input file is missing") | x::_ -> x
in in
run ?o:output basis au charge dummy multiplicity pseudo cart xyz_filename run ?o:output basis au charge dummy multiplicity pseudo cart xyz_filename
)
with
| Failure txt -> Printf.eprintf "Fatal error: %s\n%!" txt
| Command_line.Error txt -> Printf.eprintf "Command line error: %s\n%!" txt

View File

@ -110,7 +110,7 @@ let run slave ?prefix exe ezfio_file =
let task_thread = let task_thread =
let thread = let thread =
Thread.create ( fun () -> Thread.create ( fun () ->
TaskServer.run port_number ) TaskServer.run ~port:port_number )
in in
thread (); thread ();
in in

View File

@ -4,7 +4,7 @@ source $QP_ROOT/tests/bats/common.bats.sh
source $QP_ROOT/quantum_package.rc source $QP_ROOT/quantum_package.rc
function run() { function run() {
thresh=1.e-5 thresh=2.e-5
test_exe cisd || skip test_exe cisd || skip
qp edit --check qp edit --check
qp set determinants n_states 2 qp set determinants n_states 2

View File

@ -1,4 +1,5 @@
subroutine davidson_diag_h_csf(dets_in,u_in,dim_in,energies,sze,sze_csf,N_st,N_st_diag,Nint,dressing_state,converged) subroutine davidson_diag_h_csf(dets_in, u_in, dim_in, energies, sze, sze_csf, &
N_st, N_st_diag, Nint, dressing_state,converged)
use bitmasks use bitmasks
implicit none implicit none
BEGIN_DOC BEGIN_DOC

View File

@ -69,13 +69,21 @@ END_PROVIDER
do_csf = s2_eig .and. only_expected_s2 .and. csf_based do_csf = s2_eig .and. only_expected_s2 .and. csf_based
if (diag_algorithm == "Davidson") then if (diag_algorithm == 'Davidson') then
if (do_csf) then if (do_csf) then
if (sigma_vector_algorithm == 'det') then if (sigma_vector_algorithm == 'det') then
call davidson_diag_H_csf(psi_det,CI_eigenvectors, & call davidson_diag_H_csf (psi_det, &
size(CI_eigenvectors,1),CI_electronic_energy, & CI_eigenvectors, &
N_det,N_csf,min(N_det,N_states),min(N_det,N_states_diag),N_int,0,converged) size(CI_eigenvectors,1), &
CI_electronic_energy, &
N_det, &
N_csf, &
min(N_csf,N_states), &
min(N_csf,N_states_diag), &
N_int, &
0, &
converged)
else if (sigma_vector_algorithm == 'cfg') then else if (sigma_vector_algorithm == 'cfg') then
call davidson_diag_H_cfg(psi_det,CI_eigenvectors, & call davidson_diag_H_cfg(psi_det,CI_eigenvectors, &
size(CI_eigenvectors,1),CI_electronic_energy, & size(CI_eigenvectors,1),CI_electronic_energy, &
@ -85,9 +93,17 @@ END_PROVIDER
stop 'bug' stop 'bug'
endif endif
else else
call davidson_diag_HS2(psi_det,CI_eigenvectors, CI_s2, & call davidson_diag_HS2(psi_det, &
size(CI_eigenvectors,1),CI_electronic_energy, & CI_eigenvectors, &
N_det,min(N_det,N_states),min(N_det,N_states_diag),N_int,0,converged) CI_s2, &
size(CI_eigenvectors,1), &
CI_electronic_energy, &
N_det, &
min(N_det,N_states), &
min(N_det,N_states_diag), &
N_int, &
0, &
converged)
endif endif
integer :: N_states_diag_save integer :: N_states_diag_save
@ -108,9 +124,17 @@ END_PROVIDER
CI_electronic_energy_tmp(1:N_states_diag_save) = CI_electronic_energy(1:N_states_diag_save) CI_electronic_energy_tmp(1:N_states_diag_save) = CI_electronic_energy(1:N_states_diag_save)
CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) = CI_eigenvectors(1:N_det,1:N_states_diag_save) CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) = CI_eigenvectors(1:N_det,1:N_states_diag_save)
call davidson_diag_H_csf(psi_det,CI_eigenvectors_tmp, & call davidson_diag_H_csf (psi_det, &
size(CI_eigenvectors_tmp,1),CI_electronic_energy_tmp, & CI_eigenvectors_tmp, &
N_det,N_csf,min(N_det,N_states),min(N_det,N_states_diag),N_int,0,converged) size(CI_eigenvectors_tmp,1), &
CI_electronic_energy_tmp, &
N_det, &
N_csf, &
min(N_csf,N_states), &
min(N_csf,N_states_diag), &
N_int, &
0, &
converged)
CI_electronic_energy(1:N_states_diag_save) = CI_electronic_energy_tmp(1:N_states_diag_save) CI_electronic_energy(1:N_states_diag_save) = CI_electronic_energy_tmp(1:N_states_diag_save)
CI_eigenvectors(1:N_det,1:N_states_diag_save) = CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) CI_eigenvectors(1:N_det,1:N_states_diag_save) = CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save)
@ -128,9 +152,17 @@ END_PROVIDER
CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) = CI_eigenvectors(1:N_det,1:N_states_diag_save) CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) = CI_eigenvectors(1:N_det,1:N_states_diag_save)
CI_s2_tmp(1:N_states_diag_save) = CI_s2(1:N_states_diag_save) CI_s2_tmp(1:N_states_diag_save) = CI_s2(1:N_states_diag_save)
call davidson_diag_HS2(psi_det,CI_eigenvectors_tmp, CI_s2_tmp, & call davidson_diag_HS2(psi_det, &
size(CI_eigenvectors_tmp,1),CI_electronic_energy_tmp, & CI_eigenvectors_tmp, &
N_det,min(N_det,N_states),min(N_det,N_states_diag),N_int,0,converged) CI_s2_tmp, &
size(CI_eigenvectors_tmp,1), &
CI_electronic_energy_tmp, &
N_det, &
min(N_det,N_states), &
min(N_det,N_states_diag), &
N_int, &
0, &
converged)
CI_electronic_energy(1:N_states_diag_save) = CI_electronic_energy_tmp(1:N_states_diag_save) CI_electronic_energy(1:N_states_diag_save) = CI_electronic_energy_tmp(1:N_states_diag_save)
CI_eigenvectors(1:N_det,1:N_states_diag_save) = CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save) CI_eigenvectors(1:N_det,1:N_states_diag_save) = CI_eigenvectors_tmp(1:N_det,1:N_states_diag_save)

View File

@ -40,7 +40,14 @@ function run_stoch() {
run_stoch -49.14097596 0.0001 10000 run_stoch -49.14097596 0.0001 10000
} }
@test "NH3" { # 0:00:11 @test "F2" { # 4.07m
[[ -n $TRAVIS ]] && skip
qp set_file f2.ezfio
qp set_frozen_core
run_stoch -199.307512211742 0.002 100000
}
@test "NH3" { # 10.6657s
qp set_file nh3.ezfio qp set_file nh3.ezfio
qp set_mo_class --core="[1-4]" --act="[5-72]" qp set_mo_class --core="[1-4]" --act="[5-72]"
run -56.24474908 1.e-5 10000 run -56.24474908 1.e-5 10000
@ -179,10 +186,3 @@ function run_stoch() {
run_stoch -93.0980746734051 5.e-4 50000 run_stoch -93.0980746734051 5.e-4 50000
} }
@test "F2" { # 0:03:34
[[ -n $TRAVIS ]] && skip
qp set_file f2.ezfio
qp set_frozen_core
run_stoch -199.307512211742 0.002 100000
}

View File

@ -54,11 +54,23 @@ subroutine routine_s2
double precision, allocatable :: psi_coef_tmp(:,:) double precision, allocatable :: psi_coef_tmp(:,:)
integer :: i,j,k integer :: i,j,k
double precision :: accu(N_states) double precision :: accu(N_states)
integer :: weights(0:16), ix
double precision :: x
print *, 'Weights of the CFG' weights(:) = 0
do i=1,N_det do i=1,N_det
print *, i, real(weight_configuration(det_to_configuration(i),:)), real(sum(weight_configuration(det_to_configuration(i),:))) x = -dlog(1.d-32+sum(weight_configuration(det_to_configuration(i),:)))/dlog(10.d0)
ix = min(int(x), 16)
weights(ix) += 1
enddo enddo
print *, 'Histogram of the weights of the CFG'
do i=0,15
print *, ' 10^{-', i, '} ', weights(i)
end do
print *, '< 10^{-', 15, '} ', weights(16)
print*, 'Min weight of the configuration?' print*, 'Min weight of the configuration?'
read(5,*) wmin read(5,*) wmin