The Elk Code
 
Loading...
Searching...
No Matches
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:
9pure 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
23implicit none
24! arguments
25real(8), intent(in) :: eps
26real(8), intent(inout) :: v(3)
27! local variables
28real(8) t1
29t1=1.d0-eps
30v(1)=v(1)-int(v(1))
31if (v(1) < 0.d0) v(1)=v(1)+1.d0
32if ((v(1) < eps).or.(v(1) > t1)) v(1)=0.d0
33v(2)=v(2)-int(v(2))
34if (v(2) < 0.d0) v(2)=v(2)+1.d0
35if ((v(2) < eps).or.(v(2) > t1)) v(2)=0.d0
36v(3)=v(3)-int(v(3))
37if (v(3) < 0.d0) v(3)=v(3)+1.d0
38if ((v(3) < eps).or.(v(3) > t1)) v(3)=0.d0
39end subroutine
40!EOC
41
pure subroutine r3frac(eps, v)
Definition r3frac.f90:10