mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-11-09 06:53:38 +01:00
Merge branch 'dev-stable' of https://github.com/QuantumPackage/qp2 into dev-stable
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
commit
099645e3fb
@ -224,14 +224,18 @@ def write_ezfio(res, filename):
|
|||||||
exponent += [p.expo for p in b.prim]
|
exponent += [p.expo for p in b.prim]
|
||||||
ang_mom.append(str.count(s, "z"))
|
ang_mom.append(str.count(s, "z"))
|
||||||
shell_prim_num.append(len(b.prim))
|
shell_prim_num.append(len(b.prim))
|
||||||
shell_index += [nshell_tot+1] * len(b.prim)
|
shell_index += [nshell_tot] * len(b.prim)
|
||||||
|
|
||||||
|
shell_num = len(ang_mom)
|
||||||
|
assert(shell_index[0] = 1)
|
||||||
|
assert(shell_index[-1] = shell_num)
|
||||||
|
|
||||||
# ~#~#~#~#~ #
|
# ~#~#~#~#~ #
|
||||||
# W r i t e #
|
# W r i t e #
|
||||||
# ~#~#~#~#~ #
|
# ~#~#~#~#~ #
|
||||||
|
|
||||||
ezfio.set_basis_basis("Read from ResultsFile")
|
ezfio.set_basis_basis("Read from ResultsFile")
|
||||||
ezfio.set_basis_shell_num(len(ang_mom))
|
ezfio.set_basis_shell_num(shell_num)
|
||||||
ezfio.set_basis_basis_nucleus_index(nucl_index)
|
ezfio.set_basis_basis_nucleus_index(nucl_index)
|
||||||
ezfio.set_basis_prim_num(len(coefficient))
|
ezfio.set_basis_prim_num(len(coefficient))
|
||||||
|
|
||||||
|
@ -26,8 +26,7 @@ let of_string = function
|
|||||||
| "J" | "j" -> J
|
| "J" | "j" -> J
|
||||||
| "K" | "k" -> K
|
| "K" | "k" -> K
|
||||||
| "L" | "l" -> L
|
| "L" | "l" -> L
|
||||||
| x -> raise (Failure ("Angmom should be S|P|D|F|G|H|I|J|K|L,
|
| x -> raise (Failure ("Angmom should be S|P|D|F|G|H|I|J|K|L, not "^x^"."))
|
||||||
not "^x^"."))
|
|
||||||
|
|
||||||
let of_char = function
|
let of_char = function
|
||||||
| 'S' | 's' -> S
|
| 'S' | 's' -> S
|
||||||
|
@ -17,7 +17,7 @@ let read in_channel at_number =
|
|||||||
(** Find an element in the basis set file *)
|
(** Find an element in the basis set file *)
|
||||||
let find in_channel element =
|
let find in_channel element =
|
||||||
seek_in in_channel 0;
|
seek_in in_channel 0;
|
||||||
let element_read = ref Element.X in
|
let element_read = ref Element.Og in
|
||||||
while !element_read <> element
|
while !element_read <> element
|
||||||
do
|
do
|
||||||
let buffer = input_line in_channel in
|
let buffer = input_line in_channel in
|
||||||
|
@ -20,7 +20,7 @@ type t = X
|
|||||||
|
|
||||||
let of_string x =
|
let of_string x =
|
||||||
match (String.capitalize_ascii (String.lowercase_ascii x)) with
|
match (String.capitalize_ascii (String.lowercase_ascii x)) with
|
||||||
| "X" | "Dummy" -> X
|
| "X" | "Ghost" -> X
|
||||||
| "H" | "Hydrogen" -> H
|
| "H" | "Hydrogen" -> H
|
||||||
| "He" | "Helium" -> He
|
| "He" | "Helium" -> He
|
||||||
| "Li" | "Lithium" -> Li
|
| "Li" | "Lithium" -> Li
|
||||||
@ -265,7 +265,7 @@ let to_string = function
|
|||||||
|
|
||||||
|
|
||||||
let to_long_string = function
|
let to_long_string = function
|
||||||
| X -> "Dummy"
|
| X -> "Ghost"
|
||||||
| H -> "Hydrogen"
|
| H -> "Hydrogen"
|
||||||
| He -> "Helium"
|
| He -> "Helium"
|
||||||
| Li -> "Lithium"
|
| Li -> "Lithium"
|
||||||
|
@ -6,8 +6,8 @@ type element =
|
|||||||
| Element of Element.t
|
| Element of Element.t
|
||||||
| Int_elem of (Nucl_number.t * Element.t)
|
| Int_elem of (Nucl_number.t * Element.t)
|
||||||
|
|
||||||
(** Handle dummy atoms placed on bonds *)
|
(** Handle ghost atoms placed on bonds *)
|
||||||
let dummy_centers ~threshold ~molecule ~nuclei =
|
let ghost_centers ~threshold ~molecule ~nuclei =
|
||||||
let d =
|
let d =
|
||||||
Molecule.distance_matrix molecule
|
Molecule.distance_matrix molecule
|
||||||
in
|
in
|
||||||
@ -68,11 +68,11 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
(Molecule.of_file xyz_file ~charge:(Charge.of_int c)
|
(Molecule.of_file xyz_file ~charge:(Charge.of_int c)
|
||||||
~multiplicity:(Multiplicity.of_int m) )
|
~multiplicity:(Multiplicity.of_int m) )
|
||||||
in
|
in
|
||||||
let dummy =
|
let ghost =
|
||||||
dummy_centers ~threshold:d ~molecule ~nuclei:molecule.Molecule.nuclei
|
ghost_centers ~threshold:d ~molecule ~nuclei:molecule.Molecule.nuclei
|
||||||
in
|
in
|
||||||
let nuclei =
|
let nuclei =
|
||||||
molecule.Molecule.nuclei @ dummy
|
molecule.Molecule.nuclei @ ghost
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
||||||
@ -145,8 +145,6 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
| i :: k :: [] -> (Nucl_number.of_int @@ int_of_string i, Element.of_string k)
|
| i :: k :: [] -> (Nucl_number.of_int @@ int_of_string i, Element.of_string k)
|
||||||
| _ -> failwith "Expected format is int,Element:basis"
|
| _ -> failwith "Expected format is int,Element:basis"
|
||||||
in Int_elem result
|
in Int_elem result
|
||||||
and basis =
|
|
||||||
String.lowercase_ascii basis
|
|
||||||
in
|
in
|
||||||
let key =
|
let key =
|
||||||
match elem with
|
match elem with
|
||||||
@ -313,7 +311,7 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
}
|
}
|
||||||
in
|
in
|
||||||
let nuclei =
|
let nuclei =
|
||||||
molecule.Molecule.nuclei @ dummy
|
molecule.Molecule.nuclei @ ghost
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
||||||
@ -491,11 +489,7 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
|> List.rev
|
|> List.rev
|
||||||
|> list_map (fun (x,i) ->
|
|> list_map (fun (x,i) ->
|
||||||
try
|
try
|
||||||
let e =
|
let e = x.Atom.element in
|
||||||
match x.Atom.element with
|
|
||||||
| Element.X -> Element.H
|
|
||||||
| e -> e
|
|
||||||
in
|
|
||||||
let key =
|
let key =
|
||||||
Int_elem (i,x.Atom.element)
|
Int_elem (i,x.Atom.element)
|
||||||
in
|
in
|
||||||
@ -507,6 +501,12 @@ let run ?o b au c d m p cart xyz_file =
|
|||||||
in
|
in
|
||||||
try
|
try
|
||||||
Basis.read_element (basis_channel key) i e
|
Basis.read_element (basis_channel key) i e
|
||||||
|
with _ ->
|
||||||
|
try
|
||||||
|
if e = Element.X then
|
||||||
|
Basis.read_element (basis_channel key) i (Element.H)
|
||||||
|
else
|
||||||
|
raise Not_found
|
||||||
with Not_found ->
|
with Not_found ->
|
||||||
failwith (Printf.sprintf "Basis not found for atom %d (%s)" (Nucl_number.to_int i)
|
failwith (Printf.sprintf "Basis not found for atom %d (%s)" (Nucl_number.to_int i)
|
||||||
(Element.to_string x.Atom.element) )
|
(Element.to_string x.Atom.element) )
|
||||||
@ -710,9 +710,9 @@ If a file with the same name as the basis set exists, this file will be read. O
|
|||||||
arg=With_arg "<int>";
|
arg=With_arg "<int>";
|
||||||
doc="Total charge of the molecule. Default is 0. For negative values, use m instead of -, for ex m1"} ;
|
doc="Total charge of the molecule. Default is 0. For negative values, use m instead of -, for ex m1"} ;
|
||||||
|
|
||||||
{ opt=Optional ; short='d'; long="dummy";
|
{ opt=Optional ; short='g'; long="ghost";
|
||||||
arg=With_arg "<float>";
|
arg=With_arg "<float>";
|
||||||
doc="Add dummy atoms. x * (covalent radii of the atoms)."} ;
|
doc="Add ghost atoms. x * (covalent radii of the atoms)."} ;
|
||||||
|
|
||||||
{ opt=Optional ; short='m'; long="multiplicity";
|
{ opt=Optional ; short='m'; long="multiplicity";
|
||||||
arg=With_arg "<int>";
|
arg=With_arg "<int>";
|
||||||
@ -756,8 +756,8 @@ If a file with the same name as the basis set exists, this file will be read. O
|
|||||||
int_of_string x )
|
int_of_string x )
|
||||||
in
|
in
|
||||||
|
|
||||||
let dummy =
|
let ghost =
|
||||||
match Command_line.get "dummy" with
|
match Command_line.get "ghost" with
|
||||||
| None -> 0.
|
| None -> 0.
|
||||||
| Some x -> float_of_string x
|
| Some x -> float_of_string x
|
||||||
in
|
in
|
||||||
@ -782,7 +782,7 @@ If a file with the same name as the basis set exists, this file will be read. O
|
|||||||
| x::_ -> x
|
| x::_ -> x
|
||||||
in
|
in
|
||||||
|
|
||||||
run ?o:output basis au charge dummy multiplicity pseudo cart xyz_filename
|
run ?o:output basis au charge ghost multiplicity pseudo cart xyz_filename
|
||||||
)
|
)
|
||||||
with
|
with
|
||||||
(* | Failure txt -> Printf.eprintf "Fatal error: %s\n%!" txt *)
|
(* | Failure txt -> Printf.eprintf "Fatal error: %s\n%!" txt *)
|
||||||
|
@ -31,11 +31,12 @@ subroutine run_pt2_slave(thread,iproc,energy)
|
|||||||
|
|
||||||
double precision, intent(in) :: energy(N_states_diag)
|
double precision, intent(in) :: energy(N_states_diag)
|
||||||
integer, intent(in) :: thread, iproc
|
integer, intent(in) :: thread, iproc
|
||||||
if (N_det > 100000 ) then
|
|
||||||
call run_pt2_slave_large(thread,iproc,energy)
|
call run_pt2_slave_large(thread,iproc,energy)
|
||||||
else
|
! if (N_det > 100000 ) then
|
||||||
call run_pt2_slave_small(thread,iproc,energy)
|
! call run_pt2_slave_large(thread,iproc,energy)
|
||||||
endif
|
! else
|
||||||
|
! call run_pt2_slave_small(thread,iproc,energy)
|
||||||
|
! endif
|
||||||
end
|
end
|
||||||
|
|
||||||
subroutine run_pt2_slave_small(thread,iproc,energy)
|
subroutine run_pt2_slave_small(thread,iproc,energy)
|
||||||
@ -178,15 +179,12 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||||||
type(pt2_type) :: pt2_data
|
type(pt2_type) :: pt2_data
|
||||||
integer :: n_tasks, k, N
|
integer :: n_tasks, k, N
|
||||||
integer :: i_generator, subset
|
integer :: i_generator, subset
|
||||||
|
integer :: ifirst
|
||||||
|
|
||||||
integer :: bsize ! Size of selection buffers
|
integer :: bsize ! Size of selection buffers
|
||||||
logical :: sending
|
logical :: sending
|
||||||
double precision :: time_shift
|
|
||||||
|
|
||||||
PROVIDE global_selection_buffer global_selection_buffer_lock
|
PROVIDE global_selection_buffer global_selection_buffer_lock
|
||||||
|
|
||||||
call random_number(time_shift)
|
|
||||||
time_shift = time_shift*15.d0
|
|
||||||
|
|
||||||
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
||||||
|
|
||||||
@ -198,15 +196,13 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||||||
|
|
||||||
zmq_socket_push = new_zmq_push_socket(thread)
|
zmq_socket_push = new_zmq_push_socket(thread)
|
||||||
|
|
||||||
|
ifirst = 0
|
||||||
b%N = 0
|
b%N = 0
|
||||||
buffer_ready = .False.
|
buffer_ready = .False.
|
||||||
n_tasks = 1
|
n_tasks = 1
|
||||||
|
|
||||||
sending = .False.
|
sending = .False.
|
||||||
done = .False.
|
done = .False.
|
||||||
double precision :: time0, time1
|
|
||||||
call wall_time(time0)
|
|
||||||
time0 = time0+time_shift
|
|
||||||
do while (.not.done)
|
do while (.not.done)
|
||||||
|
|
||||||
integer, external :: get_tasks_from_taskserver
|
integer, external :: get_tasks_from_taskserver
|
||||||
@ -233,28 +229,29 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||||||
ASSERT (b%N == bsize)
|
ASSERT (b%N == bsize)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
double precision :: time0, time1
|
||||||
|
call wall_time(time0)
|
||||||
call pt2_alloc(pt2_data,N_states)
|
call pt2_alloc(pt2_data,N_states)
|
||||||
b%cur = 0
|
b%cur = 0
|
||||||
call select_connected(i_generator,energy,pt2_data,b,subset,pt2_F(i_generator))
|
call select_connected(i_generator,energy,pt2_data,b,subset,pt2_F(i_generator))
|
||||||
|
call wall_time(time1)
|
||||||
|
|
||||||
integer, external :: tasks_done_to_taskserver
|
integer, external :: tasks_done_to_taskserver
|
||||||
if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then
|
if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then
|
||||||
done = .true.
|
done = .true.
|
||||||
endif
|
endif
|
||||||
call sort_selection_buffer(b)
|
call sort_selection_buffer(b)
|
||||||
|
call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending)
|
||||||
call wall_time(time1)
|
|
||||||
! if (time1-time0 > 15.d0) then
|
|
||||||
call omp_set_lock(global_selection_buffer_lock)
|
call omp_set_lock(global_selection_buffer_lock)
|
||||||
global_selection_buffer%mini = b%mini
|
global_selection_buffer%mini = b%mini
|
||||||
call merge_selection_buffers(b,global_selection_buffer)
|
call merge_selection_buffers(b,global_selection_buffer)
|
||||||
|
if (ifirst /= 0 ) then
|
||||||
b%cur=0
|
b%cur=0
|
||||||
|
else
|
||||||
|
ifirst = 1
|
||||||
|
endif
|
||||||
call omp_unset_lock(global_selection_buffer_lock)
|
call omp_unset_lock(global_selection_buffer_lock)
|
||||||
call wall_time(time0)
|
if ( iproc == 1 ) then
|
||||||
! endif
|
|
||||||
|
|
||||||
call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending)
|
|
||||||
if ( iproc == 1 .or. i_generator < 100 .or. done) then
|
|
||||||
call omp_set_lock(global_selection_buffer_lock)
|
call omp_set_lock(global_selection_buffer_lock)
|
||||||
call push_pt2_results_async_send(zmq_socket_push, (/i_generator/), (/pt2_data/), global_selection_buffer, (/task_id/), 1,sending)
|
call push_pt2_results_async_send(zmq_socket_push, (/i_generator/), (/pt2_data/), global_selection_buffer, (/task_id/), 1,sending)
|
||||||
global_selection_buffer%cur = 0
|
global_selection_buffer%cur = 0
|
||||||
|
@ -7,17 +7,20 @@ subroutine run_selection_slave(thread, iproc, energy)
|
|||||||
|
|
||||||
double precision, intent(in) :: energy(N_states)
|
double precision, intent(in) :: energy(N_states)
|
||||||
integer, intent(in) :: thread, iproc
|
integer, intent(in) :: thread, iproc
|
||||||
|
|
||||||
integer :: rc, i
|
integer :: rc, i
|
||||||
|
|
||||||
integer :: worker_id, task_id(1), ctask, ltask
|
integer :: worker_id, task_id(1), ctask, ltask
|
||||||
character*(512) :: task
|
character*(512) :: task
|
||||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
|
||||||
integer(ZMQ_PTR) :: zmq_socket_push
|
|
||||||
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
|
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
|
||||||
|
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
||||||
|
|
||||||
integer(ZMQ_PTR), external :: new_zmq_push_socket
|
integer(ZMQ_PTR), external :: new_zmq_push_socket
|
||||||
|
integer(ZMQ_PTR) :: zmq_socket_push
|
||||||
|
|
||||||
type(selection_buffer) :: buf, buf2
|
type(selection_buffer) :: buf, buf2
|
||||||
type(pt2_type) :: pt2_data
|
|
||||||
logical :: done, buffer_ready
|
logical :: done, buffer_ready
|
||||||
|
type(pt2_type) :: pt2_data
|
||||||
|
|
||||||
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
|
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
|
||||||
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_tc_order psi_bilinear_matrix_order
|
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_tc_order psi_bilinear_matrix_order
|
||||||
|
@ -11,7 +11,7 @@ subroutine ZMQ_selection(N_in, pt2_data)
|
|||||||
integer, external :: omp_get_thread_num
|
integer, external :: omp_get_thread_num
|
||||||
type(pt2_type), intent(inout) :: pt2_data
|
type(pt2_type), intent(inout) :: pt2_data
|
||||||
|
|
||||||
PROVIDE psi_det psi_coef N_det qp_max_mem N_states pt2_F s2_eig N_det_generators
|
! PROVIDE psi_det psi_coef N_det qp_max_mem N_states pt2_F s2_eig N_det_generators
|
||||||
|
|
||||||
N = max(N_in,1)
|
N = max(N_in,1)
|
||||||
N = min(N, (elec_alpha_num * (mo_num-elec_alpha_num))**2)
|
N = min(N, (elec_alpha_num * (mo_num-elec_alpha_num))**2)
|
||||||
@ -61,7 +61,6 @@ subroutine ZMQ_selection(N_in, pt2_data)
|
|||||||
ipos=1
|
ipos=1
|
||||||
task = ' '
|
task = ' '
|
||||||
|
|
||||||
|
|
||||||
do i= 1, N_det_generators
|
do i= 1, N_det_generators
|
||||||
do j=1,pt2_F(i)
|
do j=1,pt2_F(i)
|
||||||
write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') j, i, N
|
write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') j, i, N
|
||||||
|
@ -186,6 +186,7 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||||||
type(pt2_type) :: pt2_data
|
type(pt2_type) :: pt2_data
|
||||||
integer :: n_tasks, k, N
|
integer :: n_tasks, k, N
|
||||||
integer :: i_generator, subset
|
integer :: i_generator, subset
|
||||||
|
integer :: ifirst
|
||||||
|
|
||||||
integer :: bsize ! Size of selection buffers
|
integer :: bsize ! Size of selection buffers
|
||||||
logical :: sending
|
logical :: sending
|
||||||
@ -202,6 +203,7 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||||||
|
|
||||||
zmq_socket_push = new_zmq_push_socket(thread)
|
zmq_socket_push = new_zmq_push_socket(thread)
|
||||||
|
|
||||||
|
ifirst = 0
|
||||||
b%N = 0
|
b%N = 0
|
||||||
buffer_ready = .False.
|
buffer_ready = .False.
|
||||||
n_tasks = 1
|
n_tasks = 1
|
||||||
@ -250,7 +252,11 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||||||
call omp_set_lock(global_selection_buffer_lock)
|
call omp_set_lock(global_selection_buffer_lock)
|
||||||
global_selection_buffer%mini = b%mini
|
global_selection_buffer%mini = b%mini
|
||||||
call merge_selection_buffers(b,global_selection_buffer)
|
call merge_selection_buffers(b,global_selection_buffer)
|
||||||
|
if (ifirst /= 0 ) then
|
||||||
b%cur=0
|
b%cur=0
|
||||||
|
else
|
||||||
|
ifirst = 1
|
||||||
|
endif
|
||||||
call omp_unset_lock(global_selection_buffer_lock)
|
call omp_unset_lock(global_selection_buffer_lock)
|
||||||
if ( iproc == 1 ) then
|
if ( iproc == 1 ) then
|
||||||
call omp_set_lock(global_selection_buffer_lock)
|
call omp_set_lock(global_selection_buffer_lock)
|
||||||
|
@ -20,4 +20,5 @@ subroutine routine
|
|||||||
call diagonalize_CI
|
call diagonalize_CI
|
||||||
print*,'N_det = ',N_det
|
print*,'N_det = ',N_det
|
||||||
call save_wavefunction_general(N_det,N_states,psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted)
|
call save_wavefunction_general(N_det,N_states,psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted)
|
||||||
|
call print_mol_properties
|
||||||
end
|
end
|
||||||
|
@ -14,5 +14,6 @@ end
|
|||||||
|
|
||||||
subroutine run
|
subroutine run
|
||||||
implicit none
|
implicit none
|
||||||
|
call print_mol_properties
|
||||||
print *, psi_energy + nuclear_repulsion
|
print *, psi_energy + nuclear_repulsion
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user