@@ -17,7 +17,7 @@ program cea
1717 implicit none
1818
1919 ! Locals
20- character (:), allocatable :: input_file , thermo_file, trans_file
20+ character (:), allocatable :: input_file_stem , thermo_file, trans_file
2121 character (:), allocatable :: compile_thermo_input, compile_trans_input
2222 character (:), allocatable :: data_search_dirs(:)
2323 type (ThermoDB) :: all_thermo
@@ -36,7 +36,7 @@ program cea
3636 integer :: n
3737 logical :: ok
3838
39- call parse_arguments(input_file , thermo_file, trans_file, compile_thermo_input, compile_trans_input)
39+ call parse_arguments(input_file_stem , thermo_file, trans_file, compile_thermo_input, compile_trans_input)
4040 call log_info(' CEA Version: ' // version_string)
4141
4242 if (allocated (compile_thermo_input) .or. allocated (compile_trans_input)) then
@@ -51,11 +51,11 @@ program cea
5151 stop
5252 end if
5353
54- call log_info(' Input File: ' // input_file )
54+ call log_info(' Input File: ' // input_file_stem )
5555 call log_info(' Thermo File: ' // thermo_file)
5656
57- if (.not. exists(input_file // ' .inp' )) then
58- call abort(' Could not locate input file: ' // input_file )
57+ if (.not. exists(input_file_stem // ' .inp' )) then
58+ call abort(' Could not locate input file: ' // input_file_stem )
5959 end if
6060
6161 call get_data_search_dirs(data_search_dirs)
@@ -73,11 +73,11 @@ program cea
7373 end if
7474
7575 ! Read and parse the input and data files
76- problems = read_input(input_file // ' .inp' )
76+ problems = read_input(input_file_stem // ' .inp' )
7777 all_thermo = read_thermo(thermo_file)
7878
7979 ! Initialize the output file
80- open (1 , file= input_file (1 :len_trim (input_file ))// " .out" , status= " replace" )
80+ open (1 , file= input_file_stem (1 :len_trim (input_file_stem ))// " .out" , status= " replace" )
8181
8282 ! Loop over all problem in the input file
8383 do n = 1 , size (problems)
@@ -129,8 +129,8 @@ program cea
129129
130130contains
131131
132- subroutine parse_arguments (input_file , thermo_file , trans_file , compile_thermo_input , compile_trans_input )
133- character (:), allocatable , intent (out ) :: input_file
132+ subroutine parse_arguments (input_file_stem , thermo_file , trans_file , compile_thermo_input , compile_trans_input )
133+ character (:), allocatable , intent (out ) :: input_file_stem
134134 character (:), allocatable , intent (out ) :: thermo_file
135135 character (:), allocatable , intent (out ) :: trans_file
136136 character (:), allocatable , intent (out ) :: compile_thermo_input
@@ -172,20 +172,26 @@ subroutine parse_arguments(input_file, thermo_file, trans_file, compile_thermo_i
172172 stop
173173 case default
174174 call log_info(' Reading input_file from first positional argument' )
175- input_file = arg
175+ ! If the user has added a .inp extension, remove it.
176+ input_file_stem = arg
177+ if (len (arg) > 4 ) then
178+ if (arg(len (arg)- 3 :len (arg)) == ' .inp' ) then
179+ input_file_stem = arg(:len (arg)- 4 )
180+ end if
181+ end if
176182 end select
177183 end do
178184
179185 if (allocated (compile_thermo_input) .or. allocated (compile_trans_input)) then
180- if (allocated (input_file )) then
186+ if (allocated (input_file_stem )) then
181187 call log_error(' input_file is not allowed with --compile-thermo/--compile-trans' )
182188 call display_help
183189 call abort
184190 end if
185191 return
186192 end if
187193
188- if (.not. allocated (input_file )) then
194+ if (.not. allocated (input_file_stem )) then
189195 call log_error(' Required argument not specified: input_file' )
190196 call display_help
191197 call abort
0 commit comments