10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-12 17:13:54 +01:00

rst format in output directory

This commit is contained in:
Anthony Scemama 2014-04-11 01:53:15 +02:00
parent 4a3e16a5ae
commit 585eb90a77
11 changed files with 231 additions and 76 deletions

View File

@ -1 +1 @@
Ezfio_files
Ezfio_files Output Utils

View File

@ -25,4 +25,6 @@ Needed Modules
.. NEEDED_MODULES file.
* `Ezfio_files <http://github.com/LCPQ/quantum_package/tree/master/src/Ezfio_files>`_
* `Output <http://github.com/LCPQ/quantum_package/tree/master/src/Output>`_
* `Utils <http://github.com/LCPQ/quantum_package/tree/master/src/Utils>`_

View File

@ -5,7 +5,7 @@
implicit none
BEGIN_DOC
! Numbers of alpha ("up") , beta ("down") and total electrons
! Numbers of alpha ("up") , beta ("down") and total electrons
END_DOC
PROVIDE ezfio_filename
call ezfio_get_electrons_elec_alpha_num(elec_alpha_num)
@ -15,6 +15,14 @@
elec_num_tab(2) = elec_beta_num
ASSERT (elec_alpha_num > 0)
ASSERT (elec_beta_num >= 0)
call write_time(output_Electrons)
call write_int(output_Electrons,elec_num, &
'Number of electrons' )
call write_int(output_Electrons,elec_alpha_num, &
'Number of alpha electrons' )
call write_int(output_Electrons,elec_beta_num, &
'Number of beta electrons' )
write(output_Electrons,*)
END_PROVIDER

View File

@ -37,6 +37,11 @@ $(error )
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)
@ -49,11 +54,6 @@ $(error )
endif
# Create the NEEDED_MODULES variable, needed for IRPF90
NEEDED_MODULES=$(shell cat NEEDED_MODULES)
# Check and update dependencies
include Makefile.depend

View File

@ -1 +1 @@
Ezfio_files Utils
Ezfio_files Utils Output

View File

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

View File

@ -2,21 +2,21 @@
&BEGIN_PROVIDER [ integer, nucl_num_aligned ]
implicit none
BEGIN_DOC
! Number of nuclei
! Number of nuclei
END_DOC
PROVIDE ezfio_filename
nucl_num = 0
call ezfio_get_nuclei_nucl_num(nucl_num)
ASSERT (nucl_num > 0)
integer :: align_double
integer :: align_double
nucl_num_aligned = align_double(nucl_num)
END_PROVIDER
BEGIN_PROVIDER [ double precision, nucl_charge, (nucl_num) ]
implicit none
BEGIN_DOC
! Nuclear charges
! Nuclear charges
END_DOC
PROVIDE ezfio_filename
nucl_charge = -1.d0
@ -24,37 +24,72 @@ BEGIN_PROVIDER [ double precision, nucl_charge, (nucl_num) ]
ASSERT (nucl_charge(:) >= 0.d0)
END_PROVIDER
BEGIN_PROVIDER [ character*(32), nucl_label, (nucl_num) ]
implicit none
BEGIN_DOC
! Nuclear labels
END_DOC
PROVIDE ezfio_filename
nucl_label = ""
call ezfio_get_nuclei_nucl_label(nucl_label)
END_PROVIDER
BEGIN_PROVIDER [ double precision, nucl_coord, (nucl_num_aligned,3) ]
implicit none
BEGIN_DOC
! Nuclear coordinates in the format (:, {x,y,z})
! Nuclear coordinates in the format (:, {x,y,z})
END_DOC
PROVIDE ezfio_filename
double precision, allocatable :: buffer(:,:)
double precision, allocatable :: buffer(:,:)
nucl_coord = 0.d0
allocate (buffer(nucl_num,3))
buffer = 0.d0
call ezfio_get_nuclei_nucl_coord(buffer)
integer :: i,j
integer :: i,j
do i=1,3
do j=1,nucl_num
nucl_coord(j,i) = buffer(j,i)
enddo
do j=1,nucl_num
nucl_coord(j,i) = buffer(j,i)
enddo
enddo
deallocate(buffer)
character*(64), parameter :: f = '(A16, 4(X,F12.6))'
character*(64), parameter :: ft= '(A16, 4(X,A12 ))'
double precision, parameter :: a0= 0.529177249d0
call write_time(output_Nuclei)
write(output_Nuclei,'(A)') ''
write(output_Nuclei,'(A)') 'Nuclear Coordinates (Angstroms)'
write(output_Nuclei,'(A)') '==============================='
write(output_Nuclei,'(A)') ''
write(output_Nuclei,ft) &
'================','============','============','============','============'
write(output_Nuclei,*) &
' Atom Charge X Y Z '
write(output_Nuclei,ft) &
'================','============','============','============','============'
do i=1,nucl_num
write(output_Nuclei,f) nucl_label(i), nucl_charge(i), &
nucl_coord(i,1)*a0, &
nucl_coord(i,2)*a0, &
nucl_coord(i,3)*a0
enddo
write(output_Nuclei,ft) &
'================','============','============','============','============'
write(output_Nuclei,'(A)') ''
END_PROVIDER
BEGIN_PROVIDER [ double precision, nucl_coord_transp, (3,nucl_num) ]
implicit none
BEGIN_DOC
! Transposed array of nucl_coord
END_DOC
integer :: i, k
nucl_coord_transp = 0.
integer :: i, k
nucl_coord_transp = 0.d0
do i=1,nucl_num
nucl_coord_transp(1,i) = nucl_coord(i,1)
@ -77,8 +112,8 @@ END_PROVIDER
! nucl_dist_vec : Nucleus-nucleus distances vectors
END_DOC
integer :: ie1, ie2, l
integer,save :: ifirst = 0
integer :: ie1, ie2, l
integer,save :: ifirst = 0
if (ifirst == 0) then
ifirst = 1
nucl_dist = 0.d0
@ -87,48 +122,53 @@ END_PROVIDER
nucl_dist_vec_y = 0.d0
nucl_dist_vec_z = 0.d0
endif
do ie2 = 1,nucl_num
!DEC$ VECTOR ALWAYS
!DEC$ VECTOR ALIGNED
do ie1 = 1,nucl_num_aligned
nucl_dist_vec_x(ie1,ie2) = nucl_coord(ie1,1) - nucl_coord(ie2,1)
nucl_dist_vec_y(ie1,ie2) = nucl_coord(ie1,2) - nucl_coord(ie2,2)
nucl_dist_vec_z(ie1,ie2) = nucl_coord(ie1,3) - nucl_coord(ie2,3)
enddo
!DEC$ VECTOR ALWAYS
!DEC$ VECTOR ALIGNED
do ie1 = 1,nucl_num_aligned
nucl_dist_2(ie1,ie2) = nucl_dist_vec_x(ie1,ie2)*nucl_dist_vec_x(ie1,ie2) + &
nucl_dist_vec_y(ie1,ie2)*nucl_dist_vec_y(ie1,ie2) + &
nucl_dist_vec_z(ie1,ie2)*nucl_dist_vec_z(ie1,ie2)
nucl_dist(ie1,ie2) = sqrt(nucl_dist_2(ie1,ie2))
ASSERT (nucl_dist(ie1,ie2) > 0.d0)
enddo
!DEC$ VECTOR ALWAYS
!DEC$ VECTOR ALIGNED
do ie1 = 1,nucl_num_aligned
nucl_dist_vec_x(ie1,ie2) = nucl_coord(ie1,1) - nucl_coord(ie2,1)
nucl_dist_vec_y(ie1,ie2) = nucl_coord(ie1,2) - nucl_coord(ie2,2)
nucl_dist_vec_z(ie1,ie2) = nucl_coord(ie1,3) - nucl_coord(ie2,3)
enddo
!DEC$ VECTOR ALWAYS
!DEC$ VECTOR ALIGNED
do ie1 = 1,nucl_num_aligned
nucl_dist_2(ie1,ie2) = nucl_dist_vec_x(ie1,ie2)*nucl_dist_vec_x(ie1,ie2) +&
nucl_dist_vec_y(ie1,ie2)*nucl_dist_vec_y(ie1,ie2) + &
nucl_dist_vec_z(ie1,ie2)*nucl_dist_vec_z(ie1,ie2)
nucl_dist(ie1,ie2) = sqrt(nucl_dist_2(ie1,ie2))
ASSERT (nucl_dist(ie1,ie2) > 0.d0)
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, nuclear_repulsion ]
BEGIN_PROVIDER [ double precision, nuclear_repulsion ]
implicit none
BEGIN_DOC
! Nuclear repulsion energy
! Nuclear repulsion energy
END_DOC
integer :: k,l
double precision :: Z12, r2, x(3)
nuclear_repulsion = 0.d0
do l = 1, nucl_num
integer :: k,l
double precision :: Z12, r2, x(3)
nuclear_repulsion = 0.d0
do l = 1, nucl_num
do k = 1, nucl_num
if(k /= l) then
Z12 = nucl_charge(k)*nucl_charge(l)
x(1) = nucl_coord(k,1) - nucl_coord(l,1)
x(2) = nucl_coord(k,2) - nucl_coord(l,2)
x(3) = nucl_coord(k,3) - nucl_coord(l,3)
r2 = x(1)*x(1) + x(2)*x(2) + x(3)*x(3)
nuclear_repulsion += Z12/dsqrt(r2)
endif
if(k /= l) then
Z12 = nucl_charge(k)*nucl_charge(l)
x(1) = nucl_coord(k,1) - nucl_coord(l,1)
x(2) = nucl_coord(k,2) - nucl_coord(l,2)
x(3) = nucl_coord(k,3) - nucl_coord(l,3)
r2 = x(1)*x(1) + x(2)*x(2) + x(3)*x(3)
nuclear_repulsion += Z12/dsqrt(r2)
endif
enddo
enddo
nuclear_repulsion *= 0.5d0
enddo
nuclear_repulsion *= 0.5d0
call write_time(output_Nuclei)
call write_double(output_Nuclei,nuclear_repulsion, &
'Nuclear repulsion energy')
END_PROVIDER
END_PROVIDER

View File

@ -1 +1 @@
Utils

View File

@ -2,6 +2,21 @@
Output Module
=============
This module deals with the program I/O in log files.
All output should be printed using routines present in this module.

View File

@ -1,22 +1,78 @@
BEGIN_TEMPLATE
BEGIN_PROVIDER [ integer, output_$NAME ]
BEGIN_PROVIDER [ double precision, output_wall_time_0 ]
&BEGIN_PROVIDER [ double precision, output_cpu_time_0 ]
implicit none
BEGIN_DOC
! Output file for $NAME
BEGIN_DOC
! Initial CPU and wall times when printing in the output files
END_DOC
integer :: getUnitAndOpen
call ezfio_set_output_empty(.False.)
output_$NAME = getUnitAndOpen(trim(ezfio_filename)//'/output/'//'$NAME','w')
call cpu_time(output_wall_time_0)
call wall_time(output_wall_time_0)
END_PROVIDER
SUBST [ NAME ]
AO ;;
MO ;;
AO_integrals ;;
MO_integrals ;;
END_TEMPLATE
BEGIN_SHELL [ /bin/bash ]
for NAME in $(cat ${QPACKAGE_ROOT}/src/NEEDED_MODULES)
do
cat << EOF
BEGIN_PROVIDER [ integer, output_$NAME ]
implicit none
BEGIN_DOC
! Output file for $NAME
END_DOC
PROVIDE output_wall_time_0 output_cpu_time_0
integer :: getUnitAndOpen
call ezfio_set_output_empty(.False.)
output_$NAME = getUnitAndOpen(trim(ezfio_filename)//'/output/'//'$NAME.rst','a')
write(output_$NAME,'(A)') &
'--------------------------------------------------------------------------------'
END_PROVIDER
EOF
done
END_SHELL
subroutine write_time(iunit)
implicit none
BEGIN_DOC
! Write a time stamp in the output for chronological reconstruction
END_DOC
integer, intent(in) :: iunit
double precision :: wt, ct
call cpu_time(ct)
call wall_time(wt)
write(iunit,*)
write(iunit,'(A,F15.6,A,F15.6,A)') &
'.. >>>>> [ WALL TIME: ', wt-output_wall_time_0, &
' s ] [ CPU TIME: ', ct-output_cpu_time_0, ' s ] <<<<< ..'
write(iunit,*)
end
subroutine write_double(iunit,value,label)
implicit none
BEGIN_DOC
! Write a double precision value in output
END_DOC
integer, intent(in) :: iunit
double precision :: value
character*(*) :: label
character*(64), parameter :: f = '(A50,G16.8)'
character*(50) :: newlabel
write(newlabel,'(A,A)') '* ',trim(label)
write(iunit,f) newlabel, value
end
subroutine write_int(iunit,value,label)
implicit none
BEGIN_DOC
! Write an integer value in output
END_DOC
integer, intent(in) :: iunit
integer :: value
character*(*) :: label
character*(64), parameter :: f = '(A50,I16)'
character*(50) :: newlabel
write(newlabel,'(A,A)') '* ',trim(label)
write(iunit,f) newlabel, value
end

33
src/Output/tests/Makefile Normal file
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