From c8258a48bdc77fd53e96a4fd7890a8d755e0d807 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 25 Mar 2015 11:42:15 +0100 Subject: [PATCH 1/9] Upgrade irpf90 --- scripts/upgrade_irpf90.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade_irpf90.sh b/scripts/upgrade_irpf90.sh index a3aeac48..5735754f 100755 --- a/scripts/upgrade_irpf90.sh +++ b/scripts/upgrade_irpf90.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/bash # # Upgrades IRPF90 from the web. -# Tue Nov 4 00:53:13 CET 2014 +# Wed Mar 25 11:41:04 CET 2015 if [[ -z ${QPACKAGE_ROOT} ]] then @@ -10,9 +10,9 @@ then fi cd -- ${QPACKAGE_ROOT} -mv -- ${QPACKAGE_ROOT}/irpf90 ${QPACKAGE_ROOT}/irpf90.old +mv -f -- ${QPACKAGE_ROOT}/irpf90 ${QPACKAGE_ROOT}/irpf90.old -make irpf90 +${QPACKAGE_ROOT}/scripts/install_irpf90.sh if [[ $? -eq 0 ]] then From fddd24ed6f35d71d2cfbec94e9b7bea4e5d078a4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 25 Mar 2015 21:01:48 +0100 Subject: [PATCH 2/9] Update INSTALL.md --- INSTALL.md | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 9433be64..712e3d8f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -5,25 +5,39 @@ * curl * m4 * GNU make -* Fortran compiler (ifort or gfortran) -* Python 2.7 or new +* Fortran compiler (ifort or gfortran are tested) +* Python >= 2.7 * Bash -## Installing <> +## Standard installation -1) Run `./setup_environment.sh` - It will doawnload and install all the requirement - (Installing OCaml will take somme time 20min) +1) `./setup_environment.sh` -2) `source /home/razoa/quantum_package/quantum_package.rc` - It containt all the environement variable neeeded by the quantum package +This command will download and install all the requirements. +Installing OCaml and the Core library may take somme time +(up to 20min on an old machine). -3) Create the Makefile.config who containt all the flag needed by the compilator. - (`cp ./src/Makefile.config.gfortran ./src/Makefile.config`) +2) `source quantum_package.rc` + +This file contains all the environement variables neeeded by the quantum package +both to compile and run. This should also be done before running calculations. + +3) `cp ./src/Makefile.config.gfortran ./src/Makefile.config` + +Create the ``Makefile.config`` which contains all the flags needed by the compiler. +The is also an example for the Intel Compiler (`Makefile.config.ifort`). +Edit this file and tune the flags as you want. + +4) `make build` + +It will compile all the executables and tools. + +5) `make binary` + +Optional. It will build a `tar.gz` file containing everything needed to run the quantum package on a +machine where you can't compile. -4) make build - It will compile all the fortran ## Installing behind a firewall @@ -64,4 +78,3 @@ ssh -fN -D 10000 user@external-server.com - From 72eb7905bb384953330b636fc34d295dac80929f Mon Sep 17 00:00:00 2001 From: Manu Date: Wed, 25 Mar 2015 22:41:49 +0100 Subject: [PATCH 3/9] add the possibility to avoid the skip in the generators with the select_max criterion and add a full_ci_no_skip.irp.f that uses it --- scripts/generate_h_apply.py | 3 + src/Bitmask/bitmask_cas_routines.irp.f | 18 ++--- src/Dets/save_for_casino.irp.f | 87 +----------------------- src/Full_CI/H_apply.irp.f | 4 ++ src/Full_CI/full_ci_no_skip.irp.f | 91 ++++++++++++++++++++++++++ src/Properties/need.irp.f | 8 +-- src/Utils/abort.irp.f | 5 +- 7 files changed, 116 insertions(+), 100 deletions(-) create mode 100644 src/Full_CI/full_ci_no_skip.irp.f diff --git a/scripts/generate_h_apply.py b/scripts/generate_h_apply.py index 0ac11353..36bd48aa 100755 --- a/scripts/generate_h_apply.py +++ b/scripts/generate_h_apply.py @@ -133,6 +133,9 @@ class H_apply(object): self["filterparticle"] = """ if(iand(ibset(0_bit_kind,j_a),hole(k_a,other_spin)).eq.0_bit_kind )cycle """ + def unset_skip(self): + self["skip"] = """ + """ def set_filter_2h_2p(self): diff --git a/src/Bitmask/bitmask_cas_routines.irp.f b/src/Bitmask/bitmask_cas_routines.irp.f index 776d4546..a2e8ef08 100644 --- a/src/Bitmask/bitmask_cas_routines.irp.f +++ b/src/Bitmask/bitmask_cas_routines.irp.f @@ -214,13 +214,13 @@ logical function is_a_two_holes_two_particles(key_in) integer :: i,i_diff i_diff = 0 if(N_int == 1)then - i_diff = i_diff & + i_diff = i_diff + & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & + popcnt( iand( iand( xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1))), virt_bitmask(1,2) ), virt_bitmask(1,2)) ) else if(N_int == 2)then - i_diff = i_diff & + i_diff = i_diff + & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -231,7 +231,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(2,2),iand(key_in(2,2),cas_bitmask(2,2,1))), virt_bitmask(2,2) ), virt_bitmask(2,2)) ) else if(N_int == 3)then - i_diff = i_diff & + i_diff = i_diff + & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -245,7 +245,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(3,1),iand(key_in(3,1),cas_bitmask(3,1,1))), virt_bitmask(3,1) ), virt_bitmask(3,1)) ) & + popcnt( iand( iand( xor(key_in(3,2),iand(key_in(3,2),cas_bitmask(3,2,1))), virt_bitmask(3,2) ), virt_bitmask(3,2)) ) else if(N_int == 4)then - i_diff = i_diff & + i_diff = i_diff + & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -263,7 +263,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(4,1),iand(key_in(4,1),cas_bitmask(4,1,1))), virt_bitmask(4,1) ), virt_bitmask(4,1)) ) & + popcnt( iand( iand( xor(key_in(4,2),iand(key_in(4,2),cas_bitmask(4,2,1))), virt_bitmask(4,2) ), virt_bitmask(4,2)) ) else if(N_int == 5)then - i_diff = i_diff & + i_diff = i_diff + & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -285,7 +285,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(5,1),iand(key_in(5,1),cas_bitmask(5,1,1))), virt_bitmask(5,1) ), virt_bitmask(5,1)) ) & + popcnt( iand( iand( xor(key_in(5,2),iand(key_in(5,2),cas_bitmask(5,2,1))), virt_bitmask(5,2) ), virt_bitmask(5,2)) ) else if(N_int == 6)then - i_diff = i_diff & + i_diff = i_diff + & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -311,7 +311,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(6,1),iand(key_in(6,1),cas_bitmask(6,1,1))), virt_bitmask(6,1) ), virt_bitmask(6,1)) ) & + popcnt( iand( iand( xor(key_in(6,2),iand(key_in(6,2),cas_bitmask(6,2,1))), virt_bitmask(6,2) ), virt_bitmask(6,2)) ) else if(N_int == 7)then - i_diff = i_diff & + i_diff = i_diff + & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -341,7 +341,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(7,1),iand(key_in(7,1),cas_bitmask(7,1,1))), virt_bitmask(7,1) ), virt_bitmask(7,1)) ) & + popcnt( iand( iand( xor(key_in(7,2),iand(key_in(7,2),cas_bitmask(7,2,1))), virt_bitmask(7,2) ), virt_bitmask(7,2)) ) else if(N_int == 8)then - i_diff = i_diff & + i_diff = i_diff + & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -378,7 +378,7 @@ logical function is_a_two_holes_two_particles(key_in) else do i = 1, N_int - i_diff = i_diff & + i_diff = i_diff + & + popcnt( xor( iand(inact_bitmask(i,1), xor(key_in(i,1),iand(key_in(i,1),cas_bitmask(i,1,1)))), inact_bitmask(i,1)) ) & + popcnt( xor( iand(inact_bitmask(i,2), xor(key_in(i,2),iand(key_in(i,2),cas_bitmask(i,2,1)))), inact_bitmask(i,2)) ) & + popcnt( iand( iand( xor(key_in(i,1),iand(key_in(i,1),cas_bitmask(i,1,1))), virt_bitmask(i,1) ), virt_bitmask(i,1)) ) & diff --git a/src/Dets/save_for_casino.irp.f b/src/Dets/save_for_casino.irp.f index 631f79bd..0c18d1e2 100644 --- a/src/Dets/save_for_casino.irp.f +++ b/src/Dets/save_for_casino.irp.f @@ -4,7 +4,6 @@ subroutine save_casino character*(128) :: message integer :: getUnitAndOpen, iunit integer, allocatable :: itmp(:) - integer :: n_ao_new real, allocatable :: rtmp(:) PROVIDE ezfio_filename @@ -76,8 +75,7 @@ subroutine save_casino icount += 2*ao_l(i)+1 endif enddo - n_ao_new = icount - write(iunit,*) n_ao_new + write(iunit,*) icount write(iunit,'(A)') 'Number of Gaussian primitives per primitive cell' allocate(itmp(ao_num)) integer :: l @@ -177,89 +175,6 @@ subroutine save_casino write(iunit,'(A)') - write(iunit,'(A)') 'MULTIDETERMINANT INFORMATION' - write(iunit,'(A)') '----------------------------' - write(iunit,'(A)') 'GS' - write(iunit,'(A)') 'ORBITAL COEFFICIENTS' - write(iunit,'(A)') '------------------------' - - ! Transformation cartesian -> spherical - double precision :: tf2(6,5), tf3(10,7), tf4(15,9) - integer :: check2(3,6), check3(3,10), check4(3,15) - check2(:,1) = (/ 2, 0, 0 /) - check2(:,2) = (/ 1, 1, 0 /) - check2(:,3) = (/ 1, 0, 1 /) - check2(:,4) = (/ 0, 2, 0 /) - check2(:,5) = (/ 0, 1, 1 /) - check2(:,6) = (/ 0, 0, 2 /) - - check3(:,1) = (/ 3, 0, 0 /) - check3(:,2) = (/ 2, 1, 0 /) - check3(:,3) = (/ 2, 0, 1 /) - check3(:,4) = (/ 1, 2, 0 /) - check3(:,5) = (/ 1, 1, 1 /) - check3(:,6) = (/ 1, 0, 2 /) - check3(:,7) = (/ 0, 3, 0 /) - check3(:,8) = (/ 0, 2, 1 /) - check3(:,9) = (/ 0, 1, 2 /) - check3(:,10) = (/ 0, 0, 3 /) - - check4(:,1) = (/ 4, 0, 0 /) - check4(:,2) = (/ 3, 1, 0 /) - check4(:,3) = (/ 3, 0, 1 /) - check4(:,4) = (/ 2, 2, 0 /) - check4(:,5) = (/ 2, 1, 1 /) - check4(:,6) = (/ 2, 0, 2 /) - check4(:,7) = (/ 1, 3, 0 /) - check4(:,8) = (/ 1, 2, 1 /) - check4(:,9) = (/ 1, 1, 2 /) - check4(:,10) = (/ 1, 0, 3 /) - check4(:,11) = (/ 0, 4, 0 /) - check4(:,12) = (/ 0, 3, 1 /) - check4(:,13) = (/ 0, 2, 2 /) - check4(:,14) = (/ 0, 1, 3 /) - check4(:,15) = (/ 0, 0, 4 /) - -! tf2 = (/ -! -0.5, 0, 0, -0.5, 0, 1.0, & -! 0, 0, 1.0, 0, 0, 0, & -! 0, 0, 0, 0, 1.0, 0, & -! 0.86602540378443864676, 0, 0, -0.86602540378443864676, 0, 0, & -! 0, 1.0, 0, 0, 0, 0, & -! /) -! tf3 = (/ -! 0, 0, -0.67082039324993690892, 0, 0, 0, 0, -0.67082039324993690892, 0, 1.0, & -! -0.61237243569579452455, 0, 0, -0.27386127875258305673, 0, 1.0954451150103322269, 0, 0, 0, 0, & -! 0, -0.27386127875258305673, 0, 0, 0, 0, -0.61237243569579452455, 0, 1.0954451150103322269, 0, & -! 0, 0, 0.86602540378443864676, 0, 0, 0, 0, -0.86602540378443864676, 0, 0, & -! 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 0, & -! 0.790569415042094833, 0, 0, -1.0606601717798212866, 0, 0, 0, 0, 0, 0, & -! 0, 1.0606601717798212866, 0, 0, 0, 0, -0.790569415042094833, 0, 0, 0, & -! /) -! tf4 = (/ -! 0.375, 0, 0, 0.21957751641341996535, 0, -0.87831006565367986142, 0, 0, 0, 0, 0.375, 0, -0.87831006565367986142, 0, 1.0, & -! 0, 0, -0.89642145700079522998, 0, 0, 0, 0, -0.40089186286863657703, 0, 1.19522860933439364, 0, 0, 0, 0, 0, & -! 0, 0, 0, 0, -0.40089186286863657703, 0, 0, 0, 0, 0, 0, -0.89642145700079522998, 0, 1.19522860933439364, 0, & -! -0.5590169943749474241, 0, 0, 0, 0, 0.9819805060619657157, 0, 0, 0, 0, 0.5590169943749474241, 0, -0.9819805060619657157, 0, 0, & -! 0, -0.42257712736425828875, 0, 0, 0, 0, -0.42257712736425828875, 0, 1.1338934190276816816, 0, 0, 0, 0, 0, 0, & -! 0, 0, 0.790569415042094833, 0, 0, 0, 0, -1.0606601717798212866, 0, 0, 0, 0, 0, 0, 0, & -! 0, 0, 0, 0, 1.0606601717798212866, 0, 0, 0, 0, 0, 0, -0.790569415042094833, 0, 0, 0, & -! 0.73950997288745200532, 0, 0, -1.2990381056766579701, 0, 0, 0, 0, 0, 0, 0.73950997288745200532, 0, 0, 0, 0, & -! 0, 1.1180339887498948482, 0, 0, 0, 0, -1.1180339887498948482, 0, 0, 0, 0, 0, 0, 0, 0, & -! /) -! - - - allocate(rtmp(ao_num*mo_tot_num)) - l=0 - do i=1,mo_tot_num - do j=1,ao_num - l += 1 - rtmp(l) = mo_coef(j,i) - enddo - enddo - write(iunit,'(4(1PE20.13))') rtmp(1:l) - deallocate(rtmp) close(iunit) end diff --git a/src/Full_CI/H_apply.irp.f b/src/Full_CI/H_apply.irp.f index 5c6fcdc7..a755ad4a 100644 --- a/src/Full_CI/H_apply.irp.f +++ b/src/Full_CI/H_apply.irp.f @@ -10,6 +10,10 @@ s = H_apply("FCI_PT2") s.set_perturbation("epstein_nesbet_2x2") print s +s = H_apply("FCI_no_skip") +s.set_selection_pt2("epstein_nesbet_2x2") +s.unset_skip() +print s s = H_apply("FCI_mono") s.set_selection_pt2("epstein_nesbet_2x2") diff --git a/src/Full_CI/full_ci_no_skip.irp.f b/src/Full_CI/full_ci_no_skip.irp.f new file mode 100644 index 00000000..aa84fb9d --- /dev/null +++ b/src/Full_CI/full_ci_no_skip.irp.f @@ -0,0 +1,91 @@ +program full_ci + implicit none + integer :: i,k + + + double precision, allocatable :: pt2(:), norm_pert(:), H_pert_diag(:) + integer :: N_st, degree + N_st = N_states + allocate (pt2(N_st), norm_pert(N_st),H_pert_diag(N_st)) + character*(64) :: perturbation + + pt2 = 1.d0 + diag_algorithm = "Lapack" + if (N_det > n_det_max_fci) then + call diagonalize_CI + call save_wavefunction + psi_det = psi_det_sorted + psi_coef = psi_coef_sorted + N_det = n_det_max_fci + soft_touch N_det psi_det psi_coef + call diagonalize_CI + call save_wavefunction + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + endif + double precision :: i_H_psi_array(N_states),diag_H_mat_elem,h,i_O1_psi_array(N_states) + if(read_wf)then + call i_H_psi(psi_det(1,1,N_det),psi_det,psi_coef,N_int,N_det,psi_det_size,N_states,i_H_psi_array) + h = diag_H_mat_elem(psi_det(1,1,N_det),N_int) + selection_criterion = dabs(psi_coef(N_det,1) * (i_H_psi_array(1) - h * psi_coef(N_det,1))) * 0.1d0 + soft_touch selection_criterion + endif + + + integer :: n_det_before + print*,'Beginning the selection ...' + do while (N_det < n_det_max_fci.and.maxval(abs(pt2(1:N_st))) > pt2_max) + n_det_before = N_det + call H_apply_FCI_no_skip(pt2, norm_pert, H_pert_diag, N_st) + + PROVIDE psi_coef + PROVIDE psi_det + PROVIDE psi_det_sorted + + if (N_det > n_det_max_fci) then + psi_det = psi_det_sorted + psi_coef = psi_coef_sorted + N_det = n_det_max_fci + soft_touch N_det psi_det psi_coef + endif + call diagonalize_CI + call save_wavefunction + if(n_det_before == N_det)then + selection_criterion = selection_criterion * 0.5d0 + endif + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + call ezfio_set_full_ci_energy(CI_energy) + if (abort_all) then + exit + endif + enddo + N_det = min(n_det_max_fci,N_det) + touch N_det psi_det psi_coef + call diagonalize_CI + if(do_pt2_end)then + print*,'Last iteration only to compute the PT2' + threshold_selectors = 1.d0 + threshold_generators = 0.999d0 + call H_apply_FCI_PT2(pt2, norm_pert, H_pert_diag, N_st) + + print *, 'Final step' + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print *, 'PT2 = ', pt2 + print *, 'E = ', CI_energy + print *, 'E+PT2 = ', CI_energy+pt2 + print *, '-----' + call ezfio_set_full_ci_energy_pt2(CI_energy+pt2) + endif + call save_wavefunction + deallocate(pt2,norm_pert) +end diff --git a/src/Properties/need.irp.f b/src/Properties/need.irp.f index 22cb6a48..eb4dfe34 100644 --- a/src/Properties/need.irp.f +++ b/src/Properties/need.irp.f @@ -132,7 +132,7 @@ ! double precision function gammp(a,x) implicit double precision (a-h,o-z) - if(x.lt.0..or.a.le.0.)stop 'error in gammp' + if(x.lt.0..or.a.le.0.)pause if(x.lt.a+1.)then call gser(gammp,a,x,gln) else @@ -169,7 +169,7 @@ parameter (itmax=100,eps=3.e-7) gln=gammln(a) if(x.le.0.)then - if(x.lt.0.) stop 'error in gser' + if(x.lt.0.)pause gamser=0. return endif @@ -182,7 +182,7 @@ sum=sum+del if(abs(del).lt.abs(sum)*eps)go to 1 11 continue - stop 'a too large, itmax too small' + pause 'a too large, itmax too small' 1 gamser=sum*exp(-x+a*log(x)-gln) return end @@ -233,7 +233,7 @@ gold=g endif 11 continue - stop 'a too large, itmax too small' + pause 'a too large, itmax too small' 1 gammcf=exp(-x+a*log(x)-gln)*g return end diff --git a/src/Utils/abort.irp.f b/src/Utils/abort.irp.f index 4abf1a01..e915202e 100644 --- a/src/Utils/abort.irp.f +++ b/src/Utils/abort.irp.f @@ -17,13 +17,16 @@ BEGIN_PROVIDER [ logical, abort_here ] END_PROVIDER subroutine trap_signals + use ifport implicit none BEGIN_DOC ! What to do when a signal is caught. Here, trap Ctrl-C and call the control_C subroutine. END_DOC integer, external :: catch_signal + integer :: err, flag integer, parameter :: sigusr2 = 12 - call signal (sigusr2, catch_signal) + flag = -1 + err = signal (sigusr2, catch_signal, flag) end subroutine trap_signals integer function catch_signal(signum) From 6b2496d0ed7e99b41672a990fde13d7be7246121 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 25 Mar 2015 23:03:51 +0100 Subject: [PATCH 4/9] Lots of cleaning in scripts and Makefiles --- .gitignore | 3 +- scripts/archive_ezfio.sh | 78 --------------- scripts/build_modules.sh | 34 +++++++ scripts/check_dependencies.sh | 14 +-- scripts/clean_modules.sh | 36 +++++++ scripts/create_Makefile.sh | 14 +-- scripts/create_Makefile_depend.sh | 12 ++- scripts/create_Needed_modules.sh | 12 ++- scripts/create_gitignore.sh | 10 ++ scripts/create_module.sh | 21 ++-- scripts/create_rst_templates.sh | 21 ++-- scripts/ezfio_interface.py | 57 +++++++---- scripts/get_basis.sh | 12 ++- scripts/install_curl.sh | 7 +- scripts/install_emsl.sh | 8 +- scripts/install_ezfio.sh | 8 +- scripts/install_ocaml.sh | 4 +- scripts/prepare_ezfio.sh | 18 ++++ scripts/prepare_module.sh | 15 --- scripts/qp_include.sh | 80 +++++++++++++++ scripts/run_Makefile_common.sh | 69 +++++++++++++ scripts/run_Makefile_global.sh | 81 +++++++++++++++ scripts/save_current_mos.sh | 7 ++ scripts/unarchive_ezfio.sh | 54 ---------- scripts/upgrade_ezfio.sh | 2 +- setup_environment.sh | 3 + src/AOs/Makefile | 2 - src/BiInts/Makefile | 2 - src/Bitmask/Makefile | 2 - src/CAS_SD_selected/Makefile | 2 - src/CID/Makefile | 2 - src/CID_SC2_selected/Makefile | 2 - src/CID_selected/Makefile | 2 - src/CIS/Makefile | 2 - src/CISD/Makefile | 2 - src/CISD_SC2_selected/Makefile | 2 - src/CISD_selected/Makefile | 2 - src/DDCI_selected/Makefile | 2 - src/Dets/Makefile | 2 - src/Electrons/Makefile | 2 - src/Ezfio_files/Makefile | 2 - src/FCIdump/Makefile | 2 - src/Full_CI/Makefile | 2 - src/Generators_CAS/Makefile | 2 - src/Generators_full/Makefile | 2 - src/Generators_restart/Makefile | 2 - src/Hartree_Fock/Makefile | 2 - src/MOGuess/Makefile | 2 - src/MOs/Makefile | 2 - src/MP2/Makefile | 2 - src/Makefile | 37 ++++--- src/Makefile.common | 160 +++--------------------------- src/Molden/Makefile | 2 - src/MonoInts/Makefile | 2 - src/NEEDED_MODULES | 2 +- src/Nuclei/Makefile | 2 - src/Output/Makefile | 2 - src/Perturbation/Makefile | 2 - src/Properties/Makefile | 2 - src/Selectors_full/Makefile | 2 - src/Selectors_no_sorted/Makefile | 2 - src/SingleRefMethod/Makefile | 2 - src/Utils/Makefile | 2 - 63 files changed, 491 insertions(+), 456 deletions(-) delete mode 100755 scripts/archive_ezfio.sh create mode 100755 scripts/build_modules.sh create mode 100755 scripts/clean_modules.sh create mode 100755 scripts/prepare_ezfio.sh delete mode 100755 scripts/prepare_module.sh create mode 100644 scripts/qp_include.sh create mode 100755 scripts/run_Makefile_common.sh create mode 100755 scripts/run_Makefile_global.sh delete mode 100755 scripts/unarchive_ezfio.sh diff --git a/.gitignore b/.gitignore index e096320a..cdcdc6d8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ EMSL_Basis bin/ *.log quantum_package_static.tar.gz - +resultsFile +opam_installer.sh diff --git a/scripts/archive_ezfio.sh b/scripts/archive_ezfio.sh deleted file mode 100755 index eb0298fc..00000000 --- a/scripts/archive_ezfio.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# Computes the MD5 digest of an EZFIO file, and creates a tar. -# Thu Apr 3 16:55:50 CEST 2014 - -if [[ -z ${QPACKAGE_ROOT} ]] -then - print "The QPACKAGE_ROOT environment variable is not set." - print "Please reload the quantum_package.rc file." -fi - -function archive() -{ - FILE="$1" - MD5="$2" - ARCHIVE="${QPACKAGE_ROOT}/data/cache/$MD5" - if [[ -f "$ARCHIVE" ]] - then - if ! diff "$FILE" "${QPACKAGE_ROOT}/data/cache/$MD5" &> /dev/null - then - echo "Something went wrong. The file" - echo "${QPACKAGE_ROOT}/data/cache/$MD5" - echo "is different from $FILE" - echo "Aborting" - return 1 - fi - else - cp "$FILE" "${QPACKAGE_ROOT}/data/cache/$MD5" - fi -} - - - - -EZFIO_FILE=$(basename ${1}) - -if [[ -z ${EZFIO_FILE} ]] -then - echo "Usage: $(basename $0) " - exit 1 -fi - - -cd "${QPACKAGE_ROOT}/EZFIO/src" -FILES=($(python << EOF | sort -from read_config import * -for group in groups: - if group == "ezfio": - continue - for d in groups[group]: - if d[2] == (): - suffix = "" - else: - suffix = ".gz" - print group+'/'+d[0]+suffix -print "ezfio/creation" -print "ezfio/library" -EOF -)) -cd $OLDPWD - -MD5_FILE=$(basename "${EZFIO_FILE}" .ezfio).md5 -rm -f -- "${MD5_FILE}" -for FILE in ${FILES[@]} -do - FILE="${EZFIO_FILE}/${FILE}" - MD5=$(md5sum "${FILE}" 2>/dev/null | cut -d ' ' -f 1) - if [[ ! -z $MD5 ]] - then - if ! archive "$FILE" "$MD5" - then - rm -- "${MD5_FILE}" - exit 1 - fi - echo "$MD5" "$FILE" >> "${MD5_FILE}" - fi -done - diff --git a/scripts/build_modules.sh b/scripts/build_modules.sh new file mode 100755 index 00000000..5aedc105 --- /dev/null +++ b/scripts/build_modules.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# This script should run from the directory $QPACKAGE_ROOT/src + +source ${QPACKAGE_ROOT}/scripts/run_Makefile_global.sh + +NPROC=$(cat /proc/cpuinfo | grep MHz | wc -l) + +export IN_MAKE=1 + +for MODULE in $@ +do + if [[ ! -d ${MODULE} ]] + then + error "Module ${MODULE} doesn't exist" + fi + cd ${MODULE} + echo ${MODULE} + ${QPACKAGE_ROOT}/scripts/run_Makefile_common.sh + if [[ $# -eq 1 ]] + then + env make -j ${NPROC} all + else + env make -j ${NPROC} all &> make.log + if [[ $? -ne 0 ]] + then + cat make.log + error " +Build failed for module $MODULE +" + fi + fi + cd ${OLDPWD} +done diff --git a/scripts/check_dependencies.sh b/scripts/check_dependencies.sh index 9e856c41..f21dbc40 100755 --- a/scripts/check_dependencies.sh +++ b/scripts/check_dependencies.sh @@ -10,13 +10,13 @@ # read in the Makefile. # Thu Apr 3 01:44:23 CEST 2014 -function unique_list() -{ - for d in $@ - do - echo $d - done | sort | uniq -} +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh if [[ -z $1 ]] then diff --git a/scripts/clean_modules.sh b/scripts/clean_modules.sh new file mode 100755 index 00000000..cc25cede --- /dev/null +++ b/scripts/clean_modules.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Cleans a module directory + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +function do_clean() +{ + rm -rf -- \ + IRPF90_temp IRPF90_man Makefile.depend $(cat NEEDED_MODULES) include \ + ezfio_interface.irp.f irpf90.make irpf90_entities tags $(ls_exe) +} + +if [[ -z $1 ]] +then + check_current_dir_is_module + do_clean +else + check_current_dir_is_src + for i in $@ + do + if [[ -d $i ]] + then + cd $i + do_clean + cd $OLDPWD + fi + done +fi + diff --git a/scripts/create_Makefile.sh b/scripts/create_Makefile.sh index f0cbf963..e04b99fc 100755 --- a/scripts/create_Makefile.sh +++ b/scripts/create_Makefile.sh @@ -6,17 +6,17 @@ # module directory. # Thu Apr 3 01:44:41 CEST 2014 -MODULE=$(basename "$PWD") - -if [[ "$MODULE" == "src" ]] +if [[ -z ${QPACKAGE_ROOT} ]] then - echo "Error: This script should not be run in the src directory." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_module cat << EOF > Makefile -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/scripts/create_Makefile_depend.sh b/scripts/create_Makefile_depend.sh index 6edd9843..56e1c5e0 100755 --- a/scripts/create_Makefile_depend.sh +++ b/scripts/create_Makefile_depend.sh @@ -6,9 +6,19 @@ # files included by including other modules. # Thu Apr 3 01:44:09 CEST 2014 +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_module + SRC="" OBJ="" -DEPS="$(cat NEEDED_MODULES)" +DEPS="$NEEDED_MODULES" for M in ${DEPS} do diff --git a/scripts/create_Needed_modules.sh b/scripts/create_Needed_modules.sh index 9b08b127..026eadab 100755 --- a/scripts/create_Needed_modules.sh +++ b/scripts/create_Needed_modules.sh @@ -4,13 +4,15 @@ # This script is supposed to run in a module directory. # Thu Apr 3 13:38:38 CEST 2014 -MODULE=$(basename $PWD) - -if [[ $MODULE == "src" ]] +if [[ -z ${QPACKAGE_ROOT} ]] then - echo "Error: This script should not be run in the src directory." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_module OUTPUT=$(${QPACKAGE_ROOT}/scripts/check_dependencies.sh $@) echo ${OUTPUT} > NEEDED_MODULES diff --git a/scripts/create_gitignore.sh b/scripts/create_gitignore.sh index 2c249bb6..605b0ab8 100755 --- a/scripts/create_gitignore.sh +++ b/scripts/create_gitignore.sh @@ -5,6 +5,16 @@ # Tue Jan 13 14:18:05 CET 2015 # +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_module + cat << EOF > .gitignore # # Do not modify this file. Add your ignored files to the gitignore diff --git a/scripts/create_module.sh b/scripts/create_module.sh index 74362bc7..dbddc3d3 100755 --- a/scripts/create_module.sh +++ b/scripts/create_module.sh @@ -7,7 +7,17 @@ # All remaining aruments are dependencies. # Thu Apr 3 01:44:58 CEST 2014 -DEBUG=1 +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_src + +DEBUG=0 # If DEBUG=1, the print debug info. function debug() @@ -36,13 +46,6 @@ function fail() } -if [[ -z $QPACKAGE_ROOT ]] -then - echo "Error:" - echo "QPACKAGE_ROOT environment variable is not set." - echo "source quantum_package.rc" - exit 1 -fi MODULE=$1 @@ -68,7 +71,7 @@ debug "Module does not already exist: OK" # Set up dependencies -ALL_MODULES="$(cat NEEDED_MODULES)" +ALL_MODULES="${NEEDED_MODULES}" echo "Select which modules you are sure you will need: (press q to quit)" NEEDED_MODULES="" select M in ${ALL_MODULES} diff --git a/scripts/create_rst_templates.sh b/scripts/create_rst_templates.sh index d78f49f3..931701ee 100755 --- a/scripts/create_rst_templates.sh +++ b/scripts/create_rst_templates.sh @@ -3,24 +3,15 @@ # Creates the rst files when creating a new module. # Thu Apr 3 11:54:16 CEST 2014 -MODULE=$(basename $PWD) - -if [[ $MODULE == "src" ]] +if [[ -z ${QPACKAGE_ROOT} ]] then - echo "Error: This script should not be run in the src directory." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh -function asksure() { - echo -n $@ "(Y/N) " - answer=w - while [[ $answer != [YyNn] ]] - do - read answer - [[ $answer = [Yy] ]] && retval=0 || retval=1 - done - return $retval -} +check_current_dir_is_module README="True" if [[ -f README.rst ]] diff --git a/scripts/ezfio_interface.py b/scripts/ezfio_interface.py index beebd8a2..ed7ebfc9 100755 --- a/scripts/ezfio_interface.py +++ b/scripts/ezfio_interface.py @@ -184,15 +184,26 @@ def save_ezfio_provider(path_head, dict_code_provider): path = "{0}/ezfio_interface.irp.f".format(path_head) - print "Path = {}".format(path) +# print "Path = {}".format(path) - with open(path, "w") as f: - f.write("!DO NOT MODIFY BY HAND \n") - f.write("!Created by $QPACKAGE_ROOT/scripts/ezfio_interface.py \n") - f.write("!from file {0}/EZFIO.cfg\n".format(path_head)) - f.write("\n") - for provider_name, code in dict_code_provider.iteritems(): - f.write(code + "\n") + try: + f = open(path, "r") + except IOError: + old_output = "" + else: + old_output = f.read() + f.close() + + output = "! DO NOT MODIFY BY HAND\n" + \ + "! Created by $QPACKAGE_ROOT/scripts/ezfio_interface.py\n" + \ + "! from file {0}/EZFIO.cfg\n".format(path_head) + \ + "\n" + for provider_name, code in dict_code_provider.iteritems(): + output += code + "\n" + + if output != old_output: + with open(path, "w") as f: + f.write(output) def create_ezfio_config(dict_ezfio_cfg, opt, folder): @@ -220,10 +231,19 @@ def save_ezfio_config(folder, str_ezfio_config): path = "{0}/config/{1}.ezfio_interface_config".format(ezfio_dir, folder) - print "Path = {}".format(path) +# print "Path = {}".format(path) - with open(path, "w") as f: - f.write(str_ezfio_config) + try: + f = open(path, "r") + except IOError: + old_output = "" + else: + old_output = f.read() + f.close() + + if str_ezfio_config != old_output: + with open(path, "w") as f: + f.write(str_ezfio_config) def main(): """Take in argument a EZFIO.cfg""" @@ -238,28 +258,25 @@ def main(): path = os.path.expanduser(path) path = os.path.expandvars(path) path = os.path.abspath(path) - print path +# print path path_dirname = os.path.dirname(path) folder = [i for i in path_dirname.split("/") if i][-1] folder = folder.lower() - print "Find a EZFIO.cfg in {}".format(path) +# print "Found a EZFIO.cfg in {}".format(path) dict_info_provider = get_dict_config_file(path,folder) - print "Generating the ezfio_interface.irp.f: \n" +# print "Generating the ezfio_interface.irp.f: \n" d_config = create_ezfio_provider(dict_info_provider) -# for provider, code in d_config.iteritems(): -# print code - print "Saving the ezfio_interface.irp.f" +# print "Saving the ezfio_interface.irp.f" save_ezfio_provider(path_dirname, d_config) - print "Generating the ezfio_config" +# print "Generating the ezfio_config" config_ezfio = create_ezfio_config(dict_info_provider, "config", folder) -# print config_ezfio - print "Saving ezfio_config" +# print "Saving ezfio_config" save_ezfio_config(folder, config_ezfio) diff --git a/scripts/get_basis.sh b/scripts/get_basis.sh index d6182799..51b0a4f0 100755 --- a/scripts/get_basis.sh +++ b/scripts/get_basis.sh @@ -8,6 +8,13 @@ # Prints in stdout the name of a temporary file containing the basis set. # +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi + export EMSL_API_ROOT="${QPACKAGE_ROOT}"/EMSL_Basis/ export PYTHONPATH="${EMSL_API_ROOT}":${PYTHONPATH} @@ -15,8 +22,11 @@ tmpfile="$1" shift # Case insensitive basis in input -basis=$( ${EMSL_API_ROOT}/EMSL_api.py list_basis | cut -d "'" -f 2 | grep -i "^${1}\$") +#basis=$( ${EMSL_API_ROOT}/EMSL_api.py list_basis | cut -d "'" -f 2 | grep -i "^${1}\$") + +basis="$1" shift + atoms="" for atom in $@ diff --git a/scripts/install_curl.sh b/scripts/install_curl.sh index afe49839..20033f77 100755 --- a/scripts/install_curl.sh +++ b/scripts/install_curl.sh @@ -6,12 +6,11 @@ CURL="curl-7.30.0.ermine" CURL_URL="http://qmcchem.ups-tlse.fr/files/scemama/${CURL}.tar.bz2" -# Check the QPACKAGE_ROOT directory if [[ -z ${QPACKAGE_ROOT} ]] then - echo "The QPACKAGE_ROOT environment variable is not set." - echo "Please reload the quantum_package.rc file." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi cd ${QPACKAGE_ROOT} diff --git a/scripts/install_emsl.sh b/scripts/install_emsl.sh index dae8f670..dff002a1 100755 --- a/scripts/install_emsl.sh +++ b/scripts/install_emsl.sh @@ -6,18 +6,18 @@ BASE="EMSL_Basis_Set_Exchange_Local" URL="https://github.com/LCPQ/${BASE}/archive/master.tar.gz" -# Check the QPACKAGE_ROOT directory if [[ -z ${QPACKAGE_ROOT} ]] then - echo "The QPACKAGE_ROOT environment variable is not set." - echo "Please reload the quantum_package.rc file." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi cd ${QPACKAGE_ROOT} ${QPACKAGE_ROOT}/scripts/fetch_from_web.py ${URL} ${QPACKAGE_ROOT}/${BASE}.tar.gz tar -zxf ${BASE}.tar.gz && rm ${BASE}.tar.gz ||exit 1 +rm -rf EMSL_Basis mv ${BASE}-master EMSL_Basis diff --git a/scripts/install_ezfio.sh b/scripts/install_ezfio.sh index e43363cf..0f7a6505 100755 --- a/scripts/install_ezfio.sh +++ b/scripts/install_ezfio.sh @@ -6,17 +6,15 @@ BASE="ezfio" URL="https://github.com/LCPQ/${BASE}/archive/master.tar.gz" -# Check the QPACKAGE_ROOT directory if [[ -z ${QPACKAGE_ROOT} ]] then - echo "The QPACKAGE_ROOT environment variable is not set." - echo "Please reload the quantum_package.rc file." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi cd ${QPACKAGE_ROOT} - rm -rf -- EZFIO ${QPACKAGE_ROOT}/scripts/fetch_from_web.py ${URL} ${QPACKAGE_ROOT}/${BASE}.tar.gz tar -zxf ${BASE}.tar.gz && rm ${BASE}.tar.gz ||exit 1 diff --git a/scripts/install_ocaml.sh b/scripts/install_ocaml.sh index 3c695df4..9e89fb68 100755 --- a/scripts/install_ocaml.sh +++ b/scripts/install_ocaml.sh @@ -45,7 +45,8 @@ then done fi fi -scripts/fetch_from_web.py "https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh" opam_installer.sh +${QPACKAGE_ROOT}/scripts/fetch_from_web.py \ + "https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh" opam_installer.sh chmod +x opam_installer.sh echo N | ./opam_installer.sh ${QPACKAGE_ROOT}/bin @@ -53,6 +54,7 @@ if [[ ! -f ${QPACKAGE_ROOT}/bin/opam ]]; then echo "Installation of OPAM failed" exit 2 fi +rm opam_installer.sh ${QPACKAGE_ROOT}/bin/opam config setup -a --dot-profile ${QPACKAGE_ROOT}/quantum_package.rc source ${QPACKAGE_ROOT}/quantum_package.rc diff --git a/scripts/prepare_ezfio.sh b/scripts/prepare_ezfio.sh new file mode 100755 index 00000000..c01bacd3 --- /dev/null +++ b/scripts/prepare_ezfio.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Prepares the EZFIO library before running make +# Wed Mar 25 21:25:11 CET 2015 + +echo "Building EZFIO library" +echo "=-=-=-=-=-=-=-=-=-=-=-" + +# Interpret all the EZFIO.cfg files +for dir in ${QPACKAGE_ROOT}/src/*/ +do + cd $dir || exit -1 + ${QPACKAGE_ROOT}/scripts/ezfio_interface.py +done + +# For old-style directories. Will be removed some day... +cp ${QPACKAGE_ROOT}/src{/*,}/*.ezfio_config ${QPACKAGE_ROOT}/EZFIO/config + + diff --git a/scripts/prepare_module.sh b/scripts/prepare_module.sh deleted file mode 100755 index 287c3663..00000000 --- a/scripts/prepare_module.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# This script is used by module Makefiles, and should not be used by users. -# Checks if all the other module directories are properly linked in the -# current directory. If not, the links are created. -# Wed Apr 2 14:35:42 CEST 2014 - -for dir in $@ -do - if [[ ! -h $dir ]] ; - then - ln -s ../$dir $dir - fi -done - - diff --git a/scripts/qp_include.sh b/scripts/qp_include.sh new file mode 100644 index 00000000..467baca8 --- /dev/null +++ b/scripts/qp_include.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# +# Useful functions in all scripts + +# Make a list unique +function unique_list() +{ + for d in $@ + do + echo $d + done | sort | uniq +} + +function check_current_dir_is_src() +{ + if [[ "${PWD}" == "${QPACKAGE_ROOT}/src" ]] + then + return 0 + else + echo "Current directory should be \$QPACKAGE_ROOT/src" + exit -1 + fi +} + +function check_current_dir_is_module() +{ + cd .. + if [[ "${PWD}" == "${QPACKAGE_ROOT}/src" ]] + then + cd $OLDPWD + return 0 + else + cd $OLDPWD + echo "Current directory should be \$QPACKAGE_ROOT/src" + exit -1 + fi +} +if [[ -f NEEDED_MODULES ]] +then + NEEDED_MODULES=$(cat NEEDED_MODULES) +fi + +# List of executables in the current directory +function ls_exe() +{ + find . -perm /u+x -type f +} + +function asksure() { + echo -n $@ "(Y/N) " + answer=w + while [[ $answer != [YyNn] ]] + do + read answer + [[ $answer = [Yy] ]] && retval=0 || retval=1 + done + return $retval +} + +function error() +{ + echo "-------------------- Error --------------------" + printf "$@\n" + echo "-----------------------------------------------" + exit -1 +} + +if [[ -z ${DEBUG} ]] +then + function info () + { + : + } +else + function info () + { + echo "$@" + } +fi + diff --git a/scripts/run_Makefile_common.sh b/scripts/run_Makefile_common.sh new file mode 100755 index 00000000..0a579a94 --- /dev/null +++ b/scripts/run_Makefile_common.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# Checks to run in every Module directory before building + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_module + +# Check if the NEEDED_MODULES file is consistent +INCLUDE_DIRS="${NEEDED_MODULES} include" +NEEDED_MODULES_OK=$( ${QPACKAGE_ROOT}/scripts/check_dependencies.sh ${NEEDED_MODULES} ) +if [[ $? -ne 0 ]] +then + error " +Your NEEDED_MODULES file is inconsistent. It should be +${NEEDED_MODULES_OK} +" +else + info "NEEDED_MODULES files is consistent" +fi + +# Check if README.rst exists +if [[ ! -f README.rst ]] +then + ${QPACKAGE_ROOT}/scripts/create_rst_templates.sh + error " +README.rst was not present, so I created a +default one for you. +You should document it before you compile, as +well as the ASSUMPTIONS.rst file. +" +else + info "README.rst is present" +fi + + +# Check if ASSUMPTIONS.rst exists +if [[ ! -f ASSUMPTIONS.rst ]] +then + error "This is a Bug. At that point, the ASSUMPTIONS.rst) file should exist." +else + info "ASSUMPTIONS.rst is present." +fi + + +# Create symbolic links of other modules +if [[ $PWD != ${QPACKAGE_ROOT}/src ]] +then + for dir in ${INCLUDE_DIRS} + do + if [[ ! -h $dir ]] ; + then + ln -s ../$dir $dir + fi + done +fi + +# Update Makefile.depend +${QPACKAGE_ROOT}/scripts/create_Makefile_depend.sh + +# Update EZFIO interface +${QPACKAGE_ROOT}/scripts/ezfio_interface.py + diff --git a/scripts/run_Makefile_global.sh b/scripts/run_Makefile_global.sh new file mode 100755 index 00000000..82dee8ab --- /dev/null +++ b/scripts/run_Makefile_global.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# Makes several checks before compiling. +# Wed Mar 25 21:22:18 CET 2015 + +# Required EZFIO version +EZFIO_REQUIRED_VERSION=1.1 + +# Required IRPF90 version +IRPF90_REQUIRED_VERSION=1.5 + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_src + + +# Check if the user's config exists +if [[ ! -f ${QPACKAGE_ROOT}/src/Makefile.config ]] +then + error " +Makefile.config is not present. +You can create Makefile.config +by modifying Makefile.config.example +" +else + info "Makefile.config is present" +fi + + +IRPF90_VERSION=$( ${IRPF90} -v ) +python << EOF +import sys +irp_version = float("${IRPF90_VERSION}".rsplit('.',1)[0]) +irp_required_version = float($IRPF90_REQUIRED_VERSION) +if irp_version < irp_required_version: + sys.exit(-1) +EOF + +if [[ $? -ne 0 ]] +then + error " +Current IRPF90 version : +\$ ${IRPF90} -v +${IRPF90_VERSION}. + +IRPF90 version >= ${IRPF90_REQUIRED_VERSION} is required. +To upgrade IRPF90, run : + ${QPACKAGE_ROOT}/scripts/upgrade_irpf90.sh +" +else + info "irpf90 version is OK" +fi + + +# Check EZFIO version +EZFIO_VERSION=$(cat ${QPACKAGE_ROOT}/EZFIO/version | cut -d '=' -f 2) +python << EOF +import sys +ezfio_version = float("${EZFIO_VERSION}".rsplit('.',1)[0]) +ezfio_required_version = float($EZFIO_REQUIRED_VERSION) +if ezfio_version < ezfio_required_version: + sys.exit(-1) +EOF + +if [[ $? -ne 0 ]] +then + error " +Current EZFIO version : ${EZFIO_VERSION} +EZFIO version >= ${EZFIO_REQUIRED_VERSION} is required. +To upgrade EZFIO, run : + ${QPACKAGE_ROOT}/scripts/upgrade_ezfio.sh +" +else + info "EZFIO version is OK" +fi + diff --git a/scripts/save_current_mos.sh b/scripts/save_current_mos.sh index 941f4ed8..36149ae2 100755 --- a/scripts/save_current_mos.sh +++ b/scripts/save_current_mos.sh @@ -4,6 +4,13 @@ # directory, where xxx is the corresponding mo_label. # Wed Apr 2 14:35:15 CEST 2014 +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi + EZFIO=$1 if [[ -z ${EZFIO} ]] diff --git a/scripts/unarchive_ezfio.sh b/scripts/unarchive_ezfio.sh deleted file mode 100755 index 7f70fa6e..00000000 --- a/scripts/unarchive_ezfio.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# Reads a *.md5 file, then fetches the proper data in the -# cache and re-creates the EZFIO database. -# If the cache data is not present, download it from -# $QPACKAGE_CACHE_URL -# Fri Apr 4 01:02:53 CEST 2014 - -if [[ -z ${QPACKAGE_ROOT} ]] -then - print "The QPACKAGE_ROOT environment variable is not set." - print "Please reload the quantum_package.rc file." -fi - -EZFIO_FILE=$(basename $(basename ${1} .md5)) - -if [[ -z $1 ]] -then - echo "Usage: $(basename $0) " - exit 1 -fi - -if [[ ! -f ${EZFIO_FILE}.md5 ]] -then - echo "Error: ${EZFIO_FILE}.md5 does not exist." - exit 1 -fi - -key=($(cut -d ' ' -f 1 ${EZFIO_FILE}.md5)) -filename=($(cut -d ' ' -f 2 ${EZFIO_FILE}.md5)) - -if [[ -z ${QPACKAGE_CACHE_URL} ]] -then - echo "Error: The QPACKAGE_CACHE_URL environment variable is not set." - exit 1 -fi - -VERSION=$( cut -d '=' -f 2 < ${QPACKAGE_ROOT}/EZFIO/version) -for i in ${!key[@]} -do - MD5=${key[$i]} - file=${filename[$i]} - if [[ ! -d $file ]] - then - mkdir -p $(dirname $file) - echo ${VERSION} > $(dirname $file)/.version - fi - if [[ ! -f ${QPACKAGE_ROOT}/data/cache/${MD5} ]] - then - ${QPACKAGE_ROOT}/scripts/fetch_from_web.py ${QPACKAGE_CACHE_URL}/${MD5} ${QPACKAGE_ROOT}/data/cache/${MD5} - fi - cp ${QPACKAGE_ROOT}/data/cache/${MD5} ${file} -done -echo ${VERSION} > ${EZFIO_FILE}.ezfio/.version diff --git a/scripts/upgrade_ezfio.sh b/scripts/upgrade_ezfio.sh index daa51405..4a9af403 100755 --- a/scripts/upgrade_ezfio.sh +++ b/scripts/upgrade_ezfio.sh @@ -12,7 +12,7 @@ fi cd -- ${QPACKAGE_ROOT} mv -- ${QPACKAGE_ROOT}/EZFIO ${QPACKAGE_ROOT}/EZFIO.old -make EZFIO +${QPACKAGE_ROOT}/scripts/install_ezfio.sh if [[ $? -eq 0 ]] then diff --git a/setup_environment.sh b/setup_environment.sh index c0d8b0ce..9fe24c96 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -75,6 +75,9 @@ source ${QPACKAGE_ROOT}/quantum_package.rc " $BLACK +mkdir -f install_logs +mv *.log install_logs/ + if [[ $1 == "--robot" ]] ; then exit 0 diff --git a/src/AOs/Makefile b/src/AOs/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/AOs/Makefile +++ b/src/AOs/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/BiInts/Makefile b/src/BiInts/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/BiInts/Makefile +++ b/src/BiInts/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Bitmask/Makefile b/src/Bitmask/Makefile index fa91d467..d230cb0c 100644 --- a/src/Bitmask/Makefile +++ b/src/Bitmask/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC=bitmasks_module.f90 diff --git a/src/CAS_SD_selected/Makefile b/src/CAS_SD_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CAS_SD_selected/Makefile +++ b/src/CAS_SD_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CID/Makefile b/src/CID/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CID/Makefile +++ b/src/CID/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CID_SC2_selected/Makefile b/src/CID_SC2_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CID_SC2_selected/Makefile +++ b/src/CID_SC2_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CID_selected/Makefile b/src/CID_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CID_selected/Makefile +++ b/src/CID_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CIS/Makefile b/src/CIS/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CIS/Makefile +++ b/src/CIS/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CISD/Makefile b/src/CISD/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CISD/Makefile +++ b/src/CISD/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CISD_SC2_selected/Makefile b/src/CISD_SC2_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CISD_SC2_selected/Makefile +++ b/src/CISD_SC2_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CISD_selected/Makefile b/src/CISD_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CISD_selected/Makefile +++ b/src/CISD_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/DDCI_selected/Makefile b/src/DDCI_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/DDCI_selected/Makefile +++ b/src/DDCI_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Dets/Makefile b/src/Dets/Makefile index f97f77c0..092d879d 100644 --- a/src/Dets/Makefile +++ b/src/Dets/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC=H_apply_template.f diff --git a/src/Electrons/Makefile b/src/Electrons/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Electrons/Makefile +++ b/src/Electrons/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Ezfio_files/Makefile b/src/Ezfio_files/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Ezfio_files/Makefile +++ b/src/Ezfio_files/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/FCIdump/Makefile b/src/FCIdump/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/FCIdump/Makefile +++ b/src/FCIdump/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Full_CI/Makefile b/src/Full_CI/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Full_CI/Makefile +++ b/src/Full_CI/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Generators_CAS/Makefile b/src/Generators_CAS/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Generators_CAS/Makefile +++ b/src/Generators_CAS/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Generators_full/Makefile b/src/Generators_full/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Generators_full/Makefile +++ b/src/Generators_full/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Generators_restart/Makefile b/src/Generators_restart/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Generators_restart/Makefile +++ b/src/Generators_restart/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Hartree_Fock/Makefile b/src/Hartree_Fock/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Hartree_Fock/Makefile +++ b/src/Hartree_Fock/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/MOGuess/Makefile b/src/MOGuess/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/MOGuess/Makefile +++ b/src/MOGuess/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/MOs/Makefile b/src/MOs/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/MOs/Makefile +++ b/src/MOs/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/MP2/Makefile b/src/MP2/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/MP2/Makefile +++ b/src/MP2/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Makefile b/src/Makefile index 307197fe..cd8ce65b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,19 +1,24 @@ -default: all +ifndef QPACKAGE_ROOT + $(error "QPACKAGE_ROOT is not defined. Please source quantum_package.rc") +endif -SRC= -OBJ= +include Makefile.config ALL_MODULES=$(shell cat NEEDED_MODULES) +EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO +EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a -.PHONY: executables all all_clean $(ALL_MODULES) +.PHONY: $(ALL_MODULES) -all: $(ALL_MODULES) -all_clean: - @for i in $(ALL_MODULES) ; do cd $$i ; make veryclean ; make clean_links ; cd .. ; done +default: $(EZFIO) + $(QPACKAGE_ROOT)/scripts/build_modules.sh $(ALL_MODULES) -$(ALL_MODULES): FORCE - cd $@ ; make -j $$(cat /proc/cpuinfo | grep MHz | wc -l) +veryclean: + $(QPACKAGE_ROOT)/scripts/clean_modules.sh $(ALL_MODULES) + +$(ALL_MODULES): $(EZFIO) + $(QPACKAGE_ROOT)/scripts/build_modules.sh $@ executables: $(ALL_MODULES) rm -f executables ; \ @@ -21,7 +26,15 @@ executables: $(ALL_MODULES) do printf "%-30s %s\n" $$(basename $$EXE) $$EXE | sed "s|$(QPACKAGE_ROOT)|\$$QPACKAGE_ROOT|g" >> executables ;\ done -# Dummy rule to enable to force recompilation -FORCE: +# Define the EZFIO rules +$(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/EZFIO.cfg) + $(QPACKAGE_ROOT)/scripts/prepare_ezfio.sh + cd $(EZFIO_DIR);\ + export FC="$(FC)" ; export FCFLAGS="$(FCFLAGS)" ; export IRPF90="$(IRPF90)" ;\ + $(MAKE) ;\ + $(MAKE) Python + +# Frequent typos +clena: clean +veryclena: veryclean -veryclean: all_clean diff --git a/src/Makefile.common b/src/Makefile.common index 7b63f772..9ecc93c0 100644 --- a/src/Makefile.common +++ b/src/Makefile.common @@ -1,160 +1,34 @@ -.PHONY: default +.PHONY: default silent + +ifneq ($(IN_MAKE),1) + +default: + @$(MAKE) -C $(QPACKAGE_ROOT)/src $$(basename $(PWD)) + +veryclean: + clean_modules.sh + +else # Called by scripts/build_module.sh default: all .gitignore -# Required EZFIO version -EZFIO_VERSION=1.1 - -# Required IRPF90 version -IRPF90_VERSION=1.4 - -# Check if QPACKAGE_ROOT is defined - -ifndef QPACKAGE_ROOT -$(info -------------------- Error --------------------) -$(info QPACKAGE_ROOT undefined. Run the setup_environment.sh script) -$(info -----------------------------------------------) -$(error ) -#else -#$(info QPACKAGE_ROOT is defined.) -endif - - -# Check if the user's config exists - -MAKEFILE_OK=$(shell ls $(QPACKAGE_ROOT)/src/Makefile.config 2> /dev/null && echo True || echo False) -ifeq ($(MAKEFILE_OK),False) -$(info -------------------- Error --------------------) -$(info Makefile.config is not present.) -$(info You can create Makefile.config) -$(info by modifying Makefile.config.example) -$(info -----------------------------------------------) -$(error ) -#else -#$(info Makefile.config is present.) -endif - - # Include the user's config - include $(QPACKAGE_ROOT)/src/Makefile.config - -# Check the version of IRPF90 - -IRP_VERSION_OK=$(shell $(IRPF90) -v | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= $(IRPF90_VERSION)") -ifeq ($(IRP_VERSION_OK),False) -$(info -------------------- Error --------------------) -$(info IRPF90 version >= $(IRPF90_VERSION) is required) -$(info To upgrade IRPF90, run : ) -$(info $(QPACKAGE_ROOT)/scripts/upgrade_irpf90.sh ) -$(info -----------------------------------------------) -$(error ) -#else -#$(info irpf90 version is OK.) -endif - - # Create the NEEDED_MODULES variable, needed for IRPF90 - NEEDED_MODULES=$(shell cat NEEDED_MODULES) - -# Check if the NEEDED_MODULES file is consistent - -NEEDED_MODULES_OK=$(shell X=`$(QPACKAGE_ROOT)/scripts/check_dependencies.sh $(NEEDED_MODULES)` && echo OK || echo $$X) -ifneq ($(NEEDED_MODULES_OK),OK) -$(info -------------------- Error --------------------) -$(info Your NEEDED_MODULES file is inconsistent. It should be) -$(info $(NEEDED_MODULES_OK)) -$(info -----------------------------------------------) -$(error ) -#else -#$(info NEEDED_MODULES files is consistent.) -endif - - # Check and update dependencies - include Makefile.depend -# Check if README.rst exists - -README_RST_OK=$(shell ls README.rst 2>/dev/null || echo False) -ifeq ($(README_RST_OK), False) -$(shell $(QPACKAGE_ROOT)/scripts/create_rst_templates.sh) -$(info -------------------- Error --------------------) -$(info README.rst was not present, so I created a) -$(info default one for you.) -$(info You should document it before you compile, as) -$(info well as the ASSUMPTIONS.rst file.) -$(info -----------------------------------------------) -$(error ) -#else -#$(info README.rst is present.) -endif - - -# Check if ASSUMPTIONS.rst exists - -ASSUMPTIONS_RST_OK=$(shell ls ASSUMPTIONS.rst || echo False) -ifeq ($(ASSUMPTIONS_RST_OK), False) -$(info -------------------- Error --------------------) -$(info This is a Bug. At that point, the ASSUMPTIONS.rst) -$(info file should exist.) -$(info -----------------------------------------------) -#else -#$(info ASSUMPTIONS.rst is present.) -endif - - # Define the Makefile common variables - EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a INCLUDE_DIRS=$(NEEDED_MODULES) include -# Check EZFIO version - -EZFIO_VERSION_OK=$(shell cat $(EZFIO_DIR)/version | cut -d '=' -f 2 | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= $(EZFIO_VERSION)") -ifeq ($(EZFIO_VERSION_OK),False) -$(info -------------------- Error --------------------) -$(info EZFIO version >= $(EZFIO_VERSION) is required ) -$(info To upgrade EZFIO, run : ) -$(info $(QPACKAGE_ROOT)/scripts/upgrade_ezfio.sh ) -$(info -----------------------------------------------) -$(error ) -#else -#$(info EZFIO version is OK.) -endif - -# Define the EZFIO rules - -$(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/EZFIO.cfg) - @echo Building EZFIO library - @echo =-=-=-=-=-=-=-=-=-=-=- - for dir in $(QPACKAGE_ROOT)/src/*/ ;\ - do \ - cd $$dir && \ - $(QPACKAGE_ROOT)/scripts/ezfio_interface.py && \ - cd .. ;\ - done - cp $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(EZFIO_DIR)/config - cd $(EZFIO_DIR) ; export FC="$(FC)" ; export FCFLAGS="$(FCFLAGS)" ; export IRPF90="$(IRPF90)" ; $(MAKE) ; $(MAKE) Python - -ezfio: $(EZFIO) - - -# Create symbolic links of other modules - -ifneq ($(PWD),$(QPACKAGE_ROOT)/src) -$(shell $(QPACKAGE_ROOT)/scripts/prepare_module.sh $(INCLUDE_DIRS)) clean_links: rm -f $(INCLUDE_DIRS) $$(basename $$PWD) -else -clean_links: -endif LIB+=$(EZFIO) $(MKL) IRPF90+=$(patsubst %, -I %, $(INCLUDE_DIRS)) $(IRPF90_FLAGS) @@ -163,22 +37,14 @@ irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp - $(IRPF90) - update_README.py -Makefile.depend: Makefile - $(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh - -ifneq ( $(PWD), $($(QPACKAGE_ROOT)/src)) include irpf90.make + endif -# Dummy rule to enable to force recompilation -FORCE: - -vercylean: veryclean - .gitignore: $(QPACKAGE_ROOT)/scripts/create_gitignore.sh - # Frequent typos clena: clean veryclena: veryclean +vercylean: veryclean diff --git a/src/Molden/Makefile b/src/Molden/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Molden/Makefile +++ b/src/Molden/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/MonoInts/Makefile b/src/MonoInts/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/MonoInts/Makefile +++ b/src/MonoInts/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/NEEDED_MODULES b/src/NEEDED_MODULES index 84057d07..3df2ab88 100644 --- a/src/NEEDED_MODULES +++ b/src/NEEDED_MODULES @@ -1 +1 @@ -AOs BiInts Bitmask Dets Electrons Ezfio_files Full_CI Generators_full Hartree_Fock MOGuess MonoInts MOs Nuclei Output Selectors_full Utils Molden FCIdump Generators_CAS CAS_SD_selected DDCI_selected +AOs BiInts Bitmask CID CID_SC2_selected CID_selected CIS CISD CISD_selected CISD_SC2_selected Dets Electrons Ezfio_files Full_CI Generators_full Hartree_Fock MOGuess MonoInts MOs MP2 Nuclei Output Selectors_full Utils Molden FCIdump Generators_CAS CAS_SD_selected DDCI_selected diff --git a/src/Nuclei/Makefile b/src/Nuclei/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Nuclei/Makefile +++ b/src/Nuclei/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Output/Makefile b/src/Output/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Output/Makefile +++ b/src/Output/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Perturbation/Makefile b/src/Perturbation/Makefile index ea95cbf1..b668f388 100644 --- a/src/Perturbation/Makefile +++ b/src/Perturbation/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC=perturbation_template.f diff --git a/src/Properties/Makefile b/src/Properties/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Properties/Makefile +++ b/src/Properties/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Selectors_full/Makefile b/src/Selectors_full/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Selectors_full/Makefile +++ b/src/Selectors_full/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Selectors_no_sorted/Makefile b/src/Selectors_no_sorted/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Selectors_no_sorted/Makefile +++ b/src/Selectors_no_sorted/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/SingleRefMethod/Makefile b/src/SingleRefMethod/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/SingleRefMethod/Makefile +++ b/src/SingleRefMethod/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Utils/Makefile b/src/Utils/Makefile index 69065f55..aac09429 100644 --- a/src/Utils/Makefile +++ b/src/Utils/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC=map_module.f90 From cfb1aac93232a42e197f58824007753aba716e17 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Mar 2015 00:44:37 +0100 Subject: [PATCH 5/9] Repaired QP --- src/Bitmask/bitmask_cas_routines.irp.f | 18 +++--- src/Dets/save_for_casino.irp.f | 87 +++++++++++++++++++++++++- src/Properties/need.irp.f | 8 +-- src/Utils/abort.irp.f | 5 +- 4 files changed, 100 insertions(+), 18 deletions(-) diff --git a/src/Bitmask/bitmask_cas_routines.irp.f b/src/Bitmask/bitmask_cas_routines.irp.f index a2e8ef08..776d4546 100644 --- a/src/Bitmask/bitmask_cas_routines.irp.f +++ b/src/Bitmask/bitmask_cas_routines.irp.f @@ -214,13 +214,13 @@ logical function is_a_two_holes_two_particles(key_in) integer :: i,i_diff i_diff = 0 if(N_int == 1)then - i_diff = i_diff + & + i_diff = i_diff & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & + popcnt( iand( iand( xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1))), virt_bitmask(1,2) ), virt_bitmask(1,2)) ) else if(N_int == 2)then - i_diff = i_diff + & + i_diff = i_diff & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -231,7 +231,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(2,2),iand(key_in(2,2),cas_bitmask(2,2,1))), virt_bitmask(2,2) ), virt_bitmask(2,2)) ) else if(N_int == 3)then - i_diff = i_diff + & + i_diff = i_diff & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -245,7 +245,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(3,1),iand(key_in(3,1),cas_bitmask(3,1,1))), virt_bitmask(3,1) ), virt_bitmask(3,1)) ) & + popcnt( iand( iand( xor(key_in(3,2),iand(key_in(3,2),cas_bitmask(3,2,1))), virt_bitmask(3,2) ), virt_bitmask(3,2)) ) else if(N_int == 4)then - i_diff = i_diff + & + i_diff = i_diff & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -263,7 +263,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(4,1),iand(key_in(4,1),cas_bitmask(4,1,1))), virt_bitmask(4,1) ), virt_bitmask(4,1)) ) & + popcnt( iand( iand( xor(key_in(4,2),iand(key_in(4,2),cas_bitmask(4,2,1))), virt_bitmask(4,2) ), virt_bitmask(4,2)) ) else if(N_int == 5)then - i_diff = i_diff + & + i_diff = i_diff & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -285,7 +285,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(5,1),iand(key_in(5,1),cas_bitmask(5,1,1))), virt_bitmask(5,1) ), virt_bitmask(5,1)) ) & + popcnt( iand( iand( xor(key_in(5,2),iand(key_in(5,2),cas_bitmask(5,2,1))), virt_bitmask(5,2) ), virt_bitmask(5,2)) ) else if(N_int == 6)then - i_diff = i_diff + & + i_diff = i_diff & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -311,7 +311,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(6,1),iand(key_in(6,1),cas_bitmask(6,1,1))), virt_bitmask(6,1) ), virt_bitmask(6,1)) ) & + popcnt( iand( iand( xor(key_in(6,2),iand(key_in(6,2),cas_bitmask(6,2,1))), virt_bitmask(6,2) ), virt_bitmask(6,2)) ) else if(N_int == 7)then - i_diff = i_diff + & + i_diff = i_diff & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -341,7 +341,7 @@ logical function is_a_two_holes_two_particles(key_in) + popcnt( iand( iand( xor(key_in(7,1),iand(key_in(7,1),cas_bitmask(7,1,1))), virt_bitmask(7,1) ), virt_bitmask(7,1)) ) & + popcnt( iand( iand( xor(key_in(7,2),iand(key_in(7,2),cas_bitmask(7,2,1))), virt_bitmask(7,2) ), virt_bitmask(7,2)) ) else if(N_int == 8)then - i_diff = i_diff + & + i_diff = i_diff & + popcnt( xor( iand(inact_bitmask(1,1), xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1)))), inact_bitmask(1,1)) ) & + popcnt( xor( iand(inact_bitmask(1,2), xor(key_in(1,2),iand(key_in(1,2),cas_bitmask(1,2,1)))), inact_bitmask(1,2)) ) & + popcnt( iand( iand( xor(key_in(1,1),iand(key_in(1,1),cas_bitmask(1,1,1))), virt_bitmask(1,1) ), virt_bitmask(1,1)) ) & @@ -378,7 +378,7 @@ logical function is_a_two_holes_two_particles(key_in) else do i = 1, N_int - i_diff = i_diff + & + i_diff = i_diff & + popcnt( xor( iand(inact_bitmask(i,1), xor(key_in(i,1),iand(key_in(i,1),cas_bitmask(i,1,1)))), inact_bitmask(i,1)) ) & + popcnt( xor( iand(inact_bitmask(i,2), xor(key_in(i,2),iand(key_in(i,2),cas_bitmask(i,2,1)))), inact_bitmask(i,2)) ) & + popcnt( iand( iand( xor(key_in(i,1),iand(key_in(i,1),cas_bitmask(i,1,1))), virt_bitmask(i,1) ), virt_bitmask(i,1)) ) & diff --git a/src/Dets/save_for_casino.irp.f b/src/Dets/save_for_casino.irp.f index 0c18d1e2..631f79bd 100644 --- a/src/Dets/save_for_casino.irp.f +++ b/src/Dets/save_for_casino.irp.f @@ -4,6 +4,7 @@ subroutine save_casino character*(128) :: message integer :: getUnitAndOpen, iunit integer, allocatable :: itmp(:) + integer :: n_ao_new real, allocatable :: rtmp(:) PROVIDE ezfio_filename @@ -75,7 +76,8 @@ subroutine save_casino icount += 2*ao_l(i)+1 endif enddo - write(iunit,*) icount + n_ao_new = icount + write(iunit,*) n_ao_new write(iunit,'(A)') 'Number of Gaussian primitives per primitive cell' allocate(itmp(ao_num)) integer :: l @@ -175,6 +177,89 @@ subroutine save_casino write(iunit,'(A)') + write(iunit,'(A)') 'MULTIDETERMINANT INFORMATION' + write(iunit,'(A)') '----------------------------' + write(iunit,'(A)') 'GS' + write(iunit,'(A)') 'ORBITAL COEFFICIENTS' + write(iunit,'(A)') '------------------------' + + ! Transformation cartesian -> spherical + double precision :: tf2(6,5), tf3(10,7), tf4(15,9) + integer :: check2(3,6), check3(3,10), check4(3,15) + check2(:,1) = (/ 2, 0, 0 /) + check2(:,2) = (/ 1, 1, 0 /) + check2(:,3) = (/ 1, 0, 1 /) + check2(:,4) = (/ 0, 2, 0 /) + check2(:,5) = (/ 0, 1, 1 /) + check2(:,6) = (/ 0, 0, 2 /) + + check3(:,1) = (/ 3, 0, 0 /) + check3(:,2) = (/ 2, 1, 0 /) + check3(:,3) = (/ 2, 0, 1 /) + check3(:,4) = (/ 1, 2, 0 /) + check3(:,5) = (/ 1, 1, 1 /) + check3(:,6) = (/ 1, 0, 2 /) + check3(:,7) = (/ 0, 3, 0 /) + check3(:,8) = (/ 0, 2, 1 /) + check3(:,9) = (/ 0, 1, 2 /) + check3(:,10) = (/ 0, 0, 3 /) + + check4(:,1) = (/ 4, 0, 0 /) + check4(:,2) = (/ 3, 1, 0 /) + check4(:,3) = (/ 3, 0, 1 /) + check4(:,4) = (/ 2, 2, 0 /) + check4(:,5) = (/ 2, 1, 1 /) + check4(:,6) = (/ 2, 0, 2 /) + check4(:,7) = (/ 1, 3, 0 /) + check4(:,8) = (/ 1, 2, 1 /) + check4(:,9) = (/ 1, 1, 2 /) + check4(:,10) = (/ 1, 0, 3 /) + check4(:,11) = (/ 0, 4, 0 /) + check4(:,12) = (/ 0, 3, 1 /) + check4(:,13) = (/ 0, 2, 2 /) + check4(:,14) = (/ 0, 1, 3 /) + check4(:,15) = (/ 0, 0, 4 /) + +! tf2 = (/ +! -0.5, 0, 0, -0.5, 0, 1.0, & +! 0, 0, 1.0, 0, 0, 0, & +! 0, 0, 0, 0, 1.0, 0, & +! 0.86602540378443864676, 0, 0, -0.86602540378443864676, 0, 0, & +! 0, 1.0, 0, 0, 0, 0, & +! /) +! tf3 = (/ +! 0, 0, -0.67082039324993690892, 0, 0, 0, 0, -0.67082039324993690892, 0, 1.0, & +! -0.61237243569579452455, 0, 0, -0.27386127875258305673, 0, 1.0954451150103322269, 0, 0, 0, 0, & +! 0, -0.27386127875258305673, 0, 0, 0, 0, -0.61237243569579452455, 0, 1.0954451150103322269, 0, & +! 0, 0, 0.86602540378443864676, 0, 0, 0, 0, -0.86602540378443864676, 0, 0, & +! 0, 0, 0, 0, 1.0, 0, 0, 0, 0, 0, & +! 0.790569415042094833, 0, 0, -1.0606601717798212866, 0, 0, 0, 0, 0, 0, & +! 0, 1.0606601717798212866, 0, 0, 0, 0, -0.790569415042094833, 0, 0, 0, & +! /) +! tf4 = (/ +! 0.375, 0, 0, 0.21957751641341996535, 0, -0.87831006565367986142, 0, 0, 0, 0, 0.375, 0, -0.87831006565367986142, 0, 1.0, & +! 0, 0, -0.89642145700079522998, 0, 0, 0, 0, -0.40089186286863657703, 0, 1.19522860933439364, 0, 0, 0, 0, 0, & +! 0, 0, 0, 0, -0.40089186286863657703, 0, 0, 0, 0, 0, 0, -0.89642145700079522998, 0, 1.19522860933439364, 0, & +! -0.5590169943749474241, 0, 0, 0, 0, 0.9819805060619657157, 0, 0, 0, 0, 0.5590169943749474241, 0, -0.9819805060619657157, 0, 0, & +! 0, -0.42257712736425828875, 0, 0, 0, 0, -0.42257712736425828875, 0, 1.1338934190276816816, 0, 0, 0, 0, 0, 0, & +! 0, 0, 0.790569415042094833, 0, 0, 0, 0, -1.0606601717798212866, 0, 0, 0, 0, 0, 0, 0, & +! 0, 0, 0, 0, 1.0606601717798212866, 0, 0, 0, 0, 0, 0, -0.790569415042094833, 0, 0, 0, & +! 0.73950997288745200532, 0, 0, -1.2990381056766579701, 0, 0, 0, 0, 0, 0, 0.73950997288745200532, 0, 0, 0, 0, & +! 0, 1.1180339887498948482, 0, 0, 0, 0, -1.1180339887498948482, 0, 0, 0, 0, 0, 0, 0, 0, & +! /) +! + + + allocate(rtmp(ao_num*mo_tot_num)) + l=0 + do i=1,mo_tot_num + do j=1,ao_num + l += 1 + rtmp(l) = mo_coef(j,i) + enddo + enddo + write(iunit,'(4(1PE20.13))') rtmp(1:l) + deallocate(rtmp) close(iunit) end diff --git a/src/Properties/need.irp.f b/src/Properties/need.irp.f index eb4dfe34..22cb6a48 100644 --- a/src/Properties/need.irp.f +++ b/src/Properties/need.irp.f @@ -132,7 +132,7 @@ ! double precision function gammp(a,x) implicit double precision (a-h,o-z) - if(x.lt.0..or.a.le.0.)pause + if(x.lt.0..or.a.le.0.)stop 'error in gammp' if(x.lt.a+1.)then call gser(gammp,a,x,gln) else @@ -169,7 +169,7 @@ parameter (itmax=100,eps=3.e-7) gln=gammln(a) if(x.le.0.)then - if(x.lt.0.)pause + if(x.lt.0.) stop 'error in gser' gamser=0. return endif @@ -182,7 +182,7 @@ sum=sum+del if(abs(del).lt.abs(sum)*eps)go to 1 11 continue - pause 'a too large, itmax too small' + stop 'a too large, itmax too small' 1 gamser=sum*exp(-x+a*log(x)-gln) return end @@ -233,7 +233,7 @@ gold=g endif 11 continue - pause 'a too large, itmax too small' + stop 'a too large, itmax too small' 1 gammcf=exp(-x+a*log(x)-gln)*g return end diff --git a/src/Utils/abort.irp.f b/src/Utils/abort.irp.f index e915202e..4abf1a01 100644 --- a/src/Utils/abort.irp.f +++ b/src/Utils/abort.irp.f @@ -17,16 +17,13 @@ BEGIN_PROVIDER [ logical, abort_here ] END_PROVIDER subroutine trap_signals - use ifport implicit none BEGIN_DOC ! What to do when a signal is caught. Here, trap Ctrl-C and call the control_C subroutine. END_DOC integer, external :: catch_signal - integer :: err, flag integer, parameter :: sigusr2 = 12 - flag = -1 - err = signal (sigusr2, catch_signal, flag) + call signal (sigusr2, catch_signal) end subroutine trap_signals integer function catch_signal(signum) From c7765043fefc0f3526acb04b978c68afa836bda2 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Mar 2015 01:17:37 +0100 Subject: [PATCH 6/9] Improved setup --- scripts/install_irpf90.sh | 1 - setup_environment.sh | 73 +++++++++++++++++++++++++++++++++++---- 2 files changed, 66 insertions(+), 8 deletions(-) diff --git a/scripts/install_irpf90.sh b/scripts/install_irpf90.sh index 04513ca8..d93340d2 100755 --- a/scripts/install_irpf90.sh +++ b/scripts/install_irpf90.sh @@ -27,4 +27,3 @@ echo '${QPACKAGE_ROOT}/irpf90/bin/irpman $@' > bin/irpman chmod +x bin/irpf90 bin/irpman - diff --git a/setup_environment.sh b/setup_environment.sh index 9fe24c96..ca853fdf 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -41,22 +41,81 @@ export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/ocaml source "\${QPACKAGE_ROOT}"/bin/irpman &> /dev/null EOF + source quantum_package.rc -make EZFIO + +echo "${BLUE}===== Installing IRPF90 ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_irpf90.sh | tee install_irpf90.log +if [[ ! -d ${QPACKAGE_ROOT}/irpf90 ]] +then + echo $RED "Error in IRPF90 installation" $BLACK + exit 1 +fi + +if [[ ! -x ${QPACKAGE_ROOT}/bin/irpf90 ]] +then + echo $RED "Error in IRPF90 installation" $BLACK + exit 1 +fi + + +if [[ ! -x ${QPACKAGE_ROOT}/bin/irpman ]] +then + echo $RED "Error in IRPF90 installation" $BLACK + exit 1 +fi + + +echo "${BLUE}===== Installing EZFIO ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_ezfio.sh | tee install_ezfio.log + if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]] then echo $RED "Error in EZFIO installation" $BLACK exit 1 fi -make ocaml -if [[ ! -f ${QPACKAGE_ROOT}/ocaml/Qptypes.ml ]] + +echo "${BLUE}===== Installing Zlib ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_zlib.sh | tee install_zlib.log + +echo "${BLUE}===== Installing Curl ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_curl.sh | tee install_curl.log + +echo "${BLUE}===== Installing M4 ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_m4.sh | tee install_m4.log + +echo "${BLUE}===== Installing EMSL Basis set library ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_emsl.sh | tee install_emsl.log + +if [[ ! -d ${QPACKAGE_ROOT}/EMSL_Basis ]] then - echo $RED "Error in ocaml installation" $BLACK + echo $RED "Error in EMSL Basis set library installation" $BLACK exit 1 fi -make resultsFile +echo "${BLUE}===== Installing EZFIO ===== ${BLACK}" + +${QPACKAGE_ROOT}/scripts/install_ezfio.sh | tee install_ezfio.log +if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]] +then + echo $RED "Error in EZFIO installation" $BLACK + exit 1 +fi + + +echo "${BLUE}===== Installing Ocaml compiler and libraries ===== ${BLACK}" +rm -f -- ocaml/Qptypes.ml +${QPACKAGE_ROOT}/scripts/install_ocaml.sh | tee install_ocaml.log + +if [[ ! -f ${QPACKAGE_ROOT}/ocaml/Qptypes.ml ]] +then + echo $RED "Error in Ocaml installation" $BLACK + exit 1 +fi + +echo "${BLUE}===== Installing resultsFile Python library ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_resultsFile.sh if [[ ! -d ${QPACKAGE_ROOT}/resultsFile ]] then echo $RED "Error in resultsFile installation" $BLACK @@ -75,8 +134,8 @@ source ${QPACKAGE_ROOT}/quantum_package.rc " $BLACK -mkdir -f install_logs -mv *.log install_logs/ +mkdir -p ${QPACKAGE_ROOT}/install_logs +mv ${QPACKAGE_ROOT}/*.log ${QPACKAGE_ROOT}/install_logs/ if [[ $1 == "--robot" ]] ; then From a500848a8b721902a67d052397b3dc28945fc672 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Mar 2015 01:33:32 +0100 Subject: [PATCH 7/9] Improved Ocaml makefile --- ocaml/Makefile | 7 +++---- scripts/create_executables_list.sh | 26 ++++++++++++++++++++++++++ src/Makefile | 14 +++++--------- 3 files changed, 34 insertions(+), 13 deletions(-) create mode 100755 scripts/create_executables_list.sh diff --git a/ocaml/Makefile b/ocaml/Makefile index 18788a1b..be763cbd 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -1,7 +1,6 @@ -# Check if QPACKAGE_ROOT is defined - .NOPARALLEL: +# Check if QPACKAGE_ROOT is defined ifndef QPACKAGE_ROOT $(info -------------------- Error --------------------) $(info QPACKAGE_ROOT undefined. Source the quantum_package.rc script) @@ -30,8 +29,8 @@ default: $(ALL_TESTS) $(ALL_EXE) .gitignore echo $$i ; \ done >> .gitignore -executables: - $(MAKE) -C $(QPACKAGE_ROOT)/data executables +executables: $(QPACKAGE_ROOT)/data/executables + $(QPACKAGE_ROOT)/scripts/create_executables_list.sh external_libs: opam install cryptokit core diff --git a/scripts/create_executables_list.sh b/scripts/create_executables_list.sh new file mode 100755 index 00000000..b4aa4244 --- /dev/null +++ b/scripts/create_executables_list.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Thu Mar 26 01:27:14 CET 2015 + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +cd ${QPACKAGE_ROOT}/data + +rm -f executables +EXES=$(find ${QPACKAGE_ROOT}/src -perm /u+x -type f | grep -e "${QPACKAGE_ROOT}/src/[^/]*/[^/]*$" |sort ) + +for EXE in $EXES +do + printf "%-30s %s\n" $(basename $EXE) $EXE | sed "s|${QPACKAGE_ROOT}|\$QPACKAGE_ROOT|g" >> executables +done + + + + + diff --git a/src/Makefile b/src/Makefile index cd8ce65b..298cc134 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,24 +8,18 @@ ALL_MODULES=$(shell cat NEEDED_MODULES) EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a -.PHONY: $(ALL_MODULES) +.PHONY: $(ALL_MODULES) ezfio -default: $(EZFIO) +default: ezfio $(QPACKAGE_ROOT)/scripts/build_modules.sh $(ALL_MODULES) veryclean: $(QPACKAGE_ROOT)/scripts/clean_modules.sh $(ALL_MODULES) -$(ALL_MODULES): $(EZFIO) +$(ALL_MODULES): ezfio $(QPACKAGE_ROOT)/scripts/build_modules.sh $@ -executables: $(ALL_MODULES) - rm -f executables ; \ - for EXE in $$(find $(QPACKAGE_ROOT)/src -perm /u+x -type f | grep -e "$(QPACKAGE_ROOT)/src/[^/]*/[^/]*$$" |sort ) ; \ - do printf "%-30s %s\n" $$(basename $$EXE) $$EXE | sed "s|$(QPACKAGE_ROOT)|\$$QPACKAGE_ROOT|g" >> executables ;\ - done - # Define the EZFIO rules $(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/EZFIO.cfg) $(QPACKAGE_ROOT)/scripts/prepare_ezfio.sh @@ -34,6 +28,8 @@ $(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ $(MAKE) ;\ $(MAKE) Python +ezfio: $(EZFIO) + # Frequent typos clena: clean veryclena: veryclean From ded78166db5d511172ff90990fcabd9662610ddf Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Mar 2015 02:03:01 +0100 Subject: [PATCH 8/9] Corrected ocaml makefile --- ocaml/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ocaml/Makefile b/ocaml/Makefile index be763cbd..2c3fae01 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -30,6 +30,8 @@ default: $(ALL_TESTS) $(ALL_EXE) .gitignore done >> .gitignore executables: $(QPACKAGE_ROOT)/data/executables + +$(QPACKAGE_ROOT)/data/executables: $(QPACKAGE_ROOT)/scripts/create_executables_list.sh external_libs: From abff0f0c44e58d3314abaae0323975081753042d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Mar 2015 02:16:12 +0100 Subject: [PATCH 9/9] Fixed static build with gfortran --- scripts/make_binary.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/make_binary.sh b/scripts/make_binary.sh index 8ac6495d..832be596 100755 --- a/scripts/make_binary.sh +++ b/scripts/make_binary.sh @@ -123,8 +123,12 @@ echo "Copying dynamic libraries" # -------------------------- MKL_LIBS=$(find_libs ${FORTRAN_EXEC} | grep libmkl | head -1) -MKL_LIBS=$(dirname ${MKL_LIBS}) -MKL_LIBS=$(ls ${MKL_LIBS}/libmkl_{def,avx,avx2}.so) +if [[ -n ${MKL_LIBS} ]] +then + MKL_LIBS=$(dirname ${MKL_LIBS}) + MKL_LIBS=$(ls ${MKL_LIBS}/libmkl_{def,avx,avx2}.so) +fi + ALL_LIBS=$(find_libs ${OCAML_EXEC} ${FORTRAN_EXEC}) cp -- ${ALL_LIBS} ${MKL_LIBS} ${QPACKAGE_STATIC}/extra_lib if [[ $? -ne 0 ]] ; @@ -133,12 +137,7 @@ then exit 1 fi -cp -- ${QPACKAGE_STATIC}/extra_lib/{libiomp*,libmkl*} ${QPACKAGE_STATIC}/lib/ -if [[ $? -ne 0 ]] ; -then - echo 'mv -- ${QPACKAGE_STATIC}/extra_lib/{libiomp*,libmkl*} ${QPACKAGE_STATIC}/lib/' - exit 1 -fi +cp -- ${QPACKAGE_STATIC}/extra_lib/lib{[gi]omp*,mkl*,lapack*,blas*,z*} ${QPACKAGE_STATIC}/lib/ # echo "Copying EMSL_Basis directory"