Skip to content

Commit

Permalink
rename CIMAT to CIDATA
Browse files Browse the repository at this point in the history
  • Loading branch information
kohei-noda-qcrg committed Oct 23, 2024
1 parent 236de90 commit c7829c1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ add_executable(r4dcaspt2ocoexe
one_e_exct.f90
r4dcaspt2_tra.f90
ras_det_check.f90
read_cimat.f90
read_cidata.f90
read_mrconee.f90
prtoutfock.f90
sdet.f90
Expand Down
54 changes: 27 additions & 27 deletions src/casci.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ SUBROUTINE casci
use module_time
Implicit NONE

integer :: j0, j, i0, irec, unit_cimat
integer :: j0, j, i0, irec, unit_cidata
real(8) :: cutoff_threshold

complex*16, allocatable :: mat_complex(:, :) ! For complex
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=cimat_key_size) :: key
character(len=cidata_key_size) :: key
integer :: dict_cas_idx_size, idx
integer, allocatable :: keys(:), vals(:)
type(time_type) :: tmp_start_time, tmp_end_time
Expand Down Expand Up @@ -112,45 +112,45 @@ SUBROUTINE casci
end if
Call memminus(KIND(mat_complex), SIZE(mat_complex), 2); Deallocate (mat_complex)
end if
! write CI matrix to CIMAT file
! 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 = 'CIMAT'
call open_unformatted_file(unit=unit_cimat, file=filename, status='replace')
filename = 'CIDATA'
call open_unformatted_file(unit=unit_cidata, file=filename, status='replace')
key = "ninact"
write (unit_cimat) key
write (unit_cimat) ninact
write (unit_cidata) key
write (unit_cidata) ninact
key = 'nact'
write (unit_cimat) key
write (unit_cimat) nact
write (unit_cidata) key
write (unit_cidata) nact
key = 'nsec'
write (unit_cimat) key
write (unit_cimat) nsec
write (unit_cidata) key
write (unit_cidata) nsec
key = 'nelec'
write (unit_cimat) key
write (unit_cimat) nelec
write (unit_cidata) key
write (unit_cidata) nelec
key = 'ndet'
write (unit_cimat) key
write (unit_cimat) ndet
write (unit_cidata) key
write (unit_cidata) ndet
key = 'nroot'
write (unit_cimat) key
write (unit_cimat) nroot
write (unit_cidata) key
write (unit_cidata) nroot
key = 'ecas'
write (unit_cimat) key
write (unit_cimat) ecas(1:nroot)
write (unit_cidata) key
write (unit_cidata) ecas(1:nroot)
key = 'dict_cas_idx_values'
write (unit_cimat) key
write (unit_cimat) vals(1:dict_cas_idx_size)
write (unit_cidata) key
write (unit_cidata) vals(1:dict_cas_idx_size)
key = 'ci_coefficients'
write (unit_cimat) key
write (unit_cidata) key
if (realonly%is_realonly()) then
write (unit_cimat) (cir(:, irec), irec=1, nroot)
write (unit_cidata) (cir(:, irec), irec=1, nroot)
else
write (unit_cimat) (cir(:, irec), irec=1, nroot)
write (unit_cimat) (cii(:, irec), irec=1, nroot)
write (unit_cidata) (cir(:, irec), irec=1, nroot)
write (unit_cidata) (cii(:, irec), irec=1, nroot)
end if
key = 'end'
write (unit_cimat) key
close (unit_cimat)
write (unit_cidata) key
close (unit_cidata)
end if
Deallocate (ecas)
deallocate (keys, vals)
Expand Down
2 changes: 1 addition & 1 deletion src/module_global_variables.f90
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,6 @@ MODULE module_global_variables
real(8), parameter :: global_threshold = 1.0d-15 ! Threshold for removing small elements
integer :: ndet, iroot ! ndet: the number of CAS configuration
integer, parameter :: len_convert_int_to_chr = 30 ! Length of the string for converting integer to character
integer, parameter :: cimat_key_size = 30 ! Length of the key in CIMAT file
integer, parameter :: cidata_key_size = 30 ! Length of the key in cidata file
logical :: dirac_32bit_build = .false. ! If .true., the DIRAC is built in 32-bit mode (default: .false.(64-bit mode))
end MODULE module_global_variables
2 changes: 1 addition & 1 deletion src/r4dcaspt2_tra.f90
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ PROGRAM r4dcaspt2_tra ! DO CASPT2 CALC WITH MO TRANSFORMATION
nmo = ninact + nact + nsec
if (rank == 0) print *, 'nmo =', nmo

call read_cimat
call read_cidata

iroot = selectroot
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
Expand Down
28 changes: 14 additions & 14 deletions src/read_cimat.f90 → src/read_cidata.f90
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
subroutine read_cimat
! Read CASCI energy and CI coefficients and dictionary of CAS configurations from CIMAT file
subroutine read_cidata
! Read CASCI energy and CI coefficients and dictionary of CAS configurations from cidata file
use module_dict, only: add
use module_error, only: stop_with_errorcode
use module_essential_input
use module_file_manager, only: open_unformatted_file
use module_realonly, only: realonly
use module_global_variables
implicit none
character(len=cimat_key_size) :: key
character(len=cidata_key_size) :: key
integer :: unit, i, dict_cas_idx_size
integer :: ninact_read, nact_read, nsec_read, nelec_read, nroot_read
integer(8), allocatable :: dict_cas_idx_values(:)
Expand All @@ -25,11 +25,11 @@ subroutine read_cimat
call add_essential_input("ci_coefficients")
call add_essential_input("end")

call open_unformatted_file(unit, "CIMAT", "old", "read", "append")
call open_unformatted_file(unit, file="CIDATA", status="old", optional_position="append")
backspace (unit)
read (unit) key
if (trim(adjustl(key)) /= "end") then ! CIMAT must be ended with "end"
if (rank == 0) print *, "Error: CIMAT file is corrupted."
if (trim(adjustl(key)) /= "end") then ! cidata must be ended with "end"
if (rank == 0) print *, "Error: cidata file is corrupted."
call stop_with_errorcode(1)
end if
rewind (unit)
Expand All @@ -40,42 +40,42 @@ subroutine read_cimat
case ("ninact")
read (unit) ninact_read
if (ninact_read /= ninact) then
if (rank == 0) print *, "Error: ninact in CIMAT file is not equal to ninact in input file."
if (rank == 0) print *, "Error: ninact in cidata file is not equal to ninact in input file."
call stop_with_errorcode(1)
end if
call update_esesential_input(trim(adjustl(key)), .true.)
case ("nact")
read (unit) nact_read
if (nact_read /= nact) then
if (rank == 0) print *, "Error: nact in CIMAT file is not equal to nact in input file."
if (rank == 0) print *, "Error: nact in cidata file is not equal to nact in input file."
call stop_with_errorcode(1)
end if
call update_esesential_input(trim(adjustl(key)), .true.)
case ("nsec")
read (unit) nsec_read
if (nsec_read /= nsec) then
if (rank == 0) print *, "Error: nsec in CIMAT file is not equal to nsec in input file."
if (rank == 0) print *, "Error: nsec in cidata file is not equal to nsec in input file."
call stop_with_errorcode(1)
end if
call update_esesential_input(trim(adjustl(key)), .true.)
case ("nelec")
read (unit) nelec_read
if (nelec_read /= nelec) then
if (rank == 0) print *, "Error: nelec in CIMAT file is not equal to nelec in input file."
if (rank == 0) print *, "Error: nelec in cidata file is not equal to nelec in input file."
call stop_with_errorcode(1)
end if
call update_esesential_input(trim(adjustl(key)), .true.)
case ("ndet")
read (unit) ndet
if (ndet < 0) then
if (rank == 0) print *, "Error: Invalid ndet in CIMAT file. ndet = ", ndet
if (rank == 0) print *, "Error: Invalid ndet in cidata file. ndet = ", ndet
call stop_with_errorcode(1)
end if
call update_esesential_input(trim(adjustl(key)), .true.)
case ("nroot")
read (unit) nroot_read
if (nroot_read < 0) then
if (rank == 0) print *, "Error: Invalid nroot in CIMAT file. nroot = ", nroot_read
if (rank == 0) print *, "Error: Invalid nroot in cidata file. nroot = ", nroot_read
call stop_with_errorcode(1)
end if
call update_esesential_input(trim(adjustl(key)), .true.)
Expand Down Expand Up @@ -126,12 +126,12 @@ subroutine read_cimat
call update_esesential_input(trim(adjustl(key)), .true.)
exit
case default
if (rank == 0) print *, "Error: Unknown keyword in CIMAT file."
if (rank == 0) print *, "Error: Unknown keyword in cidata file."
call stop_with_errorcode(1)
end select
end do

call check_all_essential_inputs_specified
deallocate (essential_inputs)

end subroutine read_cimat
end subroutine read_cidata

0 comments on commit c7829c1

Please sign in to comment.