Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Consolidated random seeds to the param reader so that we can save see…
Browse files Browse the repository at this point in the history
…ds to files during dumps
  • Loading branch information
daminton committed May 25, 2021
1 parent 3277b18 commit 661c6c6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
7 changes: 0 additions & 7 deletions src/main/swiftest_symba.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ program swiftest_symba
character(len=*), parameter :: simtimefmt = '(" Time = ", es12.5, "; fraction done = ", f5.3, "; number of active pl, tp = ", i7, ", ", i7)'
character(len=*), parameter :: walltimefmt = '(" Wall time (s): ", es12.5, "; Wall time/step in this interval (s): ", es12.5)'
character(len=*), parameter :: endwallfmt = '("Wall time to complete run (s): ", es12.5)'
integer(I4B), allocatable :: seed(:)
integer(I4B) :: nseeds
integer(I4B), dimension(:), allocatable :: discard_stat_list
logical, dimension(:), allocatable :: discard_l_pl

Expand Down Expand Up @@ -75,11 +73,6 @@ program swiftest_symba

call util_version

call random_seed(size = nseeds)
allocate(seed(nseeds))
seed(:) = [(i * 1, i = 1, nseeds)]
call random_seed(put = seed)

call get_command_argument(1, inparfile, status = ierr)
if (ierr /= 0) then
write(*, 100, advance = "NO") "Enter name of parameter data file: "
Expand Down
1 change: 1 addition & 0 deletions src/modules/user.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module user
real(DP) :: MU2KG = -1.0_DP !! Converts mass units to grams
real(DP) :: TU2S = -1.0_DP !! Converts time units to seconds
real(DP) :: DU2M = -1.0_DP !! Converts distance unit to centimeters
integer(I4B), dimension(:), allocatable :: seed !! Random seeds


!Logical flags to turn on or off various features of the code
Expand Down
11 changes: 1 addition & 10 deletions src/symba/symba_frag_pos.f90
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ subroutine symba_frag_pos(param, symba_plA, family, x, v, L_spin, Ip, mass, radi
real(DP) :: ke_family, ke_target, ke_frag, ke_offset
real(DP), dimension(NDIM) :: x_col_unit, y_col_unit, z_col_unit
character(len=*), parameter :: fmtlabel = "(A14,10(ES11.4,1X,:))"
integer(I4B), dimension(:), allocatable :: seed
integer(I4B) :: nseed
integer(I4B) :: try, ntry
integer(I4B), parameter :: NFRAG_MIN = 6 !! The minimum allowable number of fragments (set to 6 because that's how many unknowns are needed in the tangential velocity calculation)
real(DP) :: r_max_start = 1.0_DP
Expand All @@ -147,14 +145,6 @@ subroutine symba_frag_pos(param, symba_plA, family, x, v, L_spin, Ip, mass, radi
end if

ntry = nfrag - NFRAG_MIN
! Temporary until we get random number stuff settled for the whole project
if (lfirst) then
call random_seed(size=nseed)
allocate(seed(nseed))
seed = [(12*ii, ii=1, nseed)]
call random_seed(put=seed)
lfirst = .false.
end if

allocate(x_frag, source=xb_frag)
allocate(v_frag, source=vb_frag)
Expand Down Expand Up @@ -248,6 +238,7 @@ subroutine symba_frag_pos(param, symba_plA, family, x, v, L_spin, Ip, mass, radi
write(*, "(' -------------------------------------------------------------------------------------')")
if (lmerge) then
write(*,*) "symba_frag_pos failed after: ",try," tries"
stop
else
write(*,*) "symba_frag_pos succeeded after: ",try," tries"
write(*, "(' dL_tot should be very small' )")
Expand Down

0 comments on commit 661c6c6

Please sign in to comment.