Skip to content

Commit

Permalink
filename can now be input for datafile
Browse files Browse the repository at this point in the history
  • Loading branch information
vtripath65 committed Nov 10, 2024
1 parent 124d8d5 commit ceb9461
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
31 changes: 31 additions & 0 deletions src/modules/quick_input_parser_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module quick_input_parser_module
module procedure read_integer_keyword
module procedure read_float_keyword
module procedure read_string_keyword
module procedure read_string_endpoints_keyword
end interface read

contains
Expand Down Expand Up @@ -146,4 +147,34 @@ subroutine read_string_keyword(line, keyword, val, required)
endif
end subroutine read_string_keyword

subroutine read_string_endpoints_keyword(line, keyword, i, j, required, found)
implicit none
character(len=*), intent(in) :: line
character(len=*), intent(in) :: keyword
logical, intent(in), optional :: required
integer, intent(out) :: i,j
integer :: ierror
logical, intent(out) :: found
logical :: reqdef !default value of required

reqdef = .true.
if(present(required)) then
reqdef=required
endif

call trimSpace(i,j,line,keyword,found)

if(reqdef .and. .not. found) then
call PrtErr(OUTFILEHANDLE, "Keyword "//trim(keyword)//" needs an input value.")
call quick_exit(OUTFILEHANDLE,1)
endif

if(found) then
if(ierror/=0) then
call PrtErr(OUTFILEHANDLE, "Error with keyword "//trim(keyword)//" encountered.")
call quick_exit(OUTFILEHANDLE,1)
endif
endif
end subroutine read_string_endpoints_keyword

end module quick_input_parser_module
17 changes: 15 additions & 2 deletions src/modules/quick_method_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ subroutine print_quick_method(self,io,ierr)
if (self%printEnergy) write(io,'(" PRINT ENERGY EVERY CYCLE")')

if (self%readDMX) write(io,'(" READ DENSITY MATRIX FROM FILE")')
if (self%readPMat) write(io,'(" READ DENSITY MATRIX From FILE")')
if (self%readPMat) write(io,'(" READ DENSITY MATRIX From DATAFILE")')
if (self%writePMat) write(io,'(" WRITE DENSITY MATRIX TO FILE")')
if (self%Skip) write(io,'(" SKIPPING SCF CALCULATION")')
if (self%readSAD) write(io,'(" READ SAD GUESS FROM FILE")')
Expand Down Expand Up @@ -529,12 +529,25 @@ subroutine read_quick_method(self,keywd,ierr)
use quick_exception_module
use quick_mpi_module
use quick_files_module, only : write_molden
use quick_files_module, only : dataFileName
implicit none
character(len=300) :: keyWD
character(len=300) :: tempstring
integer :: itemp,i,j
type (quick_method_type) self
integer, intent(inout) :: ierr
logical :: found

tempstring = keyWD
call upcase(tempstring,300)
if (index(tempstring,'READPMAT').ne.0)then
self%readPMat=.true.
call read(tempstring, 'READPMAT', i, j, .false., found)
if(found)then
dataFileName = keyWD(i:i+j-2)
endif
Write(6,*)'dataFileName = ',dataFileName
endif

call upcase(keyWD,300)
if (index(keyWD,'PDB').ne. 0) self%PDB=.true.
Expand Down Expand Up @@ -659,7 +672,7 @@ subroutine read_quick_method(self,keywd,ierr)
end if
if (index(keyWD,'ZMAKE').ne.0) self%zmat=.true.
if (index(keyWD,'DIPOLE').ne.0) self%dipole=.true.
if (index(keyWD,'READ').ne.0) self%readPMat=.true.

if (index(keyWD,'WRITE').ne.0) self%writePMat=.true.
if (index(keyWD,'SKIP').ne.0) self%Skip=.true.
if (index(keyWD,'EXTCHARGES').ne.0) self%EXTCHARGES=.true.
Expand Down
7 changes: 4 additions & 3 deletions src/read_job_and_atom.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ subroutine read_job_and_atom(ierr)
end do
endif

call upcase(keyWD,300)
write(iOutFile,'(" KEYWORD=",a)') trim(keyWD)

! These interfaces,"read","check" and "print" are from quick_method_module
SAFE_CALL(read(quick_method,keyWD,ierr)) ! read method from Keyword

write(iOutFile,'(" KEYWORD=",a)') trim(keyWD)
! call upcase(keyWD,300)

call read(quick_qm_struct,keyWD) ! read qm struct from Keyword
call check(quick_method,iOutFile,ierr) ! check the correctness
call print(quick_method,iOutFile,ierr) ! then print method
Expand Down

0 comments on commit ceb9461

Please sign in to comment.