10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-03 18:05:59 +02:00
quantum_package/plugins/Full_CI_ZMQ/dump_fci_iterations_value.irp.f

128 lines
4.7 KiB
Fortran
Raw Normal View History

Added save iterations to Full_CI_ZMQ (#203) * Added/Updated files to save iterations Modified EZFIO.cfg to include iteratively saved data if the keyword of "full_ci_zmq/iterative" is set to true in the ezfio. The default is false. Will save the number of total iterations in full_ci_zmq/n_iter Saves the number of determinants in full_ci_zmq/n_det_iter Saves the energy in full_ci_zmq/energy_iter. Saves the energy_pt2 in full_ci_zmq/energybefore_pt2_iter These results are the same as the output of the program at every iteration. Modified fci_zmq.irp.f to include calls to fci_iterations.irp.f at each iteration (starting at N_det==1 and including the final call to do the final pt2 correction) Created fci_iterations as a subroutine to save the number of determinants, energy, and energy+pt2 for every iteration and saves the results in the full_ci_zmq output directory. * Updated files to include 3 save options Updated "iterative" in EZFIO.cfg to be an integer that can take the values of 1 (Append), 2 (Overwrite), or 3 (Do not save). Updated fci_iterations to be simpler and include the three options. Also updated the output so that only N_det, energy, and pt2 are output. The user must manipulate from there. * Delete fci_iterations.irp.f The file was modified and moved to fci_iterations.f90 * Fixed the comments * Rename fci_iterations to dump_fci_iterations_value Changed name to be clear on purpose. * Updated files for iterative saving Renamed fci_iterations to dump_fci_iterations_value for clarity In EZFIO.cfg changed keyword "iterative" to "iterative_save" for clarity Update dump_fci_iterations_value with "iterative_save" keyword Removed call to dump_fci_iterations on line 27 in fci_zmq Updated fci_zmq with the name change for calls * Delete fci_zmq.irp.f * Delete fci_zmq_pt2.irp.f * Delete EZFIO.cfg * Get latest updates from master * Added calls to dump_fci_iterations_value * Readded dump_fci_iterations_value * Updated EZFIO.cfg
2017-06-27 20:30:09 +02:00
subroutine dump_fci_iterations_value(n_determinants,energy,pt2)
implicit none
! Not using an irp.f90 environment because the SAVE statement is needed for simpler code
! BEGIN_DOC
!! Output the number of determinants, energy, and pt2 correction at each iteration
! END_DOC
2017-11-21 14:53:32 +01:00
integer, intent(in) :: n_determinants
double precision, intent(in) :: energy(N_states), pt2(N_states)
Added save iterations to Full_CI_ZMQ (#203) * Added/Updated files to save iterations Modified EZFIO.cfg to include iteratively saved data if the keyword of "full_ci_zmq/iterative" is set to true in the ezfio. The default is false. Will save the number of total iterations in full_ci_zmq/n_iter Saves the number of determinants in full_ci_zmq/n_det_iter Saves the energy in full_ci_zmq/energy_iter. Saves the energy_pt2 in full_ci_zmq/energybefore_pt2_iter These results are the same as the output of the program at every iteration. Modified fci_zmq.irp.f to include calls to fci_iterations.irp.f at each iteration (starting at N_det==1 and including the final call to do the final pt2 correction) Created fci_iterations as a subroutine to save the number of determinants, energy, and energy+pt2 for every iteration and saves the results in the full_ci_zmq output directory. * Updated files to include 3 save options Updated "iterative" in EZFIO.cfg to be an integer that can take the values of 1 (Append), 2 (Overwrite), or 3 (Do not save). Updated fci_iterations to be simpler and include the three options. Also updated the output so that only N_det, energy, and pt2 are output. The user must manipulate from there. * Delete fci_iterations.irp.f The file was modified and moved to fci_iterations.f90 * Fixed the comments * Rename fci_iterations to dump_fci_iterations_value Changed name to be clear on purpose. * Updated files for iterative saving Renamed fci_iterations to dump_fci_iterations_value for clarity In EZFIO.cfg changed keyword "iterative" to "iterative_save" for clarity Update dump_fci_iterations_value with "iterative_save" keyword Removed call to dump_fci_iterations on line 27 in fci_zmq Updated fci_zmq with the name change for calls * Delete fci_zmq.irp.f * Delete fci_zmq_pt2.irp.f * Delete EZFIO.cfg * Get latest updates from master * Added calls to dump_fci_iterations_value * Readded dump_fci_iterations_value * Updated EZFIO.cfg
2017-06-27 20:30:09 +02:00
integer :: N_iterations
integer, allocatable :: n_determinants_list(:)
2017-11-21 14:53:32 +01:00
double precision, allocatable :: energy_list(:,:)
double precision, allocatable :: pt2_list(:,:)
Added save iterations to Full_CI_ZMQ (#203) * Added/Updated files to save iterations Modified EZFIO.cfg to include iteratively saved data if the keyword of "full_ci_zmq/iterative" is set to true in the ezfio. The default is false. Will save the number of total iterations in full_ci_zmq/n_iter Saves the number of determinants in full_ci_zmq/n_det_iter Saves the energy in full_ci_zmq/energy_iter. Saves the energy_pt2 in full_ci_zmq/energybefore_pt2_iter These results are the same as the output of the program at every iteration. Modified fci_zmq.irp.f to include calls to fci_iterations.irp.f at each iteration (starting at N_det==1 and including the final call to do the final pt2 correction) Created fci_iterations as a subroutine to save the number of determinants, energy, and energy+pt2 for every iteration and saves the results in the full_ci_zmq output directory. * Updated files to include 3 save options Updated "iterative" in EZFIO.cfg to be an integer that can take the values of 1 (Append), 2 (Overwrite), or 3 (Do not save). Updated fci_iterations to be simpler and include the three options. Also updated the output so that only N_det, energy, and pt2 are output. The user must manipulate from there. * Delete fci_iterations.irp.f The file was modified and moved to fci_iterations.f90 * Fixed the comments * Rename fci_iterations to dump_fci_iterations_value Changed name to be clear on purpose. * Updated files for iterative saving Renamed fci_iterations to dump_fci_iterations_value for clarity In EZFIO.cfg changed keyword "iterative" to "iterative_save" for clarity Update dump_fci_iterations_value with "iterative_save" keyword Removed call to dump_fci_iterations on line 27 in fci_zmq Updated fci_zmq with the name change for calls * Delete fci_zmq.irp.f * Delete fci_zmq_pt2.irp.f * Delete EZFIO.cfg * Get latest updates from master * Added calls to dump_fci_iterations_value * Readded dump_fci_iterations_value * Updated EZFIO.cfg
2017-06-27 20:30:09 +02:00
integer :: saveMethod
logical :: hasIter
logical,save :: firstAccess=.TRUE. !! every update of firstAccess will be saved
2017-11-21 14:53:32 +01:00
double precision, allocatable :: extrapolated_energy(:,:)
integer :: i,k
Added save iterations to Full_CI_ZMQ (#203) * Added/Updated files to save iterations Modified EZFIO.cfg to include iteratively saved data if the keyword of "full_ci_zmq/iterative" is set to true in the ezfio. The default is false. Will save the number of total iterations in full_ci_zmq/n_iter Saves the number of determinants in full_ci_zmq/n_det_iter Saves the energy in full_ci_zmq/energy_iter. Saves the energy_pt2 in full_ci_zmq/energybefore_pt2_iter These results are the same as the output of the program at every iteration. Modified fci_zmq.irp.f to include calls to fci_iterations.irp.f at each iteration (starting at N_det==1 and including the final call to do the final pt2 correction) Created fci_iterations as a subroutine to save the number of determinants, energy, and energy+pt2 for every iteration and saves the results in the full_ci_zmq output directory. * Updated files to include 3 save options Updated "iterative" in EZFIO.cfg to be an integer that can take the values of 1 (Append), 2 (Overwrite), or 3 (Do not save). Updated fci_iterations to be simpler and include the three options. Also updated the output so that only N_det, energy, and pt2 are output. The user must manipulate from there. * Delete fci_iterations.irp.f The file was modified and moved to fci_iterations.f90 * Fixed the comments * Rename fci_iterations to dump_fci_iterations_value Changed name to be clear on purpose. * Updated files for iterative saving Renamed fci_iterations to dump_fci_iterations_value for clarity In EZFIO.cfg changed keyword "iterative" to "iterative_save" for clarity Update dump_fci_iterations_value with "iterative_save" keyword Removed call to dump_fci_iterations on line 27 in fci_zmq Updated fci_zmq with the name change for calls * Delete fci_zmq.irp.f * Delete fci_zmq_pt2.irp.f * Delete EZFIO.cfg * Get latest updates from master * Added calls to dump_fci_iterations_value * Readded dump_fci_iterations_value * Updated EZFIO.cfg
2017-06-27 20:30:09 +02:00
!!! Check to ensure that we should save iterations (default is Append)
! saveMethod: 1==Append, 2==Overwrite, 3==NoSave
call ezfio_get_full_ci_zmq_iterative_save(saveMethod)
!!! Check we are saving data
if (saveMethod/=3) then
!!! If the iteration number exists get it
!!! otherwise set it to zero
call ezfio_has_full_ci_zmq_n_iter(hasIter)
if (hasIter) then
call ezfio_get_full_ci_zmq_n_iter(N_iterations)
else
N_iterations=0
endif
!!! If it is append we don't have to do any more checks
!!! N_iterations will be correct now.
!!! If we should overwrite and this is the first time
!!! Then we need to reset N_iterations to zero
if ((saveMethod==2).AND.(firstAccess)) then
N_iterations=0
endif
!! Now allocate the array for entire size needed
2017-11-21 14:53:32 +01:00
allocate(extrapolated_energy(N_iterations+1,N_states))
Added save iterations to Full_CI_ZMQ (#203) * Added/Updated files to save iterations Modified EZFIO.cfg to include iteratively saved data if the keyword of "full_ci_zmq/iterative" is set to true in the ezfio. The default is false. Will save the number of total iterations in full_ci_zmq/n_iter Saves the number of determinants in full_ci_zmq/n_det_iter Saves the energy in full_ci_zmq/energy_iter. Saves the energy_pt2 in full_ci_zmq/energybefore_pt2_iter These results are the same as the output of the program at every iteration. Modified fci_zmq.irp.f to include calls to fci_iterations.irp.f at each iteration (starting at N_det==1 and including the final call to do the final pt2 correction) Created fci_iterations as a subroutine to save the number of determinants, energy, and energy+pt2 for every iteration and saves the results in the full_ci_zmq output directory. * Updated files to include 3 save options Updated "iterative" in EZFIO.cfg to be an integer that can take the values of 1 (Append), 2 (Overwrite), or 3 (Do not save). Updated fci_iterations to be simpler and include the three options. Also updated the output so that only N_det, energy, and pt2 are output. The user must manipulate from there. * Delete fci_iterations.irp.f The file was modified and moved to fci_iterations.f90 * Fixed the comments * Rename fci_iterations to dump_fci_iterations_value Changed name to be clear on purpose. * Updated files for iterative saving Renamed fci_iterations to dump_fci_iterations_value for clarity In EZFIO.cfg changed keyword "iterative" to "iterative_save" for clarity Update dump_fci_iterations_value with "iterative_save" keyword Removed call to dump_fci_iterations on line 27 in fci_zmq Updated fci_zmq with the name change for calls * Delete fci_zmq.irp.f * Delete fci_zmq_pt2.irp.f * Delete EZFIO.cfg * Get latest updates from master * Added calls to dump_fci_iterations_value * Readded dump_fci_iterations_value * Updated EZFIO.cfg
2017-06-27 20:30:09 +02:00
allocate(n_determinants_list(N_iterations+1))
2017-11-21 14:53:32 +01:00
allocate(energy_list(N_states,N_iterations+1))
allocate(pt2_list(N_states,N_iterations+1))
Added save iterations to Full_CI_ZMQ (#203) * Added/Updated files to save iterations Modified EZFIO.cfg to include iteratively saved data if the keyword of "full_ci_zmq/iterative" is set to true in the ezfio. The default is false. Will save the number of total iterations in full_ci_zmq/n_iter Saves the number of determinants in full_ci_zmq/n_det_iter Saves the energy in full_ci_zmq/energy_iter. Saves the energy_pt2 in full_ci_zmq/energybefore_pt2_iter These results are the same as the output of the program at every iteration. Modified fci_zmq.irp.f to include calls to fci_iterations.irp.f at each iteration (starting at N_det==1 and including the final call to do the final pt2 correction) Created fci_iterations as a subroutine to save the number of determinants, energy, and energy+pt2 for every iteration and saves the results in the full_ci_zmq output directory. * Updated files to include 3 save options Updated "iterative" in EZFIO.cfg to be an integer that can take the values of 1 (Append), 2 (Overwrite), or 3 (Do not save). Updated fci_iterations to be simpler and include the three options. Also updated the output so that only N_det, energy, and pt2 are output. The user must manipulate from there. * Delete fci_iterations.irp.f The file was modified and moved to fci_iterations.f90 * Fixed the comments * Rename fci_iterations to dump_fci_iterations_value Changed name to be clear on purpose. * Updated files for iterative saving Renamed fci_iterations to dump_fci_iterations_value for clarity In EZFIO.cfg changed keyword "iterative" to "iterative_save" for clarity Update dump_fci_iterations_value with "iterative_save" keyword Removed call to dump_fci_iterations on line 27 in fci_zmq Updated fci_zmq with the name change for calls * Delete fci_zmq.irp.f * Delete fci_zmq_pt2.irp.f * Delete EZFIO.cfg * Get latest updates from master * Added calls to dump_fci_iterations_value * Readded dump_fci_iterations_value * Updated EZFIO.cfg
2017-06-27 20:30:09 +02:00
!!! Pull previously written data
!!! Unless it is at the beginning of a new/restarted calculation
if((hasIter).AND.(N_iterations>0)) then
2017-11-21 14:53:32 +01:00
call ezfio_get_full_ci_zmq_n_det_iter(n_determinants_list)
call ezfio_get_full_ci_zmq_energy_iter(energy_list)
call ezfio_get_full_ci_zmq_pt2_iter(pt2_list)
Added save iterations to Full_CI_ZMQ (#203) * Added/Updated files to save iterations Modified EZFIO.cfg to include iteratively saved data if the keyword of "full_ci_zmq/iterative" is set to true in the ezfio. The default is false. Will save the number of total iterations in full_ci_zmq/n_iter Saves the number of determinants in full_ci_zmq/n_det_iter Saves the energy in full_ci_zmq/energy_iter. Saves the energy_pt2 in full_ci_zmq/energybefore_pt2_iter These results are the same as the output of the program at every iteration. Modified fci_zmq.irp.f to include calls to fci_iterations.irp.f at each iteration (starting at N_det==1 and including the final call to do the final pt2 correction) Created fci_iterations as a subroutine to save the number of determinants, energy, and energy+pt2 for every iteration and saves the results in the full_ci_zmq output directory. * Updated files to include 3 save options Updated "iterative" in EZFIO.cfg to be an integer that can take the values of 1 (Append), 2 (Overwrite), or 3 (Do not save). Updated fci_iterations to be simpler and include the three options. Also updated the output so that only N_det, energy, and pt2 are output. The user must manipulate from there. * Delete fci_iterations.irp.f The file was modified and moved to fci_iterations.f90 * Fixed the comments * Rename fci_iterations to dump_fci_iterations_value Changed name to be clear on purpose. * Updated files for iterative saving Renamed fci_iterations to dump_fci_iterations_value for clarity In EZFIO.cfg changed keyword "iterative" to "iterative_save" for clarity Update dump_fci_iterations_value with "iterative_save" keyword Removed call to dump_fci_iterations on line 27 in fci_zmq Updated fci_zmq with the name change for calls * Delete fci_zmq.irp.f * Delete fci_zmq_pt2.irp.f * Delete EZFIO.cfg * Get latest updates from master * Added calls to dump_fci_iterations_value * Readded dump_fci_iterations_value * Updated EZFIO.cfg
2017-06-27 20:30:09 +02:00
endif
!! Now increment to the current iteration
N_iterations = N_iterations+1
!! Add the data from latest iteration
n_determinants_list(N_iterations) = n_determinants
2017-11-21 14:53:32 +01:00
energy_list(:,N_iterations) = energy(:)
pt2_list(:,N_iterations) = pt2(:)
2017-11-21 17:20:18 +01:00
if (N_iterations > 2) then
2017-11-22 16:21:16 +01:00
write(*,'(A)') ''
write(*,'(A)') 'Extrapolated energies'
write(*,'(A)') '------------------------'
write(*,'(A)') ''
2017-11-21 17:20:18 +01:00
do i=1, min(N_states,N_det)
call extrapolate_data(N_iterations, energy_list(i,1:N_iterations), pt2_list(i,1:N_iterations), extrapolated_energy(1:N_iterations,i))
enddo
2017-11-22 16:21:16 +01:00
print *, ''
print *, 'State ', 1
print *, ''
write(*,*) '=========== ', '==================='
write(*,*) 'minimum PT2 ', 'Extrapolated energy'
write(*,*) '=========== ', '==================='
do k=2,min(N_iterations,8)
write(*,'(F11.4,2X,F18.8)') pt2_list(1,N_iterations+1-k), extrapolated_energy(k,1)
enddo
write(*,*) '=========== ', '==================='
do i=2, min(N_states,N_det)
2017-11-21 17:20:18 +01:00
print *, ''
2017-11-22 16:21:16 +01:00
print *, 'State ', i
2017-11-21 17:20:18 +01:00
print *, ''
2017-11-22 16:21:16 +01:00
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
write(*,*) 'minimum PT2 ', 'Extrapolated energy ', ' Excitation (a.u) ', ' Excitation (eV) '
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
2017-11-21 17:20:18 +01:00
do k=2,min(N_iterations,8)
2017-11-22 16:21:16 +01:00
write(*,'(F11.4,X,3(X,F18.8))') pt2_list(i,N_iterations+1-k), extrapolated_energy(k,i), &
extrapolated_energy(k,i) - extrapolated_energy(k,1), &
(extrapolated_energy(k,i) - extrapolated_energy(k,1) ) * 27.211396641308d0
2017-11-21 17:20:18 +01:00
enddo
2017-11-22 16:21:16 +01:00
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
2017-11-21 14:53:32 +01:00
enddo
2017-11-21 17:20:18 +01:00
print *, ''
endif
Added save iterations to Full_CI_ZMQ (#203) * Added/Updated files to save iterations Modified EZFIO.cfg to include iteratively saved data if the keyword of "full_ci_zmq/iterative" is set to true in the ezfio. The default is false. Will save the number of total iterations in full_ci_zmq/n_iter Saves the number of determinants in full_ci_zmq/n_det_iter Saves the energy in full_ci_zmq/energy_iter. Saves the energy_pt2 in full_ci_zmq/energybefore_pt2_iter These results are the same as the output of the program at every iteration. Modified fci_zmq.irp.f to include calls to fci_iterations.irp.f at each iteration (starting at N_det==1 and including the final call to do the final pt2 correction) Created fci_iterations as a subroutine to save the number of determinants, energy, and energy+pt2 for every iteration and saves the results in the full_ci_zmq output directory. * Updated files to include 3 save options Updated "iterative" in EZFIO.cfg to be an integer that can take the values of 1 (Append), 2 (Overwrite), or 3 (Do not save). Updated fci_iterations to be simpler and include the three options. Also updated the output so that only N_det, energy, and pt2 are output. The user must manipulate from there. * Delete fci_iterations.irp.f The file was modified and moved to fci_iterations.f90 * Fixed the comments * Rename fci_iterations to dump_fci_iterations_value Changed name to be clear on purpose. * Updated files for iterative saving Renamed fci_iterations to dump_fci_iterations_value for clarity In EZFIO.cfg changed keyword "iterative" to "iterative_save" for clarity Update dump_fci_iterations_value with "iterative_save" keyword Removed call to dump_fci_iterations on line 27 in fci_zmq Updated fci_zmq with the name change for calls * Delete fci_zmq.irp.f * Delete fci_zmq_pt2.irp.f * Delete EZFIO.cfg * Get latest updates from master * Added calls to dump_fci_iterations_value * Readded dump_fci_iterations_value * Updated EZFIO.cfg
2017-06-27 20:30:09 +02:00
! Reset the iteration number
call ezfio_set_full_ci_zmq_n_iter(N_iterations)
!!!! Now reset the ezfio values
!!!! To include the latest data
call ezfio_set_full_ci_zmq_n_det_iter(n_determinants_list)
call ezfio_set_full_ci_zmq_energy_iter(energy_list)
call ezfio_set_full_ci_zmq_pt2_iter(pt2_list)
deallocate(n_determinants_list)
deallocate(energy_list)
deallocate(pt2_list)
2017-11-21 14:53:32 +01:00
Added save iterations to Full_CI_ZMQ (#203) * Added/Updated files to save iterations Modified EZFIO.cfg to include iteratively saved data if the keyword of "full_ci_zmq/iterative" is set to true in the ezfio. The default is false. Will save the number of total iterations in full_ci_zmq/n_iter Saves the number of determinants in full_ci_zmq/n_det_iter Saves the energy in full_ci_zmq/energy_iter. Saves the energy_pt2 in full_ci_zmq/energybefore_pt2_iter These results are the same as the output of the program at every iteration. Modified fci_zmq.irp.f to include calls to fci_iterations.irp.f at each iteration (starting at N_det==1 and including the final call to do the final pt2 correction) Created fci_iterations as a subroutine to save the number of determinants, energy, and energy+pt2 for every iteration and saves the results in the full_ci_zmq output directory. * Updated files to include 3 save options Updated "iterative" in EZFIO.cfg to be an integer that can take the values of 1 (Append), 2 (Overwrite), or 3 (Do not save). Updated fci_iterations to be simpler and include the three options. Also updated the output so that only N_det, energy, and pt2 are output. The user must manipulate from there. * Delete fci_iterations.irp.f The file was modified and moved to fci_iterations.f90 * Fixed the comments * Rename fci_iterations to dump_fci_iterations_value Changed name to be clear on purpose. * Updated files for iterative saving Renamed fci_iterations to dump_fci_iterations_value for clarity In EZFIO.cfg changed keyword "iterative" to "iterative_save" for clarity Update dump_fci_iterations_value with "iterative_save" keyword Removed call to dump_fci_iterations on line 27 in fci_zmq Updated fci_zmq with the name change for calls * Delete fci_zmq.irp.f * Delete fci_zmq_pt2.irp.f * Delete EZFIO.cfg * Get latest updates from master * Added calls to dump_fci_iterations_value * Readded dump_fci_iterations_value * Updated EZFIO.cfg
2017-06-27 20:30:09 +02:00
endif
!!! set first access to false
!!! it will be saved
firstAccess=.FALSE.
end subroutine
2017-11-21 14:53:32 +01:00