Skip to content

Commit dcb7c48

Browse files
committed
Remove all occurnaces of stop 1 or stop 'string'
There is now a new linter/check_stop.f90 that will replace those stop's with a call to mesa_error()
1 parent 45c53d0 commit dcb7c48

File tree

171 files changed

+1129
-1043
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+1129
-1043
lines changed

astero/private/adipls_support.f90

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -377,15 +377,15 @@ subroutine run_adipls( &
377377
iounit_dev_null = alloc_iounit(ierr)
378378
if (ierr /= 0) then
379379
write(*,*) 'adipls failed in alloc_iounit for iounit_dev_null'
380-
stop 'run_adipls'
380+
call mesa_error(__FILE__,__LINE__,'run_adipls')
381381
end if
382382
end if
383383

384384
filename = 'adipls.stdout'
385385
open(unit=iounit_dev_null, file=trim(filename), iostat=ierr)
386386
if (ierr /= 0) then
387387
write(*,*) 'adipls failed to open ' // trim(filename)
388-
stop 'run_adipls'
388+
call mesa_error(__FILE__,__LINE__,'run_adipls')
389389
end if
390390
istdou = iounit_dev_null
391391
istdpr = iounit_dev_null
@@ -418,7 +418,7 @@ subroutine run_adipls( &
418418
if (ierr_param < 0) then
419419
ierr = ierr_param
420420
write(*,*) 'call to adipls failed'
421-
stop 'run_adipls'
421+
call mesa_error(__FILE__,__LINE__,'run_adipls')
422422
end if
423423

424424

@@ -429,7 +429,7 @@ subroutine setup_adipls
429429
iounit = alloc_iounit(ierr)
430430
if (ierr /= 0) then
431431
write(*,*) 'setup_adipls failed in alloc_iounit'
432-
stop 'run_adipls'
432+
call mesa_error(__FILE__,__LINE__,'run_adipls')
433433
end if
434434
filename = 'adipls.c.pruned.in'
435435
open(unit=iounit, file=trim(filename), action='read', status='old', iostat=ierr)
@@ -446,7 +446,7 @@ subroutine setup_adipls
446446
write(*,*)
447447
write(*,*)
448448
write(*,*)
449-
stop 'run_adipls'
449+
call mesa_error(__FILE__,__LINE__,'run_adipls')
450450
end if
451451

452452
write(*,*)
@@ -463,7 +463,7 @@ subroutine setup_adipls
463463
if (ierr_param < 0) then
464464
ierr = ierr_param
465465
write(*,*) '1st call to adipls failed in setup_adipls'
466-
stop 'run_adipls'
466+
call mesa_error(__FILE__,__LINE__,'run_adipls')
467467
end if
468468

469469
write(*,*) 'back from 1st call on adipls'
@@ -482,7 +482,7 @@ subroutine setup_redist
482482
iounit = alloc_iounit(ierr)
483483
if (ierr /= 0) then
484484
write(*,*) 'setup_redist failed in alloc_iounit'
485-
stop 'run_rdist'
485+
call mesa_error(__FILE__,__LINE__,'run_rdist')
486486
end if
487487
filename = 'redistrb.c.pruned.in'
488488
open(unit=iounit, file=trim(filename), action='read', status='old', iostat=ierr)
@@ -500,14 +500,14 @@ subroutine setup_redist
500500
write(*,*)
501501
write(*,*)
502502
write(*,*)
503-
stop 'run_adipls'
504-
stop 'run_rdist'
503+
call mesa_error(__FILE__,__LINE__,'run_adipls')
504+
call mesa_error(__FILE__,__LINE__,'run_rdist')
505505
end if
506506

507507
read(iounit,*,iostat=ierr) nn_redist
508508
if (ierr /= 0) then
509509
write(*,*) 'setup_redist failed to read nn_redist from ' // trim(filename)
510-
stop 'run_rdist'
510+
call mesa_error(__FILE__,__LINE__,'run_rdist')
511511
end if
512512
write(*,*) 'nn_redist', nn_redist
513513

@@ -533,7 +533,7 @@ subroutine setup_redist
533533
if (ierr_param < 0) then
534534
ierr = ierr_param
535535
write(*,*) '1st call to srdist failed'
536-
stop 'run_rdist'
536+
call mesa_error(__FILE__,__LINE__,'run_rdist')
537537
end if
538538

539539
write(*,*) 'back from 1st call on srdist'
@@ -645,7 +645,7 @@ subroutine check_arg_data(nn, data, ldaa, aa, x, ierr)
645645
end do
646646
end do
647647

648-
if (ierr /= 0) stop 'check_arg_data'
648+
if (ierr /= 0) call mesa_error(__FILE__,__LINE__,'check_arg_data')
649649

650650

651651
contains

astero/private/astero_run_support.f90

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ end subroutine extras_controls
6060
ierr = 0
6161
call do_read_star_job('inlist', ierr) ! this does alloc_star
6262
! and saves the id in id_from_read_star_job
63-
if (ierr /= 0) stop 1
63+
if (ierr /= 0) call mesa_error(__FILE__,__LINE__)
6464

6565
id = id_from_read_star_job
6666
id_from_read_star_job = 0
@@ -69,7 +69,7 @@ end subroutine extras_controls
6969
call star_setup(id, 'inlist', ierr)
7070
if (ierr /= 0) then
7171
write(*,*) 'failed in star_setup'
72-
stop 1
72+
call mesa_error(__FILE__,__LINE__)
7373
end if
7474

7575
okay_to_restart = .true.
@@ -85,7 +85,7 @@ end subroutine extras_controls
8585
call read_astero_search_controls(inlist_astero_fname, ierr)
8686
if (ierr /= 0) then
8787
write(*,*) 'failed in read_astero_search_controls'
88-
stop 1
88+
call mesa_error(__FILE__,__LINE__)
8989
end if
9090

9191
if (Y_depends_on_Z .and. vary_Y) then
@@ -132,22 +132,22 @@ end subroutine extras_controls
132132
call write_astero_search_controls(save_controls_filename, ierr)
133133
if (ierr /= 0) then
134134
write(*,*) 'failed in write_astero_search_controls'
135-
stop 1
135+
call mesa_error(__FILE__,__LINE__)
136136
end if
137137
end if
138138

139139
call check_search_controls(ierr)
140140
if (ierr /= 0) then
141141
write(*,*) 'failed in check_search_controls'
142-
stop 1
142+
call mesa_error(__FILE__,__LINE__)
143143
end if
144144

145145
nu_max_sun = s% nu_max_sun
146146
delta_nu_sun = s% delta_nu_sun
147147
call init_obs_data(ierr)
148148
if (ierr /= 0) then
149149
write(*,*) 'failed in init_obs_data'
150-
stop 1
150+
call mesa_error(__FILE__,__LINE__)
151151
end if
152152

153153
next_Y_to_try = -1
@@ -742,7 +742,7 @@ subroutine bobyqa_fun(n,x,f)
742742
call save_sample_results_to_file(-1,bobyqa_output_filename,ierr)
743743
if (ierr /= 0) then
744744
write(*,*) 'failed in save_sample_results_to_file'
745-
stop 'bobyqa_fun'
745+
call mesa_error(__FILE__,__LINE__,'bobyqa_fun')
746746
end if
747747

748748
end subroutine bobyqa_fun
@@ -762,7 +762,7 @@ subroutine newuoa_fun(n,x,f)
762762
call save_sample_results_to_file(-1,newuoa_output_filename,ierr)
763763
if (ierr /= 0) then
764764
write(*,*) 'failed in save_sample_results_to_file'
765-
stop 'newuoa_fun'
765+
call mesa_error(__FILE__,__LINE__,'newuoa_fun')
766766
end if
767767

768768
end subroutine newuoa_fun
@@ -829,7 +829,7 @@ subroutine bobyqa_or_newuoa_fun(n,x,f)
829829
f = eval1(star_id, ierr)
830830
if (ierr /= 0) then
831831
write(*,*) 'got ierr from eval1'
832-
stop 'bobyqa_fun'
832+
call mesa_error(__FILE__,__LINE__,'bobyqa_fun')
833833
end if
834834
if (sample_number == prev_sample_number) then
835835
if (sample_number <= 0) then ! failed on 1st try
@@ -847,7 +847,7 @@ subroutine bobyqa_or_newuoa_fun(n,x,f)
847847
call show_all_sample_results(6,-1,ierr)
848848
if (ierr /= 0) then
849849
write(*,*) 'failed in show_all_sample_results'
850-
stop 'bobyqa_fun'
850+
call mesa_error(__FILE__,__LINE__,'bobyqa_fun')
851851
end if
852852

853853
min_sample_chi2_so_far = minval(sample_chi2(1:sample_number))
@@ -1437,7 +1437,7 @@ subroutine setup_simplex_and_f(ierr)
14371437
ierr = 0
14381438
allocate(index(num_samples), stat=ierr)
14391439
if (ierr /= 0) then
1440-
stop 'failed in allocate before calling qsort from show_all_sample_results'
1440+
call mesa_error(__FILE__,__LINE__,'failed in allocate before calling qsort from show_all_sample_results')
14411441
end if
14421442
call qsort(index, num_samples, sample_chi2)
14431443
max_i = 0
@@ -1533,7 +1533,7 @@ subroutine save_best_for_sample(i, op_code)
15331533
call alloc_sample_ptrs(ierr)
15341534
if (ierr /= 0) then
15351535
write(*,*) 'ERROR -- failed to allocate for samples'
1536-
stop 'save_best_for_sample'
1536+
call mesa_error(__FILE__,__LINE__,'save_best_for_sample')
15371537
return
15381538
end if
15391539
end if
@@ -1662,7 +1662,7 @@ subroutine set_sample_averages
16621662
avg_model_number_top_samples + &
16631663
avg_model_number_sigma_limit*avg_model_number_sigma
16641664
write(*,*)
1665-
!stop 'set_sample_averages'
1665+
!call mesa_error(__FILE__,__LINE__,'set_sample_averages')
16661666

16671667
end subroutine set_sample_averages
16681668

astero/private/astero_support.f90

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ subroutine get_one_el_info( &
9797
call do_gyre_get_modes(s, l, store_model, ierr)
9898
if (ierr /= 0) then
9999
write(*,*) 'failed in do_gyre_get_modes'
100-
stop 'get_one_el_info'
100+
call mesa_error(__FILE__,__LINE__,'get_one_el_info')
101101
end if
102102

103103
else if (code == 'adipls') then
@@ -130,7 +130,7 @@ subroutine get_one_el_info( &
130130
do_redistribute_mesh, ierr)
131131
if (ierr /= 0) then
132132
write(*,*) 'failed in run_adipls'
133-
stop 'get_one_el_info'
133+
call mesa_error(__FILE__,__LINE__,'get_one_el_info')
134134
end if
135135

136136
else
@@ -144,7 +144,7 @@ subroutine get_one_el_info( &
144144
! sort results by increasing frequency
145145
allocate(index(num_results), stat=ierr)
146146
if (ierr /= 0) then
147-
stop 'failed in allocate before calling qsort'
147+
call mesa_error(__FILE__,__LINE__,'failed in allocate before calling qsort')
148148
end if
149149
call qsort(index, num_results, cyclic_freq)
150150

@@ -177,7 +177,7 @@ subroutine get_one_el_info( &
177177
model_inertia(3,:), model_inertia_alt_up(3,:), model_inertia_alt_down(3,:), &
178178
model_order(3,:), model_order_alt_up(3,:), model_order_alt_down(3,:), ierr)
179179
else
180-
stop 'bad value for l in get_one_el_info'
180+
call mesa_error(__FILE__,__LINE__,'bad value for l in get_one_el_info')
181181
end if
182182
if (ierr /= 0) then
183183
!write(*,2) 'failed to find frequency for matching for l =', l
@@ -697,7 +697,7 @@ subroutine init_obs_data(ierr)
697697
write(*,1) 'sum_1', sum_1
698698
write(*,1) 'sum_2', sum_2
699699
write(*,*)
700-
stop 'init_obs_data'
700+
call mesa_error(__FILE__,__LINE__,'init_obs_data')
701701
end if
702702

703703
end subroutine init_obs_data
@@ -782,12 +782,12 @@ end subroutine get_kjeldsen_nonradial_freq_corr
782782

783783

784784
subroutine get_kjeldsen_nonradial_freq_corr_alt_up
785-
!stop 'get_kjeldsen_nonradial_freq_corr_alt_up'
785+
!call mesa_error(__FILE__,__LINE__,'get_kjeldsen_nonradial_freq_corr_alt_up')
786786
end subroutine get_kjeldsen_nonradial_freq_corr_alt_up
787787

788788

789789
subroutine get_kjeldsen_nonradial_freq_corr_alt_down
790-
!stop 'get_kjeldsen_nonradial_freq_corr_alt_down'
790+
!call mesa_error(__FILE__,__LINE__,'get_kjeldsen_nonradial_freq_corr_alt_down')
791791
end subroutine get_kjeldsen_nonradial_freq_corr_alt_down
792792

793793

@@ -1644,7 +1644,7 @@ real(dp) function get_chi2(s, max_el, trace_okay, ierr)
16441644
stop
16451645
end if
16461646

1647-
!if (is_bad(chi2)) stop 'get_chi2'
1647+
!if (is_bad(chi2)) call mesa_error(__FILE__,__LINE__,'get_chi2')
16481648

16491649
end function get_chi2
16501650

astero/private/extras_support.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ integer function do_astero_extras_check_model(s, id)
146146
dt_for_smaller_steps_before_age_target
147147
write(*,1) 'max_years_for_timestep', &
148148
s% max_years_for_timestep
149-
stop 'bad max_years_for_timestep'
149+
call mesa_error(__FILE__,__LINE__,'bad max_years_for_timestep')
150150
end if
151151
end if
152152
else
@@ -1376,7 +1376,7 @@ subroutine astero_data_for_extra_history_columns(id, n, astero_names, vals, ierr
13761376
if (i /= (num_extra_history_columns + num_extra)) then
13771377
write(*,2) 'i', i
13781378
write(*,2) 'num_extra_history_columns', num_extra_history_columns
1379-
stop 'bad num_extra_history_columns'
1379+
call mesa_error(__FILE__,__LINE__,'bad num_extra_history_columns')
13801380
end if
13811381

13821382
i = num_extra+1

astero/public/astero_def.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ subroutine save_sample_results_to_file(i_total, results_fname, ierr)
13251325
integer :: iounit
13261326
write(*,*) 'save_sample_results_to_file ' // trim(results_fname)
13271327
iounit = alloc_iounit(ierr)
1328-
if (ierr /= 0) stop 'alloc_iounit failed'
1328+
if (ierr /= 0) call mesa_error(__FILE__,__LINE__,'alloc_iounit failed')
13291329
open(unit=iounit, file=trim(results_fname), action='write', iostat=ierr)
13301330
if (ierr /= 0) return
13311331
call show_all_sample_results(iounit, i_total, ierr)
@@ -1916,7 +1916,7 @@ subroutine read_samples_from_file(results_fname, ierr)
19161916
write(*,*) 'read samples from file ' // trim(results_fname)
19171917

19181918
iounit = alloc_iounit(ierr)
1919-
if (ierr /= 0) stop 'alloc_iounit failed'
1919+
if (ierr /= 0) call mesa_error(__FILE__,__LINE__,'alloc_iounit failed')
19201920
open(unit=iounit, file=trim(results_fname), action='read', status='old', iostat=ierr)
19211921
if (ierr /= 0) then
19221922
write(*,*) 'failed to open ' // trim(results_fname)

astero/test_suite/astero_adipls/src/run_star_extras.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ subroutine extras_after_evolve(id, ierr)
149149
call get_adipls_frequency_info( &
150150
s, store_for_adipls, l_to_match, order_to_match, expected_freq, &
151151
save_mode_info, order_to_save, save_mode_filename, freq, okay, ierr)
152-
if (ierr /= 0) stop 1
152+
if (ierr /= 0) call mesa_error(__FILE__,__LINE__)
153153
if (okay) then
154154
write(*,'(a,2f20.2)') 'got ok match for expected frequency', freq, expected_freq
155155
else
@@ -270,7 +270,7 @@ subroutine get_adipls_frequency_info( &
270270
!write(*,*) 'done adipls_get_one_el_info'
271271
if (ierr /= 0) then
272272
write(*,*) 'failed in adipls_get_one_el_info'
273-
stop 1
273+
call mesa_error(__FILE__,__LINE__)
274274
end if
275275
write(*,*)
276276
write(*,'(2a8,99a20)') 'el', 'order', 'freq (microHz)', 'inertia'

astero/test_suite/astero_gyre/src/run_star_extras.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ subroutine extras_after_evolve(id, ierr)
131131
if (astero_gyre_is_enabled) then
132132
call get_gyre_frequency_info(s, .true., okay, ierr)
133133

134-
if (ierr /= 0) stop 1
134+
if (ierr /= 0) call mesa_error(__FILE__,__LINE__)
135135
if (okay) then
136136
write(*,'(a,2f20.2)') 'got ok match for expected frequency', actual_freq, expected_freq
137137
else
@@ -214,7 +214,7 @@ subroutine get_gyre_frequency_info(s, check_match, okay, ierr)
214214
s% id, l_to_match, store_model, ierr)
215215
if (ierr /= 0) then
216216
write(*,*) 'failed in do_gyre_get_modes'
217-
stop 1
217+
call mesa_error(__FILE__,__LINE__)
218218
end if
219219

220220
write(*,*)

atm/private/atm_t_tau_uniform.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ subroutine eval_data( &
664664
write(*,1) 'P0', P0
665665
write(*,1) 'Pextra', Pextra
666666
write(*,1) 'P', P
667-
!stop 'atm_t_tau_uniform'
667+
!call mesa_error(__FILE__,__LINE__,'atm_t_tau_uniform')
668668
return
669669
end if
670670

atm/private/atm_t_tau_varying.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ end function interp_y
503503

504504
! Dummy routine that's never called
505505

506-
stop 'Bogus call to eval_solout'
506+
call mesa_error(__FILE__,__LINE__,'Bogus call to eval_solout')
507507

508508
end subroutine eval_solout
509509

atm/private/atm_table.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ subroutine eval_table( &
201201
write(*,*)
202202
ierr = -1
203203
return
204-
!if (is_bad(lnP) .or. is_bad(lnT)) stop 'eval_table'
204+
!if (is_bad(lnP) .or. is_bad(lnT)) call mesa_error(__FILE__,__LINE__,'eval_table')
205205
end if
206206

207207
! Finish

0 commit comments

Comments
 (0)