10
0
mirror of https://github.com/LCPQ/quantum_package synced 2025-04-16 13:39:32 +02:00

Test in bitmasks

This commit is contained in:
Anthony Scemama 2014-04-17 15:10:26 +02:00
parent 0764aa259d
commit b4904d65df
6 changed files with 1560 additions and 12 deletions

View File

@ -1 +1 @@
AOs Electrons Ezfio_files MOs Nuclei Utils
AOs Electrons Ezfio_files MOs Nuclei Output Utils

View File

@ -43,5 +43,6 @@ Needed Modules
* `Ezfio_files <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files>`_
* `MOs <http://github.com/LCPQ/quantum_package/tree/master/src/MOs>`_
* `Nuclei <http://github.com/LCPQ/quantum_package/tree/master/src/Nuclei>`_
* `Output <http://github.com/LCPQ/quantum_package/tree/master/src/Output>`_
* `Utils <http://github.com/LCPQ/quantum_package/tree/master/src/Utils>`_

View File

@ -59,36 +59,59 @@ subroutine list_to_bitstring( string, list, n_elements, Nint)
end
subroutine write_bitstring( iunit, string, Nint )
implicit none
subroutine bitstring_to_str( output, string, Nint )
use bitmasks
integer, intent(in) :: iunit
implicit none
BEGIN_DOC
! Transform a bit string to a string for printing
END_DOC
character*(*), intent(out) :: output
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) = '|'
output = ''
output(ibuf: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) = '+'
output(ibuf:ibuf) = '+'
else
buffer(ibuf) = '-'
output(ibuf:ibuf) = '-'
endif
ibuf = ibuf+1
itemp = ishft(itemp,1)
enddo
enddo
buffer(ibuf) = '|'
write(iunit,'(100A)') buffer(1:ibuf)
output(ibuf:ibuf) = '|'
end
subroutine bitstring_to_hexa( output, string, Nint )
use bitmasks
implicit none
BEGIN_DOC
! Transform a bit string to a string in hexadecimal format for printing
END_DOC
character*(*), intent(out) :: output
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: string(Nint)
integer :: i, j, ibuf
integer(bit_kind) :: itemp
character*(32) :: f
write(f,*) '(Z',bit_kind_size/4,'.',bit_kind_size/4,')'
ibuf = 0
output = ''
do i=Nint,1,-1
ibuf = ibuf+1
write(output(ibuf:ibuf+bit_kind_size/4),f) string(i)
enddo
end

View File

@ -0,0 +1,33 @@
OPENMP =1
PROFILE =0
DEBUG = 0
IRPF90+= -I tests
REF_FILES=$(subst %.irp.f, %.ref, $(wildcard *.irp.f))
.PHONY: clean executables serial_tests parallel_tests
all: clean executables serial_tests parallel_tests
parallel_tests: $(REF_FILES)
@echo ; echo " ---- Running parallel tests ----" ; echo
@OMP_NUM_THREADS=10 ${QPACKAGE_ROOT}/scripts/run_tests.py
serial_tests: $(REF_FILES)
@echo ; echo " ---- Running serial tests ----" ; echo
@OMP_NUM_THREADS=1 ${QPACKAGE_ROOT}/scripts/run_tests.py
executables: $(wildcard *.irp.f) veryclean
$(MAKE) -C ..
%.ref: $(wildcard $(QPACKAGE_ROOT)/data/inputs/*.md5) executables
$(QPACKAGE_ROOT)/scripts/create_test_ref.sh $*
clean:
$(MAKE) -C .. clean
veryclean:
$(MAKE) -C .. veryclean

View File

@ -0,0 +1,12 @@
program test_hf
implicit none
character*(300) :: h
print *, 'mo_tot_num : ', mo_tot_num
print *, 'alpha : ', elec_alpha_num
call bitstring_to_hexa( h, HF_bitmask(1,1), N_int )
print *, 'HF_alpha : 0x'//trim(h)
print *, 'beta : ', elec_beta_num
call bitstring_to_hexa( h, HF_bitmask(1,2), N_int )
print *, 'HF_beta : 0x'//trim(h)
end

File diff suppressed because it is too large Load Diff