The Elk Code
r3frac.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2002-2005 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
3 ! This file is distributed under the terms of the GNU Lesser General Public
4 ! License. See the file COPYING for license details.
5 
6 !BOP
7 ! !ROUTINE: r3frac
8 ! !INTERFACE:
9 pure subroutine r3frac(eps,v)
10 ! !INPUT/OUTPUT PARAMETERS:
11 ! eps : zero component tolerance (in,real)
12 ! v : input vector (inout,real(3))
13 ! !DESCRIPTION:
14 ! Finds the fractional part of each component of a real 3-vector using the
15 ! function ${\rm frac}\,(x)=x-\lfloor x\rfloor$. A component is taken to be
16 ! zero if it lies within the intervals $[0,\epsilon)$ or $(1-\epsilon,1]$.
17 !
18 ! !REVISION HISTORY:
19 ! Created January 2003 (JKD)
20 ! Removed iv, September 2011 (JKD)
21 !EOP
22 !BOC
23 implicit none
24 ! arguments
25 real(8), intent(in) :: eps
26 real(8), intent(inout) :: v(3)
27 ! local variables
28 real(8) t1
29 t1=1.d0-eps
30 v(1)=v(1)-int(v(1))
31 if (v(1) < 0.d0) v(1)=v(1)+1.d0
32 if ((v(1) < eps).or.(v(1) > t1)) v(1)=0.d0
33 v(2)=v(2)-int(v(2))
34 if (v(2) < 0.d0) v(2)=v(2)+1.d0
35 if ((v(2) < eps).or.(v(2) > t1)) v(2)=0.d0
36 v(3)=v(3)-int(v(3))
37 if (v(3) < 0.d0) v(3)=v(3)+1.d0
38 if ((v(3) < eps).or.(v(3) > t1)) v(3)=0.d0
39 end subroutine
40 !EOC
41 
pure subroutine r3frac(eps, v)
Definition: r3frac.f90:10