From 282dcd3c58ab0df7c8d0655b1e6142eaa1562d9a Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Tue, 28 Jan 2020 11:35:14 -0500 Subject: [PATCH 1/2] 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 From 64926a4e16ae447f8352edc61ba23ca9fe7cb544 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 29 Jan 2020 09:30:51 -0500 Subject: [PATCH 2/2] Update to documentation for position specifiers --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d45ef3..821ccc5 100644 --- a/README.md +++ b/README.md @@ -225,4 +225,23 @@ This command remeshes the atoms/elements within the group to the new element siz -ow ``` -If this option is passed then all files are automatically overwritten without asking the user. \ No newline at end of file +If this option is passed then all files are automatically overwritten without asking the user. + +## Position Specification + +Specifying positions in cacmb can be done through a variety of ways. Examples of each format is shown below. + +`val` - Where `val` is a number, then that value in Angstroms is used as the position. As an example, `11.1` would be read in as a position of 11.1 $\AA$. + +`-inf` - This specifies the lower box boundary in the specific dimension. The vector `-inf -inf -inf` specifies the bottom corner of the simulation cell which also acts as the simulation cell origin. The vector `-inf 10 3` instead puts only the x position at the simulation cell origin. + +`inf` - Similar to `-inf` but references the upper boundary of the box in that dimension + +`inf-val` - Using a minus sign reduces the position from the **upper boundary** by `val`. `inf-10` would be at a distance of $10 \AA$ from the upper boundary in that dimension. + +`inf+val` - This increases the position from the **lower boundary**. `inf+10` would be a position $10\AA$ from the lower boundary within the cell. + +`inf*val` - This gives you a fractional position in the simulation cell. As an example `inf*0.5` gives you the center point of the simulation cell. + +`rand` - Returns a random position that lies within the simulation cell. +