From 21bcaa0bf15b7f47c543fc175528e8db2dce71ca Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 23 May 2017 18:37:41 +0200 Subject: [PATCH 1/5] Removed production mode in configure --- configure | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/configure b/configure index 85285f9b..d41ba5ce 100755 --- a/configure +++ b/configure @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """configure -Usage: configure (--production | --development) +Usage: configure Options: @@ -10,18 +10,10 @@ Options: config_file A config file with all the information for compiling. Example config_files are given in config/ - --production You can only compile **all** the modules with this flag, - but it will compile lighting fast. - - --development this will create a build.ninja for each directory which - contains a binary. In a second step you may compile them - individually if you like. - - Examples: - ./configure config/gfortran.cfg --production - ./configure config/ifort.cfg --development + ./configure config/gfortran.cfg + ./configure config/ifort.cfg """ @@ -34,10 +26,7 @@ import sys from os.path import join -if not any(i in ["--production", "--development"] for i in sys.argv): - sys.argv += ["--development"] - -if len(sys.argv) != 3: +if len(sys.argv) != 2: print __doc__ sys.exit() @@ -528,7 +517,7 @@ def create_ninja_and_rc(l_installed): qp_create_ninja = os.path.join(QP_ROOT, "scripts", "compilation", "qp_create_ninja.py") - l = [qp_create_ninja, "create"] + sys.argv[1:] + l = [qp_create_ninja, "create", "--development"] + sys.argv[1:] try: with open('/dev/null', 'w') as dnull: From 2fd46841aed16b4750d674d7b2e507ece04d6e72 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 23 May 2017 19:30:51 +0200 Subject: [PATCH 2/5] Fixed selection CASSD slave --- .../CAS_SD_ZMQ/selection_cassd_slave.irp.f | 68 +++++++++---------- plugins/Generators_CAS/generators.irp.f | 12 ++-- plugins/Selectors_CASSD/selectors.irp.f | 5 +- plugins/Selectors_CASSD/zmq.irp.f | 9 +-- 4 files changed, 49 insertions(+), 45 deletions(-) diff --git a/plugins/CAS_SD_ZMQ/selection_cassd_slave.irp.f b/plugins/CAS_SD_ZMQ/selection_cassd_slave.irp.f index 657ad63c..b5f2371d 100644 --- a/plugins/CAS_SD_ZMQ/selection_cassd_slave.irp.f +++ b/plugins/CAS_SD_ZMQ/selection_cassd_slave.irp.f @@ -1,11 +1,12 @@ -program selection_slave +program prog_selection_slave implicit none BEGIN_DOC ! Helper program to compute the PT2 in distributed mode. END_DOC read_wf = .False. - SOFT_TOUCH read_wf + distributed_davidson = .False. + SOFT_TOUCH read_wf distributed_davidson call provide_everything call switch_qp_run_to_master call run_wf @@ -23,19 +24,21 @@ subroutine run_wf integer(ZMQ_PTR), external :: new_zmq_to_qp_run_socket integer(ZMQ_PTR) :: zmq_to_qp_run_socket double precision :: energy(N_states) - character*(64) :: states(1) + character*(64) :: states(4) integer :: rc, i call provide_everything zmq_context = f77_zmq_ctx_new () states(1) = 'selection' + states(2) = 'davidson' + states(3) = 'pt2' zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() do - call wait_for_states(states,zmq_state,1) + call wait_for_states(states,zmq_state,3) if(trim(zmq_state) == 'Stopped') then @@ -51,43 +54,40 @@ subroutine run_wf !$OMP PARALLEL PRIVATE(i) i = omp_get_thread_num() - call selection_slave_tcp(i, energy) + call run_selection_slave(0, i, energy) !$OMP END PARALLEL print *, 'Selection done' + else if (trim(zmq_state) == 'davidson') then + + ! Davidson + ! -------- + + print *, 'Davidson' + call zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states) + call omp_set_nested(.True.) + call davidson_slave_tcp(0) + call omp_set_nested(.False.) + print *, 'Davidson done' + + else if (trim(zmq_state) == 'pt2') then + + ! PT2 + ! --- + + print *, 'PT2' + call zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states) + + !$OMP PARALLEL PRIVATE(i) + i = omp_get_thread_num() + call run_selection_slave(0, i, energy) + !$OMP END PARALLEL + print *, 'PT2 done' + endif end do end -subroutine update_energy(energy) - implicit none - double precision, intent(in) :: energy(N_states) - BEGIN_DOC -! Update energy when it is received from ZMQ - END_DOC - integer :: j,k - do j=1,N_states - do k=1,N_det - CI_eigenvectors(k,j) = psi_coef(k,j) - enddo - enddo - call u_0_S2_u_0(CI_eigenvectors_s2,CI_eigenvectors,N_det,psi_det,N_int) - if (.True.) then - do k=1,N_states - ci_electronic_energy(k) = energy(k) - enddo - TOUCH ci_electronic_energy CI_eigenvectors_s2 CI_eigenvectors - endif - call write_double(6,ci_energy,'Energy') -end - -subroutine selection_slave_tcp(i,energy) - implicit none - double precision, intent(in) :: energy(N_states) - integer, intent(in) :: i - - call run_selection_slave(0,i,energy) -end diff --git a/plugins/Generators_CAS/generators.irp.f b/plugins/Generators_CAS/generators.irp.f index f47341de..4e2fcd58 100644 --- a/plugins/Generators_CAS/generators.irp.f +++ b/plugins/Generators_CAS/generators.irp.f @@ -14,9 +14,9 @@ BEGIN_PROVIDER [ integer, N_det_generators ] good = .True. do k=1,N_int good = good .and. ( & - iand(not(cas_bitmask(k,1,l)), psi_det(k,1,i)) == & + iand(not(cas_bitmask(k,1,l)), psi_det_sorted(k,1,i)) == & iand(not(cas_bitmask(k,1,l)), HF_bitmask(k,1)) ) .and. ( & - iand(not(cas_bitmask(k,2,l)), psi_det(k,2,i)) == & + iand(not(cas_bitmask(k,2,l)), psi_det_sorted(k,2,i)) == & iand(not(cas_bitmask(k,2,l)), HF_bitmask(k,2)) ) enddo if (good) then @@ -46,9 +46,9 @@ END_PROVIDER good = .True. do k=1,N_int good = good .and. ( & - iand(not(cas_bitmask(k,1,l)), psi_det(k,1,i)) == & + iand(not(cas_bitmask(k,1,l)), psi_det_sorted(k,1,i)) == & iand(not(cas_bitmask(k,1,l)), HF_bitmask(k,1)) .and. ( & - iand(not(cas_bitmask(k,2,l)), psi_det(k,2,i)) == & + iand(not(cas_bitmask(k,2,l)), psi_det_sorted(k,2,i)) == & iand(not(cas_bitmask(k,2,l)), HF_bitmask(k,2) )) ) enddo if (good) then @@ -58,8 +58,8 @@ END_PROVIDER if (good) then m = m+1 do k=1,N_int - psi_det_generators(k,1,m) = psi_det(k,1,i) - psi_det_generators(k,2,m) = psi_det(k,2,i) + psi_det_generators(k,1,m) = psi_det_sorted(k,1,i) + psi_det_generators(k,2,m) = psi_det_sorted(k,2,i) enddo psi_coef_generators(m,:) = psi_coef(m,:) endif diff --git a/plugins/Selectors_CASSD/selectors.irp.f b/plugins/Selectors_CASSD/selectors.irp.f index ab36527d..3c0e2b5f 100644 --- a/plugins/Selectors_CASSD/selectors.irp.f +++ b/plugins/Selectors_CASSD/selectors.irp.f @@ -61,7 +61,10 @@ END_PROVIDER endif enddo if (N_det /= m) then - print *, N_det, m + print *, 'N_det = ', N_det + print *, 'm = ', m + print *, 'N_det_generators = ', N_det_generators + print *, 'psi_det_size = ', psi_det_size stop 'N_det /= m' endif END_PROVIDER diff --git a/plugins/Selectors_CASSD/zmq.irp.f b/plugins/Selectors_CASSD/zmq.irp.f index 37dd29de..f7f0c4b0 100644 --- a/plugins/Selectors_CASSD/zmq.irp.f +++ b/plugins/Selectors_CASSD/zmq.irp.f @@ -84,23 +84,24 @@ subroutine zmq_get_psi(zmq_to_qp_run_socket, worker_id, energy, size_energy) N_states = N_states_read N_det = N_det_read psi_det_size = psi_det_size_read + TOUCH psi_det_size N_det N_states - rc = f77_zmq_recv(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE) + rc = f77_zmq_recv(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,0) if (rc /= N_int*2*N_det*bit_kind) then print *, 'f77_zmq_recv(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE)' stop 'error' endif - rc = f77_zmq_recv(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,ZMQ_SNDMORE) + rc = f77_zmq_recv(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,0) if (rc /= psi_det_size*N_states*8) then print *, '77_zmq_recv(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,ZMQ_SNDMORE)' stop 'error' endif - TOUCH psi_det_size N_det N_states psi_det psi_coef + TOUCH psi_det psi_coef rc = f77_zmq_recv(zmq_to_qp_run_socket,energy,size_energy*8,0) if (rc /= size_energy*8) then - print *, 'f77_zmq_recv(zmq_to_qp_run_socket,energy,size_energy*8,0)' + print *, '77_zmq_recv(zmq_to_qp_run_socket,energy,size_energy*8,0)' stop 'error' endif From f80807b1635904f026ae5f422427d49179c6de65 Mon Sep 17 00:00:00 2001 From: scemama Date: Wed, 24 May 2017 00:06:31 +0200 Subject: [PATCH 3/5] Use recv8 and snd8 in ZMQ for large wf --- plugins/Selectors_full/zmq.irp.f | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/plugins/Selectors_full/zmq.irp.f b/plugins/Selectors_full/zmq.irp.f index f7f0c4b0..ca3681cb 100644 --- a/plugins/Selectors_full/zmq.irp.f +++ b/plugins/Selectors_full/zmq.irp.f @@ -9,25 +9,26 @@ subroutine zmq_put_psi(zmq_to_qp_run_socket,worker_id, energy, size_energy) integer, intent(in) :: size_energy double precision, intent(out) :: energy(size_energy) integer :: rc + integer*8 :: rc8 character*(256) :: msg write(msg,*) 'put_psi ', worker_id, N_states, N_det, psi_det_size, n_det_generators, n_det_selectors - rc = f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),ZMQ_SNDMORE) - if (rc /= len(trim(msg))) then - print *, 'f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),ZMQ_SNDMORE)' + rc8 = f77_zmq_send8(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),ZMQ_SNDMORE) + if (rc8 /= len(trim(msg))) then + print *, 'f77_zmq_send8(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),ZMQ_SNDMORE)' stop 'error' endif - rc = f77_zmq_send(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE) - if (rc /= N_int*2*N_det*bit_kind) then - print *, 'f77_zmq_send(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE)' + rc8 = f77_zmq_send8(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE) + if (rc8 /= N_int*2_8*N_det*bit_kind) then + print *, 'f77_zmq_send8(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE)' stop 'error' endif - rc = f77_zmq_send(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,ZMQ_SNDMORE) - if (rc /= psi_det_size*N_states*8) then - print *, 'f77_zmq_send(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,ZMQ_SNDMORE)' + rc8 = f77_zmq_send8(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,ZMQ_SNDMORE) + if (rc8 /= psi_det_size*N_states*8_8) then + print *, 'f77_zmq_send8(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,ZMQ_SNDMORE)' stop 'error' endif @@ -59,6 +60,7 @@ subroutine zmq_get_psi(zmq_to_qp_run_socket, worker_id, energy, size_energy) integer, intent(in) :: size_energy double precision, intent(out) :: energy(size_energy) integer :: rc + integer*8 :: rc8 character*(64) :: msg write(msg,*) 'get_psi ', worker_id @@ -86,15 +88,15 @@ subroutine zmq_get_psi(zmq_to_qp_run_socket, worker_id, energy, size_energy) psi_det_size = psi_det_size_read TOUCH psi_det_size N_det N_states - rc = f77_zmq_recv(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,0) - if (rc /= N_int*2*N_det*bit_kind) then - print *, 'f77_zmq_recv(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE)' + rc8 = f77_zmq_recv8(zmq_to_qp_run_socket,psi_det,int(N_int*2_8*N_det*bit_kind,8),0) + if (rc8 /= N_int*2_8*N_det*bit_kind) then + print *, 'f77_zmq_recv8(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE)' stop 'error' endif - rc = f77_zmq_recv(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,0) - if (rc /= psi_det_size*N_states*8) then - print *, '77_zmq_recv(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,ZMQ_SNDMORE)' + rc8 = f77_zmq_recv8(zmq_to_qp_run_socket,psi_coef,int(psi_det_size*N_states*8_8,8),0) + if (rc8 /= psi_det_size*N_states*8_8) then + print *, '77_zmq_recv8(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,ZMQ_SNDMORE)' stop 'error' endif TOUCH psi_det psi_coef From 70d52c126a208ed1f36fea0ebb05b9aeb8dd5bd5 Mon Sep 17 00:00:00 2001 From: scemama Date: Wed, 24 May 2017 15:24:20 +0200 Subject: [PATCH 4/5] Larges messages for 100M --- plugins/Full_CI_ZMQ/selection_slave.irp.f | 36 +++++++++++++++-------- plugins/Selectors_full/zmq.irp.f | 6 ++-- src/Davidson/davidson_parallel.irp.f | 32 +++++++++++++++----- src/Davidson/u0Hu0.irp.f | 4 +-- 4 files changed, 53 insertions(+), 25 deletions(-) diff --git a/plugins/Full_CI_ZMQ/selection_slave.irp.f b/plugins/Full_CI_ZMQ/selection_slave.irp.f index 92c6b775..ba85ca82 100644 --- a/plugins/Full_CI_ZMQ/selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_slave.irp.f @@ -5,7 +5,8 @@ program selection_slave END_DOC read_wf = .False. - SOFT_TOUCH read_wf + distributed_davidson = .False. + SOFT_TOUCH read_wf distributed_davidson call provide_everything call switch_qp_run_to_master call run_wf @@ -13,7 +14,7 @@ end subroutine provide_everything PROVIDE H_apply_buffer_allocated mo_bielec_integrals_in_map psi_det_generators psi_coef_generators psi_det_sorted_bit psi_selectors n_det_generators n_states generators_bitmask zmq_context - PROVIDE pt2_e0_denominator mo_tot_num N_int fragment_count + PROVIDE pt2_e0_denominator mo_tot_num N_int fragment_count end subroutine run_wf @@ -23,19 +24,21 @@ subroutine run_wf integer(ZMQ_PTR), external :: new_zmq_to_qp_run_socket integer(ZMQ_PTR) :: zmq_to_qp_run_socket double precision :: energy(N_states) - character*(64) :: states(1) + character*(64) :: states(4) integer :: rc, i call provide_everything zmq_context = f77_zmq_ctx_new () states(1) = 'selection' + states(2) = 'davidson' + states(3) = 'pt2' zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() do - call wait_for_states(states,zmq_state,1) + call wait_for_states(states,zmq_state,3) if(trim(zmq_state) == 'Stopped') then @@ -51,21 +54,30 @@ subroutine run_wf !$OMP PARALLEL PRIVATE(i) i = omp_get_thread_num() - call selection_slave_tcp(i, energy) + call run_selection_slave(0,i,energy) !$OMP END PARALLEL print *, 'Selection done' + else if (trim(zmq_state) == 'pt2') then + + ! PT2 + ! --- + + print *, 'PT2' + call zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states) + + logical :: lstop + lstop = .False. + !$OMP PARALLEL PRIVATE(i) + i = omp_get_thread_num() + call run_pt2_slave(0,i,energy,lstop) + !$OMP END PARALLEL + print *, 'PT2 done' + endif end do end -subroutine selection_slave_tcp(i,energy) - implicit none - double precision, intent(in) :: energy(N_states) - integer, intent(in) :: i - - call run_selection_slave(0,i,energy) -end diff --git a/plugins/Selectors_full/zmq.irp.f b/plugins/Selectors_full/zmq.irp.f index ca3681cb..420f0376 100644 --- a/plugins/Selectors_full/zmq.irp.f +++ b/plugins/Selectors_full/zmq.irp.f @@ -14,19 +14,19 @@ subroutine zmq_put_psi(zmq_to_qp_run_socket,worker_id, energy, size_energy) write(msg,*) 'put_psi ', worker_id, N_states, N_det, psi_det_size, n_det_generators, n_det_selectors - rc8 = f77_zmq_send8(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),ZMQ_SNDMORE) + rc8 = f77_zmq_send8(zmq_to_qp_run_socket,trim(msg),int(len(trim(msg)),8),ZMQ_SNDMORE) if (rc8 /= len(trim(msg))) then print *, 'f77_zmq_send8(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),ZMQ_SNDMORE)' stop 'error' endif - rc8 = f77_zmq_send8(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE) + rc8 = f77_zmq_send8(zmq_to_qp_run_socket,psi_det,int(N_int*2_8*N_det*bit_kind,8),ZMQ_SNDMORE) if (rc8 /= N_int*2_8*N_det*bit_kind) then print *, 'f77_zmq_send8(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE)' stop 'error' endif - rc8 = f77_zmq_send8(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,ZMQ_SNDMORE) + rc8 = f77_zmq_send8(zmq_to_qp_run_socket,psi_coef,int(psi_det_size*N_states*8,8),ZMQ_SNDMORE) if (rc8 /= psi_det_size*N_states*8_8) then print *, 'f77_zmq_send8(zmq_to_qp_run_socket,psi_coef,psi_det_size*N_states*8,ZMQ_SNDMORE)' stop 'error' diff --git a/src/Davidson/davidson_parallel.irp.f b/src/Davidson/davidson_parallel.irp.f index 9af78b4f..ce8e4b72 100644 --- a/src/Davidson/davidson_parallel.irp.f +++ b/src/Davidson/davidson_parallel.irp.f @@ -317,32 +317,33 @@ subroutine H_S2_u_0_nstates_zmq(v_0,s_0,u_0,N_st,sze) character*(512) :: task integer :: rc + integer*8 :: rc8 double precision :: energy(N_st) energy = 0.d0 task = ' ' write(task,*) 'put_psi ', 1, N_st, N_det, N_det - rc = f77_zmq_send(zmq_to_qp_run_socket,trim(task),len(trim(task)),ZMQ_SNDMORE) + rc8 = f77_zmq_send8(zmq_to_qp_run_socket,trim(task),int(len(trim(task)),8),ZMQ_SNDMORE) if (rc /= len(trim(task))) then - print *, 'f77_zmq_send(zmq_to_qp_run_socket,trim(task),len(trim(task)),ZMQ_SNDMORE)' + print *, 'f77_zmq_send8(zmq_to_qp_run_socket,trim(task),int(len(trim(task)),8),ZMQ_SNDMORE)' stop 'error' endif - rc = f77_zmq_send(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE) + rc8 = f77_zmq_send8(zmq_to_qp_run_socket,psi_det,int(N_int*2*N_det*bit_kind,8),ZMQ_SNDMORE) if (rc /= N_int*2*N_det*bit_kind) then - print *, 'f77_zmq_send(zmq_to_qp_run_socket,psi_det,N_int*2*N_det*bit_kind,ZMQ_SNDMORE)' + print *, 'f77_zmq_send8(zmq_to_qp_run_socket,psi_det,int(N_int*2*N_det*bit_kind,8),ZMQ_SNDMORE)' stop 'error' endif - rc = f77_zmq_send(zmq_to_qp_run_socket,u_t,size(u_t)*8,ZMQ_SNDMORE) + rc8 = f77_zmq_send8(zmq_to_qp_run_socket,u_t,int(size(u_t)*8,8),ZMQ_SNDMORE) if (rc /= size(u_t)*8) then - print *, 'f77_zmq_send(zmq_to_qp_run_socket,u_t,size(u_t)*8,ZMQ_SNDMORE)' + print *, 'f77_zmq_send8(zmq_to_qp_run_socket,u_t,int(size(u_t)*8,8),ZMQ_SNDMORE)' stop 'error' endif - rc = f77_zmq_send(zmq_to_qp_run_socket,energy,N_st*8,0) + rc8 = f77_zmq_send8(zmq_to_qp_run_socket,energy,int(N_st*8,8),0) if (rc /= N_st*8) then - print *, 'f77_zmq_send(zmq_to_qp_run_socket,energy,size_energy*8,0)' + print *, 'f77_zmq_send8(zmq_to_qp_run_socket,energy,int(size_energy*8,8),0)' stop 'error' endif @@ -410,3 +411,18 @@ subroutine H_S2_u_0_nstates_zmq(v_0,s_0,u_0,N_st,sze) enddo end + +BEGIN_PROVIDER [ integer, nthreads_davidson ] + implicit none + BEGIN_DOC + ! Number of threads for Davdison + END_DOC + nthreads_davidson = nproc + character*(32) :: env + call getenv('NTHREADS_DAVIDSON',env) + if (trim(env) /= '') then + read(env,*) nthreads_davidson + endif + call write_int(6,nthreads_davidson,'Number of threads for Diagonalization') +END_PROVIDER + diff --git a/src/Davidson/u0Hu0.irp.f b/src/Davidson/u0Hu0.irp.f index 1fbf00e0..c67b1440 100644 --- a/src/Davidson/u0Hu0.irp.f +++ b/src/Davidson/u0Hu0.irp.f @@ -134,8 +134,8 @@ subroutine H_S2_u_0_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istart,iend, ! Prepare the array of all alpha single excitations ! ------------------------------------------------- - PROVIDE N_int - !$OMP PARALLEL DEFAULT(NONE) & + PROVIDE N_int nthreads_davidson + !$OMP PARALLEL DEFAULT(NONE) NUM_THREADS(nthreads_davidson) & !$OMP SHARED(psi_bilinear_matrix_rows, N_det, & !$OMP psi_bilinear_matrix_columns, & !$OMP psi_det_alpha_unique, psi_det_beta_unique, & From 20e7a23ef78d7cdf963cd35d810ccf30a099a2b8 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 24 May 2017 15:24:51 +0200 Subject: [PATCH 5/5] Fixed pseudos --- .../CAS_SD_ZMQ/selection_cassd_slave.irp.f | 2 +- .../qp_convert_output_to_ezfio.py | 54 +++++++++++++------ 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/plugins/CAS_SD_ZMQ/selection_cassd_slave.irp.f b/plugins/CAS_SD_ZMQ/selection_cassd_slave.irp.f index b5f2371d..f8a4997a 100644 --- a/plugins/CAS_SD_ZMQ/selection_cassd_slave.irp.f +++ b/plugins/CAS_SD_ZMQ/selection_cassd_slave.irp.f @@ -38,7 +38,7 @@ subroutine run_wf do - call wait_for_states(states,zmq_state,3) + call wait_for_states(states,zmq_state,4) if(trim(zmq_state) == 'Stopped') then diff --git a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py index 6823df81..122ce1fe 100755 --- a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py +++ b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py @@ -3,7 +3,7 @@ convert output of gamess/GAU$$IAN to ezfio Usage: - qp_convert_output_to_ezfio.py [--ezfio=] + qp_convert_output_to_ezfio.py [--ezfio=] Option: file.out is the file to check (like gamess.out) @@ -20,18 +20,17 @@ from functools import reduce # Add to the path # # ~#~#~#~#~#~#~#~ # + try: QP_ROOT = os.environ["QP_ROOT"] except: print "Error: QP_ROOT environment variable not found." sys.exit(1) else: - sys.path = [ QP_ROOT + "/install/EZFIO/Python", QP_ROOT + "/resultsFile", QP_ROOT + "/scripts"] + sys.path - # ~#~#~#~#~#~ # # I m p o r t # # ~#~#~#~#~#~ # @@ -280,12 +279,13 @@ def write_ezfio(res, filename): # {% for coef,n,zeta for l_param} # {coef,n, zeta} + # OUTPUT # Local are 1 array padded by max(n_max_block) when l == 0 (output:k_loc_max) # v_k[n-2][atom] = value - #No Local are 2 array padded with max of lmax_block when l!=0 (output:lmax+1) and max(n_max_block)whem l !=0 (kmax) + #Non Local are 2 array padded with max of lmax_block when l!=0 (output:lmax+1) and max(n_max_block)whem l !=0 (kmax) # v_kl[l][n-2][atom] = value def pad(array, size, value=0): @@ -309,8 +309,16 @@ def write_ezfio(res, filename): array_l_max_block.append(l_max_block) array_z_remove.append(z_remove) - matrix.append([[coef_n_zeta.split()[1:] for coef_n_zeta in l.split('\n')] for l in array_party[1:]]) - + x = [[coef_n_zeta.split() for coef_n_zeta in l.split('\n')] \ + for l in array_party[1:] ] + x = [] + for l in array_party[1:]: + y = [] + for coef_n_zeta in l.split('\n'): + z = coef_n_zeta.split() + if z : y.append(z) + x.append(y) + matrix.append(x) return (matrix, array_l_max_block, array_z_remove) def get_local_stuff(matrix): @@ -319,7 +327,6 @@ def write_ezfio(res, filename): k_loc_max = max(len(i) for i in matrix_local_unpad) matrix_local = [ pad(ll, k_loc_max, [0., 2, 0.]) for ll in matrix_local_unpad] - m_coef = [[float(i[0]) for i in atom] for atom in matrix_local] m_n = [[int(i[1]) - 2 for i in atom] for atom in matrix_local] m_zeta = [[float(i[2]) for i in atom] for atom in matrix_local] @@ -343,26 +350,42 @@ def write_ezfio(res, filename): return (l_max_block, k_max, m_coef_noloc, m_n_noloc, m_zeta_noloc) try: - pseudo_str = res_file.get_pseudo() + pseudo_str = [] + label = ezfio.get_nuclei_nucl_label() + for ecp in res.pseudo: + pseudo_str += [ "%(label)s GEN %(zcore)d %(lmax)d" % { "label": label[ ecp["atom"]-1 ], + "zcore": ecp["zcore"], "lmax": ecp["lmax"] } ] + lmax = ecp["lmax"] + for l in [lmax] + list(range(0,lmax)): + pseudo_str += [ "%d"%len(ecp[str(l)]) ] + for t in ecp[str(l)]: + pseudo_str += [ "%f %d %f"%t ] + pseudo_str += [""] + pseudo_str = "\n".join(pseudo_str) + matrix, array_l_max_block, array_z_remove = parse_str(pseudo_str) - + array_z_remove = map(float,array_z_remove) except: ezfio.set_pseudo_do_pseudo(False) else: ezfio.set_pseudo_do_pseudo(True) - + # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # # Z _ e f f , a l p h a / b e t a _ e l e c # # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # - ezfio.pseudo_charge_remove = array_z_remove - ezfio.nuclei_nucl_charge = [i - j for i, j in zip(ezfio.nuclei_nucl_charge, array_z_remove)] + ezfio.set_pseudo_nucl_charge_remove(array_z_remove) + charge = ezfio.get_nuclei_nucl_charge() + charge = [ i - j for i, j in zip(charge, array_z_remove) ] + ezfio.set_nuclei_nucl_charge (charge) import math - num_elec = sum(ezfio.nuclei_nucl_charge) + num_elec_diff = sum(array_z_remove)/2 + nalpha = ezfio.get_electrons_elec_alpha_num() - num_elec_diff + nbeta = ezfio.get_electrons_elec_beta_num() - num_elec_diff - ezfio.electrons_elec_alpha_num = int(math.ceil(num_elec / 2.)) - ezfio.electrons_elec_beta_num = int(math.floor(num_elec / 2.)) + ezfio.set_electrons_elec_alpha_num(nalpha) + ezfio.set_electrons_elec_beta_num( nbeta ) # Change all the array 'cause EZFIO # v_kl (v, l) => v_kl(l,v) @@ -421,3 +444,4 @@ if __name__ == '__main__': print file_, 'recognized as', str(res_file).split('.')[-1].split()[0] write_ezfio(res_file, ezfio_file) + os.system("qp_run save_ortho_mos "+ezfio_file)