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:
parent
0764aa259d
commit
b4904d65df
@ -1 +1 @@
|
|||||||
AOs Electrons Ezfio_files MOs Nuclei Utils
|
AOs Electrons Ezfio_files MOs Nuclei Output Utils
|
||||||
|
@ -43,5 +43,6 @@ Needed Modules
|
|||||||
* `Ezfio_files <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files>`_
|
* `Ezfio_files <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files>`_
|
||||||
* `MOs <http://github.com/LCPQ/quantum_package/tree/master/src/MOs>`_
|
* `MOs <http://github.com/LCPQ/quantum_package/tree/master/src/MOs>`_
|
||||||
* `Nuclei <http://github.com/LCPQ/quantum_package/tree/master/src/Nuclei>`_
|
* `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>`_
|
* `Utils <http://github.com/LCPQ/quantum_package/tree/master/src/Utils>`_
|
||||||
|
|
||||||
|
@ -59,36 +59,59 @@ subroutine list_to_bitstring( string, list, n_elements, Nint)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
subroutine write_bitstring( iunit, string, Nint )
|
subroutine bitstring_to_str( output, string, Nint )
|
||||||
|
use bitmasks
|
||||||
implicit none
|
implicit none
|
||||||
use bitmasks
|
BEGIN_DOC
|
||||||
integer, intent(in) :: iunit
|
! Transform a bit string to a string for printing
|
||||||
|
END_DOC
|
||||||
|
character*(*), intent(out) :: output
|
||||||
integer, intent(in) :: Nint
|
integer, intent(in) :: Nint
|
||||||
integer(bit_kind), intent(in) :: string(Nint)
|
integer(bit_kind), intent(in) :: string(Nint)
|
||||||
|
|
||||||
integer :: i, j, ibuf
|
integer :: i, j, ibuf
|
||||||
integer(bit_kind) :: itemp
|
integer(bit_kind) :: itemp
|
||||||
character*(1) :: buffer(Nint*bit_kind_size+2)
|
|
||||||
|
|
||||||
ibuf = 1
|
ibuf = 1
|
||||||
buffer(ibuf) = '|'
|
output = ''
|
||||||
|
output(ibuf:ibuf) = '|'
|
||||||
ibuf = ibuf+1
|
ibuf = ibuf+1
|
||||||
do i=1,Nint
|
do i=1,Nint
|
||||||
itemp = 1_bit_kind
|
itemp = 1_bit_kind
|
||||||
do j=1,bit_kind_size
|
do j=1,bit_kind_size
|
||||||
if (iand(itemp,string(i)) == itemp) then
|
if (iand(itemp,string(i)) == itemp) then
|
||||||
buffer(ibuf) = '+'
|
output(ibuf:ibuf) = '+'
|
||||||
else
|
else
|
||||||
buffer(ibuf) = '-'
|
output(ibuf:ibuf) = '-'
|
||||||
endif
|
endif
|
||||||
ibuf = ibuf+1
|
ibuf = ibuf+1
|
||||||
itemp = ishft(itemp,1)
|
itemp = ishft(itemp,1)
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
buffer(ibuf) = '|'
|
output(ibuf:ibuf) = '|'
|
||||||
write(iunit,'(100A)') buffer(1:ibuf)
|
|
||||||
|
|
||||||
end
|
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
|
||||||
|
|
||||||
|
|
||||||
|
33
src/Bitmask/tests/Makefile
Normal file
33
src/Bitmask/tests/Makefile
Normal 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
|
||||||
|
|
||||||
|
|
12
src/Bitmask/tests/test_hf.irp.f
Normal file
12
src/Bitmask/tests/test_hf.irp.f
Normal 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
|
1479
src/Bitmask/tests/test_hf.ref
Normal file
1479
src/Bitmask/tests/test_hf.ref
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user