mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-09-01 13:43:40 +02:00
Merge branch 'dev' of github.com:QuantumPackage/qp2 into dev
This commit is contained in:
commit
5c66b316b9
@ -60,19 +60,14 @@ def main(arguments):
|
||||
print("Running tests for %s"%(bats_file))
|
||||
print("")
|
||||
if arguments["-v"]:
|
||||
p = None
|
||||
if arguments["TEST"]:
|
||||
test = "export TEST=%s ; "%arguments["TEST"]
|
||||
else:
|
||||
test = ""
|
||||
try:
|
||||
os.system(test+" python3 bats_to_sh.py "+bats_file+
|
||||
os.system(test+" python3 bats_to_sh.py "+bats_file+
|
||||
"| bash")
|
||||
except:
|
||||
if p:
|
||||
p.terminate()
|
||||
else:
|
||||
subprocess.check_call(["bats", bats_file], env=os.environ)
|
||||
subprocess.check_call(["bats", "--verbose-run", "--trace", bats_file], env=os.environ)
|
||||
|
||||
|
||||
|
||||
|
4
configure
vendored
4
configure
vendored
@ -281,8 +281,8 @@ EOF
|
||||
|
||||
execute << EOF
|
||||
cd "\${QP_ROOT}"/external
|
||||
tar -zxf qp2-dependencies/bats-v1.1.0.tar.gz
|
||||
( cd bats-core-1.1.0/ ; ./install.sh \${QP_ROOT})
|
||||
tar -zxf qp2-dependencies/bats-v1.7.0.tar.gz
|
||||
( cd bats-core-1.7.0/ ; ./install.sh \${QP_ROOT})
|
||||
EOF
|
||||
|
||||
else
|
||||
|
2
external/qp2-dependencies
vendored
2
external/qp2-dependencies
vendored
@ -1 +1 @@
|
||||
Subproject commit 90ee61f5041c7c94a0c605625a264860292813a0
|
||||
Subproject commit 242151e03d1d6bf042387226431d82d35845686a
|
@ -56,3 +56,7 @@ let string_of_string s = s
|
||||
let list_map f l =
|
||||
List.rev_map f l
|
||||
|> List.rev
|
||||
|
||||
let socket_convert socket =
|
||||
((Obj.magic (Obj.repr socket)) : [ `Xsub ] Zmq.Socket.t )
|
||||
|
||||
|
@ -2,7 +2,7 @@ open Qputils
|
||||
open Qptypes
|
||||
|
||||
type ezfio_or_address = EZFIO of string | ADDRESS of string
|
||||
type req_or_sub = REQ | SUB
|
||||
type req_or_sub = REQ | SUB
|
||||
|
||||
let localport = 42379
|
||||
|
||||
@ -29,7 +29,7 @@ let () =
|
||||
end;
|
||||
|
||||
let arg =
|
||||
let x =
|
||||
let x =
|
||||
match Command_line.anon_args () with
|
||||
| [x] -> x
|
||||
| _ -> begin
|
||||
@ -44,7 +44,7 @@ let () =
|
||||
in
|
||||
|
||||
|
||||
let localhost =
|
||||
let localhost =
|
||||
Lazy.force TaskServer.ip_address
|
||||
in
|
||||
|
||||
@ -52,28 +52,28 @@ let () =
|
||||
let long_address =
|
||||
match arg with
|
||||
| ADDRESS x -> x
|
||||
| EZFIO x ->
|
||||
let ic =
|
||||
| EZFIO x ->
|
||||
let ic =
|
||||
Filename.concat (Qpackage.ezfio_work x) "qp_run_address"
|
||||
|> open_in
|
||||
in
|
||||
let result =
|
||||
let result =
|
||||
input_line ic
|
||||
|> String.trim
|
||||
in
|
||||
close_in ic;
|
||||
result
|
||||
in
|
||||
|
||||
|
||||
let protocol, address, port =
|
||||
match String.split_on_char ':' long_address with
|
||||
| t :: a :: p :: [] -> t, a, int_of_string p
|
||||
| _ -> failwith @@
|
||||
| _ -> failwith @@
|
||||
Printf.sprintf "%s : Malformed address" long_address
|
||||
in
|
||||
|
||||
|
||||
let zmq_context =
|
||||
let zmq_context =
|
||||
Zmq.Context.create ()
|
||||
in
|
||||
|
||||
@ -105,10 +105,10 @@ let () =
|
||||
|
||||
|
||||
let create_socket sock_type bind_or_connect addr =
|
||||
let socket =
|
||||
let socket =
|
||||
Zmq.Socket.create zmq_context sock_type
|
||||
in
|
||||
let () =
|
||||
let () =
|
||||
try
|
||||
bind_or_connect socket addr
|
||||
with
|
||||
@ -131,37 +131,64 @@ let () =
|
||||
Sys.set_signal Sys.sigint handler;
|
||||
|
||||
|
||||
let new_thread req_or_sub addr_in addr_out =
|
||||
let new_thread_req addr_in addr_out =
|
||||
let socket_in, socket_out =
|
||||
match req_or_sub with
|
||||
| REQ ->
|
||||
create_socket Zmq.Socket.router Zmq.Socket.bind addr_in,
|
||||
create_socket Zmq.Socket.dealer Zmq.Socket.connect addr_out
|
||||
| SUB ->
|
||||
create_socket Zmq.Socket.sub Zmq.Socket.connect addr_in,
|
||||
create_socket Zmq.Socket.pub Zmq.Socket.bind addr_out
|
||||
in
|
||||
|
||||
if req_or_sub = SUB then
|
||||
Zmq.Socket.subscribe socket_in "";
|
||||
|
||||
|
||||
|
||||
let action_in =
|
||||
match req_or_sub with
|
||||
| REQ -> (fun () -> Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
|
||||
| SUB -> (fun () -> Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
|
||||
let action_in =
|
||||
fun () -> Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out
|
||||
in
|
||||
|
||||
let action_out =
|
||||
match req_or_sub with
|
||||
| REQ -> (fun () -> Zmq.Socket.recv_all socket_out |> Zmq.Socket.send_all socket_in )
|
||||
| SUB -> (fun () -> () )
|
||||
let action_out =
|
||||
fun () -> Zmq.Socket.recv_all socket_out |> Zmq.Socket.send_all socket_in
|
||||
in
|
||||
|
||||
let pollitem =
|
||||
Zmq.Poll.mask_of
|
||||
[| (socket_in, Zmq.Poll.In) ; (socket_out, Zmq.Poll.In) |]
|
||||
[| (socket_convert socket_in, Zmq.Poll.In) ; (socket_convert socket_out, Zmq.Poll.In) |]
|
||||
in
|
||||
|
||||
while !run_status do
|
||||
|
||||
let polling =
|
||||
Zmq.Poll.poll ~timeout:1000 pollitem
|
||||
in
|
||||
|
||||
match polling with
|
||||
| [| Some Zmq.Poll.In ; Some Zmq.Poll.In |] -> ( action_out () ; action_in () )
|
||||
| [| _ ; Some Zmq.Poll.In |] -> action_out ()
|
||||
| [| Some Zmq.Poll.In ; _ |] -> action_in ()
|
||||
| _ -> ()
|
||||
done;
|
||||
|
||||
Zmq.Socket.close socket_in;
|
||||
Zmq.Socket.close socket_out;
|
||||
in
|
||||
|
||||
let new_thread_sub addr_in addr_out =
|
||||
let socket_in, socket_out =
|
||||
create_socket Zmq.Socket.sub Zmq.Socket.connect addr_in,
|
||||
create_socket Zmq.Socket.pub Zmq.Socket.bind addr_out
|
||||
in
|
||||
|
||||
Zmq.Socket.subscribe socket_in "";
|
||||
|
||||
|
||||
|
||||
let action_in =
|
||||
fun () -> Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out
|
||||
in
|
||||
|
||||
let action_out =
|
||||
fun () -> ()
|
||||
in
|
||||
|
||||
let pollitem =
|
||||
Zmq.Poll.mask_of
|
||||
[| (socket_convert socket_in, Zmq.Poll.In) ; (socket_convert socket_out, Zmq.Poll.In) |]
|
||||
in
|
||||
|
||||
|
||||
@ -173,8 +200,8 @@ let () =
|
||||
|
||||
match polling with
|
||||
| [| Some Zmq.Poll.In ; Some Zmq.Poll.In |] -> ( action_out () ; action_in () )
|
||||
| [| _ ; Some Zmq.Poll.In |] -> action_out ()
|
||||
| [| Some Zmq.Poll.In ; _ |] -> action_in ()
|
||||
| [| _ ; Some Zmq.Poll.In |] -> action_out ()
|
||||
| [| Some Zmq.Poll.In ; _ |] -> action_in ()
|
||||
| _ -> ()
|
||||
done;
|
||||
|
||||
@ -193,8 +220,8 @@ let () =
|
||||
Printf.sprintf "tcp://*:%d" localport
|
||||
in
|
||||
|
||||
let f () =
|
||||
new_thread REQ addr_in addr_out
|
||||
let f () =
|
||||
new_thread_req addr_in addr_out
|
||||
in
|
||||
|
||||
(Thread.create f) ()
|
||||
@ -211,8 +238,8 @@ let () =
|
||||
Printf.sprintf "tcp://*:%d" (localport+2)
|
||||
in
|
||||
|
||||
let f () =
|
||||
new_thread REQ addr_in addr_out
|
||||
let f () =
|
||||
new_thread_req addr_in addr_out
|
||||
in
|
||||
(Thread.create f) ()
|
||||
in
|
||||
@ -227,8 +254,8 @@ let () =
|
||||
Printf.sprintf "tcp://*:%d" (localport+1)
|
||||
in
|
||||
|
||||
let f () =
|
||||
new_thread SUB addr_in addr_out
|
||||
let f () =
|
||||
new_thread_sub addr_in addr_out
|
||||
in
|
||||
(Thread.create f) ()
|
||||
in
|
||||
@ -236,7 +263,7 @@ let () =
|
||||
|
||||
|
||||
let input_thread =
|
||||
let f () =
|
||||
let f () =
|
||||
let addr_out =
|
||||
match arg with
|
||||
| EZFIO _ -> None
|
||||
@ -248,22 +275,22 @@ let () =
|
||||
Printf.sprintf "tcp://*:%d" (localport+9)
|
||||
in
|
||||
|
||||
let socket_in =
|
||||
let socket_in =
|
||||
create_socket Zmq.Socket.rep Zmq.Socket.bind addr_in
|
||||
in
|
||||
|
||||
let socket_out =
|
||||
match addr_out with
|
||||
match addr_out with
|
||||
| Some addr_out -> Some (
|
||||
create_socket Zmq.Socket.req Zmq.Socket.connect addr_out)
|
||||
| None -> None
|
||||
in
|
||||
|
||||
let temp_file =
|
||||
let temp_file =
|
||||
Filename.temp_file "qp_tunnel" ".tar.gz"
|
||||
in
|
||||
|
||||
let get_ezfio_filename () =
|
||||
let get_ezfio_filename () =
|
||||
match arg with
|
||||
| EZFIO x -> x
|
||||
| ADDRESS _ ->
|
||||
@ -277,9 +304,9 @@ let () =
|
||||
end
|
||||
in
|
||||
|
||||
let get_input () =
|
||||
let get_input () =
|
||||
match arg with
|
||||
| EZFIO x ->
|
||||
| EZFIO x ->
|
||||
begin
|
||||
Printf.sprintf "tar --exclude=\"*.gz.*\" -zcf %s %s" temp_file x
|
||||
|> Sys.command |> ignore;
|
||||
@ -291,11 +318,11 @@ let () =
|
||||
in
|
||||
ignore @@ Unix.lseek fd 0 Unix.SEEK_SET ;
|
||||
let bstr =
|
||||
Unix.map_file fd Bigarray.char
|
||||
Unix.map_file fd Bigarray.char
|
||||
Bigarray.c_layout false [| len |]
|
||||
|> Bigarray.array1_of_genarray
|
||||
in
|
||||
let result =
|
||||
let result =
|
||||
String.init len (fun i -> bstr.{i}) ;
|
||||
in
|
||||
Unix.close fd;
|
||||
@ -313,7 +340,7 @@ let () =
|
||||
end
|
||||
in
|
||||
|
||||
let () =
|
||||
let () =
|
||||
match socket_out with
|
||||
| None -> ()
|
||||
| Some socket_out ->
|
||||
@ -329,7 +356,7 @@ let () =
|
||||
| ADDRESS _ ->
|
||||
begin
|
||||
Printf.printf "Getting input... %!";
|
||||
let ezfio_filename =
|
||||
let ezfio_filename =
|
||||
get_ezfio_filename ()
|
||||
in
|
||||
Printf.printf "%s%!" ezfio_filename;
|
||||
@ -343,7 +370,7 @@ let () =
|
||||
|> Sys.command |> ignore ;
|
||||
let oc =
|
||||
Filename.concat (Qpackage.ezfio_work ezfio_filename) "qp_run_address"
|
||||
|> open_out
|
||||
|> open_out
|
||||
in
|
||||
Printf.fprintf oc "tcp://%s:%d\n" localhost localport;
|
||||
close_out oc;
|
||||
@ -359,9 +386,9 @@ let () =
|
||||
let action () =
|
||||
match Zmq.Socket.recv socket_in with
|
||||
| "get_input" -> get_input ()
|
||||
|> Zmq.Socket.send socket_in
|
||||
|> Zmq.Socket.send socket_in
|
||||
| "get_ezfio_filename" -> get_ezfio_filename ()
|
||||
|> Zmq.Socket.send socket_in
|
||||
|> Zmq.Socket.send socket_in
|
||||
| "test" -> Zmq.Socket.send socket_in "OK"
|
||||
| x -> Printf.sprintf "Message '%s' not understood" x
|
||||
|> Zmq.Socket.send socket_in
|
||||
@ -372,7 +399,7 @@ On remote hosts, create ssh tunnel using:
|
||||
ssh -L %d:%s:%d -L %d:%s:%d -L %d:%s:%d -L %d:%s:%d %s &
|
||||
Or from this host connect to clients using:
|
||||
ssh -R %d:localhost:%d -R %d:localhost:%d -R %d:localhost:%d -R %d:localhost:%d <host> &
|
||||
%!"
|
||||
%!"
|
||||
(port ) localhost (localport )
|
||||
(port+1) localhost (localport+1)
|
||||
(port+2) localhost (localport+2)
|
||||
@ -392,12 +419,12 @@ Or from this host connect to clients using:
|
||||
match polling.(0) with
|
||||
| Some Zmq.Poll.In -> action ()
|
||||
| None -> ()
|
||||
| Some Zmq.Poll.In_out
|
||||
| Some Zmq.Poll.In_out
|
||||
| Some Zmq.Poll.Out -> ()
|
||||
|
||||
done;
|
||||
|
||||
let () =
|
||||
let () =
|
||||
match socket_out with
|
||||
| Some socket_out -> Zmq.Socket.close socket_out
|
||||
| None -> ()
|
||||
@ -415,7 +442,7 @@ Or from this host connect to clients using:
|
||||
Thread.join ocaml_thread;
|
||||
Zmq.Context.terminate zmq_context;
|
||||
Printf.printf "qp_tunnel exited properly.\n"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -37,48 +37,48 @@ function run_stoch() {
|
||||
qp set_file b2_stretched.ezfio
|
||||
qp set determinants n_det_max 10000
|
||||
qp set_frozen_core
|
||||
run_stoch -49.14104086 0.0001 10000
|
||||
run_stoch -49.14097596 0.0001 10000
|
||||
}
|
||||
|
||||
@test "NH3" { # 0:00:11
|
||||
qp set_file nh3.ezfio
|
||||
qp set_mo_class --core="[1-4]" --act="[5-72]"
|
||||
run -56.24474790 1.e-5 10000
|
||||
run -56.24474908 1.e-5 10000
|
||||
}
|
||||
|
||||
@test "DHNO" { # 0:00:10
|
||||
qp set_file dhno.ezfio
|
||||
qp set_mo_class --core="[1-7]" --act="[8-64]"
|
||||
run -130.45901042 1.e-4 10000
|
||||
run -130.45904647 1.e-4 10000
|
||||
}
|
||||
|
||||
@test "HCO" { # 0:01:16
|
||||
qp set_file hco.ezfio
|
||||
run_stoch -113.41658256 1.e-3 50000
|
||||
run_stoch -113.41448940 2.e-3 50000
|
||||
}
|
||||
|
||||
@test "H2O2" { # 0:01:48
|
||||
qp set_file h2o2.ezfio
|
||||
qp set_mo_class --core="[1-2]" --act="[3-24]" --del="[25-38]"
|
||||
run_stoch -151.02317880 2.e-3 100000
|
||||
run_stoch -151.02437936 2.e-3 100000
|
||||
}
|
||||
|
||||
@test "HBO" { # 0:00:46
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file hbo.ezfio
|
||||
run_stoch -100.22361288 1.e-4 50000
|
||||
run_stoch -100.221198108988 2.e-3 50000
|
||||
}
|
||||
|
||||
@test "H2O" { # 0:01:05
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file h2o.ezfio
|
||||
run_stoch -76.24347962 1.e-4 100000
|
||||
run_stoch -76.241332121813 1.e-3 100000
|
||||
}
|
||||
|
||||
@test "ClO" { # 0:03:07
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file clo.ezfio
|
||||
run_stoch -534.58202840 1.e-3 100000
|
||||
run_stoch -534.573564655419 1.e-3 100000
|
||||
}
|
||||
|
||||
@test "SO" { # 0:01:49
|
||||
@ -90,99 +90,99 @@ function run_stoch() {
|
||||
@test "H2S" { # 0:01:12
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file h2s.ezfio
|
||||
run_stoch -398.87187312 1.e-3 50000
|
||||
run_stoch -398.865173546866 1.e-3 50000
|
||||
}
|
||||
|
||||
@test "OH" { # 0:00:41
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file oh.ezfio
|
||||
run_stoch -75.62393829 1.e-3 50000
|
||||
run_stoch -75.6193013819546 1.e-3 50000
|
||||
}
|
||||
|
||||
@test "SiH2_3B1" { # 0:00:50
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file sih2_3b1.ezfio
|
||||
run_stoch -290.02083172 3.e-5 50000
|
||||
run_stoch -290.01754869 3.e-5 50000
|
||||
}
|
||||
|
||||
@test "H3COH" { # 0:01:05
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file h3coh.ezfio
|
||||
run_stoch -115.22625460 2.e-3 50000
|
||||
run_stoch -115.224147057725 2.e-3 50000
|
||||
}
|
||||
|
||||
@test "SiH3" { # 0:01:09
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file sih3.ezfio
|
||||
run_stoch -5.57818759 1.e-3 50000
|
||||
run_stoch -5.57812512359276 1.e-3 50000
|
||||
}
|
||||
|
||||
@test "CH4" { # 0:02:06
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file ch4.ezfio
|
||||
qp set_mo_class --core="[1]" --act="[2-30]" --del="[31-59]"
|
||||
run_stoch -40.24195947 1.e-4 100000
|
||||
run_stoch -40.2419474611994 1.e-4 100000
|
||||
}
|
||||
|
||||
@test "ClF" { # 0:01:55
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file clf.ezfio
|
||||
run_stoch -559.20157348 1.e-3 50000
|
||||
run_stoch -559.20666465 1.e-2 50000
|
||||
}
|
||||
|
||||
@test "SO2" { # 0:00:24
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file so2.ezfio
|
||||
qp set_mo_class --core="[1-8]" --act="[9-87]"
|
||||
run_stoch -41.57468087 1.e-4 50000
|
||||
run_stoch -41.57468756 1.e-4 50000
|
||||
}
|
||||
|
||||
@test "C2H2" { # 0:00:57
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file c2h2.ezfio
|
||||
qp set_mo_class --act="[1-30]" --del="[31-36]"
|
||||
run_stoch -12.38655876 1.e-3 50000
|
||||
run_stoch -12.3862664765532 1.e-3 50000
|
||||
}
|
||||
|
||||
@test "N2" { # 0:01:15
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file n2.ezfio
|
||||
qp set_mo_class --core="[1,2]" --act="[3-40]" --del="[41-60]"
|
||||
run_stoch -109.31133266 2.e-3 50000
|
||||
run_stoch -109.311954243348 2.e-3 50000
|
||||
}
|
||||
|
||||
@test "N2H4" { # 0:00:51
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file n2h4.ezfio
|
||||
qp set_mo_class --core="[1-2]" --act="[3-24]" --del="[25-48]"
|
||||
run_stoch -111.38161063 1.e-3 50000
|
||||
run_stoch -111.38119165053 1.e-3 50000
|
||||
}
|
||||
|
||||
@test "CO2" { # 0:01:00
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file co2.ezfio
|
||||
qp set_mo_class --core="[1,2]" --act="[3-30]" --del="[31-42]"
|
||||
run_stoch -188.00154729 2.e-3 50000
|
||||
run_stoch -188.002190327443 2.e-3 50000
|
||||
}
|
||||
|
||||
@test "[Cu(NH3)4]2+" { # 0:01:53
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file cu_nh3_4_2plus.ezfio
|
||||
qp set_mo_class --core="[1-24]" --act="[25-45]" --del="[46-87]"
|
||||
run_stoch -1862.98705091 1.e-05 50000
|
||||
run_stoch -1862.98705340328 1.e-05 50000
|
||||
}
|
||||
|
||||
@test "HCN" { # 0:01:26
|
||||
[[ -n $TRAVIS ]] && skip
|
||||
qp set_file hcn.ezfio
|
||||
qp set_mo_class --core="[1,2]" --act="[3-40]" --del="[41-55]"
|
||||
run_stoch -93.09855896 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.30821487 0.002 100000
|
||||
run_stoch -199.307512211742 0.002 100000
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ subroutine print_extrapolated_energy
|
||||
enddo
|
||||
|
||||
print *, ''
|
||||
call ezfio_set_fci_energy_extrapolated(extrapolated_energy(2,1:N_states))
|
||||
call ezfio_set_fci_energy_extrapolated(extrapolated_energy(min(N_iter,3),1:N_states))
|
||||
|
||||
end subroutine
|
||||
|
||||
|
@ -46,7 +46,7 @@ function test_exe() {
|
||||
|
||||
run_only_test() {
|
||||
if [[ "$BATS_TEST_DESCRIPTION" != "$1" ]] && [[ "$BATS_TEST_NUMBER" != "$1" ]]; then
|
||||
if [[ -z $BATS_TEST_FILENAME ]] ; then
|
||||
if [[ -z "$BATS_TEST_FILENAME" ]] ; then
|
||||
exit 0
|
||||
else
|
||||
skip
|
||||
|
Loading…
Reference in New Issue
Block a user