diff --git a/bin/qp_convert_output_to_ezfio b/bin/qp_convert_output_to_ezfio index cbc81032..b6e99176 100755 --- a/bin/qp_convert_output_to_ezfio +++ b/bin/qp_convert_output_to_ezfio @@ -120,6 +120,7 @@ def write_ezfio(res, filename): exponent = [] res.convert_to_cartesian() + # ~#~#~#~#~#~#~ # # P a r s i n g # # ~#~#~#~#~#~#~ # @@ -177,6 +178,68 @@ def write_ezfio(res, filename): print("OK") + # _ + # |_) _. _ o _ + # |_) (_| _> | _> + # + + print("Basis\t\t...\t", end=' ') + # ~#~#~#~ # + # I n i t # + # ~#~#~#~ # + + coefficient = [] + exponent = [] + + # ~#~#~#~#~#~#~ # + # P a r s i n g # + # ~#~#~#~#~#~#~ # + + nbasis = 0 + nucl_center = [] + curr_center = -1 + nucl_shell_num = [] + ang_mom = [] + nshell = 0 + shell_prim_index = [1] + shell_prim_num = [] + for b in res.basis: + s = b.sym + if str.count(s, "y") + str.count(s, "x") == 0: + c = b.center + nshell += 1 + if c != curr_center: + curr_center = c + nucl_center.append(nbasis+1) + nucl_shell_num.append(nshell) + nshell = 0 + nbasis += 1 + coefficient += b.coef[:len(b.prim)] + exponent += [p.expo for p in b.prim] + ang_mom.append(str.count(s, "z")) + shell_prim_index.append(len(exponent)+1) + shell_prim_num.append(len(b.prim)) + + nucl_shell_num.append(nshell+1) + nucl_shell_num = nucl_shell_num[1:] + + # ~#~#~#~#~ # + # W r i t e # + # ~#~#~#~#~ # + + ezfio.set_basis_basis("Read from ResultsFile") + ezfio.set_basis_basis_nucleus_index(nucl_center) + ezfio.set_basis_prim_num(len(coefficient)) + ezfio.set_basis_shell_num(len(ang_mom)) + ezfio.set_basis_nucleus_shell_num(nucl_shell_num) + ezfio.set_basis_prim_coef(coefficient) + ezfio.set_basis_prim_expo(exponent) + ezfio.set_basis_shell_ang_mom(ang_mom) + ezfio.set_basis_shell_prim_num(shell_prim_num) + ezfio.set_basis_shell_prim_index(shell_prim_index) + + print("OK") + # _ # |\/| _ _ |_) _. _ o _ # | | (_) _> |_) (_| _> | _> diff --git a/scripts/compilation/qp_create_ninja b/scripts/compilation/qp_create_ninja index a132bc9e..c0ba8c6a 100755 --- a/scripts/compilation/qp_create_ninja +++ b/scripts/compilation/qp_create_ninja @@ -709,6 +709,11 @@ def save_subninja_file(path_module): " description = Cleaning module {0}".format(path_module.rel), ""] + l_string += ["rule make_tidy", + " command = module_handler.py tidy {0}".format(path_module.rel), + " description = Cleaning module {0}".format(path_module.rel), + ""] + l_string += ["rule executables", " command = make -C {0} executables .gitignore qp_edit.native qp_run.native".format(join("$QP_ROOT","ocaml")), " description = Updating OCaml executables", @@ -719,6 +724,7 @@ def save_subninja_file(path_module): "build local: make_local_binaries dummy_target", "", "build executables: executables local dummy_target", "", "default executables", "", "build clean: make_clean dummy_target", + "", "build tidy: make_tidy dummy_target", ""] path_ninja_cur = join(path_module.abs, "build.ninja") @@ -745,6 +751,10 @@ def create_build_ninja_global(): " command = module_handler.py clean --all", " description = Cleaning all modules", ""] + l_string += ["rule make_tidy", + " command = module_handler.py tidy --all", + " description = Cleaning all modules", ""] + l_string += ["rule make_ocaml", " command = make -C {0}/ocaml".format("$QP_ROOT"), " pool = console", @@ -759,6 +769,8 @@ def create_build_ninja_global(): "default ocaml_target", "", "build clean: make_clean dummy_target", + "", + "build tidy: make_tidy dummy_target", "", ] path_ninja_cur = join(QP_ROOT, "build.ninja") diff --git a/scripts/module/module_handler.py b/scripts/module/module_handler.py index a6bb6d3f..707a6734 100755 --- a/scripts/module/module_handler.py +++ b/scripts/module/module_handler.py @@ -6,12 +6,18 @@ Module utilitary Usage: module_handler.py print_descendant [...] module_handler.py clean [ --all | ...] - module_handler.py create_git_ignore [...] + module_handler.py tidy [ --all | ...] + module_handler.py create_git_ignore [ --all | ...] Options: print_descendant Print the genealogy of the needed modules + clean Used for ninja clean + tidy A light version of clean, where only the intermediate + files are removed + create_git_ignore deprecated NEED The path of NEED file. by default try to open the file in the current path + """ import os import sys @@ -209,7 +215,7 @@ if __name__ == '__main__': # Remove all produced ezfio_config files for filename in os.listdir( os.path.join(QP_EZFIO, "config") ): os.remove( os.path.join(QP_EZFIO, "config", filename) ) - + elif not arguments['']: dir_ = os.getcwd() @@ -230,11 +236,11 @@ if __name__ == '__main__': for module in l_module: print(" ".join(sorted(m.l_descendant_unique([module])))) - if arguments["clean"]: + if arguments["clean"] or arguments["tidy"]: l_dir = ['IRPF90_temp', 'IRPF90_man'] l_file = ["irpf90_entities", "tags", "irpf90.make", "Makefile", - "Makefile.depend", ".ninja_log", ".ninja_deps", + "Makefile.depend", ".ninja_log", ".ninja_deps", "ezfio_interface.irp.f"] for module in l_module: @@ -242,25 +248,25 @@ if __name__ == '__main__': l_symlink = m.l_descendant_unique([module]) l_exe = get_binaries(module_abs) + for f in l_dir: + try: + shutil.rmtree(os.path.join(module_abs, f)) + except: + pass + + for symlink in l_symlink: + try: + os.unlink(os.path.join(module_abs, symlink)) + except: + pass + + for f in l_file: + try: + os.remove(os.path.join(module_abs, f)) + except: + pass + if arguments["clean"]: - for f in l_dir: - try: - shutil.rmtree(os.path.join(module_abs, f)) - except: - pass - - for symlink in l_symlink: - try: - os.unlink(os.path.join(module_abs, symlink)) - except: - pass - - for f in l_file: - try: - os.remove(os.path.join(module_abs, f)) - except: - pass - for f in l_exe: try: @@ -268,6 +274,4 @@ if __name__ == '__main__': except: pass - if arguments["create_git_ignore"]: - pass diff --git a/src/cipsi/pt2_stoch_routines.irp.f b/src/cipsi/pt2_stoch_routines.irp.f index 6f0d6683..b366a268 100644 --- a/src/cipsi/pt2_stoch_routines.irp.f +++ b/src/cipsi/pt2_stoch_routines.irp.f @@ -132,6 +132,8 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in) PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns PROVIDE psi_bilinear_matrix_transp_order psi_selectors_coef_transp psi_det_sorted PROVIDE psi_det_hii selection_weight pseudo_sym + PROVIDE n_act_orb n_inact_orb n_core_orb n_virt_orb n_del_orb seniority_max + PROVIDE pert_2rdm excitation_beta_max excitation_alpha_max excitation_max if (h0_type == 'CFG') then PROVIDE psi_configuration_hii det_to_configuration diff --git a/src/cipsi/stochastic_cipsi.irp.f b/src/cipsi/stochastic_cipsi.irp.f index 77c6ed48..781fcda6 100644 --- a/src/cipsi/stochastic_cipsi.irp.f +++ b/src/cipsi/stochastic_cipsi.irp.f @@ -13,7 +13,7 @@ subroutine run_stochastic_cipsi double precision :: rss double precision, external :: memory_of_double - PROVIDE H_apply_buffer_allocated + PROVIDE H_apply_buffer_allocated distributed_davidson mo_two_e_integrals_in_map N_iter = 1 threshold_generators = 1.d0 diff --git a/src/cipsi/zmq_selection.irp.f b/src/cipsi/zmq_selection.irp.f index 6f222d4f..58630709 100644 --- a/src/cipsi/zmq_selection.irp.f +++ b/src/cipsi/zmq_selection.irp.f @@ -21,7 +21,8 @@ subroutine ZMQ_selection(N_in, pt2_data) PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns PROVIDE psi_bilinear_matrix_transp_order selection_weight pseudo_sym - + PROVIDE n_act_orb n_inact_orb n_core_orb n_virt_orb n_del_orb seniority_max + PROVIDE pert_2rdm excitation_beta_max excitation_alpha_max excitation_max call new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'selection') diff --git a/src/csf/tree_utils.c b/src/csf/tree_utils.c index 019fdaa9..5336a6da 100644 --- a/src/csf/tree_utils.c +++ b/src/csf/tree_utils.c @@ -62,7 +62,8 @@ void getIthBF(Node *inode, int isomo, bool foundBF, int NSOMOMax, int getaddr, i if(isomo == NSOMOMax){ if(inode->addr == getaddr){ - for(int i = NSOMOMax-1; i > -1; i--){ + int i; + for(i = NSOMOMax-1; i > -1; i--){ vecBF[i] = inode->cpl; inode = inode->PREV; } @@ -150,7 +151,8 @@ void getIthDet(Node *inode, int isomo, bool foundBF, int NSOMOMax, int getaddr, if(isomo == NSOMOMax){ if(inode->addr == getaddr){ - for(int i = NSOMOMax-1; i > -1; i--){ + int i; + for(i = NSOMOMax-1; i > -1; i--){ vecBF[i] = inode->cpl; inode = inode->PREV; } @@ -224,7 +226,8 @@ void getDetlist(Node *inode, int isomo, int NSOMOMax, int *vecBF, int *detlist){ if(isomo == NSOMOMax){ int idet=0; - for(int k=0;kaddr]=idet; diff --git a/src/davidson/EZFIO.cfg b/src/davidson/EZFIO.cfg index 4343cc1e..92c41b4c 100644 --- a/src/davidson/EZFIO.cfg +++ b/src/davidson/EZFIO.cfg @@ -34,6 +34,12 @@ doc: If |true|, a memory-mapped file may be used to store the W and S2 vectors i default: True interface: ezfio,provider,ocaml +[csf_based] +type: logical +doc: If |true|, use the CSF-based algorithm +default: False +interface: ezfio,provider,ocaml + [distributed_davidson] type: logical doc: If |true|, use the distributed algorithm @@ -52,3 +58,8 @@ doc: Maximum number of determinants where |H| is fully diagonalized interface: ezfio,provider,ocaml default: 1000 +[without_diagonal] +type: logical +doc: If |true|, don't use denominator +default: False +interface: ezfio,provider,ocaml diff --git a/src/davidson/diagonalization_hcsf_dressed.irp.f b/src/davidson/diagonalization_hcsf_dressed.irp.f index da23b919..b6f438a0 100644 --- a/src/davidson/diagonalization_hcsf_dressed.irp.f +++ b/src/davidson/diagonalization_hcsf_dressed.irp.f @@ -447,14 +447,24 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N ! Compute residual vector and davidson step ! ----------------------------------------- - !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i,k) - do k=1,N_st_diag - do i=1,sze - U(i,k) = (lambda(k) * U(i,k) - W(i,k) ) & - /max(H_jj(i) - lambda (k),1.d-2) + if (without_diagonal) then + !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i,k) + do k=1,N_st_diag + do i=1,sze + U(i,k) = (lambda(k) * U(i,k) - W(i,k) ) & + /max(H_jj(i) - lambda (k),1.d-2) + enddo enddo - enddo - !$OMP END PARALLEL DO + !$OMP END PARALLEL DO + else + !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i,k) + do k=1,N_st_diag + do i=1,sze + U(i,k) = (lambda(k) * U(i,k) - W(i,k) ) + enddo + enddo + !$OMP END PARALLEL DO + endif do k=1,N_st residual_norm(k) = u_dot_u(U(1,k),sze) diff --git a/src/davidson/diagonalize_ci.irp.f b/src/davidson/diagonalize_ci.irp.f index da5fb950..fb991b65 100644 --- a/src/davidson/diagonalize_ci.irp.f +++ b/src/davidson/diagonalize_ci.irp.f @@ -42,7 +42,7 @@ END_PROVIDER logical :: converged logical :: do_csf - PROVIDE threshold_davidson nthreads_davidson + PROVIDE threshold_davidson nthreads_davidson distributed_davidson ! Guess values for the "N_states" states of the |CI| eigenvectors do j=1,min(N_states,N_det) do i=1,N_det @@ -56,9 +56,7 @@ END_PROVIDER enddo enddo -! Deactivated temporarily: bug in N_csf -! do_csf = s2_eig .and. only_expected_s2 .and. (expected_s2 == 0.d0) - do_csf = .False. + do_csf = s2_eig .and. only_expected_s2 .and. csf_based if (diag_algorithm == "Davidson") then diff --git a/src/davidson/u0_h_u0.irp.f b/src/davidson/u0_h_u0.irp.f index 3f5113db..7ef154a3 100644 --- a/src/davidson/u0_h_u0.irp.f +++ b/src/davidson/u0_h_u0.irp.f @@ -46,7 +46,7 @@ subroutine u_0_H_u_0(e_0,u_0,n,keys_tmp,Nint,N_st,sze) do i=1,N_st norm = u_dot_u(u_0(1,i),n) if (norm /= 0.d0) then - e_0(i) = u_dot_v(v_0(1,i),u_0(1,i),n) + e_0(i) = u_dot_v(v_0(1,i),u_0(1,i),n) / dsqrt(norm) else e_0(i) = 0.d0 endif diff --git a/src/davidson/u0_hs2_u0.irp.f b/src/davidson/u0_hs2_u0.irp.f index 96c266c2..8f7bf06b 100644 --- a/src/davidson/u0_hs2_u0.irp.f +++ b/src/davidson/u0_hs2_u0.irp.f @@ -75,8 +75,8 @@ subroutine u_0_HS2_u_0(e_0,s_0,u_0,n,keys_tmp,Nint,N_st,sze) do i=1,N_st norm = u_dot_u(u_0(1,i),n) if (norm /= 0.d0) then - e_0(i) = u_dot_v(v_0(1,i),u_0(1,i),n) - s_0(i) = u_dot_v(s_vec(1,i),u_0(1,i),n) + e_0(i) = u_dot_v(v_0(1,i),u_0(1,i),n)/norm + s_0(i) = u_dot_v(s_vec(1,i),u_0(1,i),n)/norm else e_0(i) = 0.d0 s_0(i) = 0.d0 diff --git a/src/mo_one_e_ints/mo_overlap.irp.f b/src/mo_one_e_ints/mo_overlap.irp.f index 4ce83fcd..9b21e032 100644 --- a/src/mo_one_e_ints/mo_overlap.irp.f +++ b/src/mo_one_e_ints/mo_overlap.irp.f @@ -1,4 +1,3 @@ - BEGIN_PROVIDER [ double precision, mo_overlap,(mo_num,mo_num) ] implicit none BEGIN_DOC diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index 8756ee47..9f73d518 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -296,6 +296,8 @@ end ! If true, the excitation is banned in the selection. Useful with local MOs. END_DOC banned_excitation = .False. + use_banned_excitation = .False. + integer :: i,j, icount integer(key_kind) :: idx double precision :: tmp diff --git a/src/zmq/utils.irp.f b/src/zmq/utils.irp.f index 7cb6c896..2cb230c7 100644 --- a/src/zmq/utils.irp.f +++ b/src/zmq/utils.irp.f @@ -127,9 +127,9 @@ function zmq_port(ishift) END_DOC integer, intent(in) :: ishift character*(8) :: zmq_port - !$OMP CRITICAL(write) + !$OMP CRITICAL write(zmq_port,'(I8)') zmq_port_start+ishift - !$OMP END CRITICAL(write) + !$OMP END CRITICAL zmq_port = adjustl(trim(zmq_port)) end @@ -520,9 +520,9 @@ subroutine new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,name_in) zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() zmq_socket_pull = new_zmq_pull_socket () - !$OMP CRITICAL(write) + !$OMP CRITICAL write(name,'(A,I8.8)') trim(name_in)//'.', icount - !$OMP END CRITICAL(write) + !$OMP END CRITICAL sze = len(trim(name)) zmq_state = trim(name) call lowercase(name,sze) @@ -586,9 +586,9 @@ subroutine end_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,name_in) integer, save :: icount=0 icount = icount+1 - !$OMP CRITICAL(write) + !$OMP CRITICAL write(name,'(A,I8.8)') trim(name_in)//'.', icount - !$OMP END CRITICAL(write) + !$OMP END CRITICAL sze = len(trim(name)) call lowercase(name,sze) if (name /= zmq_state) then @@ -710,9 +710,9 @@ integer function disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_i disconnect_from_taskserver_state = -1 - !$OMP CRITICAL(write) + !$OMP CRITICAL write(message,*) 'disconnect '//trim(state), worker_id - !$OMP END CRITICAL(write) + !$OMP END CRITICAL sze = min(510,len(trim(message))) rc = f77_zmq_send(zmq_to_qp_run_socket, trim(message), sze, 0) @@ -789,9 +789,9 @@ integer function zmq_abort(zmq_to_qp_run_socket) character*(512) :: message zmq_abort = 0 - !$OMP CRITICAL(write) + !$OMP CRITICAL write(message,*) 'abort ' - !$OMP END CRITICAL(write) + !$OMP END CRITICAL sze = len(trim(message)) @@ -833,9 +833,9 @@ integer function task_done_to_taskserver(zmq_to_qp_run_socket, worker_id, task_i task_done_to_taskserver = 0 - !$OMP CRITICAL(write) + !$OMP CRITICAL write(message,*) 'task_done '//trim(zmq_state), worker_id, task_id - !$OMP END CRITICAL(write) + !$OMP END CRITICAL sze = len(trim(message)) rc = f77_zmq_send(zmq_to_qp_run_socket, trim(message), sze, 0) @@ -868,11 +868,11 @@ integer function tasks_done_to_taskserver(zmq_to_qp_run_socket, worker_id, task_ tasks_done_to_taskserver = 0 - !$OMP CRITICAL(write) + !$OMP CRITICAL allocate(character(LEN=64+n_tasks*12) :: message) write(fmt,*) '(A,X,A,I10,X,', n_tasks, '(I11,1X))' write(message,*) 'task_done '//trim(zmq_state), worker_id, (task_id(k), k=1,n_tasks) - !$OMP END CRITICAL(write) + !$OMP END CRITICAL sze = len(trim(message)) rc = f77_zmq_send(zmq_to_qp_run_socket, trim(message), sze, 0) @@ -914,9 +914,9 @@ integer function get_task_from_taskserver(zmq_to_qp_run_socket,worker_id,task_id get_task_from_taskserver = 0 - !$OMP CRITICAL(write) + !$OMP CRITICAL write(message,*) 'get_task '//trim(zmq_state), worker_id - !$OMP END CRITICAL(write) + !$OMP END CRITICAL sze = len(trim(message)) rc = f77_zmq_send(zmq_to_qp_run_socket, message, sze, 0) @@ -977,9 +977,9 @@ integer function get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id,task_i get_tasks_from_taskserver = 0 - !$OMP CRITICAL(write) + !$OMP CRITICAL write(message,'(A,A,X,I10,I10)') 'get_tasks ', trim(zmq_state), worker_id, n_tasks - !$OMP END CRITICAL(write) + !$OMP END CRITICAL sze = len(trim(message)) rc = f77_zmq_send(zmq_to_qp_run_socket, message, sze, 0) @@ -1079,9 +1079,9 @@ integer function zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id,mo zmq_delete_task = 0 - !$OMP CRITICAL(write) + !$OMP CRITICAL write(message,*) 'del_task ', zmq_state, task_id - !$OMP END CRITICAL(write) + !$OMP END CRITICAL rc = f77_zmq_send(zmq_to_qp_run_socket,trim(message),len(trim(message)),0) if (rc /= len(trim(message))) then zmq_delete_task = -1 @@ -1121,9 +1121,9 @@ integer function zmq_delete_task_async_send(zmq_to_qp_run_socket,task_id,sending endif zmq_delete_task_async_send = 0 - !$OMP CRITICAL(write) + !$OMP CRITICAL write(message,*) 'del_task ', zmq_state, task_id - !$OMP END CRITICAL(write) + !$OMP END CRITICAL rc = f77_zmq_send(zmq_to_qp_run_socket,trim(message),len(trim(message)),0) if (rc /= len(trim(message))) then zmq_delete_task_async_send = -1 @@ -1181,10 +1181,10 @@ integer function zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n allocate(character(LEN=64+n_tasks*12) :: message) - !$OMP CRITICAL(write) + !$OMP CRITICAL write(fmt,*) '(A,1X,A,1X,', n_tasks, '(I11,1X))' write(message,*) 'del_task '//trim(zmq_state), (task_id(k), k=1,n_tasks) - !$OMP END CRITICAL(write) + !$OMP END CRITICAL rc = f77_zmq_send(zmq_to_qp_run_socket,trim(message),len(trim(message)),0) @@ -1230,10 +1230,10 @@ integer function zmq_delete_tasks_async_send(zmq_to_qp_run_socket,task_id,n_task allocate(character(LEN=64+n_tasks*12) :: message) - !$OMP CRITICAL(write) + !$OMP CRITICAL write(fmt,*) '(A,1X,A,1X,', n_tasks, '(I11,1X))' write(message,*) 'del_task '//trim(zmq_state), (task_id(k), k=1,n_tasks) - !$OMP END CRITICAL(write) + !$OMP END CRITICAL rc = f77_zmq_send(zmq_to_qp_run_socket,trim(message),len(trim(message)),0)