From a89f032e150d48ea2ae1c19d7a47788c2c2e1eed Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 3 Apr 2014 01:50:22 +0200 Subject: [PATCH] Added MOs and bitmasks --- .gitignore | 2 +- Makefile | 2 +- scripts/check_dependencies.sh | 4 +- scripts/create_Makefile.sh | 8 +-- scripts/create_Makefile_depend.sh | 4 +- scripts/create_module.sh | 2 +- setup_environment.sh | 12 ++-- src/.gitignore | 9 +++ src/AOs/Makefile | 17 +++++- src/Bitmask/Makefile | 20 ++++++ src/Bitmask/bitmasks.irp.f | 57 +++++++++++++++++ src/Bitmask/bitmasks_module.f90 | 5 ++ src/Bitmask/bitmasks_routines.irp.f | 94 +++++++++++++++++++++++++++++ src/Electrons/Makefile | 20 ++++++ src/Ezfio_files/Makefile | 16 ++++- src/MOs/Makefile | 20 ++++++ src/MOs/mos.ezfio_config | 8 +++ src/MOs/mos.irp.f | 94 +++++++++++++++++++++++++++++ src/MOs/utils.irp.f | 48 +++++++++++++++ src/Makefile | 10 +-- src/Makefile.common | 24 +++++--- src/Nuclei/Makefile | 15 ++++- src/Output/Makefile | 20 ++++++ src/Output/output.ezfio_config | 3 + src/Output/output.irp.f | 22 +++++++ src/Utils/Makefile | 20 ++++++ 26 files changed, 520 insertions(+), 36 deletions(-) create mode 100644 src/.gitignore create mode 100644 src/Bitmask/Makefile create mode 100644 src/Bitmask/bitmasks.irp.f create mode 100644 src/Bitmask/bitmasks_module.f90 create mode 100644 src/Bitmask/bitmasks_routines.irp.f create mode 100644 src/Electrons/Makefile create mode 100644 src/MOs/Makefile create mode 100644 src/MOs/mos.ezfio_config create mode 100644 src/MOs/mos.irp.f create mode 100644 src/MOs/utils.irp.f create mode 100644 src/Output/Makefile create mode 100644 src/Output/output.ezfio_config create mode 100644 src/Output/output.irp.f create mode 100644 src/Utils/Makefile diff --git a/.gitignore b/.gitignore index da318243..06c4bbec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -sci.rc +quantum_package.rc EZFIO irpf90 diff --git a/Makefile b/Makefile index 92cd68e3..1d796c07 100644 --- a/Makefile +++ b/Makefile @@ -23,5 +23,5 @@ doc: $(MAKE) -C doc src: irpf90 EZFIO - export SCI_ROOT=$$PWD ; \ + export QPACKAGE_ROOT=$$PWD ; \ $(MAKE) -C src diff --git a/scripts/check_dependencies.sh b/scripts/check_dependencies.sh index 4ff0cf80..db832bfb 100755 --- a/scripts/check_dependencies.sh +++ b/scripts/check_dependencies.sh @@ -32,7 +32,7 @@ fi for d in $COMMAND_LINE do - if [[ ! -d ${SCI_ROOT}/src/$d ]] + if [[ ! -d ${QPACKAGE_ROOT}/src/$d ]] then echo Error: Directory $d does not exist exit 2 @@ -44,7 +44,7 @@ DEPS_LONG="" for i in $COMMAND_LINE do DEPS_LONG+=" $i " - DEPS_LONG+=$(grep -e '^INCLUDE_DIRS' ${SCI_ROOT}/src/${i}/Makefile 2>/dev/null | cut -d '=' -f 2) + DEPS_LONG+=$(grep -e '^INCLUDE_DIRS' ${QPACKAGE_ROOT}/src/${i}/Makefile 2>/dev/null | cut -d '=' -f 2) done DEPS=$(unique_list $DEPS_LONG) diff --git a/scripts/create_Makefile.sh b/scripts/create_Makefile.sh index ea43d144..0c21609a 100755 --- a/scripts/create_Makefile.sh +++ b/scripts/create_Makefile.sh @@ -11,7 +11,7 @@ DEPS_LONG="" for i in $@ do DEPS_LONG+=" $i " - DEPS_LONG+=$(grep 'INCLUDE_DIRS' ${SCI_ROOT}/src/${i}/Makefile 2>/dev/null | cut -d '=' -f 2) + DEPS_LONG+=$(grep 'INCLUDE_DIRS' ${QPACKAGE_ROOT}/src/${i}/Makefile 2>/dev/null | cut -d '=' -f 2) done DEPS=($( @@ -34,15 +34,15 @@ SRC= OBJ= include Makefile.depend -include \$(SCI_ROOT)/src/Makefile.config -include \$(SCI_ROOT)/src/Makefile.common +include \$(QPACKAGE_ROOT)/src/Makefile.config +include \$(QPACKAGE_ROOT)/src/Makefile.common include irpf90.make irpf90.make: \$(filter-out IRPF90_temp/%, \$(wildcard */*.irp.f)) \$(wildcard *.irp.f) \$(wildcard *.inc.f) Makefile \$(EZFIO) \$(IRPF90) Makefile.depend: Makefile - \$(SCI_ROOT)/scripts/create_Makefile_depend.sh + \$(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh EOF diff --git a/scripts/create_Makefile_depend.sh b/scripts/create_Makefile_depend.sh index 48663cf7..af78033a 100755 --- a/scripts/create_Makefile_depend.sh +++ b/scripts/create_Makefile_depend.sh @@ -13,12 +13,12 @@ DEPS=$(grep "INCLUDE_DIRS" Makefile 2>/dev/null | cut -d '=' -f 2) for M in ${DEPS} do # X is the list of external source files - X=$(grep 'SRC=' ${SCI_ROOT}/src/${M}/Makefile 2>/dev/null |cut -d '=' -f 2) + X=$(grep 'SRC=' ${QPACKAGE_ROOT}/src/${M}/Makefile 2>/dev/null |cut -d '=' -f 2) for f in ${X} do SRC+=" ${M}/${f}" done - X=$(grep 'OBJ=' ${SCI_ROOT}/src/${M}/Makefile 2>/dev/null |cut -d '=' -f 2) + X=$(grep 'OBJ=' ${QPACKAGE_ROOT}/src/${M}/Makefile 2>/dev/null |cut -d '=' -f 2) for f in ${X} do OBJ+=" IRPF90_temp/${M}/${f/IRPF90_temp//}" diff --git a/scripts/create_module.sh b/scripts/create_module.sh index ac4125e1..e8f88269 100755 --- a/scripts/create_module.sh +++ b/scripts/create_module.sh @@ -23,6 +23,6 @@ mkdir ${MODULE} cd ${MODULE} # Create the Makefile -${SCI_ROOT}/create_Makefile.sh +${QPACKAGE_ROOT}/create_Makefile.sh diff --git a/setup_environment.sh b/setup_environment.sh index caa6ef3d..f6a77f66 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -1,19 +1,19 @@ #!/bin/bash -SCI_ROOT=${PWD} +QPACKAGE_ROOT=${PWD} IRPF90=$(which irpf90) if [[ -z ${IRPF90} ]] ; then make irpf90 - IRPF90=${SCI_ROOT}/irpf90/bin/irpf90 + IRPF90=${QPACKAGE_ROOT}/irpf90/bin/irpf90 fi make EZFIO -cat << EOF > sci.rc +cat << EOF > quantum_package.rc export IRPF90=${IRPF90} -export SCI_ROOT=${SCI_ROOT} -export PATH+=:${SCI_ROOT}/scripts -export PATH+=:${SCI_ROOT}/bin +export QPACKAGE_ROOT=${QPACKAGE_ROOT} +export PATH+=:${QPACKAGE_ROOT}/scripts +export PATH+=:${QPACKAGE_ROOT}/bin EOF diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 00000000..d8f57d33 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,9 @@ +Makefile.config +*IRPF90_temp +*IRPF90_man +*irpf90.make +*irpf90_entities +*tags +*.o +*.mod +*/Makefile.depend diff --git a/src/AOs/Makefile b/src/AOs/Makefile index 9f436863..6db64f54 100644 --- a/src/AOs/Makefile +++ b/src/AOs/Makefile @@ -1,9 +1,20 @@ default: all -INCLUDE_DIRS = Ezfio_files Utils Nuclei -include ../Makefile.config -include ../Makefile.common +# Define here all other modules on which the current module depends +INCLUDE_DIRS = Ezfio_files Nuclei Utils + +# Define here all new external source files and objects.Don't forget to prefix the +# object files with IRPF90_temp/ +SRC= +OBJ= + +include Makefile.depend +include $(QPACKAGE_ROOT)/src/Makefile.config +include $(QPACKAGE_ROOT)/src/Makefile.common include irpf90.make irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) $(IRPF90) + +Makefile.depend: Makefile + $(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh diff --git a/src/Bitmask/Makefile b/src/Bitmask/Makefile new file mode 100644 index 00000000..3387b857 --- /dev/null +++ b/src/Bitmask/Makefile @@ -0,0 +1,20 @@ +default: all + +# Define here all other modules on which the current module depends +INCLUDE_DIRS = AOs Electrons Ezfio_files MOs Nuclei Utils + +# Define here all new external source files and objects.Don't forget to prefix the +# object files with IRPF90_temp/ +SRC=bitmasks_module.f90 +OBJ=IRPF90_temp/bitmasks_module.o + +include Makefile.depend +include $(QPACKAGE_ROOT)/src/Makefile.config +include $(QPACKAGE_ROOT)/src/Makefile.common +include irpf90.make + +irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) + $(IRPF90) + +Makefile.depend: Makefile + $(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh diff --git a/src/Bitmask/bitmasks.irp.f b/src/Bitmask/bitmasks.irp.f new file mode 100644 index 00000000..91e21764 --- /dev/null +++ b/src/Bitmask/bitmasks.irp.f @@ -0,0 +1,57 @@ +use bitmasks + +BEGIN_PROVIDER [ integer, N_int ] + implicit none + BEGIN_DOC + ! Number of 64-bit integers needed to represent determinants as binary strings + END_DOC + N_int = (mo_tot_num-1)/bit_kind_size + 1 +END_PROVIDER + + +BEGIN_PROVIDER [ integer(bit_kind), full_ijkl_bitmask, (N_int,4) ] + implicit none + BEGIN_DOC + ! Bitmask to include all possible integrals + END_DOC + + integer :: i,j,n + n = mod(mo_tot_num-1,bit_kind_size)+1 + full_ijkl_bitmask = 0_bit_kind + do j=1,4 + do i=1,N_int-1 + full_ijkl_bitmask(i,j) = not(0_bit_kind) + enddo + do i=1,n + full_ijkl_bitmask(N_int,j) = ibset(full_ijkl_bitmask(N_int,j),i-1) + enddo + enddo +END_PROVIDER + + +BEGIN_PROVIDER [ integer(bit_kind), HF_bitmask, (N_int,2)] + implicit none + BEGIN_DOC + ! Hartree Fock bit mask + END_DOC + integer :: i,j,n + integer :: occ(elec_alpha_num) + + HF_bitmask = 0_bit_kind + do i=1,elec_alpha_num + occ(i) = i + enddo + call list_to_bitstring( HF_bitmask(1,1), occ, elec_alpha_num, N_int) + ! elec_alpha_num <= elec_beta_num, so occ is already OK. + call list_to_bitstring( HF_bitmask(1,2), occ, elec_beta_num, N_int) + +END_PROVIDER + +BEGIN_PROVIDER [ integer(bit_kind), ref_bitmask, (N_int,2)] + implicit none + BEGIN_DOC +! Reference bit mask, used in Slater rules, chosen as Hartree-Fock bitmask + END_DOC + ref_bitmask = HF_bitmask +END_PROVIDER + diff --git a/src/Bitmask/bitmasks_module.f90 b/src/Bitmask/bitmasks_module.f90 new file mode 100644 index 00000000..28363ff0 --- /dev/null +++ b/src/Bitmask/bitmasks_module.f90 @@ -0,0 +1,5 @@ +module bitmasks + integer, parameter :: bit_kind_shift = 6 ! 5: 32 bits, 6: 64 bits + integer, parameter :: bit_kind_size = 64 + integer, parameter :: bit_kind = 64/8 +end module diff --git a/src/Bitmask/bitmasks_routines.irp.f b/src/Bitmask/bitmasks_routines.irp.f new file mode 100644 index 00000000..00f16476 --- /dev/null +++ b/src/Bitmask/bitmasks_routines.irp.f @@ -0,0 +1,94 @@ +subroutine bitstring_to_list( string, list, n_elements, Nint) + use bitmasks + implicit none + BEGIN_DOC + ! Gives the inidices(+1) of the bits set to 1 in the bit string + END_DOC + integer, intent(in) :: Nint + integer(bit_kind), intent(in) :: string(Nint) + integer, intent(out) :: list(Nint*bit_kind_size) + integer, intent(out) :: n_elements + + integer :: i, ishift + integer(bit_kind) :: l + + n_elements = 0 + ishift = 2 + do i=1,Nint + l = string(i) + do while (l /= 0_bit_kind) + n_elements = n_elements+1 + list(n_elements) = ishift+popcnt(l-1_bit_kind) - popcnt(l) + l = iand(l,l-1_bit_kind) + enddo + ishift = ishift + bit_kind_size + enddo + +end + +subroutine list_to_bitstring( string, list, n_elements, Nint) + use bitmasks + implicit none + integer, intent(in) :: Nint + integer(bit_kind), intent(out) :: string(Nint) + integer, intent(in) :: list(Nint*bit_kind_size) + integer, intent(in) :: n_elements + + + integer :: i, j + integer :: ipos, iint + BEGIN_DOC + ! return the physical string "string(N_int,2)" from the array of occupations "list(N_int*bit_kind_size,2) + ! list + ! <== ipos ==> + ! | + ! v + !string :|------------------------|-------------------------|------------------------| + ! <==== bit_kind_size ====> <==== bit_kind_size ====> <==== bit_kind_size ====> + ! { iint } { iint } { iint } + END_DOC + + string = 0_bit_kind + + do i=1,n_elements + iint = ishft(list(i)-1,-bit_kind_shift) + 1 + ipos = list(i)-ishft((iint-1),bit_kind_shift)-1 + string(iint) = ibset( string(iint), ipos ) + enddo + +end + + +subroutine write_bitstring( iunit, string, Nint ) + implicit none + use bitmasks + integer, intent(in) :: iunit + integer, intent(in) :: Nint + integer(bit_kind), intent(in) :: string(Nint) + + integer :: i, j, ibuf + integer(bit_kind) :: itemp + character*(1) :: buffer(Nint*bit_kind_size+2) + + ibuf = 1 + buffer(ibuf) = '|' + ibuf = ibuf+1 + do i=1,Nint + itemp = 1_bit_kind + do j=1,bit_kind_size + if (iand(itemp,string(i)) == itemp) then + buffer(ibuf) = '+' + else + buffer(ibuf) = '-' + endif + ibuf = ibuf+1 + itemp = ishft(itemp,1) + enddo + enddo + buffer(ibuf) = '|' + write(iunit,'(100A)') buffer(1:ibuf) + +end + + + diff --git a/src/Electrons/Makefile b/src/Electrons/Makefile new file mode 100644 index 00000000..1827854f --- /dev/null +++ b/src/Electrons/Makefile @@ -0,0 +1,20 @@ +default: all + +# Define here all other modules on which the current module depends +INCLUDE_DIRS = Ezfio_files + +# Define here all new external source files and objects.Don't forget to prefix the +# object files with IRPF90_temp/ +SRC= +OBJ= + +include Makefile.depend +include $(QPACKAGE_ROOT)/src/Makefile.config +include $(QPACKAGE_ROOT)/src/Makefile.common +include irpf90.make + +irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) + $(IRPF90) + +Makefile.depend: Makefile + $(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh diff --git a/src/Ezfio_files/Makefile b/src/Ezfio_files/Makefile index ac9b7c52..d3b4e2eb 100644 --- a/src/Ezfio_files/Makefile +++ b/src/Ezfio_files/Makefile @@ -1,8 +1,20 @@ default: all -include ../Makefile.config -include ../Makefile.common +# Define here all other modules on which the current module depends +INCLUDE_DIRS = + +# Define here all new external source files and objects.Don't forget to prefix the +# object files with IRPF90_temp/ +SRC= +OBJ= + +include Makefile.depend +include $(QPACKAGE_ROOT)/src/Makefile.config +include $(QPACKAGE_ROOT)/src/Makefile.common include irpf90.make irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) $(IRPF90) + +Makefile.depend: Makefile + $(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh diff --git a/src/MOs/Makefile b/src/MOs/Makefile new file mode 100644 index 00000000..0db39043 --- /dev/null +++ b/src/MOs/Makefile @@ -0,0 +1,20 @@ +default: all + +# Define here all other modules on which the current module depends +INCLUDE_DIRS = AOs Ezfio_files Nuclei Utils + +# Define here all new external source files and objects.Don't forget to prefix the +# object files with IRPF90_temp/ +SRC= +OBJ= + +include Makefile.depend +include $(QPACKAGE_ROOT)/src/Makefile.config +include $(QPACKAGE_ROOT)/src/Makefile.common +include irpf90.make + +irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) + $(IRPF90) + +Makefile.depend: Makefile + $(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh diff --git a/src/MOs/mos.ezfio_config b/src/MOs/mos.ezfio_config new file mode 100644 index 00000000..292b7a94 --- /dev/null +++ b/src/MOs/mos.ezfio_config @@ -0,0 +1,8 @@ +mo_basis + mo_tot_num integer + mo_coef double precision (ao_basis_ao_num,mo_basis_mo_tot_num) + mo_energy double precision (mo_basis_mo_tot_num) + mo_occ double precision (mo_basis_mo_tot_num) + mo_symmetry character*(8) (mo_basis_mo_tot_num) + mo_label character*(64) + diff --git a/src/MOs/mos.irp.f b/src/MOs/mos.irp.f new file mode 100644 index 00000000..282fa840 --- /dev/null +++ b/src/MOs/mos.irp.f @@ -0,0 +1,94 @@ +BEGIN_PROVIDER [ integer, mo_tot_num ] + implicit none + BEGIN_DOC + ! Total number of molecular orbitals and the size of the keys corresponding + END_DOC + PROVIDE ezfio_filename + call ezfio_get_mo_basis_mo_tot_num(mo_tot_num) + ASSERT (mo_tot_num > 0) +END_PROVIDER + + +BEGIN_PROVIDER [ integer, mo_tot_num_align ] + implicit none + BEGIN_DOC + ! Aligned variable for dimensioning of arrays + END_DOC + integer :: align_double + mo_tot_num_align = align_double(mo_tot_num) +END_PROVIDER + + +BEGIN_PROVIDER [ character*(64), mo_label ] + implicit none + BEGIN_DOC + ! Label characterizing the MOS (local, canonical, natural, etc) + END_DOC + logical :: exists + PROVIDE ezfio_filename + call ezfio_has_mo_basis_mo_label(exists) + if (exists) then + call ezfio_get_mo_basis_mo_label(mo_label) + else + mo_label = 'no_label' + call ezfio_set_mo_basis_mo_label(mo_label) + endif + +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, mo_energy, (mo_tot_num) ] + implicit none + BEGIN_DOC + ! Fock diagonal elements + END_DOC + PROVIDE ezfio_filename + mo_energy = 0.d0 + call ezfio_get_mo_basis_mo_energy(mo_energy) +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, mo_coef, (ao_num_align,mo_tot_num) ] + implicit none + BEGIN_DOC + ! Molecular orbital coefficients on AO basis set + ! mo_coef(i,j) = coefficient of the ith ao on the jth mo + END_DOC + integer :: i, j + double precision, allocatable :: buffer(:,:) + !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: buffer + + PROVIDE ezfio_filename + allocate(buffer(ao_num,mo_tot_num)) + buffer = 0.d0 + call ezfio_get_mo_basis_mo_coef(buffer) + do i=1,mo_tot_num + do j=1,ao_num + mo_coef(j,i) = buffer(j,i) + enddo + do j=ao_num+1,ao_num_align + mo_coef(j,i) = 0.d0 + enddo + enddo + deallocate(buffer) + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, mo_coef_transp, (mo_tot_num_align,ao_num) ] + implicit none + BEGIN_DOC + ! Molecular orbital coefficients on AO basis set + END_DOC + integer :: i, j + + do j=1,ao_num + do i=1,mo_tot_num + mo_coef_transp(i,j) = mo_coef(j,i) + enddo + do i=mo_tot_num+1,mo_tot_num_align + mo_coef_transp(i,j) = 0.d0 + enddo + enddo + +END_PROVIDER + diff --git a/src/MOs/utils.irp.f b/src/MOs/utils.irp.f new file mode 100644 index 00000000..47dea1b5 --- /dev/null +++ b/src/MOs/utils.irp.f @@ -0,0 +1,48 @@ +subroutine save_mos + implicit none + double precision, allocatable :: buffer(:,:) + integer :: i,j + + call system('save_current_mos.sh '//trim(ezfio_filename)) + + call ezfio_set_mo_basis_mo_label(mo_label) + allocate ( buffer(ao_num,mo_tot_num) ) + buffer = 0.d0 + do j = 1, mo_tot_num + do i = 1, ao_num + buffer(i,j) = mo_coef(i,j) + enddo + enddo + call ezfio_set_mo_basis_mo_coef(buffer) + deallocate (buffer) + +end + +subroutine mo_as_eigvectors_of_mo_matrix(matrix,n,m,label) + implicit none + integer,intent(in) :: n,m + character*(64), intent(in) :: label + double precision, intent(in) :: matrix(n,m) + + double precision, allocatable :: mo_coef_new(:,:), R(:,:),eigvalues(:) + !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: mo_coef_new, R + + if (m /= mo_tot_num) then + print *, irp_here, ': Error : m/= mo_tot_num' + endif + allocate(R(n,m)) + allocate(mo_coef_new(ao_num_align,m),eigvalues(m)) + mo_coef_new = mo_coef + + call jacobi_lapack(eigvalues,R,matrix,size(matrix,1),size(matrix,2)) + integer :: i + do i = 1, m + print*,'eigvalues(i) = ',eigvalues(i) + enddo + + call dgemm('N','N',ao_num,m,m,1.d0,mo_coef_new,size(mo_coef_new,1),R,size(R,1),0.d0,mo_coef,size(mo_coef,1)) + deallocate(mo_coef_new,R,eigvalues) + + mo_label = label + SOFT_TOUCH mo_coef +end diff --git a/src/Makefile b/src/Makefile index f9c33910..7f964127 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,13 +1,13 @@ default: all -INCLUDE_DIRS = Ezfio_files Nuclei Utils AOs Electrons # MonoInts BiInts MOs Output Bitmask +INCLUDE_DIRS = Ezfio_files Nuclei Utils AOs Electrons MonoInts BiInts MOs Output Bitmask include Makefile.common include Makefile.config LIB+=$(MKL) -SRC=#BiInts/map_module.f90 Bitmask/bitmasks_module.f90 -OBJ=#IRPF90_temp/BiInts/map_module.o IRPF90_temp/Bitmask/bitmasks_module.o +SRC=BiInts/map_module.f90 Bitmask/bitmasks_module.f90 +OBJ=IRPF90_temp/BiInts/map_module.o IRPF90_temp/Bitmask/bitmasks_module.o PYTHON_SCRIPTS= include irpf90.make @@ -17,5 +17,7 @@ irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp $(IRPF90) all_clean: - for i in */ ; do $(MAKE) -C $$i veryclean clean_links ; done + for i in */ ; do unset INCLUDE_DIRS ; $(MAKE) -C $$i veryclean && $(MAKE) -C $$i clean_links ; done +all_modules: + for i in */ ; do unset INCLUDE_DIRS ; $(MAKE) -C $$i || exit 1 ; done diff --git a/src/Makefile.common b/src/Makefile.common index ee853f2e..6258e38e 100644 --- a/src/Makefile.common +++ b/src/Makefile.common @@ -1,7 +1,15 @@ -ifndef SCI_ROOT -$(error SCI_ROOT undefined. Run the setup_environment.sh script) +ifndef QPACKAGE_ROOT +$(error QPACKAGE_ROOT undefined. Run the setup_environment.sh script) endif +INCLUDE_DIRS_OK=$(shell X=`$(QPACKAGE_ROOT)/scripts/check_dependencies.sh $(INCLUDE_DIRS)` && echo OK || echo $$X) +ifneq ($(INCLUDE_DIRS_OK),OK) + $(info ---------------------) + $(info Your INCLUDE_DIRS variable is inconsistent. It should be:) + $(info INCLUDE_DIRS = $(INCLUDE_DIRS_OK)) + $(info ---------------------) + $(error ) +endif IRP_VERSION_OK=$(shell $(IRPF90) -v | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= 1.3") ifeq ($(IRP_VERSION_OK),False) @@ -9,25 +17,25 @@ $(error 'IRPF90 version >= 1.3 is required') endif -MAKEFILE_OK=$(shell ls $(SCI_ROOT)/src/Makefile.config 2> /dev/null && echo True || echo False) +MAKEFILE_OK=$(shell ls $(QPACKAGE_ROOT)/src/Makefile.config 2> /dev/null && echo True || echo False) ifeq ($(MAKEFILE_OK),False) $(error 'Makefile.config is not present. Please modify Makefile.config.example to create Makefile.config') endif -EZFIO_DIR=$(SCI_ROOT)/EZFIO +EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a -$(EZFIO): $(wildcard $(SCI_ROOT)/src/*.ezfio_config) $(wildcard $(SCI_ROOT)/src/*/*.ezfio_config) +$(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) @echo Building EZFIO library - @cp $(wildcard $(SCI_ROOT)/src/*.ezfio_config) $(wildcard $(SCI_ROOT)/src/*/*.ezfio_config) $(EZFIO_DIR)/config + @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 INCLUDE_DIRS+=include -ifneq ($(PWD),$(SCI_ROOT)/src) -$(shell $(SCI_ROOT)/scripts/prepare_module.sh $(INCLUDE_DIRS)) +ifneq ($(PWD),$(QPACKAGE_ROOT)/src) +$(shell $(QPACKAGE_ROOT)/scripts/prepare_module.sh $(INCLUDE_DIRS)) clean_links: rm $(INCLUDE_DIRS) $$(basename $$PWD) else diff --git a/src/Nuclei/Makefile b/src/Nuclei/Makefile index 0179932e..788beabb 100644 --- a/src/Nuclei/Makefile +++ b/src/Nuclei/Makefile @@ -1,9 +1,20 @@ default: all + +# Define here all other modules on which the current module depends INCLUDE_DIRS = Ezfio_files Utils -include ../Makefile.config -include ../Makefile.common +# Define here all new external source files and objects.Don't forget to prefix the +# object files with IRPF90_temp/ +SRC= +OBJ= + +include Makefile.depend +include $(QPACKAGE_ROOT)/src/Makefile.config +include $(QPACKAGE_ROOT)/src/Makefile.common include irpf90.make irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) $(IRPF90) + +Makefile.depend: Makefile + $(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh diff --git a/src/Output/Makefile b/src/Output/Makefile new file mode 100644 index 00000000..d3b4e2eb --- /dev/null +++ b/src/Output/Makefile @@ -0,0 +1,20 @@ +default: all + +# Define here all other modules on which the current module depends +INCLUDE_DIRS = + +# Define here all new external source files and objects.Don't forget to prefix the +# object files with IRPF90_temp/ +SRC= +OBJ= + +include Makefile.depend +include $(QPACKAGE_ROOT)/src/Makefile.config +include $(QPACKAGE_ROOT)/src/Makefile.common +include irpf90.make + +irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) + $(IRPF90) + +Makefile.depend: Makefile + $(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh diff --git a/src/Output/output.ezfio_config b/src/Output/output.ezfio_config new file mode 100644 index 00000000..9e90e610 --- /dev/null +++ b/src/Output/output.ezfio_config @@ -0,0 +1,3 @@ +output + empty logical + diff --git a/src/Output/output.irp.f b/src/Output/output.irp.f new file mode 100644 index 00000000..1a3be122 --- /dev/null +++ b/src/Output/output.irp.f @@ -0,0 +1,22 @@ +BEGIN_TEMPLATE + +BEGIN_PROVIDER [ integer, output_$NAME ] + implicit none + BEGIN_DOC +! Output file for $NAME + END_DOC + integer :: getUnitAndOpen + call ezfio_set_output_empty(.False.) + output_$NAME = getUnitAndOpen(trim(ezfio_filename)//'/output/'//'$NAME','w') +END_PROVIDER + +SUBST [ NAME ] + +AO ;; +MO ;; +AO_integrals ;; +MO_integrals ;; + +END_TEMPLATE + + diff --git a/src/Utils/Makefile b/src/Utils/Makefile new file mode 100644 index 00000000..d3b4e2eb --- /dev/null +++ b/src/Utils/Makefile @@ -0,0 +1,20 @@ +default: all + +# Define here all other modules on which the current module depends +INCLUDE_DIRS = + +# Define here all new external source files and objects.Don't forget to prefix the +# object files with IRPF90_temp/ +SRC= +OBJ= + +include Makefile.depend +include $(QPACKAGE_ROOT)/src/Makefile.config +include $(QPACKAGE_ROOT)/src/Makefile.common +include irpf90.make + +irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile $(EZFIO) + $(IRPF90) + +Makefile.depend: Makefile + $(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh