Skip to content

Commit

Permalink
read_cidata: add _sym[0-9]+ to CIDATA filename
Browse files Browse the repository at this point in the history
  • Loading branch information
kohei-noda-qcrg committed Dec 22, 2024
1 parent 4a04d8c commit 0ad88e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/casci.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SUBROUTINE casci
real(8), allocatable :: mat_real(:, :) ! For realonly
real(8), allocatable :: ecas(:)
character(:), allocatable :: filename
character(len=len_convert_int_to_chr) :: chr_root
character(len=len_convert_int_to_chr) :: chr_root, chr_totsym
character(len=cidata_key_size) :: key
integer :: dict_cas_idx_size, idx
integer(kind=int64), allocatable :: keys(:), vals(:)
Expand Down Expand Up @@ -116,7 +116,8 @@ SUBROUTINE casci
end if
! write CI matrix to the CIDATA file
if (rank == 0) then ! Only master ranks are allowed to create files used by CASPT2 except for MDCINTNEW.
filename = 'CIDATA'
write (chr_totsym, *) totsym
filename = 'CIDATA_sym'//trim(adjustl(chr_totsym)) ! (e.g.) CIDATA_sym33
call open_unformatted_file(unit=unit_cidata, file=filename, status='replace')
key = "ninact"
write (unit_cidata) key
Expand Down
6 changes: 5 additions & 1 deletion src/read_cidata.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ subroutine read_cidata
use module_global_variables
implicit none
character(len=cidata_key_size) :: key
character(len=len_convert_int_to_chr) :: chr_totsym
character(:), allocatable :: filename
integer :: unit, i, dict_cas_idx_size
integer :: ninact_read, nact_read, nsec_read, nelec_read, nroot_read
integer(kind=int64), allocatable :: dict_cas_idx_values(:)
Expand All @@ -26,7 +28,9 @@ subroutine read_cidata
call add_essential_input("ci_coefficients")
call add_essential_input("end")

call open_unformatted_file(unit, file="CIDATA", status="old", optional_position="append")
write (chr_totsym, *) totsym
filename = "CIDATA_sym"//trim(adjustl(chr_totsym))
call open_unformatted_file(unit, file=filename, status="old", optional_position="append")
backspace (unit)
read (unit) key
if (trim(adjustl(key)) /= "end") then ! cidata must be ended with "end"
Expand Down

0 comments on commit 0ad88e8

Please sign in to comment.