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

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed array initialization bugs
  • Loading branch information
daminton committed Apr 2, 2021
1 parent e59535c commit 30bbf68
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/rmvs/rmvs_setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ module subroutine rmvs_setup_pl(self,n)
self%vin(:,:,:) = 0.0_DP
self%aoblin(:,:,:) = 0.0_DP

do j = 1, n
self%plind(j,:) = [(i,i=1,n)]
self%plind(j,2:n) = pack(self%plind(j,1:n), self%plind(j,1:n) /= j)
end do

return
end subroutine rmvs_setup_pl

Expand Down Expand Up @@ -81,7 +76,7 @@ module subroutine rmvs_setup_system(self, config)
class(rmvs_nbody_system), intent(inout) :: self !! RMVS system object
class(swiftest_configuration), intent(inout) :: config !! Input collection of configuration parameters
! Internals
integer(I4B) :: i
integer(I4B) :: i, j
! Call parent method
call whm_setup_system(self, config)

Expand All @@ -98,9 +93,14 @@ module subroutine rmvs_setup_system(self, config)
allocate(pl%plenc(i)%Gmass(npl))
allocate(pl%plenc(i)%xh(NDIM,npl))
allocate(pl%plenc(i)%vh(NDIM,npl))
pl%cbenc(i) = cb
pl%cbenc(i)%Gmass = pl%Gmass(i)
pl%plenc(i)%Gmass(1) = cb%Gmass
pl%plind(i,:) = [(j,j=1,npl)]
pl%plind(i,2:npl) = pack(pl%plind(i,1:npl), pl%plind(i,1:npl) /= i)
! Shift the planet masses up so that the central body is the first planet
! During a planetocentric encounter (like the original Swifter)
pl%plenc(i)%Gmass(1) = cb%Gmass
pl%plenc(i)%Gmass(2:npl) = pl%Gmass(pl%plind(i,2:npl))
pl%cbenc(i) = cb
pl%cbenc(i)%Gmass = pl%Gmass(i)
end do
end associate
end select
Expand Down

0 comments on commit 30bbf68

Please sign in to comment.