From acde03a04521396f34937f36e62f3dac4453fd32 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 9 Nov 2017 14:57:51 +0100 Subject: [PATCH 1/2] Works again for H --- src/det.irp.f | 124 ++++++++++++++++++-------------------------------- 1 file changed, 44 insertions(+), 80 deletions(-) diff --git a/src/det.irp.f b/src/det.irp.f index 9b1f6d0..1484b95 100644 --- a/src/det.irp.f +++ b/src/det.irp.f @@ -1467,30 +1467,6 @@ END_PROVIDER END_PROVIDER - BEGIN_PROVIDER [ double precision, single_det_value ] -&BEGIN_PROVIDER [ double precision, single_det_grad, (elec_num_8,3) ] -&BEGIN_PROVIDER [ double precision, single_det_lapl, (elec_num) ] - BEGIN_DOC - ! Value of a single determinant wave function from the 1st determinant - END_DOC - det_i = 1 - det_j = 1 - integer :: i - single_det_value = det_alpha_value_curr * det_beta_value_curr - do i=1,elec_alpha_num - single_det_grad(i,1) = det_alpha_grad_lapl_curr(1,i) * det_beta_value_curr - single_det_grad(i,2) = det_alpha_grad_lapl_curr(2,i) * det_beta_value_curr - single_det_grad(i,3) = det_alpha_grad_lapl_curr(3,i) * det_beta_value_curr - single_det_lapl(i) = det_alpha_grad_lapl_curr(4,i) * det_beta_value_curr - enddo - do i=elec_alpha_num+1,elec_num - single_det_grad(i,1) = det_alpha_value_curr * det_beta_grad_lapl_curr(1,i) - single_det_grad(i,2) = det_alpha_value_curr * det_beta_grad_lapl_curr(2,i) - single_det_grad(i,3) = det_alpha_value_curr * det_beta_grad_lapl_curr(3,i) - single_det_lapl(i) = det_alpha_value_curr * det_beta_grad_lapl_curr(4,i) - enddo -END_PROVIDER - BEGIN_PROVIDER [ double precision, psidet_value ] &BEGIN_PROVIDER [ double precision, psidet_inv ] @@ -1609,62 +1585,26 @@ END_PROVIDER ! Gradients ! --------- + call dgemv('N',elec_alpha_num*4,det_alpha_num,1.d0, & + det_alpha_grad_lapl, & + size(det_alpha_grad_lapl,1)*size(det_alpha_grad_lapl,2), & + CDb, 1, 0.d0, psidet_grad_lapl, 1) + if (elec_beta_num /= 0) then + call dgemv('N',elec_beta_num*4,det_beta_num,1.d0, & + det_beta_grad_lapl(1,elec_alpha_num+1,1), & + size(det_beta_grad_lapl,1)*size(det_beta_grad_lapl,2), & + DaC, 1, 0.d0, psidet_grad_lapl(1,elec_alpha_num+1), 1) + endif + if (do_pseudo) then - do j=1,elec_num - psidet_grad_lapl(1:4,j) = 0.d0 - pseudo_non_local(j) = 0.d0 - enddo - - do i=1,det_alpha_num - do j=1,elec_alpha_num - !DIR$ VECTOR ALIGNED - do k=1,4 - psidet_grad_lapl(k,j) = psidet_grad_lapl(k,j) + det_alpha_grad_lapl(k,j,i)*CDb(i) - enddo - pseudo_non_local(j) = pseudo_non_local(j) + det_alpha_pseudo(j,i)*CDb(i) - enddo - enddo - - do i=1,det_beta_num - do j=elec_alpha_num+1,elec_num - !DIR$ VECTOR ALIGNED - do k=1,4 - psidet_grad_lapl(k,j) = psidet_grad_lapl(k,j) + det_beta_grad_lapl(k,j,i)*DaC(i) - enddo - pseudo_non_local(j) = pseudo_non_local(j) + det_beta_pseudo(j,i)*DaC(i) - enddo - enddo - - !DIR$ VECTOR ALIGNED - do j=1,elec_num - pseudo_non_local(j) = pseudo_non_local(j) * psidet_inv - enddo - - else - - !DIR$ VECTOR ALIGNED - do j=1,elec_num - psidet_grad_lapl(1:4,j) = 0.d0 - enddo - - do i=1,det_alpha_num - do j=1,elec_alpha_num - !DIR$ VECTOR ALIGNED - do k=1,4 - psidet_grad_lapl(k,j) = psidet_grad_lapl(k,j) + det_alpha_grad_lapl(k,j,i)*CDb(i) - enddo - enddo - enddo - - do i=1,det_beta_num - do j=elec_alpha_num+1,elec_num - !DIR$ VECTOR ALIGNED - do k=1,4 - psidet_grad_lapl(k,j) = psidet_grad_lapl(k,j) + det_beta_grad_lapl(k,j,i)*DaC(i) - enddo - enddo - enddo - + call dgemv('N',elec_alpha_num,det_alpha_num,psidet_inv, & + det_alpha_pseudo, size(det_alpha_pseudo,1), & + CDb, 1, 0.d0, pseudo_non_local, 1) + if (elec_beta_num /= 0) then + call dgemv('N',elec_beta_num,det_beta_num,psidet_inv, & + det_beta_pseudo, size(det_beta_pseudo,1), & + DaC, 1, 0.d0, pseudo_non_local(elec_alpha_num+1), 1) + endif endif END_PROVIDER @@ -1748,7 +1688,7 @@ BEGIN_PROVIDER [ double precision, det_alpha_grad_lapl_curr, (4,elec_alpha_num) ! imo = mo_list_alpha_curr(j) ! do i=1,elec_alpha_num ! do k=1,4 -! det_alpha_grad_lapl_curr(k,i) = det_alpha_grad_lapl_curr(k,i) + mo_grad_lapl(k,i,imo)*slater_matrix_alpha_inv_det(i,j) +! det_alpha_grad_lapl_curr(k,i) = det_alpha_grad_lapl_curr(k,i) + mo_grad_lapl_alpha(k,i,imo)*slater_matrix_alpha_inv_det(i,j) ! enddo ! enddo ! enddo @@ -1905,3 +1845,27 @@ BEGIN_PROVIDER [ double precision, det_beta_grad_lapl_curr, (4,elec_alpha_num+1 END_PROVIDER + BEGIN_PROVIDER [ double precision, single_det_value ] +&BEGIN_PROVIDER [ double precision, single_det_grad, (elec_num_8,3) ] +&BEGIN_PROVIDER [ double precision, single_det_lapl, (elec_num) ] + BEGIN_DOC + ! Value of a single determinant wave function from the 1st determinant + END_DOC + det_i = 1 + det_j = 1 + integer :: i + single_det_value = det_alpha_value_curr * det_beta_value_curr + do i=1,elec_alpha_num + single_det_grad(i,1) = det_alpha_grad_lapl_curr(1,i) * det_beta_value_curr + single_det_grad(i,2) = det_alpha_grad_lapl_curr(2,i) * det_beta_value_curr + single_det_grad(i,3) = det_alpha_grad_lapl_curr(3,i) * det_beta_value_curr + single_det_lapl(i) = det_alpha_grad_lapl_curr(4,i) * det_beta_value_curr + enddo + do i=elec_alpha_num+1,elec_num + single_det_grad(i,1) = det_alpha_value_curr * det_beta_grad_lapl_curr(1,i) + single_det_grad(i,2) = det_alpha_value_curr * det_beta_grad_lapl_curr(2,i) + single_det_grad(i,3) = det_alpha_value_curr * det_beta_grad_lapl_curr(3,i) + single_det_lapl(i) = det_alpha_value_curr * det_beta_grad_lapl_curr(4,i) + enddo +END_PROVIDER + From 550c180cb41c69d3f7b4f1fb37c4ce100413d170 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 29 Nov 2017 19:48:28 +0100 Subject: [PATCH 2/2] Changes for Theta --- ocaml/Qmcchem_config.ml | 2 +- ocaml/Qmcchem_dataserver.ml | 2 +- ocaml/Qmcchem_run.ml | 21 ++++++++++++--------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ocaml/Qmcchem_config.ml b/ocaml/Qmcchem_config.ml index d9f302d..3a82387 100644 --- a/ocaml/Qmcchem_config.ml +++ b/ocaml/Qmcchem_config.ml @@ -83,7 +83,7 @@ let hostname = lazy ( try Unix.gethostname () with - | _ -> "localhost" + | _ -> "127.0.0.1" ) diff --git a/ocaml/Qmcchem_dataserver.ml b/ocaml/Qmcchem_dataserver.ml index 3067996..73cc34e 100644 --- a/ocaml/Qmcchem_dataserver.ml +++ b/ocaml/Qmcchem_dataserver.ml @@ -100,7 +100,7 @@ let run ?(daemon=true) ezfio_filename = ZMQ.Socket.bind socket address; accu with - | _ -> false; + | _ -> false in ZMQ.Socket.close socket; result diff --git a/ocaml/Qmcchem_run.ml b/ocaml/Qmcchem_run.ml index 7a1a465..368695c 100644 --- a/ocaml/Qmcchem_run.ml +++ b/ocaml/Qmcchem_run.ml @@ -12,13 +12,16 @@ let full_run ?(start_dataserver=true) ezfio_filename = (* Create the node file *) - let server_file = - Filename.concat ezfio_filename "nodefile" - in - Out_channel.with_file server_file ~f:(fun out_channel -> - Launcher.create_nodefile () - |> Out_channel.output_string out_channel - ) ; + (* + let () = + let server_file = + Filename.concat ezfio_filename "nodefile" + in + Out_channel.with_file server_file ~f:(fun out_channel -> + Launcher.create_nodefile () + |> Out_channel.output_string out_channel + ) + *) (* Get the configuration of executables *) @@ -32,7 +35,7 @@ let full_run ?(start_dataserver=true) ezfio_filename = if (start_dataserver) then begin (* Reset socket address in EZFIO *) - Ezfio.set_simulation_http_server "tcp://localhost:65534"; + Ezfio.set_simulation_http_server "tcp://127.0.0.1:65534"; (* Start the data server *) @@ -64,7 +67,7 @@ let full_run ?(start_dataserver=true) ezfio_filename = ZMQ.Socket.send socket (Message.(to_string Test)); ZMQ.Socket.recv socket ) with - | Unix.Unix_error _ -> + | Unix.Unix_error (_,_,_) -> begin ZMQ.Socket.set_linger_period socket 1 ; ZMQ.Socket.close socket;