1c
2c $Id$
3c
4
5      SUBROUTINE tool_rebox(n,mxarray,latt,rlatt,aaa)
6
7      implicit none
8
9      include 'p_array.inc'
10
11      integer i,n,mxarray
12
13      real*8 rlatt(3,3),latt(3,3)
14      real*8 aaa(mxarray,3)
15      real*8 ssx,ssy,ssz,xss,yss,zss
16
17      do i=1,n
18
19       ssx=(rlatt(1,1)*aaa(i,1)+rlatt(1,2)*aaa(i,2)+rlatt(1,3)*aaa(i,3))
20       ssy=(rlatt(2,1)*aaa(i,1)+rlatt(2,2)*aaa(i,2)+rlatt(2,3)*aaa(i,3))
21       ssz=(rlatt(3,1)*aaa(i,1)+rlatt(3,2)*aaa(i,2)+rlatt(3,3)*aaa(i,3))
22
23       xss=ssx-nint(ssx)
24       yss=ssy-nint(ssy)
25       zss=ssz-nint(ssz)
26
27       aaa(i,1)=(latt(1,1)*xss+latt(1,2)*yss+latt(1,3)*zss)
28       aaa(i,2)=(latt(2,1)*xss+latt(2,2)*yss+latt(2,3)*zss)
29       aaa(i,3)=(latt(3,1)*xss+latt(3,2)*yss+latt(3,3)*zss)
30
31      enddo
32
33      return
34
35      END
36