diff options
| author | Connor Moore <connor@hhmoore.ca> | 2026-02-27 14:08:37 -0500 |
|---|---|---|
| committer | Connor Moore <connor@hhmoore.ca> | 2026-02-27 14:08:37 -0500 |
| commit | 6ff45fe556d3b49a1506c5882036f909c143ed85 (patch) | |
| tree | 6ff69d8ee98361a3d531472fbe67c3cbb55ac9b6 /class/class-langevin-motion.f90 | |
| parent | 6dd6792a16954b0004cb35d14a5b25de0627c69d (diff) | |
Split up some modules and added a testing class for sectors
Diffstat (limited to 'class/class-langevin-motion.f90')
| -rw-r--r-- | class/class-langevin-motion.f90 | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/class/class-langevin-motion.f90 b/class/class-langevin-motion.f90 index 0b97d2d..fcdc77a 100644 --- a/class/class-langevin-motion.f90 +++ b/class/class-langevin-motion.f90 @@ -1,72 +1,3 @@ -module globals -! Global variables -implicit none -integer, parameter :: n=100 -double precision, parameter :: pi=2q0*asin(1q0) ! numerical constant -double precision, parameter :: L=1.0 -logical, dimension(n) :: is_tracked = .TRUE. -end module globals - -module sectors -use globals -implicit none -contains - -subroutine ONETO2(id, box_size, x, y) - implicit none - integer, intent(in) :: id - integer, intent(in) :: box_size - integer, intent(out) :: x, y - - y = id / box_size - x = mod(id, box_size) -end subroutine ONETO2 - -function TWOtoONE(x, y, box_size) result(id) - implicit none - integer, intent(in) :: x, y, box_size - integer :: id - - id = y * box_size + x -end function TWOtoONE - -function get_neighbour_ids(p, N) result (neighbours) - integer, intent(in) :: p !> The sequential position - integer, intent(in) :: N !> The grid size (i.e., NxN sectors) - integer, allocatable, dimension(:) :: neighbours !> The list of neighbours - integer :: i,j,k=0 - integer :: x_cell, y_cell, x_test, y_test - integer :: max_list(8)=-1 - - call ONETO2(p,N,x_cell,y_cell) - max_list( - - !> Start by just getting all of the neighbours - do i = -1, 1 - do j = -1,1 - if(i == 0 .and. j == 0) cycle !> Skip the cell itself - - !> The "test" coordinate - x_test = x_cell + i - y_test = y_cell + j - - !> If the coordinates are real (within the expected range), add them to the list: - if((x_test .ge. 0 .and. x_test .lt. N) .and. (y_test .ge. 0 .and. y_test .lt. N)) then - !> Increment the number of correct coordinates - k = k + 1 - !> Flip a zero to the new coordinate in the max list - max_list(k) = TWOtoONE(x_test, y_test, N) - end if - end do - end do - - !> Return a vector of all non-zero elements - neighbours = pack(max_list, max_list.ge.0) - -end function get_neighbour_ids - -end module sectors - module langevin ! Initialization and update rule for Langevin particles use globals |
