@@ -55,6 +55,7 @@ subroutine get_cmt(CMTSOLUTION,yr,jda,mo,da,ho,mi,sec, &
5555
5656 ! local variables below
5757 integer :: julian_day,isource
58+ integer :: ishift,nright
5859 integer :: i,itype,istart,iend,ier,ipos
5960 double precision :: t_shift(NSOURCES)
6061 character (len= 256 ) :: string
@@ -372,9 +373,22 @@ subroutine get_cmt(CMTSOLUTION,yr,jda,mo,da,ho,mi,sec, &
372373 ! gets external STF file name
373374 read (IIN," (a)" ) string
374375 external_source_time_function_filename = trim (string)
375-
376- ! reads in stf values
377- call read_external_source_time_function(isource,user_source_time_function,external_source_time_function_filename)
376+ if (trim (external_source_time_function_filename) == ' REUSE' .or. &
377+ trim (external_source_time_function_filename) == ' Reuse' .or. &
378+ trim (external_source_time_function_filename) == ' reuse' ) then
379+ ! Reuse the source time function of the first source.
380+ if (isource == 1 ) then
381+ stop ' Error: "reuse" option cannot be used for the first source!'
382+ endif
383+ ishift= nint (t_shift(isource)/ DT)
384+ nright= NSTEP_STF- ishift
385+ user_source_time_function(1 :ishift,isource)= 0.0_CUSTOM_REAL
386+ user_source_time_function(ishift+1 :NSTEP_STF,isource)= user_source_time_function(1 :nright,1 )
387+ else
388+
389+ ! reads in stf values
390+ call read_external_source_time_function(isource,user_source_time_function,external_source_time_function_filename)
391+ endif
378392 endif
379393
380394 enddo
0 commit comments