From 282dcd3c58ab0df7c8d0655b1e6142eaa1562d9a Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Tue, 28 Jan 2020 11:35:14 -0500 Subject: [PATCH] Add random position --- src/main.f90 | 2 ++ src/subroutines.f90 | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/main.f90 b/src/main.f90 index ed34c53..a608f19 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -23,6 +23,8 @@ program main !Call initialization functions call lattice_init call box_init + call random_seed + end_mode_arg = 0 ! Command line parsing diff --git a/src/subroutines.f90 b/src/subroutines.f90 index 9fd159c..f7a22ad 100644 --- a/src/subroutines.f90 +++ b/src/subroutines.f90 @@ -178,6 +178,7 @@ module subroutines real(kind=dp), intent(out) :: pos !The output parsed position value integer :: iospara + real(kind=dp) :: rand iospara = 0 if(trim(adjustl(pos_string)) == 'inf') then @@ -208,6 +209,10 @@ module subroutines read(pos_string(1:index(pos_string,'*')-1), *, iostat=iospara) pos end if pos = (box_bd(2*i)-box_bd(2*i-1))*pos + box_bd(2*i-1) + + else if (trim(adjustl(pos_string)) == 'rand') then + call random_number(rand) + pos = (box_bd(2*i)-box_bd(2*i-1))*rand + box_bd(2*i-1) else read(pos_string, *, iostat=iospara) pos end if